diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 9243a37aaf..c3a6e9203d 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -3,6 +3,7 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Magic; @@ -11,6 +12,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.DraedonsArsenal; using System.Collections.Generic; using System.Linq; using Terraria; @@ -36,8 +38,8 @@ namespace CalamityMod.Balancing bool DragonRageFilter(Projectile p) => p.type == ProjectileType() || p.type == ProjectileType() || (p.type == ProjectileType() && p.CountsAsClass()); - bool MonkStaffT3Filter(Projectile p) => - p.type == ProjectileID.MonkStaffT3_AltShot || (p.type == ProjectileID.Electrosphere && Main.player[p.owner].ActiveItem().type == ItemID.MonkStaffT3); + // bool MonkStaffT3Filter(Projectile p) => + // p.type == ProjectileID.MonkStaffT3_AltShot || (p.type == ProjectileID.Electrosphere && Main.player[p.owner].ActiveItem().type == ItemID.MonkStaffT3); bool MushroomSpearFilter(Projectile p) => p.type == ProjectileID.Mushroom && Main.player[p.owner].ActiveItem().type == ItemID.MushroomSpear; @@ -76,8 +78,8 @@ namespace CalamityMod.Balancing // Nerf Mushroom Spear projectiles by 50%. Do(new ProjectileSpecificRequirementBalancingRule(0.5f, MushroomSpearFilter)), - // Nerf Spectre Mask set bonus projectiles by 50%. - Do(new ProjectileSpecificRequirementBalancingRule(0.5f, SpectreMaskSetBonusFilter)), + // Nerf Spectre Mask set bonus projectiles by 30%. + Do(new ProjectileSpecificRequirementBalancingRule(0.7f, SpectreMaskSetBonusFilter)), }; NPCSpecificBalancingChanges = new List(); @@ -153,7 +155,7 @@ namespace CalamityMod.Balancing // 40% resist to Cryophobia NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 15% resust to Snowstorm Staff + // 15% resist to Snowstorm Staff NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion The Destroyer @@ -168,7 +170,7 @@ namespace CalamityMod.Balancing #region Duke Fishron // 35% vulnerability to Resurrection Butterfly. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(1.35f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.35f, ProjectileType(), ProjectileType())))); #endregion Duke Fishron @@ -177,6 +179,9 @@ namespace CalamityMod.Balancing // 25% resist to Resurrection Butterfly. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + // 20% resist to Art Attack and Nightglow. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileID.FairyQueenMagicItemShot)))); + #endregion Cultist #region Astrum Deus @@ -193,10 +198,15 @@ namespace CalamityMod.Balancing #endregion Astrum Deus #region Moon Lord - // 30% resist to the shockwave attunement from the True biome blade. + // 90% resist to the shockwave attunement from the True biome blade. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.1f, ProjectileType(), ProjectileType(), ProjectileType())))); #endregion + #region Providence + // 80% resist to Hell's Sun. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); + #endregion + #region Ceaseless Void / Dark Energies // 50% resist to true melee. @@ -246,23 +256,26 @@ namespace CalamityMod.Balancing #region Ares - // 75% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.25f, DragonRageFilter)))); - - // 60% resist to Murasama. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType())))); - // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new TrueMeleeResistBalancingRule(0.5f)))); - // 50% resist to Enforcer projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 30% resist to the Spin Throw part of the Ark of the Cosmos' combo NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.7f, AotCThrowCombo)))); - // 20% resist to Eclipse's Fall stealth strike. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + // 25% resist to Murasama. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + + // 20% resist to Dragon Rage projectiles. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); + + // 20% resist to Eclipse's Fall. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + + // 15% resist to Enforcer projectiles. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + + // 10% resist to Seraphim lasers + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType())))); #endregion Ares @@ -273,25 +286,34 @@ namespace CalamityMod.Balancing // 10% resist to Eclipse's Fall stealth strike. NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType())))); + // 10% resist to Seared Pan. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType(), ProjectileType())))); + #endregion Artemis and Apollo #region Thanatos - // 95% resist to Seraphim lasers (what the actual fuck?). - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.05f, ProjectileType())))); + // 92% resist to Seraphim lasers (what the actual fuck?). + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.08f, ProjectileType())))); - // 75% resist to Celestus. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); + // 85% resist to Dynamic Pursuer (the whole thing lol). + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.15f, ProjectileType(), ProjectileType(), ProjectileType())))); // 65% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new TrueMeleeResistBalancingRule(0.35f)))); + // 65% resist to Enforcer projectiles. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + // 50% resist to Chicken Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Prismatic Breaker. (why is this more than BOTH Rancor and Yharim's Crystal?) NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Tarragon Throwing Darts Thorns (LOL) + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); + // 50% resist to Vehemence skulls. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); @@ -307,9 +329,15 @@ namespace CalamityMod.Balancing // 30% resist to the Spin Throw part of the Ark of the Cosmos' combo NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.7f, AotCThrowCombo)))); + // 30% resist to Eclipse Fall. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 30% resist to Sirius. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 25% resist to Dragon Rage projectiles. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); + // 25% resist to Godslayer Slugs. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); @@ -325,9 +353,16 @@ namespace CalamityMod.Balancing // 20% resist to Blood Boiler fire. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + // 15% resist to Final Dawn AoE, 20% resist to Final Dawn lunge. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + // 15% resist to Gruesome Eminence. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 15% resist to Plasma Nades + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType(), ProjectileType())))); + #endregion Thanatos #region Supreme Calamitas / Brimstone Heart diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 8f3de47ca5..9d423548e8 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -2,10 +2,14 @@ { public static class BalancingConstants { - // Permanent move speed boost given to the player at all stages of the game + // When the relevant config is enabled: Gives the player a substantial +50% move speed boost at all times internal static readonly float DefaultMoveSpeedBoost = 0.5f; - - // The multiplier for the player's gravity (downwards acceleration) while they are holding the Down button (S by default). + + // When the relevant config is enabled: Increases the player's base jump height by 10% + internal static readonly float ConfigBoostedBaseJumpHeight = 5.51f; // vanilla = 5.01f + + // When the relevant config is enabled: Allows the player to hold the Down button (S by default) to fast fall. + // This is the multiplier for the player's gravity (downwards acceleration) while holding Down. internal static readonly float HoldingDownGravityMultiplier = 2f; // Altered jump speed boost provided by Shiny Red Balloon via IL edit @@ -48,8 +52,8 @@ // If stealth is too weak, increase this number. If stealth is too strong, decrease this number. // This value is intentionally not readonly. public static double UniversalStealthStrikeDamageFactor = 0.5; - internal static readonly float BaseStealthGenTime = 9f; // 9 seconds - internal static readonly float MovingStealthGenRatio = 0.333333f; + internal static readonly float BaseStealthGenTime = 4f; // 4 seconds + internal static readonly float MovingStealthGenRatio = 0.5f; // Rage internal static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default. @@ -63,6 +67,7 @@ // See NPCUtils.IsAnEnemy internal const int TinyHealthThreshold = 5; internal const int TinyDamageThreshold = 5; + // If an enemy has more health than this, they are considered an enemy even if they have 0 contact damage internal const int NoContactDamageHealthThreshold = 3000; internal const int UnreasonableHealthThreshold = 25000000; // 25 million @@ -80,7 +85,6 @@ internal static readonly float MaximumAllowedAttackSpeed = 10f; // TODO -- Add all balance related constants here that don't belong in other files. - // These constants were just the ones sitting in CalamityPlayer. // Review all constants and static readonlys in the entire mod to find things to add. } } diff --git a/BiomeManagers/AbovegroundAstralBiome.cs b/BiomeManagers/AbovegroundAstralBiome.cs index 1103dd1191..d3ce06a025 100644 --- a/BiomeManagers/AbovegroundAstralBiome.cs +++ b/BiomeManagers/AbovegroundAstralBiome.cs @@ -12,6 +12,7 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; @@ -22,8 +23,13 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) && - !player.ZoneDesert && !player.ZoneSnow; + return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !player.ZoneDesert && !player.ZoneSnow; } + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); + } + } } diff --git a/BiomeManagers/AbovegroundAstralDesertBiome.cs b/BiomeManagers/AbovegroundAstralDesertBiome.cs index 84178530db..eaf59dfac0 100644 --- a/BiomeManagers/AbovegroundAstralDesertBiome.cs +++ b/BiomeManagers/AbovegroundAstralDesertBiome.cs @@ -11,7 +11,9 @@ namespace CalamityMod.BiomeManagers public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralDesertSurfaceBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon"; + // Could use its own unique background public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; public override void SetStaticDefaults() @@ -21,8 +23,12 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) - && player.ZoneDesert && !player.ZoneSnow; + return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneDesert && !player.ZoneSnow; + } + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); } } } diff --git a/BiomeManagers/AbovegroundAstralSnowBiome.cs b/BiomeManagers/AbovegroundAstralSnowBiome.cs index 984034c540..7fc5fbb12c 100644 --- a/BiomeManagers/AbovegroundAstralSnowBiome.cs +++ b/BiomeManagers/AbovegroundAstralSnowBiome.cs @@ -10,6 +10,7 @@ namespace CalamityMod.BiomeManagers public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralSnowSurfaceBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; @@ -20,8 +21,13 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) && - !player.ZoneDesert && player.ZoneSnow; + return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !player.ZoneDesert && player.ZoneSnow; } + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); + } + } } diff --git a/BiomeManagers/AbyssLayer1Biome.cs b/BiomeManagers/AbyssLayer1Biome.cs index 907f625128..9e299f96e9 100644 --- a/BiomeManagers/AbyssLayer1Biome.cs +++ b/BiomeManagers/AbyssLayer1Biome.cs @@ -47,6 +47,7 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; public override int Music { @@ -60,13 +61,13 @@ namespace CalamityMod.BiomeManagers public override void SetStaticDefaults() { - DisplayName.SetDefault("First Layer of the Abyss"); + DisplayName.SetDefault("Abyss: First Layer"); } public override bool IsBiomeActive(Player player) { return MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && - playerYTileCoords < (Main.rockLayer + Main.maxTilesY * 0.03); + playerYTileCoords <= (Main.rockLayer + Main.maxTilesY * 0.03); } } } diff --git a/BiomeManagers/AbyssLayer2Biome.cs b/BiomeManagers/AbyssLayer2Biome.cs index 5289f1ee79..2b9ca90238 100644 --- a/BiomeManagers/AbyssLayer2Biome.cs +++ b/BiomeManagers/AbyssLayer2Biome.cs @@ -21,10 +21,11 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Second Layer of the Abyss"); + DisplayName.SetDefault("Abyss: Second Layer"); } public override bool IsBiomeActive(Player player) diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index ea6102210c..cbd29d5c81 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -21,10 +21,11 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Third Layer of the Abyss"); + DisplayName.SetDefault("Abyss: Third Layer"); } public override bool IsBiomeActive(Player player) diff --git a/BiomeManagers/AbyssLayer4Biome.cs b/BiomeManagers/AbyssLayer4Biome.cs index 9ad562d309..9368527844 100644 --- a/BiomeManagers/AbyssLayer4Biome.cs +++ b/BiomeManagers/AbyssLayer4Biome.cs @@ -21,10 +21,11 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer4"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer4"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Fourth Layer of the Abyss"); + DisplayName.SetDefault("Abyss: Fourth Layer"); } public override bool IsBiomeActive(Player player) diff --git a/BiomeManagers/ArsenalLabBiome.cs b/BiomeManagers/ArsenalLabBiome.cs index 3b613561ff..f7e015e42a 100644 --- a/BiomeManagers/ArsenalLabBiome.cs +++ b/BiomeManagers/ArsenalLabBiome.cs @@ -4,7 +4,9 @@ namespace CalamityMod.BiomeManagers { public class ArsenalLabBiome : ModBiome { - public override string BestiaryIcon => "BiomeManagers/LaboratoryIcon"; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/LaboratoryIcon"; + // Could use its own unique background if someone even bothers + public override string BackgroundPath => "Terraria/Images/MapBG32"; public override void SetStaticDefaults() { diff --git a/BiomeManagers/BrimstoneCragsBiome.cs b/BiomeManagers/BrimstoneCragsBiome.cs index 552d001d1b..69a189028b 100644 --- a/BiomeManagers/BrimstoneCragsBiome.cs +++ b/BiomeManagers/BrimstoneCragsBiome.cs @@ -11,6 +11,7 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/BrimstoneCragsIcon"; + public override string BackgroundPath => "Terraria/Images/MapBG3"; public override void SetStaticDefaults() { diff --git a/BiomeManagers/SulphurousSeaBiome.cs b/BiomeManagers/SulphurousSeaBiome.cs index fa66391e6a..92203cccf9 100644 --- a/BiomeManagers/SulphurousSeaBiome.cs +++ b/BiomeManagers/SulphurousSeaBiome.cs @@ -16,6 +16,7 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SulphurousSeaIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"; public override int Music { @@ -30,7 +31,7 @@ namespace CalamityMod.BiomeManagers if (acidRain) { music = DownedBossSystem.downedPolterghast - ? CalamityMod.Instance.GetMusicFromMusicMod("AcidRain2") ?? MusicID.Eclipse // Acid Rain Tier 3 + ? CalamityMod.Instance.GetMusicFromMusicMod("AcidRain2") ?? MusicID.Monsoon // Acid Rain Tier 3 : CalamityMod.Instance.GetMusicFromMusicMod("AcidRain1") ?? MusicID.OldOnesArmy; // Acid Rain Tier 1 + 2 } @@ -61,7 +62,7 @@ namespace CalamityMod.BiomeManagers if (point.X > Main.maxTilesX - 380) sulphurPosX = true; } - return BiomeTileCounterSystem.SulphurTiles >= 300 || (player.ZoneOverworldHeight && sulphurPosX); + return (BiomeTileCounterSystem.SulphurTiles >= 300 || (player.ZoneOverworldHeight && sulphurPosX)) && !player.Calamity().ZoneAbyss; } } } diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 86b1a93c62..86dfd70fce 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -11,6 +11,9 @@ namespace CalamityMod.BiomeManagers public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Sunken Sea background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; public override void SetStaticDefaults() { diff --git a/BiomeManagers/UndergroundAstralBiome.cs b/BiomeManagers/UndergroundAstralBiome.cs index 22a1504869..c4165903d9 100644 --- a/BiomeManagers/UndergroundAstralBiome.cs +++ b/BiomeManagers/UndergroundAstralBiome.cs @@ -11,6 +11,9 @@ namespace CalamityMod.BiomeManagers public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/UndergroundAstralIcon"; + // Could use its own unique background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralUnderground") ?? MusicID.Space; @@ -21,8 +24,12 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) && - (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight); + return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight); + } + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); } // Just slightly above the above-ground astral biomes. diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index cdd7336cdc..59914be4af 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -187,10 +187,6 @@ namespace CalamityMod.Buffs tip += ". Grants immunity to Chilled, Frozen and Glacial State"; break; - case BuffID.Invisibility: - tip += ". Grants rogue bonuses while holding certain rogue weapons"; - break; - case BuffID.Daybreak: tip = "Incinerated by solar rays"; break; diff --git a/Buffs/DamageOverTime/AstralInfectionDebuff.cs b/Buffs/DamageOverTime/AstralInfectionDebuff.cs index 73ffa3d87d..b48ef27d70 100644 --- a/Buffs/DamageOverTime/AstralInfectionDebuff.cs +++ b/Buffs/DamageOverTime/AstralInfectionDebuff.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs index e57d5b71dc..8fdea80797 100644 --- a/Buffs/DamageOverTime/BanishingFire.cs +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/BrimstoneFlames.cs b/Buffs/DamageOverTime/BrimstoneFlames.cs index 5d2ad48afd..262a4da6c6 100644 --- a/Buffs/DamageOverTime/BrimstoneFlames.cs +++ b/Buffs/DamageOverTime/BrimstoneFlames.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index 0065ebdd31..0561fd5a87 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/CrushDepth.cs b/Buffs/DamageOverTime/CrushDepth.cs index 6e2c42ff45..70b7f88491 100644 --- a/Buffs/DamageOverTime/CrushDepth.cs +++ b/Buffs/DamageOverTime/CrushDepth.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/Dragonfire.cs b/Buffs/DamageOverTime/Dragonfire.cs index 963ebdc8ca..79fd4b4a59 100644 --- a/Buffs/DamageOverTime/Dragonfire.cs +++ b/Buffs/DamageOverTime/Dragonfire.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -8,15 +9,24 @@ namespace CalamityMod.Buffs.DamageOverTime public override void SetStaticDefaults() { DisplayName.SetDefault("Dragonfire"); - Description.SetDefault("Losing life, reduced movement speed"); + Description.SetDefault("Engulfed by roaring flames"); 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().dragonFire = true; } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().dragonFire < npc.buffTime[buffIndex]) + npc.Calamity().dragonFire = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } } } diff --git a/Buffs/DamageOverTime/Dragonfire.png b/Buffs/DamageOverTime/Dragonfire.png index 01bd7a8e2e..0c84e72313 100644 Binary files a/Buffs/DamageOverTime/Dragonfire.png and b/Buffs/DamageOverTime/Dragonfire.png differ diff --git a/Buffs/DamageOverTime/GodSlayerInferno.cs b/Buffs/DamageOverTime/GodSlayerInferno.cs index ab96589ace..c3a4dc93b4 100644 --- a/Buffs/DamageOverTime/GodSlayerInferno.cs +++ b/Buffs/DamageOverTime/GodSlayerInferno.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index 90523cc11b..242c1a6f72 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index d7c0d32b82..8211b2a43d 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Plague.cs b/Buffs/DamageOverTime/Plague.cs index 0a4f71a325..cdf3498062 100644 --- a/Buffs/DamageOverTime/Plague.cs +++ b/Buffs/DamageOverTime/Plague.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index 730e5dbe54..b111b13846 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/Shred.cs b/Buffs/DamageOverTime/Shred.cs index cc872fa035..57a541b2cc 100644 --- a/Buffs/DamageOverTime/Shred.cs +++ b/Buffs/DamageOverTime/Shred.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Buffs.DamageOverTime internal const int StackFalloffFrames = 320; // 75 DPS (15x5) per stack may seem low, but it gets boosted by ranged stats and can supercrit. - internal static int BaseDamage = 15; + internal static int BaseDamage = 30; internal static int FramesPerDamageTick = 12; public override void SetStaticDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Buffs.DamageOverTime int bleedTickDamage = (int)applicator.GetTotalDamage().ApplyTo(BaseDamage * cgn.somaShredStacks); Projectile tick = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), bleedTickDamage, 0f, applicator.whoAmI, target.whoAmI); tick.DamageType = DamageClass.Ranged; // Uncommon for DirectStrikes, but it needs to be able to crit. - tick.Calamity().canSupercrit = true; + tick.Calamity().supercritHits = -1; } } } diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index 77f0ed466d..1ef29b3f27 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 9e47812098..80995110de 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -13,6 +14,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 61ce1dcb5f..fe6091ef24 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true; diff --git a/Buffs/Mounts/MarniteLiftBuff.cs b/Buffs/Mounts/MarniteLiftBuff.cs new file mode 100644 index 0000000000..af2c45bb82 --- /dev/null +++ b/Buffs/Mounts/MarniteLiftBuff.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Armor.MarniteArchitect; + +namespace CalamityMod.Buffs.Mounts +{ + public class MarniteLiftBuff : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marnite Lift"); + Description.SetDefault("Do you even..?"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(ModContent.MountType(), player); + player.buffTime[buffIndex] = 10; // reset buff time + player.GetModPlayer().mounted = true; + } + } +} diff --git a/Buffs/Mounts/MarniteLiftBuff.png b/Buffs/Mounts/MarniteLiftBuff.png new file mode 100644 index 0000000000..f3ab13c0e7 Binary files /dev/null and b/Buffs/Mounts/MarniteLiftBuff.png differ diff --git a/Buffs/Potions/BaguetteBuff.png b/Buffs/Potions/BaguetteBuff.png index e714108f42..431545d803 100644 Binary files a/Buffs/Potions/BaguetteBuff.png and b/Buffs/Potions/BaguetteBuff.png differ diff --git a/Buffs/Potions/PenumbraBuff.cs b/Buffs/Potions/PenumbraBuff.cs index feae731526..2ffcf2e778 100644 --- a/Buffs/Potions/PenumbraBuff.cs +++ b/Buffs/Potions/PenumbraBuff.cs @@ -8,9 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Penumbra"); - Description.SetDefault("Stealth regenerates 15% faster while moving\n" + - "At night, stealth additionally regenerates 15% faster while standing still\n" + - "Both boosts increase to 20% during a solar eclipse"); + Description.SetDefault("Stealth regenerates 10% faster while moving and 15% faster while standing still"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/Potions/ShadowBuff.cs b/Buffs/Potions/ShadowBuff.cs index 68b4e3d25d..b1f0231d3b 100644 --- a/Buffs/Potions/ShadowBuff.cs +++ b/Buffs/Potions/ShadowBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Shadow"); - Description.SetDefault("You're invisible, certain rogue weapons give and gain buffs, and stealth generation is boosted."); + Description.SetDefault("You are a shadow, rogue weapons spawn projectiles on hit, and stealth generation is boosted by 8%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; @@ -16,8 +16,9 @@ namespace CalamityMod.Buffs.Potions public override void Update(Player player, ref int buffIndex) { - player.invis = true; player.Calamity().shadow = true; + if (player.yoraiz0rEye < 2 && CalamityConfig.Instance.StealthInvisibility) + player.yoraiz0rEye = 2; } } } diff --git a/Buffs/StatBuffs/AvertorBonus.png b/Buffs/StatBuffs/AvertorBonus.png index 020e7e63c1..a8767506c3 100644 Binary files a/Buffs/StatBuffs/AvertorBonus.png and b/Buffs/StatBuffs/AvertorBonus.png differ diff --git a/Buffs/StatBuffs/CoralSymbiosis.cs b/Buffs/StatBuffs/CoralSymbiosis.cs new file mode 100644 index 0000000000..c5f7d7690c --- /dev/null +++ b/Buffs/StatBuffs/CoralSymbiosis.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Magic; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class CoralSymbiosis : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coral Symbiosis"); + Description.SetDefault($"Coral Spout charges up faster and deals {CoralSpout.SymbiosisDamageBuff} extra damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer().Symbiosis = true; + } + } +} diff --git a/Buffs/StatBuffs/CoralSymbiosis.png b/Buffs/StatBuffs/CoralSymbiosis.png new file mode 100644 index 0000000000..823bfb0955 Binary files /dev/null and b/Buffs/StatBuffs/CoralSymbiosis.png differ diff --git a/Buffs/StatBuffs/SpiritDefense.png b/Buffs/StatBuffs/SpiritDefense.png index 8408ef1145..8d135b5bb9 100644 Binary files a/Buffs/StatBuffs/SpiritDefense.png and b/Buffs/StatBuffs/SpiritDefense.png differ diff --git a/Buffs/StatBuffs/SpiritPower.png b/Buffs/StatBuffs/SpiritPower.png index a3706a92a3..46a7fd1518 100644 Binary files a/Buffs/StatBuffs/SpiritPower.png and b/Buffs/StatBuffs/SpiritPower.png differ diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index ddf8bcf579..ca1db3922e 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index ae95da450e..8c4039b679 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -13,6 +14,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/StatDebuffs/ExoFreeze.cs b/Buffs/StatDebuffs/ExoFreeze.cs index 2ff053606c..e8e0fcb1a6 100644 --- a/Buffs/StatDebuffs/ExoFreeze.cs +++ b/Buffs/StatDebuffs/ExoFreeze.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -13,6 +14,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/StatDebuffs/FishAlert.cs b/Buffs/StatDebuffs/FishAlert.cs index c3936a316d..eba4223fd0 100644 --- a/Buffs/StatDebuffs/FishAlert.cs +++ b/Buffs/StatDebuffs/FishAlert.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.StatDebuffs 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) diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index cb3da5831a..408d99a241 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -13,6 +14,7 @@ namespace CalamityMod.Buffs.StatDebuffs 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) diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index 0d0ebdf212..cc04c5825e 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs index c04ce9833e..28e798f9a2 100644 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ b/Buffs/StatDebuffs/KamiFlu.cs @@ -28,10 +28,5 @@ namespace CalamityMod.Buffs.StatDebuffs npc.DelBuff(buffIndex); buffIndex--; } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().teslaFreeze = true; - } } } diff --git a/Buffs/StatDebuffs/TeslaFreeze.cs b/Buffs/StatDebuffs/TeslaFreeze.cs index c04263f707..350468176d 100644 --- a/Buffs/StatDebuffs/TeslaFreeze.cs +++ b/Buffs/StatDebuffs/TeslaFreeze.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -13,6 +14,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index 8695f2724e..db9a2aca4d 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -12,6 +13,7 @@ namespace CalamityMod.Buffs.StatDebuffs 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) diff --git a/Buffs/StatDebuffs/WitherDebuff.cs b/Buffs/StatDebuffs/WitherDebuff.cs index 98f8a4c5e1..792f5975f0 100644 --- a/Buffs/StatDebuffs/WitherDebuff.cs +++ b/Buffs/StatDebuffs/WitherDebuff.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -15,6 +16,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/Summon/ExoskeletonCannons.cs b/Buffs/Summon/ExoskeletonCannons.cs new file mode 100644 index 0000000000..5c0da06187 --- /dev/null +++ b/Buffs/Summon/ExoskeletonCannons.cs @@ -0,0 +1,33 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class ExoskeletonCannons : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ares' Cannons"); + Description.SetDefault("Pulse cannon not included"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (AresExoskeleton.ArmExists(player)) + modPlayer.AresCannons = true; + + if (modPlayer.AresCannons) + player.buffTime[buffIndex] = 18000; + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/Summon/ExoskeletonCannons.png b/Buffs/Summon/ExoskeletonCannons.png new file mode 100644 index 0000000000..2659608f58 Binary files /dev/null and b/Buffs/Summon/ExoskeletonCannons.png differ diff --git a/Buffs/Summon/FleshBallBuff.png b/Buffs/Summon/FleshBallBuff.png index 5fadbf39f8..ce96c1740d 100644 Binary files a/Buffs/Summon/FleshBallBuff.png and b/Buffs/Summon/FleshBallBuff.png differ diff --git a/Buffs/Summon/FungalClumpBuff.cs b/Buffs/Summon/FungalClumpBuff.cs index 3288fe9f5d..3017d83657 100644 --- a/Buffs/Summon/FungalClumpBuff.cs +++ b/Buffs/Summon/FungalClumpBuff.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/FungalClumpBuff.png b/Buffs/Summon/FungalClumpBuff.png index d2ab50894f..07af8181f1 100644 Binary files a/Buffs/Summon/FungalClumpBuff.png and b/Buffs/Summon/FungalClumpBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d5ec2c1c0a..9602a08f9f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -18,6 +18,7 @@ using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.Brimflame; @@ -26,14 +27,17 @@ using CalamityMod.Items.Armor.GemTech; using CalamityMod.Items.Armor.OmegaBlue; using CalamityMod.Items.Armor.PlagueReaper; using CalamityMod.Items.Armor.Silva; +using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Dyes; using CalamityMod.Items.Mounts; using CalamityMod.Items.Mounts.Minecarts; -using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.VanillaArmorChanges; +using CalamityMod.Items.Weapons.DraedonsArsenal; 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.Abyss; using CalamityMod.NPCs.ExoMechs.Apollo; @@ -85,7 +89,6 @@ namespace CalamityMod.CalPlayer public static int chaosStateDuration = 900; public static int chaosStateDuration_NR = 1200; public bool killSpikyBalls = false; - public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; public int waterLeechTarget = -1; public float KameiTrailXScale = 0.1f; @@ -104,10 +107,8 @@ namespace CalamityMod.CalPlayer public bool blockAllDashes = false; public bool resetHeightandWidth = false; public bool noLifeRegen = false; - public int itemTypeLastReforged = 0; - public int reforgeTierSafety = 0; - public bool finalTierAccessoryReforge = false; public float rangedAmmoCost = 1f; + public float healingPotBonus = 1f; public bool heldGaelsLastFrame = false; internal bool hadNanomachinesLastFrame = false; public bool disableVoodooSpawns = false; @@ -202,6 +203,7 @@ namespace CalamityMod.CalPlayer public int bloodflareHeartTimer = 300; public int polarisBoostCounter = 0; public int dragonRageHits = 0; + public int dragonRageCooldown = 0; public float modStealth = 1f; public float aquaticBoostMax = 10000f; public float aquaticBoost = 0f; @@ -243,35 +245,17 @@ namespace CalamityMod.CalPlayer public static readonly SoundStyle RageFilledSound = new("CalamityMod/Sounds/Custom/AbilitySounds/FullRage"); public static readonly SoundStyle RageActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/RageActivate"); public static readonly SoundStyle RageEndSound = new("CalamityMod/Sounds/Custom/AbilitySounds/RageEnd"); - + public static readonly SoundStyle AdrenalineFilledSound = new("CalamityMod/Sounds/Custom/AbilitySounds/FullAdrenaline"); public static readonly SoundStyle AdrenalineActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/AdrenalineActivate"); + public static readonly SoundStyle AdrenalineHurtSound = new("CalamityMod/Sounds/Custom/AdrenalineMajorLoss"); public static readonly SoundStyle RogueStealthSound = new("CalamityMod/Sounds/Custom/RogueStealth"); public static readonly SoundStyle DefenseDamageSound = new("CalamityMod/Sounds/Custom/DefenseDamage"); + public static readonly SoundStyle BloodCritSound = new("CalamityMod/Sounds/Custom/BloodPactCrit"); - #endregion - - #region Proficiency - private const int levelTier1 = 1500; - private const int levelTier2 = 5500; - private const int levelTier3 = 12500; - public int meleeLevel = 0; - public int rangedLevel = 0; - public int magicLevel = 0; - public int rogueLevel = 0; - public int summonLevel = 0; - public bool shootFireworksLevelUpMelee = true; - public bool shootFireworksLevelUpRanged = true; - public bool shootFireworksLevelUpMagic = true; - public bool shootFireworksLevelUpSummon = true; - public bool shootFireworksLevelUpRogue = true; - public int exactMeleeLevel = 0; - public int exactRangedLevel = 0; - public int exactMagicLevel = 0; - public int exactSummonLevel = 0; - public int exactRogueLevel = 0; - public int gainLevelCooldown = 120; + public static readonly SoundStyle IjiDeathSound = new("CalamityMod/Sounds/Custom/IjiDies"); + public static readonly SoundStyle DrownSound = new("CalamityMod/Sounds/Custom/AbyssDrown"); #endregion #region Rogue @@ -285,12 +269,13 @@ namespace CalamityMod.CalPlayer public bool stealthStrikeThisFrame = false; public bool stealthStrikeHalfCost = false; public bool stealthStrike75Cost = false; - public bool stealthStrikeAlwaysCrits = false; + public bool stealthStrike85Cost = false; public bool wearingRogueArmor = false; public float accStealthGenBoost = 0f; // TODO -- Stealth needs to be its own damage class so that stealth bonuses only apply to stealth strikes public float stealthDamage = 0f; // This is extra Rogue Damage that is only added for stealth strikes. + public double bonusStealthDamage = 0; public float rogueVelocity = 1f; public float rogueAmmoCost = 1f; #endregion @@ -363,8 +348,8 @@ namespace CalamityMod.CalPlayer #region Defense Damage // Ratio at which incoming damage (after mitigation) is converted into defense damage. // Used to be 5% normal, 10% expert, 12% rev, 15% death, 20% boss rush - // It is now 15% on all difficulties because you already take less damage on lower difficulties. - public const double DefenseDamageRatio = 0.15; + // It is now 10% on all difficulties because you already take less damage on lower difficulties. + public const double DefenseDamageRatio = 0.1; public int CurrentDefenseDamage => (int)(totalDefenseDamage * ((float)defenseDamageRecoveryFrames / totalDefenseDamageRecoveryFrames)); internal int totalDefenseDamage = 0; // Defense damage from a single hit recovers in 50 frames, no matter how big the hit was. @@ -409,11 +394,6 @@ namespace CalamityMod.CalPlayer #endregion #region Accessory - public bool fasterMeleeLevel = false; - public bool fasterRangedLevel = false; - public bool fasterMagicLevel = false; - public bool fasterSummonLevel = false; - public bool fasterRogueLevel = false; public bool luxorsGift = false; public bool fungalSymbiote = false; public bool trinketOfChi = false; @@ -470,8 +450,7 @@ namespace CalamityMod.CalPlayer public bool aBrain = false; public bool amalgam = false; public bool raiderTalisman = false; - public int raiderStack = 0; - public int raiderCooldown = 0; + public float raiderCritBonus = RaidersTalisman.RaiderBonus; public bool gSabaton = false; public int gSabatonFall = 0; public int gSabatonCooldown = 0; @@ -516,7 +495,6 @@ namespace CalamityMod.CalPlayer public bool jellyfishNecklace = false; public bool fairyBoots = false; public bool hellfireTreads = false; - public bool abyssDivingGear = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; public bool aquaticEmblem = false; @@ -537,6 +515,7 @@ namespace CalamityMod.CalPlayer public bool handWarmer = false; public bool ursaSergeant = false; public bool scuttlersJewel = false; + public int scuttlerCooldown = 0; public bool thiefsDime = false; public bool dynamoStemCells = false; public bool etherealExtorter = false; @@ -558,9 +537,7 @@ namespace CalamityMod.CalPlayer public bool abyssalMirror = false; public bool eclipseMirror = false; public bool featherCrown = false; - public bool featherCrownDraw = false; public bool moonCrown = false; - public bool moonCrownDraw = false; public int rogueCrownCooldown = 0; public bool dragonScales = false; public bool gloveOfPrecision = false; @@ -604,12 +581,15 @@ namespace CalamityMod.CalPlayer public bool BloomStoneRegen = false; public bool ChaosStone = false; public bool CryoStone = false; + public bool voidField = false; #endregion #region Armor Set public bool silverMedkit = false; public int silverMedkitTimer = 0; public bool goldArmorGoldDrops = false; + public bool miningSet = false; + public int miningSetCooldown = 0; public bool desertProwler = false; public bool snowRuffianSet = false; public bool forbiddenCirclet = false; @@ -986,6 +966,7 @@ namespace CalamityMod.CalPlayer public bool soulSeeker = false; public bool perditionBeacon = false; public bool MoonFist = false; + public bool AresCannons = false; public List PendingProjectilesToRespawn = new List(); @@ -1104,6 +1085,8 @@ namespace CalamityMod.CalPlayer public FluidField ProfanedMoonlightAuroraDrawer; public Vector2 FireDrawerPosition; + + public int monolithAccursedShader = 0; #endregion Draw Effects #region Draedon Summoning @@ -1211,7 +1194,6 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("bossHPBar", drawBossHPBar); boost.AddWithCondition("drawSmallText", shouldDrawSmallText); boost.AddWithCondition("fullHPRespawn", healToFull); - boost.AddWithCondition("finalTierAccessoryReforge", finalTierAccessoryReforge); boost.AddWithCondition("newMerchantInventory", newMerchantInventory); boost.AddWithCondition("newPainterInventory", newPainterInventory); @@ -1270,18 +1252,6 @@ namespace CalamityMod.CalPlayer tag["aquaticBoostPower"] = aquaticBoost; tag["sCalDeathCount"] = sCalDeathCount; tag["sCalKillCount"] = sCalKillCount; - tag["meleeLevel"] = meleeLevel; - tag["exactMeleeLevel"] = exactMeleeLevel; - tag["rangedLevel"] = rangedLevel; - tag["exactRangedLevel"] = exactRangedLevel; - tag["magicLevel"] = magicLevel; - tag["exactMagicLevel"] = exactMagicLevel; - tag["summonLevel"] = summonLevel; - tag["exactSummonLevel"] = exactSummonLevel; - tag["rogueLevel"] = rogueLevel; - tag["exactRogueLevel"] = exactRogueLevel; - tag["itemTypeLastReforged"] = itemTypeLastReforged; - tag["reforgeTierSafety"] = reforgeTierSafety; tag["moveSpeedBonus"] = moveSpeedBonus; tag["defenseDamage"] = totalDefenseDamage; tag["defenseDamageRecoveryFrames"] = defenseDamageRecoveryFrames; @@ -1312,7 +1282,6 @@ namespace CalamityMod.CalPlayer drawBossHPBar = boost.Contains("bossHPBar"); shouldDrawSmallText = boost.Contains("drawSmallText"); healToFull = boost.Contains("fullHPRespawn"); - finalTierAccessoryReforge = boost.Contains("finalTierAccessoryReforge"); newMerchantInventory = boost.Contains("newMerchantInventory"); newPainterInventory = boost.Contains("newPainterInventory"); @@ -1367,26 +1336,6 @@ namespace CalamityMod.CalPlayer sCalKillCount = tag.GetInt("sCalKillCount"); deathCount = tag.GetInt("deathCount"); - // These two variables are no longer used, as the code was moved into CalamityWorld.cs to support multiplayer. - // As a result, their values are simply fed into a discard. - - _ = tag.GetInt("moneyStolenByBandit"); - _ = tag.GetInt("reforges"); - - itemTypeLastReforged = tag.GetInt("itemTypeLastReforged"); - reforgeTierSafety = tag.GetInt("reforgeTierSafety"); - - meleeLevel = tag.GetInt("meleeLevel"); - rangedLevel = tag.GetInt("rangedLevel"); - magicLevel = tag.GetInt("magicLevel"); - summonLevel = tag.GetInt("summonLevel"); - rogueLevel = tag.GetInt("rogueLevel"); - exactMeleeLevel = tag.GetInt("exactMeleeLevel"); - exactRangedLevel = tag.GetInt("exactRangedLevel"); - exactMagicLevel = tag.GetInt("exactMagicLevel"); - exactSummonLevel = tag.GetInt("exactSummonLevel"); - exactRogueLevel = tag.GetInt("exactRogueLevel"); - if (tag.ContainsKey("moveSpeedBonus")) moveSpeedBonus = tag.GetFloat("moveSpeedBonus"); totalDefenseDamage = tag.GetInt("defenseDamage"); @@ -1532,12 +1481,6 @@ namespace CalamityMod.CalPlayer afflicted = false; affliction = false; - fasterMeleeLevel = false; - fasterRangedLevel = false; - fasterMagicLevel = false; - fasterSummonLevel = false; - fasterRogueLevel = false; - dodgeScarf = false; evasionScarf = false; @@ -1706,6 +1649,7 @@ namespace CalamityMod.CalPlayer BloomStoneRegen = false; ChaosStone = false; CryoStone = false; + voidField = false; daedalusReflect = false; daedalusSplit = false; @@ -1716,6 +1660,7 @@ namespace CalamityMod.CalPlayer brimflameFrenzy = false; rangedAmmoCost = 1f; + healingPotBonus = 1f; avertorBonus = false; @@ -1730,7 +1675,6 @@ namespace CalamityMod.CalPlayer jellyfishNecklace = false; fairyBoots = false; hellfireTreads = false; - abyssDivingGear = false; abyssalAmulet = false; lumenousAmulet = false; aquaticEmblem = false; @@ -1749,6 +1693,9 @@ namespace CalamityMod.CalPlayer silverMedkit = false; goldArmorGoldDrops = false; + miningSet = false; + miningSetCooldown = 0; + eskimoSet = false; //vanilla armor meteorSet = false; //vanilla armor, for Space Gun nerf @@ -1807,9 +1754,7 @@ namespace CalamityMod.CalPlayer abyssalMirror = false; eclipseMirror = false; featherCrown = false; - featherCrownDraw = false; moonCrown = false; - moonCrownDraw = false; dragonScales = false; gloveOfPrecision = false; gloveOfRecklessness = false; @@ -2057,6 +2002,7 @@ namespace CalamityMod.CalPlayer soulSeeker = false; perditionBeacon = false; MoonFist = false; + AresCannons = false; disableVoodooSpawns = false; disablePerfCystSpawns = false; @@ -2101,13 +2047,9 @@ namespace CalamityMod.CalPlayer lecherousOrbEnchant = false; flatStealthLossReduction = 0; - lastProjectileHit = null; - AbleToSelectExoMech = false; EnchantHeldItemEffects(Player, Player.Calamity(), Player.ActiveItem()); - BaseIdleHoldoutProjectile.CheckForEveryHoldout(Player); - VanillaArmorChangeManager.ApplyPotentialEffectsTo(Player); } #endregion @@ -2178,8 +2120,7 @@ namespace CalamityMod.CalPlayer spiritOriginConvertedCrit = 0; rage = 0f; adrenaline = 0f; - raiderStack = 0; - raiderCooldown = 0; + raiderCritBonus = 0f; gSabatonFall = 0; gSabatonCooldown = 0; astralStarRainCooldown = 0; @@ -2194,12 +2135,14 @@ namespace CalamityMod.CalPlayer externalColdImmunity = externalHeatImmunity = false; polarisBoostCounter = 0; dragonRageHits = 0; + dragonRageCooldown = 0; spectralVeilImmunity = 0; jetPackDash = 0; jetPackDirection = 0; andromedaCripple = 0; theBeeCooldown = 0; killSpikyBalls = false; + scuttlerCooldown = 0; rogueCrownCooldown = 0; icicleCooldown = 0; statisTimer = 0; @@ -2255,6 +2198,7 @@ namespace CalamityMod.CalPlayer stealthAcceleration = 1f; stealthDamage = 0f; + bonusStealthDamage = 0; rogueVelocity = 1f; rogueAmmoCost = 1f; #endregion @@ -2368,6 +2312,7 @@ namespace CalamityMod.CalPlayer danceOfLightCharge = 0; bloodPactBoost = false; rangedAmmoCost = 1f; + healingPotBonus = 1f; avertorBonus = false; divineBless = false; #endregion @@ -2376,6 +2321,8 @@ namespace CalamityMod.CalPlayer silverMedkit = false; silverMedkitTimer = 0; goldArmorGoldDrops = false; + miningSet = false; + miningSetCooldown = 0; flamethrowerBoost = false; hoverboardBoost = false; //hoverboard + shroomite visage shadowSpeed = false; @@ -2493,7 +2440,6 @@ namespace CalamityMod.CalPlayer CurrentlyViewedHologramText = string.Empty; KameiBladeUseDelay = 0; - lastProjectileHit = null; brimlashBusterBoost = false; evilSmasherBoost = 0; hellbornBoost = 0; @@ -2550,6 +2496,8 @@ namespace CalamityMod.CalPlayer return new Item(); } + + public override void ProcessTriggers(TriggersSet triggersSet) { if (CalamityKeybinds.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == Player.whoAmI) @@ -2593,7 +2541,7 @@ namespace CalamityMod.CalPlayer for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.minionSlots <= 0f || !proj.IsSummon()) + if (proj.minionSlots <= 0f || !proj.CountsAsClass()) continue; if (proj.active && proj.owner == Player.whoAmI) { @@ -2611,14 +2559,15 @@ namespace CalamityMod.CalPlayer Player.HealEffect(2); } } - if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(Cooldowns.SandCloak.ID)) { - Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(25)); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - rogueStealth -= rogueStealthMax * 0.25f; - Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, Player.whoAmI); + rogueStealth -= rogueStealthMax * 0.1f; + int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, Player.whoAmI); + Main.projectile[veil].Center = Player.Center; SoundEngine.PlaySound(SoundID.Item45, Player.position); } if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && @@ -3290,11 +3239,14 @@ namespace CalamityMod.CalPlayer // TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; - // Increase tile placement speed to speed up early game a bit and make building more fun - Player.tileSpeed += 0.5f; + if (CalamityConfig.Instance.FasterTilePlacement) + { + // Increase tile placement speed to speed up early game a bit and make building more fun + Player.tileSpeed += 0.5f; - // Increase wall placement speed to speed up early game a bit and make building more fun - Player.wallSpeed += 0.5f; + // Increase wall placement speed to speed up early game a bit and make building more fun + Player.wallSpeed += 0.5f; + } // Takes the movement speed bonus and uses it to increase run speed float accRunSpeedMin = Player.accRunSpeed * 0.5f; @@ -3316,24 +3268,10 @@ namespace CalamityMod.CalPlayer if (Player.beetleOffense && Player.beetleOrbs > 0) meleeSpeedMult -= 0.1f * Player.beetleOrbs; - if (CalamityConfig.Instance.Proficiency) - meleeSpeedMult += GetMeleeSpeedBonus(); - if (GemTechSet && GemTechState.IsYellowGemActive) meleeSpeedMult += GemTechHeadgear.MeleeSpeedBoost; Player.GetAttackSpeed() += meleeSpeedMult; - - // Melee speed does not affect non-true melee weapon projectile rate of fire. - if (Player.HoldingProjectileMeleeWeapon()) - { - // Melee weapons that fire any kind of projectile don't benefit from melee speed anymore, so they get a damage boost from it instead. - Player.GetDamage() += Player.GetAttackSpeed() - 1f; - - // Set melee speed to 1f. - float newMeleeSpeed = 1f + ((Player.GetAttackSpeed() - 1f) * projectileMeleeWeaponMeleeSpeedMultiplier); - Player.GetAttackSpeed() = newMeleeSpeed; - } #endregion if (snowman) @@ -3385,6 +3323,9 @@ namespace CalamityMod.CalPlayer #region PreUpdate public override void PreUpdate() { + if (HasCustomDash && UsedDash.IsOmnidirectional) + Player.maxFallSpeed = 50f; + tailFrameUp++; if (tailFrameUp == 8) { @@ -3536,6 +3477,7 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += 0.1f; ForceVariousEffects(); + BaseIdleHoldoutProjectile.CheckForEveryHoldout(Player); } #endregion @@ -3582,32 +3524,8 @@ namespace CalamityMod.CalPlayer (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); - if (abyssalDivingSuit && !Player.IsUnderwater()) - { - float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; - runAccMult *= multiplier; - runSpeedMult *= multiplier; - } - if (flameLickedShell) - { - float multiplier = shellBoost ? 0.8f : 0.5f; - runAccMult *= multiplier; - runSpeedMult *= multiplier; - } - if (ursaSergeant) - { - runAccMult *= 0.85f; - runSpeedMult *= 0.85f; - } - if (elysianGuard) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } if ((Player.slippy || Player.slippy2) && Player.iceSkate) - { runAccMult *= 0.6f; - } if (momentumCapacitorTime > 0) { @@ -3628,6 +3546,12 @@ namespace CalamityMod.CalPlayer #endregion #region DashEffects + if (!string.IsNullOrEmpty(DeferredDashID)) + { + DashID = DeferredDashID; + DeferredDashID = string.Empty; + } + if (Player.pulley && HasCustomDash) { ModDashMovement(); @@ -3771,7 +3695,7 @@ namespace CalamityMod.CalPlayer rogueStealth += 0.5f; SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center); - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); for (int i = 0; i < 10; i++) { int damage = (int)Player.GetTotalDamage().ApplyTo(55); @@ -4038,7 +3962,7 @@ namespace CalamityMod.CalPlayer } if (dragonFire) { - damageSource = PlayerDeathReason.ByCustomReason(Player.name + " disintegrated into ashes."); + damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s ashes scatter in the wind."); } if (hInferno) { @@ -4132,7 +4056,8 @@ namespace CalamityMod.CalPlayer #region On Respawn public override void OnRespawn(Player player) { - thirdSageH = true; + if (healToFull) + thirdSageH = true; // Order the list such that less expensive minions are at the top. // This way cheaper minions will be spawned first, and at the end, the most expensive @@ -4169,10 +4094,7 @@ namespace CalamityMod.CalPlayer #region Get Heal Life public override void GetHealLife(Item item, bool quickHeal, ref int healValue) { - double healMult = 1D + - (coreOfTheBloodGod ? 0.25 : 0) + - (bloodPactBoost ? 0.5 : 0); - healValue = (int)(healValue * healMult); + healValue = (int)(healValue * healingPotBonus); } #endregion @@ -4187,9 +4109,12 @@ namespace CalamityMod.CalPlayer else acidRoundMultiplier = 1D; - // Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me - if (desertProwler && (item.CountsAsClass() || item.type == ModContent.ItemType()) && item.ammo == AmmoID.None) - damage.Flat += 1f; + if (item.CountsAsClass()) + { + // Apply weapon modifier stealth strike damage bonus + if (item.Calamity().StealthStrikePrefixBonus != 0f && StealthStrikeAvailable()) + damage += 1f - item.Calamity().StealthStrikePrefixBonus; + } } public override void ModifyWeaponKnockback(Item item, ref StatModifier knockback) @@ -4419,45 +4344,7 @@ namespace CalamityMod.CalPlayer int defenseAdd = (int)(target.defense * 0.5); damage += defenseAdd; } - if (item.CountsAsClass() && badgeOfBravery) - { - int penetratableDefense = (int)Math.Max(target.defense - Player.GetArmorPenetration(), 0); - int penetratedDefense = Math.Min(penetratableDefense, 5); - damage += (int)(0.5f * penetratedDefense); - } #endregion - - if ((target.damage > 0 || target.boss) && !target.SpawnedFromStatue && Player.whoAmI == Main.myPlayer) - { - if (CalamityConfig.Instance.Proficiency && item.DamageType == DamageClass.Melee) - { - if (gainLevelCooldown <= 0) - { - gainLevelCooldown = 120; - if (meleeLevel <= 12500) - { - if (!ReduceCooldown((int)ClassType.Melee)) - { - if (!Main.hardMode && meleeLevel >= 1500) - gainLevelCooldown = 1200; //20 seconds - if (!NPC.downedMoonlord && meleeLevel >= 5500) - gainLevelCooldown = 2400; //40 seconds - } - else - gainLevelCooldown /= 2; - - if (fasterMeleeLevel) - gainLevelCooldown /= 2; - - meleeLevel++; - shootFireworksLevelUpMelee = true; - - if (Main.netMode == NetmodeID.MultiplayerClient) - SyncLevel(false, (int)ClassType.Melee); - } - } - } - } } public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -4465,7 +4352,7 @@ namespace CalamityMod.CalPlayer if (proj.npcProj || proj.trap) return; - bool isSummon = proj.IsSummon(); + bool isSummon = proj.CountsAsClass(); Item heldItem = Player.ActiveItem(); #region MultiplierBoosts @@ -4497,12 +4384,9 @@ namespace CalamityMod.CalPlayer // Rippers are always checked for application, because there are ways to get rippers outside of Rev now CalamityUtils.ApplyRippersToDamage(this, proj.IsTrueMelee(), ref damageMult); - if (filthyGlove && proj.Calamity().stealthStrike && proj.CountsAsClass()) + if (proj.Calamity().stealthStrike && proj.CountsAsClass()) { - if (nanotech) - damageMult += 0.05; - else - damageMult += 0.1; + damageMult += bonusStealthDamage; } if (proj.type == ProjectileID.Gungnir) @@ -4544,23 +4428,6 @@ namespace CalamityMod.CalPlayer } } } - - int penetrateAmt = 0; - if (proj.Calamity().stealthStrike && proj.CountsAsClass()) - { - // Nanotech is a total of 20 as it has all three bools - if (nanotech) - penetrateAmt += 10; - if (filthyGlove || bloodyGlove) - penetrateAmt += 10; - } - if (proj.CountsAsClass() && badgeOfBravery) - { - penetrateAmt += 5; - } - int penetratableDefense = (int)Math.Max(target.defense - Player.GetArmorPenetration(), 0); //if find how much defense we can penetrate - int penetratedDefense = Math.Min(penetratableDefense, penetrateAmt); //if we have more penetrate than enemy defense, use enemy defense - damage += (int)(0.5f * penetratedDefense); #endregion #region MultiplicativeReductions @@ -4601,128 +4468,11 @@ namespace CalamityMod.CalPlayer if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) damage = (int)(damage * 0.75); } - - if (proj.type == ProjectileID.SpectreWrath && Player.ghostHurt) - damage = (int)(damage * 0.7); - #endregion // Handle on-hit ranged effects for the gem tech armor set. if (proj.CountsAsClass() && proj.type != ModContent.ProjectileType()) GemTechState.RangedOnHitEffects(target, damage); - - if ((target.damage > 0 || target.boss) && !target.SpawnedFromStatue && CalamityConfig.Instance.Proficiency) - { - if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever - { - gainLevelCooldown = 120; //2 seconds - if (proj.CountsAsClass() && meleeLevel <= 12500) - { - if (!ReduceCooldown((int)ClassType.Melee)) - { - if (!Main.hardMode && meleeLevel >= 1500) - gainLevelCooldown = 1200; //20 seconds - if (!NPC.downedMoonlord && meleeLevel >= 5500) - gainLevelCooldown = 2400; //40 seconds - } - else - gainLevelCooldown /= 2; - - if (fasterMeleeLevel) - gainLevelCooldown /= 2; - - meleeLevel++; - shootFireworksLevelUpMelee = true; - - if (Main.netMode == NetmodeID.MultiplayerClient) - SyncLevel(false, (int)ClassType.Melee); - } - else if (proj.CountsAsClass() && rangedLevel <= 12500) - { - if (!ReduceCooldown((int)ClassType.Ranged)) - { - if (!Main.hardMode && rangedLevel >= 1500) - gainLevelCooldown = 1200; //20 seconds - if (!NPC.downedMoonlord && rangedLevel >= 5500) - gainLevelCooldown = 2400; //40 seconds - } - else - gainLevelCooldown /= 2; - - if (fasterRangedLevel) - gainLevelCooldown /= 2; - - rangedLevel++; - shootFireworksLevelUpRanged = true; - - if (Main.netMode == NetmodeID.MultiplayerClient) - SyncLevel(false, (int)ClassType.Ranged); - } - else if (proj.CountsAsClass() && magicLevel <= 12500) - { - if (!ReduceCooldown((int)ClassType.Magic)) - { - if (!Main.hardMode && magicLevel >= 1500) - gainLevelCooldown = 1200; //20 seconds - if (!NPC.downedMoonlord && magicLevel >= 5500) - gainLevelCooldown = 2400; //40 seconds - } - else - gainLevelCooldown /= 2; - - if (fasterMagicLevel) - gainLevelCooldown /= 2; - - magicLevel++; - shootFireworksLevelUpMagic = true; - - if (Main.netMode == NetmodeID.MultiplayerClient) - SyncLevel(false, (int)ClassType.Magic); - } - else if (proj.IsSummon() && summonLevel <= 12500) - { - if (!ReduceCooldown((int)ClassType.Summon)) - { - if (!Main.hardMode && summonLevel >= 1500) - gainLevelCooldown = 1200; //20 seconds - if (!NPC.downedMoonlord && summonLevel >= 5500) - gainLevelCooldown = 2400; //40 seconds - } - else - gainLevelCooldown /= 2; - - if (fasterSummonLevel) - gainLevelCooldown /= 2; - - summonLevel++; - shootFireworksLevelUpSummon = true; - - if (Main.netMode == NetmodeID.MultiplayerClient) - SyncLevel(false, (int)ClassType.Summon); - } - else if (proj.CountsAsClass() && rogueLevel <= 12500) - { - if (!ReduceCooldown((int)ClassType.Rogue)) - { - if (!Main.hardMode && rogueLevel >= 1500) - gainLevelCooldown = 1200; //20 seconds - if (!NPC.downedMoonlord && rogueLevel >= 5500) - gainLevelCooldown = 2400; //40 seconds - } - else - gainLevelCooldown /= 2; - - if (fasterRogueLevel) - gainLevelCooldown /= 2; - - rogueLevel++; - shootFireworksLevelUpRogue = true; - - if (Main.netMode == NetmodeID.MultiplayerClient) - SyncLevel(false, (int)ClassType.Rogue); - } - } - } } #endregion @@ -5134,7 +4884,7 @@ namespace CalamityMod.CalPlayer if (aSparkRare) { - if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || proj.type == ModContent.ProjectileType() || proj.type == ProjectileID.VortexLightning || proj.type == ModContent.ProjectileType() || + if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || proj.type == ProjectileID.VortexLightning || proj.type == ModContent.ProjectileType() || proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) projectileDamageReduction += 0.5; } @@ -5230,60 +4980,9 @@ namespace CalamityMod.CalPlayer #endregion #region On Hit - public override void OnHitByNPC(NPC npc, int damage, bool crit) - { - if (sulfurSet) - npc.AddBuff(BuffID.Poisoned, 120); - - if (npc.type == NPCID.ShadowFlameApparition || (npc.type == NPCID.ChaosBall && (Main.hardMode || areThereAnyDamnBosses))) - { - Player.AddBuff(ModContent.BuffType(), 180); - } - else if (npc.type == NPCID.Spazmatism && npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - { - Player.AddBuff(BuffID.Bleeding, 600); - } - else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) - { - Player.AddBuff(BuffID.Poisoned, 600); - } - else if (npc.type == NPCID.PlanterasTentacle) - { - Player.AddBuff(BuffID.Poisoned, 300); - } - else if (npc.type == NPCID.AncientDoom) - { - Player.AddBuff(ModContent.BuffType(), 180); - } - else if (npc.type == NPCID.AncientLight) - { - Player.AddBuff(ModContent.BuffType(), 180); - } - else if (npc.type == NPCID.HallowBoss) - { - Player.AddBuff(ModContent.BuffType(), 480); - } - else if (npc.type == NPCID.BloodNautilus) - { - Player.AddBuff(ModContent.BuffType(), 480); - } - else if (npc.type == NPCID.GoblinShark || npc.type == NPCID.BloodEelHead) - { - Player.AddBuff(ModContent.BuffType(), 300); - } - else if (npc.type == NPCID.BloodEelBody) - { - Player.AddBuff(ModContent.BuffType(), 180); - } - else if (npc.type == NPCID.BloodEelTail) - { - Player.AddBuff(ModContent.BuffType(), 120); - } - } - public override void OnHitByProjectile(Projectile proj, int damage, bool crit) { - if (sulfurSet && !proj.friendly) + if (sulfurSet && !proj.friendly && damage > 0) { if (Main.player[proj.owner] is null) { @@ -5298,11 +4997,11 @@ namespace CalamityMod.CalPlayer } } - if (proj.hostile) + if (proj.hostile && damage > 0) { if (proj.type == ProjectileID.TorchGod) { - int fireDebuffTypes = 8; + int fireDebuffTypes = CalamityWorld.death ? 9 : CalamityWorld.revenge ? 7 : Main.expertMode ? 5 : 3; switch (Main.rand.Next(fireDebuffTypes)) { case 0: @@ -5310,30 +5009,34 @@ namespace CalamityMod.CalPlayer break; case 1: - Player.AddBuff(BuffID.CursedInferno, 300); + Player.AddBuff(BuffID.Frostburn, 300); break; case 2: - Player.AddBuff(ModContent.BuffType(), 300); + Player.AddBuff(BuffID.CursedInferno, 300); break; case 3: - Player.AddBuff(ModContent.BuffType(), 150); + Player.AddBuff(ModContent.BuffType(), 300); break; case 4: - Player.AddBuff(ModContent.BuffType(), 150); + Player.AddBuff(ModContent.BuffType(), 150); break; case 5: - Player.AddBuff(ModContent.BuffType(), 300); + Player.AddBuff(ModContent.BuffType(), 150); break; case 6: - Player.AddBuff(ModContent.BuffType(), 300); + Player.AddBuff(ModContent.BuffType(), 300); break; case 7: + Player.AddBuff(ModContent.BuffType(), 300); + break; + + case 8: Player.AddBuff(ModContent.BuffType(), 300); break; } @@ -5369,9 +5072,7 @@ namespace CalamityMod.CalPlayer } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) { - int deathModeDuration = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; - Player.AddBuff(BuffID.Electrified, proj.Calamity().lineColor == 1 ? deathModeDuration : 120); - // Scaled duration for DM lightning, 2 seconds for Storm Weaver/Cultist lightning + Player.AddBuff(BuffID.Electrified, 120); } else if (proj.type == ProjectileID.AncientDoomProjectile) { @@ -5452,16 +5153,13 @@ namespace CalamityMod.CalPlayer } } #endregion - + #region Shoot public override bool Shoot(Item item, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) { if (bladeArmEnchant) return false; - if (rottenDogTooth && item.CountsAsClass()) - damage = (int)(damage * (1f + RottenDogtooth.StealthStrikeDamageMultiplier)); - if (veneratedLocket) { if (item.CountsAsClass()) @@ -5605,6 +5303,9 @@ namespace CalamityMod.CalPlayer Player.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); Player.face = -1; } + else if (AresExoskeleton.ArmExists(Player)) + Player.body = EquipLoader.GetEquipSlot(Mod, "AresExoskeleton", EquipType.Body); + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) { Player.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs); @@ -5655,21 +5356,6 @@ namespace CalamityMod.CalPlayer Player.fallStart = (int)(Player.position.Y / 16f); } } - if (abyssDivingGear && (Player.head == -1 || Player.head == ArmorIDs.Head.FamiliarWig)) - { - Player.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingGear", EquipType.Head); - Player.face = -1; - } - if (featherCrownDraw && (Player.head == -1 || Player.head == ArmorIDs.Head.FamiliarWig)) - { - Player.head = EquipLoader.GetEquipSlot(Mod, "FeatherCrown", EquipType.Head); - Player.face = -1; - } - if (moonCrownDraw && (Player.head == -1 || Player.head == ArmorIDs.Head.FamiliarWig)) - { - Player.head = EquipLoader.GetEquipSlot(Mod, "MoonstoneCrown", EquipType.Head); - Player.face = -1; - } if (Player.body == EquipLoader.GetEquipSlot(Mod, "AuricTeslaBodyArmor", EquipType.Body)) { Player.back = (sbyte)EquipLoader.GetEquipSlot(Mod, "AuricTeslaBodyArmor", EquipType.Back); @@ -5693,12 +5379,6 @@ namespace CalamityMod.CalPlayer Player.waist = (sbyte)EquipLoader.GetEquipSlot(Mod, "DaedalusBreastplate", EquipType.Waist); } - if (Player.body == EquipLoader.GetEquipSlot(Mod, "DemonshadeBreastplate", EquipType.Body)) - { - //Use an extra front layers to have the players arms draw above the shoulderpads that droop - Player.front = (sbyte)EquipLoader.GetEquipSlot(Mod, "DemonshadeBreastplate", EquipType.Front); - } - bool victideBreastplateVisible = Player.body == EquipLoader.GetEquipSlot(Mod, "VictideBreastplate", EquipType.Body); //Give the player faulds if either the body armor or the leggings are equipped if (victideBreastplateVisible || Player.legs == EquipLoader.GetEquipSlot(Mod, "VictideGreaves", EquipType.Legs)) @@ -5728,7 +5408,7 @@ namespace CalamityMod.CalPlayer if (godSlayerDashHotKeyPressed) { // Set the player to have no registered vanilla dashes. - Player.dash = 0; + Player.dashType = 0; // Prevent the possibility of Shield of Cthulhu invulnerability exploits. Player.eocHit = -1; @@ -5763,10 +5443,11 @@ namespace CalamityMod.CalPlayer ProfanedMoonlightAuroraDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); int sourceArea = (int)Math.Ceiling(6f / ProfanedMoonlightAuroraDrawer.Scale) + 1; - ProfanedMoonlightAuroraDrawer.ShouldUpdate = true; + ProfanedMoonlightAuroraDrawer.ShouldUpdate = Player.miscCounter % 4 == 0; ProfanedMoonlightAuroraDrawer.UpdateAction = () => { - int auroraCount = totalMoonlightDyes / 2 + 4; + // Aurora Count does not scale to save on resources if you have a lot of dyes + int auroraCount = 5; for (int i = 0; i < auroraCount; i++) { float auroraPower = MathHelper.Clamp(totalMoonlightDyes / 3f, 0f, 1f); @@ -5797,7 +5478,7 @@ namespace CalamityMod.CalPlayer private void DisableDashes() { // Set the player to have no registered dashes. - Player.dash = 0; + Player.dashType = 0; DashID = string.Empty; // Put the player in a permanent state of dash cooldown. This is removed 1/5 of a second after disabling the effect. @@ -5833,7 +5514,7 @@ namespace CalamityMod.CalPlayer #endregion #region Pre Hurt - public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) + public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource, ref int cooldownCounter) { #region Ignore Incoming Hits // If any dodges are active which could dodge this hit, the hurting event is canceled (and the dodge is used). @@ -5853,10 +5534,17 @@ namespace CalamityMod.CalPlayer // The amount of damage that will be dealt is yet to be determined. // + //Todo - At some point it'd be nice to have a "TransformationPlayer" that has all the transformation sfx and visuals so their priorities can be more easily managed. #region Custom Hurt Sounds if (hurtSoundTimer == 0) { - if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) + if (Player.GetModPlayer().ProtectionMatrixDurability > 0) + { + playSound = false; + SoundEngine.PlaySound(RoverDrive.ShieldHurtSound, Player.position); + hurtSoundTimer = 20; + } + else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) { playSound = false; SoundEngine.PlaySound(Providence.DeathSound, Player.position); @@ -5880,6 +5568,18 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(NPCs.Astral.Atlas.HurtSound, Player.position); hurtSoundTimer = 10; } + else if (Player.GetModPlayer().transformationActive) + { + playSound = false; + SoundEngine.PlaySound(SoundID.NPCHit4, Player.position); + hurtSoundTimer = 10; + } + else if (Player.GetModPlayer().wulfrumSet && (Player.name.ToLower() == "wagstaff" || Player.name.ToLower() == "john wulfrum")) + { + playSound = false; + SoundEngine.PlaySound(SoundID.DSTMaleHurt, Player.position); + hurtSoundTimer = 10; + } } #endregion @@ -5903,6 +5603,7 @@ namespace CalamityMod.CalPlayer if (bloodPact && Main.rand.NextBool(4)) { Player.AddBuff(ModContent.BuffType(), 600); + SoundEngine.PlaySound(BloodCritSound, Player.Center); damageMult += 1.25; } @@ -5946,7 +5647,8 @@ namespace CalamityMod.CalPlayer #endregion #region Hurt - public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + + public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter) { modStealth = 1f; @@ -6002,7 +5704,13 @@ namespace CalamityMod.CalPlayer // Being hit for zero from Paladin's Shield damage share does not cancel Adrenaline. // Adrenaline is not lost when hit if using Draedon's Heart. if (!draedonsHeart && !adrenalineModeActive && damage > 0) + { + if (adrenaline >= adrenalineMax) + { + SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); + } adrenaline = 0f; + } // If using Draedon's Heart and not actively healing with Nanomachines, pause generation briefly. if (draedonsHeart && !adrenalineModeActive) @@ -6014,7 +5722,7 @@ namespace CalamityMod.CalPlayer hellbornBoost = 0; - if (amidiasBlessing) + if (amidiasBlessing && damage > 50) { Player.ClearBuff(ModContent.BuffType()); SoundEngine.PlaySound(SoundID.Item96, Player.position); @@ -6207,7 +5915,8 @@ namespace CalamityMod.CalPlayer #endregion #region Post Hurt - public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + + public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter) { if (pArtifact && !profanedCrystal) Player.AddCooldown(Cooldowns.ProfanedSoulArtifact.ID, CalamityUtils.SecondsToFrames(5)); @@ -6278,30 +5987,11 @@ namespace CalamityMod.CalPlayer iFramesToAdd += 10; } - // TODO -- good god what the fuck is this system - // Projectiles should be providing an index to a temporary variable in Player.OnHitByProjectile, not hardcoding it in their own OnHitPlayer - // - // To my best understanding the point of this system is to avoid giving the player type-0 iframes if they are hit by a type-1 projectile. - // Why did vanilla Moon Lord have to hate Slime Mount cheese so much to create a second type of iframes? - // WHY DID THEY NOT JUST FIX SLIME MOUNT?! - if (lastProjectileHit != null) - { - switch (lastProjectileHit.ModProjectile.CooldownSlot) - { - case 0: - case 1: - Player.hurtCooldowns[lastProjectileHit.ModProjectile.CooldownSlot] += iFramesToAdd; - break; - case -1: - default: - Player.GiveIFrames(Player.immuneTime + iFramesToAdd, true); - break; - } - } - - // In the case that no projectile that hit the player was defined, just give them iframes normally + // Give bonus immunity frames based on the type of damage dealt + if (cooldownCounter != -1) + Player.hurtCooldowns[cooldownCounter] += iFramesToAdd; else - Player.GiveIFrames(Player.immuneTime + iFramesToAdd, true); + Player.immuneTime += iFramesToAdd; if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushIFrameCurse) bossRushImmunityFrameCurseTimer = 180 + Player.immuneTime; @@ -6410,7 +6100,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(Cooldowns.InkBomb.ID)) { - Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20)); + Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(25)); rogueStealth += 0.5f; for (int i = 0; i < 3; i++) { @@ -6569,7 +6259,7 @@ namespace CalamityMod.CalPlayer if (Main.myPlayer == Player.whoAmI) { Player.trashItem.SetDefaults(0, false); - if (Player.difficulty == 0) + if (Player.difficulty == PlayerDifficultyID.SoftCore || Player.difficulty == PlayerDifficultyID.Creative) { for (int i = 0; i < 59; i++) { @@ -6592,11 +6282,11 @@ namespace CalamityMod.CalPlayer } } } - else if (Player.difficulty == 1) + else if (Player.difficulty == PlayerDifficultyID.MediumCore) { Player.DropItems(); } - else if (Player.difficulty == 2) + else if (Player.difficulty == PlayerDifficultyID.Hardcore) { Player.DropItems(); Player.KillMeForGood(); @@ -6634,6 +6324,8 @@ namespace CalamityMod.CalPlayer PlayerDeathReason damageSource = PlayerDeathReason.ByOther(Player.Male ? 14 : 15); if (abyssDeath) { + SoundEngine.PlaySound(DrownSound, Player.position); + if (Main.rand.NextBool(2)) { damageSource = PlayerDeathReason.ByCustomReason(Player.name + " is food for the Wyrms."); @@ -6665,7 +6357,7 @@ namespace CalamityMod.CalPlayer Main.NewText(deathText.ToString(), 225, 25, 25); } - if (Player.whoAmI == Main.myPlayer && Player.difficulty == 0) + if (Player.whoAmI == Main.myPlayer && (Player.difficulty == PlayerDifficultyID.SoftCore || Player.difficulty == PlayerDifficultyID.Creative)) { Player.DropCoins(); } @@ -6755,13 +6447,14 @@ namespace CalamityMod.CalPlayer // these other parameters are rebuilt every frame based on the items you have equipped stealthDamage = 0f; + bonusStealthDamage = 0; rogueStealthMax = 0f; stealthGenStandstill = 1f; stealthGenMoving = 1f; stealthStrikeThisFrame = false; stealthStrikeHalfCost = false; stealthStrike75Cost = false; - stealthStrikeAlwaysCrits = false; + stealthStrike85Cost = false; // stealthAcceleration only resets if you don't have either of the accelerator accessories equipped if (!darkGodSheath && !eclipseMirror) @@ -6790,9 +6483,9 @@ namespace CalamityMod.CalPlayer playRogueStealthSound = true; // Calculate stealth generation and gain stealth accordingly - // 1f is normal speed, anything higher is faster. Default stealth generation is 3 seconds while standing still. + // 1f is normal speed, anything higher is faster. Default stealth generation is 2 seconds while standing still. float currentStealthGen = UpdateStealthGenStats(); - rogueStealth += rogueStealthMax * (currentStealthGen / 180f); // 180 frames = 3 seconds + rogueStealth += rogueStealthMax * (currentStealthGen / 120f); // 120 frames = 2 seconds if (rogueStealth > rogueStealthMax) rogueStealth = rogueStealthMax; @@ -6823,7 +6516,7 @@ namespace CalamityMod.CalPlayer // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime ? Player.itemAnimation == Player.itemAnimationMax - 1 // Standard weapon (first frame of use animation) - : Player.itemTime == it.useTime; // Clockwork weapon (first frame of any individual use event) + : Player.itemTime == (int)(it.useTime / Player.GetAttackSpeed()); // Clockwork weapon (first frame of any individual use event) if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon) { @@ -6872,11 +6565,6 @@ namespace CalamityMod.CalPlayer double stealthAddedDamage = rogueStealth * BalancingConstants.UniversalStealthStrikeDamageFactor * useTimeFactor * stealthGenFactor; stealthDamage += (float)stealthAddedDamage; - // Show 100% crit chance if your stealth strikes always crit. - // In practice, this is only for visuals because Terraria determines crit status on hit. - if (stealthStrikeAlwaysCrits && StealthStrikeAvailable()) - Player.GetCritChance() = 100f; - // Stealth slightly decreases aggro. Player.aggro -= (int)(rogueStealth * 300f); } @@ -6893,32 +6581,22 @@ namespace CalamityMod.CalPlayer if (Player.itemAnimation > 0 || finalDawnProjCount > 0) return 0f; - // Penumbra Potion provides various boosts to rogue stealth generation if (penumbra) { - if (Main.eclipse || umbraphileSet) - { - stealthGenStandstill += 0.2f; - stealthGenMoving += 0.2f; - } - else if (!Main.dayTime) - { - stealthGenStandstill += 0.15f; - stealthGenMoving += 0.15f; - } - else // daytime - stealthGenMoving += 0.15f; + stealthGenStandstill += 0.15f; + stealthGenMoving += 0.1f; } - if (CalamityLists.daggerList.Contains(Player.ActiveItem().type) && Player.invis) + if (shadow) { stealthGenStandstill += 0.08f; stealthGenMoving += 0.08f; } - if (shadow) + + if (eArtifact) { - stealthGenStandstill += 0.1f; - stealthGenMoving += 0.1f; + stealthGenStandstill += 0.1f; + stealthGenMoving += 0.1f; } //Accessory modifiers can boost these stats @@ -6971,6 +6649,8 @@ namespace CalamityMod.CalPlayer consumptionMult = 0.5f; else if (stealthStrike75Cost) consumptionMult = 0.75f; + else if (stealthStrike85Cost) + consumptionMult = 0.85f; return rogueStealth >= rogueStealthMax * consumptionMult; } @@ -6997,941 +6677,17 @@ namespace CalamityMod.CalPlayer if (rogueStealth <= 0f) rogueStealth = 0f; } + else if (stealthStrike85Cost) + { + rogueStealth -= 0.9f * stealthToLose; + if (rogueStealth <= 0f) + rogueStealth = 0f; + } else rogueStealth = remainingStealth; } #endregion - #region Proficiency Stuff - private bool ReduceCooldown(int classType) - { - switch (classType) - { - case (int)ClassType.Melee: - - if (meleeLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) - return true; - if (meleeLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) - return true; - if (meleeLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) - return true; - - break; - - case (int)ClassType.Ranged: - - if (rangedLevel < levelTier3 && (meleeLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) - return true; - if (rangedLevel < levelTier2 && (meleeLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) - return true; - if (rangedLevel < levelTier1 && (meleeLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) - return true; - - break; - - case (int)ClassType.Magic: - - if (magicLevel < levelTier3 && (rangedLevel >= levelTier3 || meleeLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) - return true; - if (magicLevel < levelTier2 && (rangedLevel >= levelTier2 || meleeLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) - return true; - if (magicLevel < levelTier1 && (rangedLevel >= levelTier1 || meleeLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) - return true; - - break; - - case (int)ClassType.Summon: - - if (summonLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || meleeLevel >= levelTier3 || rogueLevel >= levelTier3)) - return true; - if (summonLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || meleeLevel >= levelTier2 || rogueLevel >= levelTier2)) - return true; - if (summonLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || meleeLevel >= levelTier1 || rogueLevel >= levelTier1)) - return true; - - break; - - case (int)ClassType.Rogue: - - if (rogueLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || meleeLevel >= levelTier3)) - return true; - if (rogueLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || meleeLevel >= levelTier2)) - return true; - if (rogueLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || meleeLevel >= levelTier1)) - return true; - - break; - } - return false; - } - - public void GetExactLevelUp() - { - if (gainLevelCooldown > 0) - gainLevelCooldown--; - - #region MeleeLevels - switch (meleeLevel) - { - case 100: - ExactLevelUp(0, 1, false); - break; - case 300: - ExactLevelUp(0, 2, false); - break; - case 600: - ExactLevelUp(0, 3, false); - break; - case 1000: - ExactLevelUp(0, 4, false); - break; - case 1500: - ExactLevelUp(0, 5, false); - break; - case 2100: - ExactLevelUp(0, 6, false); - break; - case 2800: - ExactLevelUp(0, 7, false); - break; - case 3600: - ExactLevelUp(0, 8, false); - break; - case 4500: - ExactLevelUp(0, 9, false); - break; - case 5500: - ExactLevelUp(0, 10, false); - break; - case 6600: - ExactLevelUp(0, 11, false); - break; - case 7800: - ExactLevelUp(0, 12, false); - break; - case 9100: - ExactLevelUp(0, 13, false); - break; - case 10500: - ExactLevelUp(0, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - ExactLevelUp(0, 15, true); - break; - default: - break; - } - #endregion - - #region RangedLevels - switch (rangedLevel) - { - case 100: - ExactLevelUp(1, 1, false); - break; - case 300: - ExactLevelUp(1, 2, false); - break; - case 600: - ExactLevelUp(1, 3, false); - break; - case 1000: - ExactLevelUp(1, 4, false); - break; - case 1500: - ExactLevelUp(1, 5, false); - break; - case 2100: - ExactLevelUp(1, 6, false); - break; - case 2800: - ExactLevelUp(1, 7, false); - break; - case 3600: - ExactLevelUp(1, 8, false); - break; - case 4500: - ExactLevelUp(1, 9, false); - break; - case 5500: - ExactLevelUp(1, 10, false); - break; - case 6600: - ExactLevelUp(1, 11, false); - break; - case 7800: - ExactLevelUp(1, 12, false); - break; - case 9100: - ExactLevelUp(1, 13, false); - break; - case 10500: - ExactLevelUp(1, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - ExactLevelUp(1, 15, true); - break; - default: - break; - } - #endregion - - #region MagicLevels - switch (magicLevel) - { - case 100: - ExactLevelUp(2, 1, false); - break; - case 300: - ExactLevelUp(2, 2, false); - break; - case 600: - ExactLevelUp(2, 3, false); - break; - case 1000: - ExactLevelUp(2, 4, false); - break; - case 1500: - ExactLevelUp(2, 5, false); - break; - case 2100: - ExactLevelUp(2, 6, false); - break; - case 2800: - ExactLevelUp(2, 7, false); - break; - case 3600: - ExactLevelUp(2, 8, false); - break; - case 4500: - ExactLevelUp(2, 9, false); - break; - case 5500: - ExactLevelUp(2, 10, false); - break; - case 6600: - ExactLevelUp(2, 11, false); - break; - case 7800: - ExactLevelUp(2, 12, false); - break; - case 9100: - ExactLevelUp(2, 13, false); - break; - case 10500: - ExactLevelUp(2, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - ExactLevelUp(2, 15, true); - break; - default: - break; - } - #endregion - - #region SummonLevels - switch (summonLevel) - { - case 100: - ExactLevelUp(3, 1, false); - break; - case 300: - ExactLevelUp(3, 2, false); - break; - case 600: - ExactLevelUp(3, 3, false); - break; - case 1000: - ExactLevelUp(3, 4, false); - break; - case 1500: - ExactLevelUp(3, 5, false); - break; - case 2100: - ExactLevelUp(3, 6, false); - break; - case 2800: - ExactLevelUp(3, 7, false); - break; - case 3600: - ExactLevelUp(3, 8, false); - break; - case 4500: - ExactLevelUp(3, 9, false); - break; - case 5500: - ExactLevelUp(3, 10, false); - break; - case 6600: - ExactLevelUp(3, 11, false); - break; - case 7800: - ExactLevelUp(3, 12, false); - break; - case 9100: - ExactLevelUp(3, 13, false); - break; - case 10500: - ExactLevelUp(3, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - ExactLevelUp(3, 15, true); - break; - default: - break; - } - #endregion - - #region RogueLevels - switch (rogueLevel) - { - case 100: - ExactLevelUp(4, 1, false); - break; - case 300: - ExactLevelUp(4, 2, false); - break; - case 600: - ExactLevelUp(4, 3, false); - break; - case 1000: - ExactLevelUp(4, 4, false); - break; - case 1500: - ExactLevelUp(4, 5, false); - break; - case 2100: - ExactLevelUp(4, 6, false); - break; - case 2800: - ExactLevelUp(4, 7, false); - break; - case 3600: - ExactLevelUp(4, 8, false); - break; - case 4500: - ExactLevelUp(4, 9, false); - break; - case 5500: - ExactLevelUp(4, 10, false); - break; - case 6600: - ExactLevelUp(4, 11, false); - break; - case 7800: - ExactLevelUp(4, 12, false); - break; - case 9100: - ExactLevelUp(4, 13, false); - break; - case 10500: - ExactLevelUp(4, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - ExactLevelUp(4, 15, true); - break; - default: - break; - } - #endregion - } - - private void ExactLevelUp(int levelUpType, int level, bool final) - { - var source = new ProjectileSource_LevelUp(Player); - Color messageColor = Color.Orange; - switch (levelUpType) - { - case 0: - exactMeleeLevel = level; - if (shootFireworksLevelUpMelee) - { - string key = final ? "Mods.CalamityMod.MeleeLevelUpFinal" : "Mods.CalamityMod.MeleeLevelUp"; - shootFireworksLevelUpMelee = false; - if (Player.whoAmI == Main.myPlayer) - { - if (final) - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - else - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 1: - exactRangedLevel = level; - if (shootFireworksLevelUpRanged) - { - string key = final ? "Mods.CalamityMod.RangedLevelUpFinal" : "Mods.CalamityMod.RangedLevelUp"; - messageColor = Color.GreenYellow; - shootFireworksLevelUpRanged = false; - if (Player.whoAmI == Main.myPlayer) - { - if (final) - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - else - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 2: - exactMagicLevel = level; - if (shootFireworksLevelUpMagic) - { - string key = final ? "Mods.CalamityMod.MagicLevelUpFinal" : "Mods.CalamityMod.MagicLevelUp"; - messageColor = Color.DodgerBlue; - shootFireworksLevelUpMagic = false; - if (Player.whoAmI == Main.myPlayer) - { - if (final) - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - else - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 3: - exactSummonLevel = level; - if (shootFireworksLevelUpSummon) - { - string key = final ? "Mods.CalamityMod.SummonLevelUpFinal" : "Mods.CalamityMod.SummonLevelUp"; - messageColor = Color.Aquamarine; - shootFireworksLevelUpSummon = false; - if (Player.whoAmI == Main.myPlayer) - { - if (final) - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - else - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 4: - exactRogueLevel = level; - if (shootFireworksLevelUpRogue) - { - string key = final ? "Mods.CalamityMod.RogueLevelUpFinal" : "Mods.CalamityMod.RogueLevelUp"; - messageColor = Color.Orchid; - shootFireworksLevelUpRogue = false; - if (Player.whoAmI == Main.myPlayer) - { - if (final) - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - else - { - int prof = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - // Main.projectile[prof].ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - SyncExactLevel(false, levelUpType); - } - } - - public void GetStatBonuses() - { - #region MeleeLevelBoosts - if (meleeLevel >= 12500) - { - Player.GetDamage() += 0.06f; - Player.GetCritChance() += 3; - } - else if (meleeLevel >= 10500) - { - Player.GetDamage() += 0.06f; - Player.GetCritChance() += 3; - } - else if (meleeLevel >= 9100) - { - Player.GetDamage() += 0.06f; - Player.GetCritChance() += 3; - } - else if (meleeLevel >= 7800) - { - Player.GetDamage() += 0.05f; - Player.GetCritChance() += 3; - } - else if (meleeLevel >= 6600) - { - Player.GetDamage() += 0.05f; - Player.GetCritChance() += 3; - } - else if (meleeLevel >= 5500) //hm limit - { - Player.GetDamage() += 0.05f; - Player.GetCritChance() += 2; - } - else if (meleeLevel >= 4500) - { - Player.GetDamage() += 0.05f; - Player.GetCritChance() += 2; - } - else if (meleeLevel >= 3600) - { - Player.GetDamage() += 0.04f; - Player.GetCritChance() += 2; - } - else if (meleeLevel >= 2800) - { - Player.GetDamage() += 0.04f; - Player.GetCritChance() += 1; - } - else if (meleeLevel >= 2100) - { - Player.GetDamage() += 0.04f; - Player.GetCritChance() += 1; - } - else if (meleeLevel >= 1500) //prehm limit - { - Player.GetDamage() += 0.03f; - Player.GetCritChance() += 1; - } - else if (meleeLevel >= 1000) - { - Player.GetDamage() += 0.02f; - Player.GetCritChance() += 1; - } - else if (meleeLevel >= 600) - { - Player.GetDamage() += 0.02f; - } - else if (meleeLevel >= 300) - Player.GetDamage() += 0.02f; - else if (meleeLevel >= 100) - Player.GetDamage() += 0.01f; - #endregion - - #region RangedLevelBoosts - if (rangedLevel >= 12500) - { - Player.GetDamage() += 0.06f; - Player.moveSpeed += 0.06f; - Player.GetCritChance() += 3; - } - else if (rangedLevel >= 10500) - { - Player.GetDamage() += 0.05f; - Player.moveSpeed += 0.06f; - Player.GetCritChance() += 3; - } - else if (rangedLevel >= 9100) - { - Player.GetDamage() += 0.05f; - Player.moveSpeed += 0.05f; - Player.GetCritChance() += 3; - } - else if (rangedLevel >= 7800) - { - Player.GetDamage() += 0.04f; - Player.moveSpeed += 0.05f; - Player.GetCritChance() += 3; - } - else if (rangedLevel >= 6600) - { - Player.GetDamage() += 0.04f; - Player.moveSpeed += 0.04f; - Player.GetCritChance() += 3; - } - else if (rangedLevel >= 5500) - { - Player.GetDamage() += 0.04f; - Player.moveSpeed += 0.04f; - Player.GetCritChance() += 2; - } - else if (rangedLevel >= 4500) - { - Player.GetDamage() += 0.03f; - Player.moveSpeed += 0.04f; - Player.GetCritChance() += 2; - } - else if (rangedLevel >= 3600) - { - Player.GetDamage() += 0.03f; - Player.moveSpeed += 0.03f; - Player.GetCritChance() += 2; - } - else if (rangedLevel >= 2800) - { - Player.GetDamage() += 0.02f; - Player.moveSpeed += 0.03f; - Player.GetCritChance() += 2; - } - else if (rangedLevel >= 2100) - { - Player.GetDamage() += 0.02f; - Player.moveSpeed += 0.03f; - Player.GetCritChance() += 1; - } - else if (rangedLevel >= 1500) - { - Player.GetDamage() += 0.02f; - Player.moveSpeed += 0.02f; - Player.GetCritChance() += 1; - } - else if (rangedLevel >= 1000) - { - Player.GetDamage() += 0.02f; - Player.moveSpeed += 0.01f; - Player.GetCritChance() += 1; - } - else if (rangedLevel >= 600) - { - Player.GetDamage() += 0.02f; - Player.GetCritChance() += 1; - } - else if (rangedLevel >= 300) - Player.GetDamage() += 0.02f; - else if (rangedLevel >= 100) - Player.GetDamage() += 0.01f; - #endregion - - #region MagicLevelBoosts - if (magicLevel >= 12500) - { - Player.GetDamage() += 0.06f; - Player.manaCost *= 0.94f; - Player.GetCritChance() += 3; - } - else if (magicLevel >= 10500) - { - Player.GetDamage() += 0.05f; - Player.manaCost *= 0.94f; - Player.GetCritChance() += 3; - } - else if (magicLevel >= 9100) - { - Player.GetDamage() += 0.05f; - Player.manaCost *= 0.95f; - Player.GetCritChance() += 3; - } - else if (magicLevel >= 7800) - { - Player.GetDamage() += 0.04f; - Player.manaCost *= 0.95f; - Player.GetCritChance() += 3; - } - else if (magicLevel >= 6600) - { - Player.GetDamage() += 0.04f; - Player.manaCost *= 0.96f; - Player.GetCritChance() += 3; - } - else if (magicLevel >= 5500) - { - Player.GetDamage() += 0.04f; - Player.manaCost *= 0.96f; - Player.GetCritChance() += 2; - } - else if (magicLevel >= 4500) - { - Player.GetDamage() += 0.04f; - Player.manaCost *= 0.97f; - Player.GetCritChance() += 2; - } - else if (magicLevel >= 3600) - { - Player.GetDamage() += 0.03f; - Player.manaCost *= 0.97f; - Player.GetCritChance() += 2; - } - else if (magicLevel >= 2800) - { - Player.GetDamage() += 0.03f; - Player.manaCost *= 0.98f; - Player.GetCritChance() += 2; - } - else if (magicLevel >= 2100) - { - Player.GetDamage() += 0.03f; - Player.manaCost *= 0.98f; - Player.GetCritChance() += 1; - } - else if (magicLevel >= 1500) - { - Player.GetDamage() += 0.02f; - Player.manaCost *= 0.98f; - Player.GetCritChance() += 1; - } - else if (magicLevel >= 1000) - { - Player.GetDamage() += 0.02f; - Player.manaCost *= 0.99f; - Player.GetCritChance() += 1; - } - else if (magicLevel >= 600) - { - Player.GetDamage() += 0.02f; - Player.manaCost *= 0.99f; - } - else if (magicLevel >= 300) - Player.GetDamage() += 0.02f; - else if (magicLevel >= 100) - Player.GetDamage() += 0.01f; - #endregion - - #region SummonLevelBoosts - if (summonLevel >= 12500) - { - Player.GetDamage() += 0.12f; - Player.GetKnockback(DamageClass.Summon) += 3.0f; - } - else if (summonLevel >= 10500) - { - Player.GetDamage() += 0.1f; - Player.GetKnockback(DamageClass.Summon) += 3.0f; - } - else if (summonLevel >= 9100) - { - Player.GetDamage() += 0.09f; - Player.GetKnockback(DamageClass.Summon) += 2.7f; - } - else if (summonLevel >= 7800) - { - Player.GetDamage() += 0.08f; - Player.GetKnockback(DamageClass.Summon) += 2.4f; - } - else if (summonLevel >= 6600) - { - Player.GetDamage() += 0.07f; - Player.GetKnockback(DamageClass.Summon) += 2.1f; - } - else if (summonLevel >= 5500) - { - Player.GetDamage() += 0.07f; - Player.GetKnockback(DamageClass.Summon) += 1.8f; - } - else if (summonLevel >= 4500) - { - Player.GetDamage() += 0.06f; - Player.GetKnockback(DamageClass.Summon) += 1.8f; - } - else if (summonLevel >= 3600) - { - Player.GetDamage() += 0.05f; - Player.GetKnockback(DamageClass.Summon) += 1.5f; - } - else if (summonLevel >= 2800) - { - Player.GetDamage() += 0.04f; - Player.GetKnockback(DamageClass.Summon) += 1.2f; - } - else if (summonLevel >= 2100) - { - Player.GetDamage() += 0.04f; - Player.GetKnockback(DamageClass.Summon) += 0.9f; - } - else if (summonLevel >= 1500) - { - Player.GetDamage() += 0.03f; - Player.GetKnockback(DamageClass.Summon) += 0.6f; - } - else if (summonLevel >= 1000) - { - Player.GetDamage() += 0.03f; - Player.GetKnockback(DamageClass.Summon) += 0.3f; - } - else if (summonLevel >= 600) - { - Player.GetDamage() += 0.02f; - Player.GetKnockback(DamageClass.Summon) += 0.3f; - } - else if (summonLevel >= 300) - Player.GetDamage() += 0.02f; - else if (summonLevel >= 100) - Player.GetDamage() += 0.01f; - #endregion - - #region RogueLevelBoosts - ref StatModifier throwingDamage = ref Player.GetDamage(); - ref float throwingCrit = ref Player.GetCritChance(); - if (rogueLevel >= 12500) - { - throwingDamage += 0.06f; - rogueVelocity += 0.06f; - throwingCrit += 3; - } - else if (rogueLevel >= 10500) - { - throwingDamage += 0.05f; - rogueVelocity += 0.06f; - throwingCrit += 3; - } - else if (rogueLevel >= 9100) - { - throwingDamage += 0.05f; - rogueVelocity += 0.05f; - throwingCrit += 3; - } - else if (rogueLevel >= 7800) - { - throwingDamage += 0.04f; - rogueVelocity += 0.05f; - throwingCrit += 3; - } - else if (rogueLevel >= 6600) - { - throwingDamage += 0.04f; - rogueVelocity += 0.04f; - throwingCrit += 3; - } - else if (rogueLevel >= 5500) - { - throwingDamage += 0.04f; - rogueVelocity += 0.04f; - throwingCrit += 2; - } - else if (rogueLevel >= 4500) - { - throwingDamage += 0.03f; - rogueVelocity += 0.04f; - throwingCrit += 2; - } - else if (rogueLevel >= 3600) - { - throwingDamage += 0.03f; - rogueVelocity += 0.03f; - throwingCrit += 2; - } - else if (rogueLevel >= 2800) - { - throwingDamage += 0.03f; - rogueVelocity += 0.03f; - throwingCrit += 1; - } - else if (rogueLevel >= 2100) - { - throwingDamage += 0.02f; - rogueVelocity += 0.03f; - throwingCrit += 1; - } - else if (rogueLevel >= 1500) - { - throwingDamage += 0.02f; - rogueVelocity += 0.02f; - throwingCrit += 1; - } - else if (rogueLevel >= 1000) - { - throwingDamage += 0.02f; - rogueVelocity += 0.01f; - throwingCrit += 1; - } - else if (rogueLevel >= 600) - { - throwingDamage += 0.02f; - rogueVelocity += 0.01f; - } - else if (rogueLevel >= 300) - throwingDamage += 0.02f; - else if (rogueLevel >= 100) - throwingDamage += 0.01f; - #endregion - } - - private float GetMeleeSpeedBonus() - { - float meleeSpeedBonus = 0f; - if (meleeLevel >= 12500) - { - meleeSpeedBonus += 0.06f; - } - else if (meleeLevel >= 10500) - { - meleeSpeedBonus += 0.05f; - } - else if (meleeLevel >= 9100) - { - meleeSpeedBonus += 0.04f; - } - else if (meleeLevel >= 7800) - { - meleeSpeedBonus += 0.04f; - } - else if (meleeLevel >= 6600) - { - meleeSpeedBonus += 0.03f; - } - else if (meleeLevel >= 5500) //hm limit - { - meleeSpeedBonus += 0.03f; - } - else if (meleeLevel >= 4500) - { - meleeSpeedBonus += 0.02f; - } - else if (meleeLevel >= 3600) - { - meleeSpeedBonus += 0.02f; - } - else if (meleeLevel >= 2800) - { - meleeSpeedBonus += 0.02f; - } - else if (meleeLevel >= 2100) - { - meleeSpeedBonus += 0.01f; - } - else if (meleeLevel >= 1500) //prehm limit - { - meleeSpeedBonus += 0.01f; - } - else if (meleeLevel >= 1000) - { - meleeSpeedBonus += 0.01f; - } - else if (meleeLevel >= 600) - { - meleeSpeedBonus += 0.01f; - } - return meleeSpeedBonus; - } - #endregion - #region Profaned Soul Crystal Stuffs internal void rollBabSpears(int randAmt, bool chaseable) @@ -8041,6 +6797,9 @@ namespace CalamityMod.CalPlayer // But it won't start running until you save and quit and re-enter a world. if (CalamityConfig.Instance.SpeedrunTimer) CalamityMod.SpeedrunTimer.Restart(); + + if (CalamityConfig.Instance.WikiStatusMessage) + Main.NewText($"[i:{ItemID.Book}]" + " [c/EE4939:Be sure to check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] " + $"[i:{ItemID.Book}]"); } /// @@ -8090,6 +6849,9 @@ namespace CalamityMod.CalPlayer #region Defense Damage Function private void DealDefenseDamage(int damage) { + if (damage <= 0) + return; + double ratioToUse = DefenseDamageRatio; if (draedonsHeart) ratioToUse *= 0.5; @@ -8166,5 +6928,16 @@ namespace CalamityMod.CalPlayer CombatText.NewText(location, messageColor, Language.GetTextValue(text)); } #endregion + + #region Kill + public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) + { + if (Player.whoAmI == Main.myPlayer && Player.ActiveItem().type == ModContent.ItemType()) + { + if (Main.rand.NextBool(20)) + SoundEngine.PlaySound(IjiDeathSound, Player.Center); + } + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 79baf2e786..7339d5b708 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -6,14 +6,21 @@ using CalamityMod.Items.Mounts; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer { public partial class CalamityPlayer : ModPlayer { + public int VerticalGodslayerDashTimer; + public string DashID; + public string DeferredDashID; + + public string LastUsedDashID; + public PlayerDashEffect UsedDash { get @@ -55,6 +62,11 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC n = Main.npc[i]; + + // Ignore critters with the Guide to Critter Companionship + if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) + continue; + if (n.active && !n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { if (hitArea.Intersects(n.getRect()) && (n.noTileCollide || Player.CanHit(n))) @@ -77,17 +89,39 @@ namespace CalamityMod.CalPlayer } if (Player.dashDelay > 0) + { + VerticalGodslayerDashTimer = 0; + LastUsedDashID = string.Empty; return; + } if (Player.dashDelay < 0) { + int dashDelayToApply = BalancingConstants.UniversalDashCooldown; + if (UsedDash.CollisionType == DashCollisionType.ShieldSlam) + dashDelayToApply = BalancingConstants.UniversalShieldSlamCooldown; + else if (UsedDash.CollisionType == DashCollisionType.ShieldBonk) + dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; + float dashSpeed = 12f; float dashSpeedDecelerationFactor = 0.985f; float runSpeed = Math.Max(Player.accRunSpeed, Player.maxRunSpeed); float runSpeedDecelerationFactor = 0.94f; + LastUsedDashID = DashID; + // Handle mid-dash effects. UsedDash.MidDashEffects(Player, ref dashSpeed, ref dashSpeedDecelerationFactor, ref runSpeedDecelerationFactor); + if (UsedDash.IsOmnidirectional && VerticalGodslayerDashTimer < 25) + { + VerticalGodslayerDashTimer++; + if (VerticalGodslayerDashTimer >= 25) + { + Player.dashDelay = dashDelayToApply; + // Stop the player from going flying + Player.velocity *= 0.2f; + } + } if (HasCustomDash) { @@ -126,11 +160,6 @@ namespace CalamityMod.CalPlayer } // Dash delay depends on the type of dash used. - int dashDelayToApply = BalancingConstants.UniversalDashCooldown; - if (UsedDash.CollisionType == DashCollisionType.ShieldSlam) - dashDelayToApply = BalancingConstants.UniversalShieldSlamCooldown; - else if (UsedDash.CollisionType == DashCollisionType.ShieldBonk) - dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; Player.dashDelay = dashDelayToApply; if (UsedDash.IsOmnidirectional) @@ -441,6 +470,11 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC n = Main.npc[i]; + + // Ignore critters with the Guide to Critter Companionship + if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) + continue; + if (n.active && !n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0) { Rectangle npcHitbox = n.getRect(); diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 5c853f4469..01a9230036 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -11,6 +11,8 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Armor.Wulfrum; namespace CalamityMod.CalPlayer { @@ -37,6 +39,11 @@ namespace CalamityMod.CalPlayer layer.Hide(); } } + + if (Player.HeldItem.ModItem is IHideFrontArm amputator && amputator.ShouldHideArm(Player)) + { + PlayerDrawLayers.ArmOverItem.Hide(); + } } public override void DrawEffects(PlayerDrawSet drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) @@ -109,12 +116,13 @@ namespace CalamityMod.CalPlayer Player.armorEffectDrawShadowSubtle = false; } - Asset heart3 = ModContent.Request("CalamityMod/ExtraTextures/Heart3"); - Asset heart4 = ModContent.Request("CalamityMod/ExtraTextures/Heart4"); - Asset heart5 = ModContent.Request("CalamityMod/ExtraTextures/Heart5"); - Asset heart6 = ModContent.Request("CalamityMod/ExtraTextures/Heart6"); - Asset heartOriginal = ModContent.Request("CalamityMod/ExtraTextures/HeartOriginal"); // Life fruit - Asset heartOriginal2 = ModContent.Request("CalamityMod/ExtraTextures/HeartOriginal2"); // Life crystal + // Hearts + Asset bOrange = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/HeartBloodOrange"); + Asset mFruit = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/HeartMiracleFruit"); + Asset eBerry = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/HeartElderberry"); + Asset dFruit = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/HeartDragonfruit"); + Asset heartOriginal = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/HeartOriginal"); // Life crystal + Asset heartOriginal2 = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/HeartOriginal2"); // Life fruit int totalFruit = (calamityPlayer.mFruit ? 1 : 0) + @@ -124,13 +132,14 @@ namespace CalamityMod.CalPlayer TextureAssets.Heart2 = totalFruit switch { - 4 => heart6, - 3 => heart5, - 2 => heart4, - 1 => heart3, - _ => heartOriginal, + 4 => dFruit, + 3 => eBerry, + 2 => mFruit, + 1 => bOrange, + _ => heartOriginal2, }; - TextureAssets.Heart = heartOriginal2; + TextureAssets.Heart = heartOriginal; + if (calamityPlayer.tRegen) { if (Main.rand.NextBool(10) && drawInfo.shadow == 0f) @@ -535,6 +544,12 @@ namespace CalamityMod.CalPlayer drawInfo.GoreCache.Add(heart); } } + if (calamityPlayer.shadow && CalamityConfig.Instance.StealthInvisibility) + { + r *= 0f; + g *= 0f; + b *= 0f; + } } #endregion diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index fa57ce0253..933c052ff4 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -9,6 +9,8 @@ using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.World; @@ -16,9 +18,10 @@ using Microsoft.Xna.Framework; using System.Collections.Generic; using System.Linq; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.CalPlayer { @@ -35,6 +38,11 @@ namespace CalamityMod.CalPlayer bool lava = attempt.inLava; bool honey = attempt.inHoney; + // If vanilla catches an enemy, just cancel + if (npcSpawn > 0) + return; + + // Set up for allowing fishing in the Sulphurous Sea Point point = Player.Center.ToTileCoordinates(); bool canSulphurFish = false; if (Abyss.AtLeftSideOfWorld) @@ -47,7 +55,6 @@ namespace CalamityMod.CalPlayer if (point.X > Main.maxTilesX - 380) canSulphurFish = true; } - if (ZoneAbyss || ZoneSulphur) canSulphurFish = true; @@ -57,33 +64,42 @@ namespace CalamityMod.CalPlayer CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); } - // Quest Fish - if (ZoneSunkenSea && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) + // Don't do anything if you can't fish in lava + if (!attempt.CanFishInLava && lava) + return; + + // If you caught junk, then ignore all Calamity catches + if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan) + return; + + // Handle our modded Quest Fish, You can catch these in any liquid... because I don't care if you can + if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) { itemDrop = ModContent.ItemType(); return; } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) + if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) { itemDrop = ModContent.ItemType(); return; } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) + if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) { itemDrop = ModContent.ItemType(); return; } - if (ZoneCalamity && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) + if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) { itemDrop = ModContent.ItemType(); return; } - if (ZoneCalamity && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) + if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) { itemDrop = ModContent.ItemType(); return; } + // Handle Alluring Bait's increased chance for Potion Material fish if (alluringBait) { int chanceForPotionFish = 1000 / power; @@ -127,7 +143,7 @@ namespace CalamityMod.CalPlayer fishList.AddWithCondition(ModContent.ItemType(), ZoneAstral); fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); - fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); + fishList.AddWithCondition(ModContent.ItemType(), !Main.dayTime && !Player.ZoneSkyHeight); } if (fishList.Any()) @@ -140,6 +156,7 @@ namespace CalamityMod.CalPlayer } } + // Handle the increased chance of crates from Enchanted Pearl and the Supreme Fishing Station if (enchantedPearl || fishingStation) { int chanceForCrates = (enchantedPearl ? 10 : 0) + @@ -176,6 +193,8 @@ namespace CalamityMod.CalPlayer { if (ZoneCalamity) itemDrop = ModContent.ItemType(); + else + itemDrop = Main.hardMode ? ItemID.LavaCrateHard : ItemID.LavaCrate; } } } @@ -244,7 +263,7 @@ namespace CalamityMod.CalPlayer } else if (Main.rand.NextBool(chanceForGoldCrate)) { - itemDrop = ItemID.GoldenCrate; + itemDrop = Main.hardMode ? ItemID.GoldenCrateHard : ItemID.GoldenCrate; } else if (Main.rand.NextBool(chanceForBiomeCrate)) { @@ -253,12 +272,15 @@ namespace CalamityMod.CalPlayer biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneAstral); biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); - biomeCrateList.AddWithCondition(ItemID.CorruptFishingCrate, Player.ZoneCorrupt); - biomeCrateList.AddWithCondition(ItemID.CrimsonFishingCrate, Player.ZoneCrimson); - biomeCrateList.AddWithCondition(ItemID.HallowedFishingCrate, Player.ZoneHallow); - biomeCrateList.AddWithCondition(ItemID.DungeonFishingCrate, Player.ZoneDungeon); - biomeCrateList.AddWithCondition(ItemID.JungleFishingCrate, Player.ZoneJungle); - biomeCrateList.AddWithCondition(ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CorruptFishingCrateHard : ItemID.CorruptFishingCrate, Player.ZoneCorrupt); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CrimsonFishingCrateHard : ItemID.CrimsonFishingCrate, Player.ZoneCrimson); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.HallowedFishingCrateHard : ItemID.HallowedFishingCrate, Player.ZoneHallow); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.DungeonFishingCrateHard : ItemID.DungeonFishingCrate, Player.ZoneDungeon); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.JungleFishingCrateHard : ItemID.JungleFishingCrate, Player.ZoneJungle); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FloatingIslandFishingCrateHard : ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FrozenCrateHard : ItemID.FrozenCrate, Player.ZoneSnow); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OasisCrateHard : ItemID.OasisCrate, Player.ZoneDesert && !Player.ZoneBeach); + biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OceanCrateHard : ItemID.OceanCrate, Player.ZoneBeach); if (biomeCrateList.Any()) { @@ -269,11 +291,11 @@ namespace CalamityMod.CalPlayer } else if (Main.rand.NextBool(chanceForIronCrate)) { - itemDrop = ItemID.IronCrate; + itemDrop = Main.hardMode ? ItemID.IronCrateHard : ItemID.IronCrate; } else { - itemDrop = ItemID.WoodenCrate; + itemDrop = Main.hardMode ? ItemID.WoodenCrateHard : ItemID.WoodenCrate; } return; } @@ -282,13 +304,67 @@ namespace CalamityMod.CalPlayer if (water) { - if (itemDrop == ItemID.WoodenCrate || itemDrop == ItemID.IronCrate || itemDrop == ItemID.GoldenCrate || itemDrop == ItemID.FrogLeg || itemDrop == ItemID.BalloonPufferfish || itemDrop == ItemID.ZephyrFish) + // Handle Calamity's crates, veryrare and legendary means it's a Golden Crate + if (attempt.crate) + { + if (attempt.rare && !attempt.veryrare && !attempt.legendary) + { + if (ZoneAstral) + { + itemDrop = ModContent.ItemType(); + } + if (ZoneSunkenSea) + { + itemDrop = ModContent.ItemType(); + } + if (canSulphurFish) + { + itemDrop = ModContent.ItemType(); + } + } + return; + } + + // Don't override the vanilla crates or any special vanilla fishing loot + List keepCatchList = new List() + { + ItemID.WoodenCrate, + ItemID.WoodenCrateHard, + ItemID.IronCrate, + ItemID.IronCrateHard, + ItemID.GoldenCrate, + ItemID.GoldenCrateHard, + ItemID.FrogLeg, + ItemID.BalloonPufferfish, + ItemID.ZephyrFish, + ItemID.CombatBook, + ItemID.CorruptFishingCrate, + ItemID.CorruptFishingCrateHard, + ItemID.CrimsonFishingCrate, + ItemID.CrimsonFishingCrateHard, + ItemID.HallowedFishingCrate, + ItemID.HallowedFishingCrateHard, + ItemID.DungeonFishingCrate, + ItemID.DungeonFishingCrateHard, + ItemID.JungleFishingCrate, + ItemID.JungleFishingCrateHard, + ItemID.FloatingIslandFishingCrate, + ItemID.FloatingIslandFishingCrateHard, + ItemID.FrozenCrate, + ItemID.FrozenCrateHard, + ItemID.OasisCrate, + ItemID.OasisCrateHard, + ItemID.OceanCrate, + ItemID.OceanCrateHard + }; + if (keepCatchList.Contains(itemDrop)) { return; } + if ((Player.ZoneCrimson || Player.ZoneCorrupt) && Player.ZoneRockLayerHeight && Main.hardMode) { - if (Main.rand.NextBool(25)) + if (attempt.uncommon && Main.rand.NextBool(7)) { itemDrop = ModContent.ItemType(); } @@ -296,7 +372,7 @@ namespace CalamityMod.CalPlayer if (Player.ZoneHallow && Player.ZoneRockLayerHeight && Main.hardMode) { - if (Main.rand.NextBool(25)) + if (attempt.uncommon && Main.rand.NextBool(7)) { itemDrop = ModContent.ItemType(); } @@ -304,23 +380,33 @@ namespace CalamityMod.CalPlayer if (Player.ZoneSkyHeight && Main.hardMode) { - if (Main.rand.NextBool(25)) + if (attempt.uncommon && Main.rand.NextBool(7)) { itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); } } + // Increased chance of Enchanted Starfish if you don't have maximum mana if (Player.ZoneOverworldHeight && !Main.dayTime) { - if (Main.rand.NextBool(10)) + int chance = Player.statManaMax < 200 ? 5 : 20; + if (attempt.uncommon && Main.rand.NextBool(chance)) { itemDrop = ModContent.ItemType(); } } + if (!Player.ZoneSkyHeight && !Main.dayTime) + { + if (attempt.uncommon && Main.rand.NextBool(10)) + { + itemDrop = ModContent.ItemType(); + } + } + if (Player.ZoneOverworldHeight && Main.dayTime) { - if (Main.rand.NextBool(25)) + if (attempt.uncommon && Main.rand.NextBool(7)) { itemDrop = ModContent.ItemType(); } @@ -328,64 +414,66 @@ namespace CalamityMod.CalPlayer if (Player.ZoneRockLayerHeight) { - if (Main.rand.NextBool(25)) + if (attempt.uncommon && Main.rand.NextBool(7)) { itemDrop = ModContent.ItemType(); } } - if (Player.ZoneSnow) + if (Player.ZoneSnow && Main.hardMode) { - if (Main.rand.NextBool(25) && Main.hardMode) + if (attempt.uncommon && Main.rand.NextBool(7)) { itemDrop = ModContent.ItemType(); } } + // Lower chance of Spadefish in Hardmode if (Player.ZoneDirtLayerHeight) { - if (Main.rand.NextBool(Main.hardMode ? 100 : 40)) + int chance = Main.hardMode ? 10 : 2; + if (attempt.veryrare && Main.rand.NextBool(chance)) { itemDrop = ModContent.ItemType(); } } + if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitas && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) + { + itemDrop = ModContent.ItemType(); + } + + if (Player.ZoneOverworldHeight && Main.bloodMoon) + { + if (attempt.uncommon && Main.rand.NextBool(7)) + { + itemDrop = ModContent.ItemType(); + } + } + if (ZoneAstral) // Astral Infection, fishing in water { - int astralFish = Main.rand.Next(100); - if (astralFish >= 85) // 15% + if (attempt.legendary) { - itemDrop = ModContent.ItemType(); + int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = legendaryCatch; } - else if (astralFish <= 84 && astralFish >= 70) // 15% + else if (attempt.uncommon || attempt.rare || attempt.veryrare) { - itemDrop = ModContent.ItemType(); + int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = uncommonCatch; } - else if (astralFish <= 69 && astralFish >= 55) // 15% - { - itemDrop = ModContent.ItemType(); - } - else if (Player.cratePotion && astralFish <= 18 && astralFish >= 9) // 10% - { - itemDrop = ModContent.ItemType(); - } - else if (!Player.cratePotion && astralFish <= 13 && astralFish >= 9) // 5% - { - itemDrop = ModContent.ItemType(); - } - else if (astralFish <= 8 && astralFish >= 6) // 3% - { - itemDrop = ModContent.ItemType(); - } - else if (astralFish <= 5 && astralFish >= 3) // 3% - { - itemDrop = ModContent.ItemType(); - } - else if (astralFish <= 2 && astralFish >= 0) // 3% - { - itemDrop = ModContent.ItemType(); - } - else // 36% w/o crate pot, 31% w/ crate pot + else { itemDrop = ModContent.ItemType(); return; @@ -394,62 +482,48 @@ namespace CalamityMod.CalPlayer if (ZoneSunkenSea) // Sunken Sea, fishing in water { - int sunkenFish = Main.rand.Next(100); - if (sunkenFish >= 85 && Main.hardMode) // 15% + if (attempt.legendary) { - itemDrop = ModContent.ItemType(); + List legendaryCatches = new List() + { + ModContent.ItemType(), + ModContent.ItemType() + }; + legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); + legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; } - else if (sunkenFish <= 84 && sunkenFish >= 70) // 15% + else if (attempt.uncommon || attempt.rare || attempt.veryrare) { - itemDrop = ModContent.ItemType(); + int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = uncommonCatch; } - else if (sunkenFish <= 69 && sunkenFish >= 55) // 15% - { - itemDrop = ModContent.ItemType(); - } - else if (Player.cratePotion && sunkenFish <= 18 && sunkenFish >= 9) // 10% - { - itemDrop = ModContent.ItemType(); - } - else if (!Player.cratePotion && sunkenFish <= 13 && sunkenFish >= 9) // 5% - { - itemDrop = ModContent.ItemType(); - } - else if (sunkenFish <= 31 && sunkenFish >= 29) // 3% - { - itemDrop = ModContent.ItemType(); - } - else if (sunkenFish <= 8 && sunkenFish >= 6 && Main.hardMode) // 3% - { - itemDrop = ModContent.ItemType(); - } - else if (sunkenFish <= 5 && sunkenFish >= 3) // 3% - { - itemDrop = ModContent.ItemType(); - } - else if (sunkenFish <= 2 && sunkenFish >= 0 && DownedBossSystem.downedDesertScourge) // 3% - { - itemDrop = ModContent.ItemType(); - } - else // 38% w/o crate pot, 33% w/ crate pot + 18% if prehardmode + else { itemDrop = ModContent.ItemType(); return; } } - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitas && Main.rand.NextBool(25)) + // There is no complete fishing pool here, so most of it is vanilla default + if (canSulphurFish) // Sulphurous Sea, fishing in water { - itemDrop = ModContent.ItemType(); - } - - if (attempt.common) - { - if (canSulphurFish) + if (attempt.legendary || (attempt.veryrare && Main.rand.NextBool())) + { + itemDrop = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + } + else if (attempt.common) { itemDrop = ModContent.ItemType(); } - return; } /*if (canSulphurFish && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) @@ -471,82 +545,44 @@ namespace CalamityMod.CalPlayer } return; }*/ - - if (canSulphurFish) - { - if (Main.rand.NextBool(15)) - { - itemDrop = ModContent.ItemType(); - } - if (Main.rand.NextFloat() < 0.08f) - { - itemDrop = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType() - }); - } - if (Player.cratePotion && Main.rand.NextBool(5)) // 20% - { - itemDrop = ModContent.ItemType(); - } - else if (!Player.cratePotion && Main.rand.NextBool(10)) // 10% - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneOverworldHeight && Main.bloodMoon) - { - if (Main.rand.NextBool(25)) - { - itemDrop = ModContent.ItemType(); - } - } } if (lava) { if (ZoneCalamity) // Brimstone Crags, fishing in lava { - int cragFish = Main.rand.Next(100); - if (cragFish >= 85) // 15% + if (attempt.legendary) { - itemDrop = ModContent.ItemType(); + List legendaryCatches = new List() + { + ModContent.ItemType(), + ModContent.ItemType() + }; + legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); + legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; } - else if (cragFish <= 84 && cragFish >= 70) // 15% - { - itemDrop = ModContent.ItemType(); - } - else if (cragFish <= 69 && cragFish >= 55) // 15% - { - itemDrop = ModContent.ItemType(); - } - else if (cragFish <= 54 && cragFish >= 41 && Main.hardMode) // 14% - { - itemDrop = ModContent.ItemType(); - } - else if (Player.cratePotion && cragFish <= 30 && cragFish >= 21) // 10% - { - itemDrop = ModContent.ItemType(); - } - else if (!Player.cratePotion && cragFish <= 25 && cragFish >= 21) // 5% - { - itemDrop = ModContent.ItemType(); - } - else if (cragFish <= 20 && cragFish >= 11 && DownedBossSystem.downedProvidence) // 10% - { - itemDrop = ModContent.ItemType(); - } - else if (cragFish <= 10 && cragFish >= (Main.hardMode ? 8 : 6)) // 5% (3% hardmode) - { + // Increased chance of Dragoon Drizzlefish in Prehardmode + else if (attempt.veryrare && !Main.hardMode) + { itemDrop = ModContent.ItemType(); - } - else if (cragFish <= 2 && cragFish >= 0) // 3% + } + else if ((attempt.rare || attempt.veryrare) && DownedBossSystem.downedProvidence && Main.rand.Next(3) >= 2) + { + itemDrop = ModContent.ItemType(); + } + else if (attempt.uncommon || attempt.rare || attempt.veryrare) { - itemDrop = ModContent.ItemType(); + List uncommonCatches = new List() + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; + uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; } - else // 32% w/o crate pot, 27% w/ crate pot, add 10% pre-Prov, add another 12% prehardmode + else { itemDrop = ModContent.ItemType(); } @@ -565,6 +601,7 @@ namespace CalamityMod.CalPlayer if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); + // Prevent the player from fishing if they have the Bloodworm if (bait.type == ModContent.ItemType()) { Point point = Player.Center.ToTileCoordinates(); @@ -586,6 +623,10 @@ namespace CalamityMod.CalPlayer Item item = Player.ActiveItem(); if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1) fishingLevel = -1; + + // If your bait is the Bloodworm, set the Fisherman's Pocket Guide to display Warning! + // This only happens when a fishing bobber projectile exists + Player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning"); } } #endregion diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 40af5f297a..7ce319a4a4 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -147,6 +147,15 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 20; } + if (irradiated) + { + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; + + Player.lifeRegenTime = 0; + lifeRegenLost += 4; + } + if (ZoneSulphur && Player.IsUnderwater() && !decayEffigy && !abyssalDivingSuit && !Player.lavaWet && !Player.honeyWet) { Player.AddBuff(ModContent.BuffType(), 2, true); @@ -262,7 +271,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegen = 0; Player.lifeRegenTime = 0; - lifeRegenLost += 18; + lifeRegenLost += 36; } if (cDepth) @@ -934,13 +943,13 @@ namespace CalamityMod.CalPlayer // Calculate the ratio of the player's current max life relative to the starting HP of 100. // This makes the soft cap far less harsh at lower amounts of max life. - // Ranges from 10 (at 100 max life) to 2 (at 500 max life) to 1 (at 1000 max life) to 0 (at greater than 2000 max life). - int lifeRegenSoftCapMin = (int)Math.Round(100f / actualMaxLife * 10f); - int lifeRegenSoftCapMax = 10; + // Ranges from 20 (at 100 max life) to 4 (at 500 max life) to 2 (at 1000 max life) to 1 (at greater than 2000 max life). + int lifeRegenSoftCapMax = 20; + int lifeRegenSoftCapMin = (int)Math.Round(100f / actualMaxLife * lifeRegenSoftCapMax); - // The soft cap for life regen which ranges from 10 (at less than 5% HP) to 0 (at greater than or equal to 95% HP). + // The soft cap for life regen which ranges from 20 (at less than 5% HP) to 1 (at greater than or equal to 95% HP). // This value is capped at a min and max amount. - int lifeRegenSoftCap = (int)MathHelper.Clamp((int)Math.Round((1f - maxLifeRatio) * 10f), lifeRegenSoftCapMin, lifeRegenSoftCapMax); + int lifeRegenSoftCap = (int)MathHelper.Clamp((int)Math.Round((1f - maxLifeRatio) * lifeRegenSoftCapMax), lifeRegenSoftCapMin, lifeRegenSoftCapMax); // If life regen is greater than the calculated soft cap, reduce it. if (Player.lifeRegen > lifeRegenSoftCap) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 190adc7578..1d2445d74e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -17,6 +17,7 @@ using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Brimflame; +using CalamityMod.Items.Armor.DesertProwler; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Dyes; @@ -58,6 +59,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; +using CalamityMod.Items.Armor.Wulfrum; namespace CalamityMod.CalPlayer { @@ -71,7 +73,7 @@ namespace CalamityMod.CalPlayer // Give the player a 24% jump speed boost while wings are equipped, otherwise grant 4% more jump speed so that players can jump 7 tiles high if (Player.wingsLogic > 0) Player.jumpSpeedBoost += 1.2f; - else + else if (CalamityConfig.Instance.HigherJumpHeight) Player.jumpSpeedBoost += 0.2f; // Decrease the counter on Fearmonger set turbo regeneration @@ -94,6 +96,19 @@ namespace CalamityMod.CalPlayer // be refreshed and copied from RegisteredGameModes. Without this, the above behavior is not reflected ingame, as GameModeData is a value type, not a reference type. Main.GameMode = Main.GameMode; } + // If people want to suffer, let them suffer + else + { + var copy = Main.RegisteredGameModes[GameModeID.Expert]; + copy.DebuffTimeMultiplier = 2f; + Main.RegisteredGameModes[GameModeID.Expert] = copy; + + copy = Main.RegisteredGameModes[GameModeID.Master]; + copy.DebuffTimeMultiplier = 2.5f; + Main.RegisteredGameModes[GameModeID.Master] = copy; + + Main.GameMode = Main.GameMode; + } // Go through the old positions for the player. for (int i = Player.Calamity().OldPositions.Length - 1; i > 0; i--) @@ -105,7 +120,7 @@ namespace CalamityMod.CalPlayer OldPositions[0] = Player.position; // Hurt the nearest NPC to the mouse if using the burning mouse. - if (blazingCursorDamage) + if (blazingCursorDamage || blazingCursorVisuals) HandleBlazingMouseEffects(); // Revengeance effects @@ -207,6 +222,11 @@ namespace CalamityMod.CalPlayer // Apply stealth damage to rogue. Player.GetDamage() += stealthDamage; + + //Slow the player down after any other speed modifiers might have been applied. + //Todo - Move this back to the wulfrum set class whenever statmodifiers are implemented for stats other than damage + if (WulfrumHat.PowerModeEngaged(Player, out _)) + Player.moveSpeed *= 0.8f; } #endregion @@ -498,6 +518,10 @@ namespace CalamityMod.CalPlayer // The sigil's brightness slowly fades away every frame if not incinerating anything. blazingMouseAuraFade = MathHelper.Clamp(blazingMouseAuraFade - 0.025f, 0.25f, 1f); + // Allows the blazing aura to display if the accessory is vanity, but it deals no damage + if (!blazingCursorDamage) + return; + // miscCounter is used to limit Calamity's hit rate. int framesPerHit = 60 / Calamity.HitsPerSecond; if (Player.miscCounter % framesPerHit != 1) @@ -509,7 +533,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC target = Main.npc[i]; - if (!target.active || !target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.townNPC) + if (!target.active || !target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type]) continue; // Brighten the sigil because it is dealing damage. This can only happen once per hit event. @@ -648,7 +672,9 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { - if (!Main.npc[i].active || Main.npc[i].friendly || Main.npc[i].lifeMax < 5 || alreadyTargetedNPCs.Contains(i) || Main.npc[i].realLife >= 0 || Main.npc[i].dontTakeDamage || Main.npc[i].immortal) + NPC target = Main.npc[i]; + if (!target.active || target.friendly || target.lifeMax < 5 || alreadyTargetedNPCs.Contains(i) || target.realLife >= 0 || + target.dontTakeDamage || target.immortal || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type]) continue; var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); @@ -659,10 +685,6 @@ namespace CalamityMod.CalPlayer } } - // Proficiency level ups - if (CalamityConfig.Instance.Proficiency) - GetExactLevelUp(); - // Max mana bonuses Player.statManaMax2 += (permafrostsConcoction ? 50 : 0) + @@ -879,20 +901,30 @@ namespace CalamityMod.CalPlayer Player.noFallDmg = true; } - // Allow the player to double their gravity (but NOT max fall speed!) by holding the down button while in midair. - bool holdingDown = Player.controlDown && !Player.controlJump; - bool controlsEnabled = Player.ControlsEnabled(); - bool notInLiquid = !Player.wet; - bool notOnRope = !Player.pulley && Player.ropeCount == 0; - bool notGrappling = Player.grappling[0] == -1; - bool airborne = Player.velocity.Y != 0; - if (holdingDown && Player.ControlsEnabled() && notInLiquid && notOnRope && notGrappling && airborne) + if (CalamityConfig.Instance.FasterFallHotkey) { - Player.velocity.Y += Player.gravity * (BalancingConstants.HoldingDownGravityMultiplier - 1f); - if (Player.velocity.Y > Player.maxFallSpeed) - Player.velocity.Y = Player.maxFallSpeed; + // Allow the player to double their gravity (but NOT max fall speed!) by holding the down button while in midair. + bool holdingDown = Player.controlDown && !Player.controlJump; + bool controlsEnabled = Player.ControlsEnabled(); + bool notInLiquid = !Player.wet; + bool notOnRope = !Player.pulley && Player.ropeCount == 0; + bool notGrappling = Player.grappling[0] == -1; + bool airborne = Player.velocity.Y != 0; + if (holdingDown && Player.ControlsEnabled() && notInLiquid && notOnRope && notGrappling && airborne) + { + Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); + if (Player.velocity.Y * Player.gravDir > Player.maxFallSpeed) + Player.velocity.Y = Player.maxFallSpeed * Player.gravDir; + } } } + else + { + if (Player.mount.Type == MountID.Slime) + Player.velocity.X *= 0.91f; + else if (Player.mount.Type == MountID.QueenSlime) + Player.velocity.X *= 0.935f; + } // Omega Blue Armor bonus if (omegaBlueSet) @@ -1060,12 +1092,14 @@ namespace CalamityMod.CalPlayer KameiBladeUseDelay--; if (galileoCooldown > 0) galileoCooldown--; + if (dragonRageCooldown > 0) + dragonRageCooldown--; if (soundCooldown > 0) soundCooldown--; if (shadowPotCooldown > 0) shadowPotCooldown--; - if (raiderCooldown > 0) - raiderCooldown--; + if (raiderCritBonus > 0f) + raiderCritBonus -= RaidersTalisman.RaiderBonus / (float)CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); if (gSabatonCooldown > 0) gSabatonCooldown--; if (gSabatonFall > 0) @@ -1080,6 +1114,8 @@ namespace CalamityMod.CalPlayer silvaMageCooldown--; if (tarraMageHealCooldown > 0) tarraMageHealCooldown--; + if (scuttlerCooldown > 0) + scuttlerCooldown--; if (rogueCrownCooldown > 0) rogueCrownCooldown--; if (spectralVeilImmunity > 0) @@ -1210,6 +1246,10 @@ namespace CalamityMod.CalPlayer adamantiteSetDefenseBoostInterpolant = 0f; if (ChlorophyteHealDelay > 0) ChlorophyteHealDelay--; + if (monolithAccursedShader > 0) + monolithAccursedShader--; + if (miningSetCooldown > 0) + miningSetCooldown--; // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) @@ -1363,12 +1403,9 @@ namespace CalamityMod.CalPlayer } // Raider Talisman bonus - if (raiderTalisman) + if (raiderTalisman && !StealthStrikeAvailable()) { - // Nanotech use to have an exclusive nerf here, but since they are currently equal, there - // is no check to indicate such. - float damageMult = 0.15f; - Player.GetDamage() += raiderStack / 150f * damageMult; + Player.GetCritChance() += raiderCritBonus; } if (kamiBoost) @@ -1997,10 +2034,10 @@ namespace CalamityMod.CalPlayer { Asset rain3 = ModContent.Request("CalamityMod/ExtraTextures/Rain3"); Asset rainOriginal = ModContent.Request("CalamityMod/ExtraTextures/RainOriginal"); - Asset mana2 = ModContent.Request("CalamityMod/ExtraTextures/Mana2"); - Asset mana3 = ModContent.Request("CalamityMod/ExtraTextures/Mana3"); - Asset mana4 = ModContent.Request("CalamityMod/ExtraTextures/Mana4"); - Asset manaOriginal = ModContent.Request("CalamityMod/ExtraTextures/ManaOriginal"); + Asset cometShard = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/ManaCometShard"); + Asset etherealCore = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/ManaEtherealCore"); + Asset phantomHeart = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/ManaPhantomHeart"); + Asset manaOriginal = ModContent.Request("CalamityMod/ExtraTextures/UI/HealthMana/ManaOriginal"); Asset carpetAuric = ModContent.Request("CalamityMod/ExtraTextures/AuricCarpet"); Asset carpetOriginal = ModContent.Request("CalamityMod/ExtraTextures/Carpet"); @@ -2010,17 +2047,17 @@ namespace CalamityMod.CalPlayer (cShard ? 1 : 0); switch (totalManaBoost) { - default: - TextureAssets.Mana = manaOriginal; - break; case 3: - TextureAssets.Mana = mana4; + TextureAssets.Mana = phantomHeart; break; case 2: - TextureAssets.Mana = mana3; + TextureAssets.Mana = etherealCore; break; case 1: - TextureAssets.Mana = mana2; + TextureAssets.Mana = cometShard; + break; + default: + TextureAssets.Mana = manaOriginal; break; } @@ -2335,19 +2372,8 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += ProfanedRagePotion.CritBoost; } - if (shadow) - { - if (Player.FindBuffIndex(BuffID.Invisibility) > -1) - Player.ClearBuff(BuffID.Invisibility); - } - if (irradiated) - { Player.statDefense -= 10; - Player.moveSpeed -= 0.1f; - Player.GetDamage() += 0.05f; - Player.GetKnockback() += 0.5f; - } if (rRage) { @@ -2424,11 +2450,12 @@ namespace CalamityMod.CalPlayer Player.statDefense += 20; Player.longInvince = true; Player.crimsonRegen = true; + healingPotBonus += 0.5f; } // 50% movement speed bonus so that you don't feel like a snail in the early game. // Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy. - if (CalamityMod.Instance.overhaul is null) + if (CalamityMod.Instance.overhaul is null && CalamityConfig.Instance.FasterBaseSpeed) Player.moveSpeed += BalancingConstants.DefaultMoveSpeedBoost; if (cirrusDress) @@ -2549,18 +2576,6 @@ namespace CalamityMod.CalPlayer if (CalamityLists.highTestFishList.Contains(Player.ActiveItem().type)) Player.accFishingLine = true; - if (CalamityLists.boomerangList.Contains(Player.ActiveItem().type) && Player.invis) - Player.GetDamage() += 0.1f; - - if (CalamityLists.javelinList.Contains(Player.ActiveItem().type) && Player.invis) - Player.GetArmorPenetration() += 5; - - if (CalamityLists.flaskBombList.Contains(Player.ActiveItem().type) && Player.invis) - rogueVelocity += 0.1f; - - if (CalamityLists.spikyBallList.Contains(Player.ActiveItem().type) && Player.invis) - Player.GetCritChance() += 10; - if (planarSpeedBoost != 0) { if (Player.ActiveItem().type != ModContent.ItemType()) @@ -2840,7 +2855,15 @@ namespace CalamityMod.CalPlayer } if (bloodyWormTooth) + { Player.GetDamage() += 0.07f; + Player.GetAttackSpeed() += 0.07f; + } + + if (filthyGlove) + { + bonusStealthDamage += nanotech ? 0.05f : 0.1f; + } if (dAmulet) Player.pStone = true; @@ -3102,7 +3125,6 @@ namespace CalamityMod.CalPlayer if (eArtifact) { Player.manaCost *= 0.85f; - Player.GetDamage() += 0.15f; Player.maxMinions += 2; } @@ -3464,9 +3486,6 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += 5; } - if (CalamityConfig.Instance.Proficiency) - GetStatBonuses(); - // Amalgam boosts if (Main.myPlayer == Player.whoAmI) { @@ -3474,8 +3493,8 @@ namespace CalamityMod.CalPlayer { // TODO -- What the FUCK is this conditional chain? int hasBuff = Player.buffType[l]; - if ((hasBuff >= BuffID.ObsidianSkin && hasBuff <= BuffID.Gravitation) || hasBuff == BuffID.Tipsy || hasBuff == BuffID.WellFed || - hasBuff == BuffID.Honey || hasBuff == BuffID.WeaponImbueVenom || (hasBuff >= BuffID.WeaponImbueCursedFlames && hasBuff <= BuffID.WeaponImbuePoison) || + if ((hasBuff >= BuffID.ObsidianSkin && hasBuff <= BuffID.Gravitation) || hasBuff == BuffID.Tipsy || hasBuff == BuffID.WellFed || hasBuff == BuffID.WellFed2 || hasBuff == BuffID.WellFed3 || + hasBuff == BuffID.Honey || hasBuff == BuffID.WeaponImbueVenom || (hasBuff >= BuffID.WeaponImbueCursedFlames && hasBuff <= BuffID.WeaponImbuePoison) || hasBuff == BuffID.Lucky || (hasBuff >= BuffID.Mining && hasBuff <= BuffID.Wrath) || (hasBuff >= BuffID.Lovestruck && hasBuff <= BuffID.Warmth) || hasBuff == BuffID.SugarRush || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || @@ -3800,6 +3819,9 @@ namespace CalamityMod.CalPlayer if (Player.statDefense > 0) Player.statDefense -= (int)(Player.statDefense * 0.1); } + + if (DesertProwlerHat.ShroudedInSmoke(Player, out _)) + Player.statDefense -= (int)(Player.statDefense * 0.75); } #endregion @@ -3957,8 +3979,6 @@ namespace CalamityMod.CalPlayer CalamityUtils.ConsumeItemViaQuickBuff(Player, item, HadalStew.BuffType, HadalStew.BuffDuration, true); if (item.type == ModContent.ItemType()) CalamityUtils.ConsumeItemViaQuickBuff(Player, item, Margarita.BuffType, Margarita.BuffDuration, false); - if (item.type == ModContent.ItemType()) - CalamityUtils.ConsumeItemViaQuickBuff(Player, item, Bloodfin.BuffType, Bloodfin.BuffDuration, false); } } } diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs index 5aad21a8d6..738d01da03 100644 --- a/CalPlayer/CalamityPlayerNetcode.cs +++ b/CalPlayer/CalamityPlayerNetcode.cs @@ -22,16 +22,6 @@ namespace CalamityMod.CalPlayer private void EnterWorldSync() { StandardSync(); - SyncExactLevel(false, 0); - SyncExactLevel(false, 1); - SyncExactLevel(false, 2); - SyncExactLevel(false, 3); - SyncExactLevel(false, 4); - SyncLevel(false, 0); - SyncLevel(false, 1); - SyncLevel(false, 2); - SyncLevel(false, 3); - SyncLevel(false, 4); } internal void MouseControlsSync() @@ -42,74 +32,6 @@ namespace CalamityMod.CalPlayer #endregion #region Creating and Sending Packets - private void SyncExactLevel(bool server, int levelType) - { - ModPacket packet = Mod.GetPacket(); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); - packet.Write(Player.whoAmI); - packet.Write(exactMeleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); - packet.Write(Player.whoAmI); - packet.Write(exactRangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); - packet.Write(Player.whoAmI); - packet.Write(exactMagicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); - packet.Write(Player.whoAmI); - packet.Write(exactSummonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); - packet.Write(Player.whoAmI); - packet.Write(exactRogueLevel); - break; - } - Player.SendPacket(packet, server); - } - - private void SyncLevel(bool server, int levelType) - { - ModPacket packet = Mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.MeleeLevelSync); - packet.Write(Player.whoAmI); - packet.Write(meleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.RangedLevelSync); - packet.Write(Player.whoAmI); - packet.Write(rangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.MagicLevelSync); - packet.Write(Player.whoAmI); - packet.Write(magicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.SummonLevelSync); - packet.Write(Player.whoAmI); - packet.Write(summonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.RogueLevelSync); - packet.Write(Player.whoAmI); - packet.Write(rogueLevel); - break; - } - Player.SendPacket(packet, server); - } - public void SyncDefenseDamage(bool server) { ModPacket packet = Mod.GetPacket(256); @@ -187,24 +109,6 @@ namespace CalamityMod.CalPlayer Player.SendPacket(packet, server); } - public void SyncItemTypeLastReforged(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.ItemTypeLastReforgedSync); - packet.Write(Player.whoAmI); - packet.Write(itemTypeLastReforged); - Player.SendPacket(packet, server); - } - - public void SyncReforgeTierSafety(bool server) - { - ModPacket packet = Mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.ReforgeTierSafetySync); - packet.Write(Player.whoAmI); - packet.Write(reforgeTierSafety); - Player.SendPacket(packet, server); - } - public void SyncRightClick(bool server) { ModPacket packet = Mod.GetPacket(256); @@ -225,56 +129,6 @@ namespace CalamityMod.CalPlayer #endregion #region Reading and Handling Packets - internal void HandleExactLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - exactMeleeLevel = reader.ReadInt32(); - break; - case 1: - exactRangedLevel = reader.ReadInt32(); - break; - case 2: - exactMagicLevel = reader.ReadInt32(); - break; - case 3: - exactSummonLevel = reader.ReadInt32(); - break; - case 4: - exactRogueLevel = reader.ReadInt32(); - break; - } - - if (Main.netMode == NetmodeID.Server) - SyncExactLevel(true, levelType); - } - - internal void HandleLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - meleeLevel = reader.ReadInt32(); - break; - case 1: - rangedLevel = reader.ReadInt32(); - break; - case 2: - magicLevel = reader.ReadInt32(); - break; - case 3: - summonLevel = reader.ReadInt32(); - break; - case 4: - rogueLevel = reader.ReadInt32(); - break; - } - - if (Main.netMode == NetmodeID.Server) - SyncLevel(true, levelType); - } - internal void HandleRage(BinaryReader reader) { rage = reader.ReadSingle(); @@ -365,20 +219,6 @@ namespace CalamityMod.CalPlayer SyncDeathCount(true); } - internal void HandleItemTypeLastReforged(BinaryReader reader) - { - itemTypeLastReforged = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - SyncItemTypeLastReforged(true); - } - - internal void HandleReforgeTierSafety(BinaryReader reader) - { - reforgeTierSafety = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - SyncReforgeTierSafety(true); - } - internal void HandleDefenseDamage(BinaryReader reader) { totalDefenseDamage = reader.ReadInt32(); diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 10ca3ae8a6..da8c352bb1 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -188,7 +188,7 @@ namespace CalamityMod.CalPlayer if (target.type == NPCID.TargetDummy || target.type == NPCType()) return; if (rageModeActive && shatteredCommunity) - ShatteredCommunity.AccumulateRageDamage(Player, this, damage); + Player.GetModPlayer().AccumulateRageDamage(damage); } #endregion @@ -393,14 +393,14 @@ namespace CalamityMod.CalPlayer ProjLifesteal(target, proj, damage, crit); ProjOnHit(proj, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); - NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.IsSummon(), proj.CountsAsClass(), true); + NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true); // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (target.type == NPCID.TargetDummy || target.type == NPCType()) return; if (rageModeActive && shatteredCommunity) - ShatteredCommunity.AccumulateRageDamage(Player, this, damage); + Player.GetModPlayer().AccumulateRageDamage(damage); } } #endregion @@ -615,7 +615,7 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 300); } ProjOnHit(proj, target.Center, crit, true); - PvpDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.IsSummon(), proj.CountsAsClass(), true); + PvpDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true); } } #endregion @@ -630,15 +630,6 @@ namespace CalamityMod.CalPlayer if (reaverDefense) Player.lifeRegenTime += 1; - if (Player.whoAmI == Main.myPlayer && desertProwler && crit && item.CountsAsClass()) - { - bool noTornado = Player.ownedProjectileCounts[ProjectileType()] < 1 && Player.ownedProjectileCounts[ProjectileType()] < 1; - if (noTornado && Main.rand.NextBool(15)) - { - Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), damage, item.knockBack, Player.whoAmI); - } - } - if (npcCheck) { if (item.CountsAsClass() && aBulwarkRare && aBulwarkRareTimer == 0) @@ -771,7 +762,7 @@ namespace CalamityMod.CalPlayer RangedOnHit(proj, modProj, position, crit, npcCheck); if (proj.CountsAsClass()) MagicOnHit(proj, modProj, position, crit, npcCheck); - if (proj.IsSummon()) + if (proj.CountsAsClass() && !proj.CountsAsClass()) SummonOnHit(proj, modProj, position, crit, npcCheck); if (proj.CountsAsClass()) RogueOnHit(proj, modProj, position, crit, npcCheck); @@ -827,14 +818,6 @@ namespace CalamityMod.CalPlayer private void RangedOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) { var source = proj.GetSource_FromThis(); - if (Player.whoAmI == Main.myPlayer && desertProwler && crit) - { - bool noTornado = Player.ownedProjectileCounts[ProjectileType()] < 1 && Player.ownedProjectileCounts[ProjectileType()] < 1; - if (noTornado && Main.rand.NextBool(15)) - { - Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), proj.damage, proj.knockBack, Player.whoAmI); - } - } if (npcCheck) { @@ -919,6 +902,7 @@ namespace CalamityMod.CalPlayer private void SummonOnHit(Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) { var source = proj.GetSource_FromThis(); + if (npcCheck) { if (phantomicArtifact) @@ -950,7 +934,7 @@ namespace CalamityMod.CalPlayer int damage = (int)Player.GetTotalDamage().ApplyTo(75); int dagger = Projectile.NewProjectile(source, proj.position, proj.velocity, ProjectileType(), damage, 1f, Player.whoAmI, 0f); if (dagger.WithinBounds(Main.maxProjectiles)) - Main.projectile[dagger].DamageType = DamageClass.Generic; + Main.projectile[dagger].DamageType = DamageClass.Summon; } } else @@ -1008,7 +992,7 @@ namespace CalamityMod.CalPlayer int apparatusDamage = (int)Player.GetTotalDamage().ApplyTo(60); int projectile = Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), apparatusDamage, 4f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; + Main.projectile[projectile].DamageType = DamageClass.Summon; jellyDmg = 100f; } else if (starbusterCore) @@ -1016,7 +1000,7 @@ namespace CalamityMod.CalPlayer int starburstDamage = (int)Player.GetTotalDamage().ApplyTo(40); int projectile = Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), starburstDamage, 3.5f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; + Main.projectile[projectile].DamageType = DamageClass.Summon; jellyDmg = 60f; } else if (nuclearRod) @@ -1024,7 +1008,7 @@ namespace CalamityMod.CalPlayer int nuclearDamage = (int)Player.GetTotalDamage().ApplyTo(20); int projectile = Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), nuclearDamage, 0f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; + Main.projectile[projectile].DamageType = DamageClass.Summon; jellyDmg = 60f; } else if (jellyChargedBattery) @@ -1045,7 +1029,7 @@ namespace CalamityMod.CalPlayer int hallowedDamage = (int)Player.GetTotalDamage().ApplyTo(30); int projectile = Projectile.NewProjectile(source, spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), hallowedDamage, 3f, proj.owner); if (projectile.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile].DamageType = DamageClass.Generic; + Main.projectile[projectile].DamageType = DamageClass.Summon; } } } @@ -1178,7 +1162,10 @@ namespace CalamityMod.CalPlayer int featherDamage = (int)Player.GetTotalDamage().ApplyTo(15); int feather = Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType(), featherDamage, 3f, proj.owner); if (feather.WithinBounds(Main.maxProjectiles)) + { Main.projectile[feather].DamageType = DamageClass.Generic; + Main.projectile[feather].extraUpdates += 3; + } } spawnedFeathers = true; } @@ -1251,55 +1238,17 @@ namespace CalamityMod.CalPlayer if (shadow && shadowPotCooldown <= 0 && modProj.stealthStrikeHitCount < 5) { - if (CalamityLists.javelinProjList.Contains(proj.type)) - { - int randrot = Main.rand.Next(-30, 391); - Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); - int soul = Projectile.NewProjectile(spawnSource, proj.Center, SoulSpeed, ProjectileType(), (int)(proj.damage * 0.1), 3f, proj.owner, 0f, 0f); - if (soul.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul].DamageType = DamageClass.Generic; - shadowPotCooldown = 30; - } - if (CalamityLists.spikyBallProjList.Contains(proj.type)) - { - int scythe = Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.05), 3f, proj.owner, 1f, 0f); - if (scythe.WithinBounds(Main.maxProjectiles)) - Main.projectile[scythe].DamageType = DamageClass.Generic; - Main.projectile[scythe].usesLocalNPCImmunity = true; - Main.projectile[scythe].localNPCHitCooldown = 10; - Main.projectile[scythe].penetrate = 2; - shadowPotCooldown = 30; - } - if (CalamityLists.daggerProjList.Contains(proj.type)) - { - Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); - shardVelocity.Normalize(); - shardVelocity *= 5f; - int shard = Projectile.NewProjectile(spawnSource, proj.Center, shardVelocity, ProjectileType(), (int)(proj.damage * 0.15), 0f, proj.owner); - if (shard.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard].DamageType = DamageClass.Generic; - Main.projectile[shard].timeLeft = 150; - shadowPotCooldown = 30; - } - if (CalamityLists.boomerangProjList.Contains(proj.type)) - { - int spiritDamage = (int)(proj.damage * 0.2); - Projectile ghost = CalamityUtils.SpawnOrb(proj, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); - if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) - { - ghost.DamageType = DamageClass.Generic; - ghost.penetrate = 1; - } - shadowPotCooldown = 30; - } - if (CalamityLists.flaskBombProjList.Contains(proj.type)) - { - int blackhole = Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.05), 3f, proj.owner, 0f, 0f); - if (blackhole.WithinBounds(Main.maxProjectiles)) - Main.projectile[blackhole].DamageType = DamageClass.Generic; - Main.projectile[blackhole].Center = proj.Center; - shadowPotCooldown = 30; - } + int randrot = Main.rand.Next(-30, 391); + Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); + int soul = Projectile.NewProjectile(spawnSource, proj.Center, SoulSpeed, ProjectileType(), (int)(proj.damage * 0.1), 3f, proj.owner, 0f, 0f); + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].DamageType = DamageClass.Generic; + shadowPotCooldown = 30; + } + + if (raiderTalisman && modProj.stealthStrike) + { + raiderCritBonus = RaidersTalisman.RaiderBonus; } if (npcCheck) @@ -1311,18 +1260,12 @@ namespace CalamityMod.CalPlayer int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, Player.whoAmI); } - - if (raiderTalisman && raiderStack < 150 && crit && raiderCooldown <= 0) - { - raiderStack++; - raiderCooldown = 30; - } if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 5) { for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int damage = (int)Player.GetTotalDamage().ApplyTo(20); + int damage = (int)Player.GetTotalDamage().ApplyTo(15); int spark = Projectile.NewProjectile(spawnSource, position, velocity, ProjectileType(), damage, 0f, Player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { @@ -1405,7 +1348,7 @@ namespace CalamityMod.CalPlayer } if (corrosiveSpine) { - target.AddBuff(BuffID.Venom, 240); + target.AddBuff(BuffID.Poisoned, 240); } if (aWeapon) { diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 39fe29a6ec..930f5f106c 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -18,6 +18,8 @@ namespace CalamityMod.CalPlayer.Dashes { public static new string ID => "Godslayer Armor"; + public static int GodslayerCooldown = 45; + public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => true; @@ -63,7 +65,7 @@ namespace CalamityMod.CalPlayer.Dashes runSpeedDecelerationFactor = 0.8f; // Cooldown for God Slayer Armor dash. - player.AddCooldown(Cooldowns.GodSlayerDash.ID, CalamityUtils.SecondsToFrames(35)); + player.AddCooldown(Cooldowns.GodSlayerDash.ID, CalamityUtils.SecondsToFrames(GodslayerCooldown)); player.Calamity().godSlayerDashHotKeyPressed = false; } diff --git a/CalPlayer/DrawLayers/BodyBulkLayer.cs b/CalPlayer/DrawLayers/BodyBulkLayer.cs index b8fc7e7a33..fa3543838d 100644 --- a/CalPlayer/DrawLayers/BodyBulkLayer.cs +++ b/CalPlayer/DrawLayers/BodyBulkLayer.cs @@ -22,12 +22,17 @@ namespace CalamityMod.CalPlayer.DrawLayers return; Player drawPlayer = drawInfo.drawPlayer; - int bodyItem = drawPlayer.armor[1].type; + Item bodyItem = drawPlayer.armor[1]; if (drawPlayer.armor[11].type > ItemID.None) - bodyItem = drawPlayer.armor[11].type; + bodyItem = drawPlayer.armor[11]; - if (ModContent.GetModItem(bodyItem) is IBulkyArmor chestplateBulkDrawer) + if (ModContent.GetModItem(bodyItem.type) is IBulkyArmor chestplateBulkDrawer) { + string equipSlotName = chestplateBulkDrawer.EquipSlotName(drawPlayer) != "" ? chestplateBulkDrawer.EquipSlotName(drawPlayer) : bodyItem.ModItem.Name; + int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Body); + if (drawPlayer.body != equipSlot) + return; + int dyeShader = drawPlayer.dye?[1].dye ?? 0; Vector2 drawPosition = drawInfo.Position - Main.screenPosition; diff --git a/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs b/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs new file mode 100644 index 0000000000..cda0f5d872 --- /dev/null +++ b/CalPlayer/DrawLayers/FrontArmOverShoulderpadLayer.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + + //Draws the front arm of the armor over the shoulderpad when walking. + public class FrontARmOverShoulderpadLayer : PlayerDrawLayer + { + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.ArmOverItem); + + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.shadow == 0f || !drawInfo.drawPlayer.dead; + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + Item bodyItem = drawPlayer.armor[1]; + if (drawPlayer.armor[11].type > ItemID.None) + bodyItem = drawPlayer.armor[11]; + + if (ModContent.GetModItem(bodyItem.type) is IDrawArmOverShoulderpad frontArmDrawer) + { + string equipSlotName = frontArmDrawer.EquipSlotName(drawPlayer) != "" ? frontArmDrawer.EquipSlotName(drawPlayer) : bodyItem.ModItem.Name; + int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Body); + if (drawPlayer.body != equipSlot) + return; + + + int dyeShader = drawPlayer.dye?[1].dye ?? 0; + Vector2 drawPosition = drawInfo.Position - Main.screenPosition; + + // Using drawPlayer to get width & height and such is perfectly fine, on the other hand. Just center everything + drawPosition += new Vector2((drawPlayer.width - drawPlayer.bodyFrame.Width) / 2f, drawPlayer.height - drawPlayer.bodyFrame.Height + 4f); + + //Convert to int to remove the jitter. + drawPosition = new Vector2((int)drawPosition.X, (int)drawPosition.Y); + + //Some dispalcements + drawPosition += drawPlayer.bodyPosition + drawInfo.bodyVect; + + //Grab the extension texture + Texture2D extraPieceTexture = ModContent.Request(frontArmDrawer.FrontArmTexture).Value; + + //Get the frame of the extension based on the players body frame + Rectangle frame = extraPieceTexture.Frame(1, 20, 0, drawPlayer.bodyFrame.Y / drawPlayer.bodyFrame.Height); + + DrawData pieceDrawData = new DrawData(extraPieceTexture, drawPosition, frame, drawInfo.colorArmorBody, drawPlayer.fullRotation, drawInfo.bodyVect, 1f, drawInfo.playerEffect, 0) + { + shader = dyeShader + }; + drawInfo.DrawDataCache.Add(pieceDrawData); + + } + } + } +} diff --git a/CalPlayer/DrawLayers/HatExtensionLayer.cs b/CalPlayer/DrawLayers/HatExtensionLayer.cs index 0aa9992ebf..9c1a8e5141 100644 --- a/CalPlayer/DrawLayers/HatExtensionLayer.cs +++ b/CalPlayer/DrawLayers/HatExtensionLayer.cs @@ -15,14 +15,19 @@ namespace CalamityMod.CalPlayer.DrawLayers protected override void Draw(ref PlayerDrawSet drawInfo) { + //Todo : Make this work even for accessories by somehow checking for the players.head equipslot's item instead of the head item. Player drawPlayer = drawInfo.drawPlayer; - int headItemType = drawPlayer.armor[0].type; - if (drawPlayer.armor[10].type > ItemID.None) - headItemType = drawPlayer.armor[10].type; + Item headItem = drawPlayer.armor[0]; - if (ModContent.GetModItem(headItemType) is IExtendedHat extendedHatDrawer) + if (drawPlayer.armor[10].type > ItemID.None) + headItem = drawPlayer.armor[10]; + + if (ModContent.GetModItem(headItem.type) is IExtendedHat extendedHatDrawer) { - if (extendedHatDrawer.PreDrawExtension(drawInfo) && !drawInfo.drawPlayer.dead) + string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.ModItem.Name; + int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Head); + + if (extendedHatDrawer.PreDrawExtension(drawInfo) && !drawInfo.drawPlayer.dead && equipSlot == drawPlayer.head) { int dyeShader = drawPlayer.dye?[0].dye ?? 0; diff --git a/CalPlayer/DrawLayers/IBulkyArmor.cs b/CalPlayer/DrawLayers/IBulkyArmor.cs index ce7f54a912..cc8abac148 100644 --- a/CalPlayer/DrawLayers/IBulkyArmor.cs +++ b/CalPlayer/DrawLayers/IBulkyArmor.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria.DataStructures; +using Terraria; /// /// Interface that can be used by chestplates to appear extra bulky, by drawing partly over the players helmet with an extra layer @@ -11,4 +12,10 @@ public interface IBulkyArmor /// This should be the same size as a regular equipped sprite (20 x 560 in 1x1) /// string BulkTexture { get; } + + /// + /// The name of the equip slot for the item. If left empty, the equip slot that is looked for will use the name of the item. + /// Useful if you have multiple body textures you need to add bulk to. + /// + string EquipSlotName(Player drawPlayer) => ""; } diff --git a/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs b/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs new file mode 100644 index 0000000000..6864017b3b --- /dev/null +++ b/CalPlayer/DrawLayers/IDrawArmOverShoulderpad.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria; + +/// +/// Interface that can be used by chestplates that need their front arm (when walking) to go over the shoulderpads +/// +public interface IDrawArmOverShoulderpad +{ + /// + /// The texture of the part that goes above the shoulderpads + /// This should be the same size as a regular equipped sprite (20 x 560 in 1x1) + /// + string FrontArmTexture { get; } + + /// + /// The name of the equip slot for the item. If left empty, the equip slot that is looked for will use the name of the item. + /// Useful if you have multiple head textures you need to extend. + /// + string EquipSlotName(Player drawPlayer) => ""; +} diff --git a/CalPlayer/DrawLayers/IExtendedHat.cs b/CalPlayer/DrawLayers/IExtendedHat.cs index 40a569380c..499f7415e5 100644 --- a/CalPlayer/DrawLayers/IExtendedHat.cs +++ b/CalPlayer/DrawLayers/IExtendedHat.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria.DataStructures; +using Terraria; public interface IExtendedHat { @@ -15,4 +16,10 @@ public interface IExtendedHat ///Return true to make the extension get drawn automatically from the texture and offsets provided. Return false if you want to draw it yourself /// bool PreDrawExtension(PlayerDrawSet drawInfo) => true; + + /// + /// The name of the equip slot for the item. If left empty, the equip slot that is looked for will use the name of the item. + /// Useful if you have multiple head textures you need to extend. + /// + string EquipSlotName(Player drawPlayer) => ""; } diff --git a/CalPlayer/DrawLayers/IHideFrontArm.cs b/CalPlayer/DrawLayers/IHideFrontArm.cs new file mode 100644 index 0000000000..b91fff9550 --- /dev/null +++ b/CalPlayer/DrawLayers/IHideFrontArm.cs @@ -0,0 +1,15 @@ +using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria; + +/// +/// Interface that can be used by items that need to hide the players front arm when held. +/// Useful for prosthesis type items. +/// +public interface IHideFrontArm +{ + /// + /// When should the arm be hidden. Defauls to always + /// + bool ShouldHideArm(Player player) => true; +} diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 2a60f6ecb4..e6305fc419 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -14,6 +14,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Config; +using CalamityMod.Items.PermanentBoosters; namespace CalamityMod { @@ -70,6 +71,12 @@ namespace CalamityMod [DefaultValue(true)] [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ShopNewAlert")] public bool ShopNewAlert { get; set; } + + [Label("$Mods.CalamityMod.Config.EntryTitle.WikiStatusMessage")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.WikiStatusMessage")] + public bool WikiStatusMessage { get; set; } #endregion #region UI Changes @@ -179,18 +186,18 @@ namespace CalamityMod #region General Gameplay Changes [Header("$Mods.CalamityMod.Config.SectionTitle.Gameplay")] + [Label("$Mods.CalamityMod.Config.EntryTitle.RemoveReforgeRNG")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.RemoveReforgeRNG")] + public bool RemoveReforgeRNG { get; set; } + [Label("$Mods.CalamityMod.Config.EntryTitle.EarlyHardmodeProgressionRework")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.EarlyHardmodeProgressionRework")] public bool EarlyHardmodeProgressionRework { get; set; } - [Label("$Mods.CalamityMod.Config.EntryTitle.Proficiency")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.Proficiency")] - public bool Proficiency { get; set; } - [Label("$Mods.CalamityMod.Config.EntryTitle.BossZen")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -229,6 +236,41 @@ namespace CalamityMod public float BossHealthBoost { get; set; } #endregion + #region Default Player Stat Boosts + [Header("$Mods.CalamityMod.Config.SectionTitle.BaseBoosts")] + + [Label("$Mods.CalamityMod.Config.EntryTitle.FasterBaseSpeed")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterBaseSpeed")] + public bool FasterBaseSpeed { get; set; } + + [Label("$Mods.CalamityMod.Config.EntryTitle.HigherJumpHeight")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.HigherJumpHeight")] + public bool HigherJumpHeight { get; set; } + + [Label("$Mods.CalamityMod.Config.EntryTitle.FasterJumpSpeed")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterJumpSpeed")] + public bool FasterJumpSpeed { get; set; } + + + [Label("$Mods.CalamityMod.Config.EntryTitle.FasterFallHotkey")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterFallHotkey")] + public bool FasterFallHotkey { get; set; } + + [Label("$Mods.CalamityMod.Config.EntryTitle.FasterTilePlacement")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterTilePlacement")] + public bool FasterTilePlacement { get; set; } + #endregion + #region Expert and Master Mode Changes [Header("$Mods.CalamityMod.Config.SectionTitle.ExpertMaster")] @@ -338,6 +380,7 @@ namespace CalamityMod new("ParticleLimit", ItemID.FragmentStardust), new("StealthInvisibility", ModContent.ItemType()), new("ShopNewAlert", ItemID.GoldChest), + new("WikiStatusMessage", ItemID.Book), new("BossHealthBarExtraInfo", ModContent.ItemType()), new("DebuffDisplay", ItemID.FlaskofIchor), @@ -357,18 +400,24 @@ namespace CalamityMod new("SpeedrunTimerPosX", ItemID.LaserRuler), new("SpeedrunTimerPosY", ItemID.LaserRuler), + new("RemoveReforgeRNG", ItemID.TinHammer), new("EarlyHardmodeProgressionRework", ItemID.Pwnhammer), - new("Proficiency", ModContent.ItemType()), new("BossZen", ModContent.ItemType()), new("TownNPCsSpawnAtNight", ItemID.ClothierVoodooDoll), new("TownNPCSpawnRateMultiplier", ItemID.GuideVoodooDoll), new("BossHealthBoost", ItemID.LifeCrystal), + new("FasterBaseSpeed", ItemID.HermesBoots), + new("HigherJumpHeight", ItemID.ShinyRedBalloon), + new("FasterJumpSpeed", ItemID.FrogLeg), + new("FasterFallHotkey", ModContent.ItemType()), + new("FasterTilePlacement", ItemID.ArchitectGizmoPack), + new("NerfExpertDebuffs", ItemID.AnkhCharm), new("ChilledWaterRework", ItemID.ArcticDivingGear), new("ForceTownSafety", ItemID.Sunflower), - new("RipperMeterShake", ModContent.ItemType()), + new("RipperMeterShake", ModContent.ItemType()), new("RageMeterPosX", ItemID.LaserRuler), new("RageMeterPosY", ItemID.LaserRuler), new("AdrenalineMeterPosX", ItemID.LaserRuler), diff --git a/CalamityLists.cs b/CalamityLists.cs index 68a6ef8a65..e884346e66 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -109,16 +109,6 @@ namespace CalamityMod public static List needsDebuffIconDisplayList; public static List trapProjectileList; public static List scopedWeaponList; - public static List boomerangList; - public static List javelinList; - public static List daggerList; - public static List flaskBombList; - public static List spikyBallList; - public static List boomerangProjList; - public static List javelinProjList; - public static List daggerProjList; - public static List flaskBombProjList; - public static List spikyBallProjList; public static List lavaFishList; public static List highTestFishList; public static List flamethrowerList; @@ -133,7 +123,6 @@ namespace CalamityMod public static List mossHornetList; public static List bossMinionList; public static List minibossList; - public static List heartDropBlockList; public static List pierceResistList; public static List pierceResistExceptionList; @@ -151,6 +140,8 @@ namespace CalamityMod public static List AresIDs; public static List SkeletronPrimeIDs; public static List StormWeaverIDs; + public static List RavagerIDs; + public static List GolemIDs; public static List BoundNPCIDs; public static List GrenadeResistIDs; @@ -279,7 +270,6 @@ namespace CalamityMod "Cameron", "Orudeon", "BumbleDoge", - "John", "Naglfar", "Helixas", "Vetus", @@ -520,7 +510,8 @@ namespace CalamityMod "Himakaze", "Face", "Carboniferous", - "James" + "James", + "Taitou1" }; projectileDestroyExceptionList = new List() @@ -1329,301 +1320,6 @@ namespace CalamityMod ItemType() }; - boomerangList = new List() - { - 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() - }; - - boomerangProjList = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - javelinList = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - - javelinProjList = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - daggerList = new List() - { - 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() - }; - - daggerProjList = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - flaskBombList = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - - flaskBombProjList = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - spikyBallList = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - - spikyBallProjList = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - highTestFishList = new List() { ItemID.GoldenFishingRod, @@ -1673,7 +1369,7 @@ namespace CalamityMod ItemType(), ItemType(), ItemType(), - ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), @@ -1882,25 +1578,6 @@ namespace CalamityMod NPCID.MartianSaucerTurret, }; - heartDropBlockList = new List() - { - NPCID.ServantofCthulhu, - NPCID.TheHungryII, - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.QueenSlimeMinionBlue, - NPCID.QueenSlimeMinionPink, - NPCID.QueenSlimeMinionPurple, - NPCID.Probe, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.PlanterasTentacle, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCType() - }; - pierceResistList = new List() { NPCID.EaterofWorldsHead, @@ -2129,6 +1806,26 @@ namespace CalamityMod NPCType() }; + // Purposefully does not include the freed head + RavagerIDs = new List + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + GolemIDs = new List + { + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight + }; + GrenadeResistIDs = new List { ProjectileID.Grenade, @@ -2721,16 +2418,6 @@ namespace CalamityMod needsDebuffIconDisplayList = null; trapProjectileList = null; scopedWeaponList = null; - boomerangList = null; - javelinList = null; - daggerList = null; - flaskBombList = null; - spikyBallList = null; - boomerangProjList = null; - javelinProjList = null; - daggerProjList = null; - flaskBombProjList = null; - spikyBallProjList = null; lavaFishList = null; highTestFishList = null; flamethrowerList = null; @@ -2745,7 +2432,6 @@ namespace CalamityMod mossHornetList = null; bossMinionList = null; minibossList = null; - heartDropBlockList = null; pierceResistList = null; pierceResistExceptionList = null; @@ -2763,6 +2449,8 @@ namespace CalamityMod AresIDs = null; SkeletronPrimeIDs = null; StormWeaverIDs = null; + RavagerIDs = null; + GolemIDs = null; BoundNPCIDs = null; GrenadeResistIDs = null; ZeroContactDamageNPCList = null; diff --git a/CalamityMod.cs b/CalamityMod.cs index a65ab5b7de..6ec09e1bef 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,4 +1,10 @@ -using CalamityMod.Balancing; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Runtime.CompilerServices; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; @@ -11,10 +17,15 @@ using CalamityMod.FluidSimulation; using CalamityMod.ILEditing; using CalamityMod.Items; using CalamityMod.Items.Dyes.HairDye; +using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Pets; using CalamityMod.Items.VanillaArmorChanges; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Localization; using CalamityMod.NPCs.AdultEidolonWyrm; using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; @@ -41,9 +52,11 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using CalamityMod.Projectiles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Schematics; @@ -55,12 +68,6 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Reflection; -using System.Runtime.CompilerServices; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Dyes; @@ -71,6 +78,7 @@ using Terraria.ModLoader; using Terraria.ModLoader.Config; [assembly: InternalsVisibleTo("CalTestHelpers")] +[assembly: InternalsVisibleTo("InfernumMode")] namespace CalamityMod { public class CalamityMod : Mod @@ -84,8 +92,8 @@ namespace CalamityMod public static int sharkKillCount = 0; // Textures - public static Asset heartOriginal2; public static Asset heartOriginal; + public static Asset heartOriginal2; public static Asset rainOriginal; public static Asset manaOriginal; public static Asset carpetOriginal; @@ -110,7 +118,7 @@ namespace CalamityMod // Debuff immunities, these are used in the NPCDebuffs file public static int[] slimeEnemyImmunities = new int[1] { BuffID.Poisoned }; - public static int[] iceEnemyImmunities = new int[3] { BuffID.Frostburn, ModContent.BuffType(), ModContent.BuffType() }; + public static int[] iceEnemyImmunities = new int[4] { BuffID.Frostburn, BuffID.Frostburn2, ModContent.BuffType(), ModContent.BuffType() }; public static int[] sulphurEnemyImmunities = new int[4] { BuffID.Poisoned, BuffID.Venom, ModContent.BuffType(), ModContent.BuffType() }; public static int[] sunkenSeaEnemyImmunities = new int[2] { ModContent.BuffType(), ModContent.BuffType() }; public static int[] abyssEnemyImmunities = new int[1] { ModContent.BuffType() }; @@ -133,10 +141,11 @@ namespace CalamityMod internal Mod overhaul = null; internal Mod redemption = null; internal Mod soa = null; + internal Mod subworldLibrary = null; internal Mod summonersAssociation = null; internal Mod thorium = null; internal Mod varia = null; - internal Mod subworldLibrary = null; + internal Mod wikithis = null; #region Load public override void Load() @@ -144,8 +153,8 @@ namespace CalamityMod Instance = this; // Save vanilla textures. - heartOriginal2 = TextureAssets.Heart; - heartOriginal = TextureAssets.Heart2; + heartOriginal = TextureAssets.Heart; + heartOriginal2 = TextureAssets.Heart2; rainOriginal = TextureAssets.Rain; manaOriginal = TextureAssets.Mana; carpetOriginal = TextureAssets.FlyingCarpet; @@ -172,14 +181,16 @@ namespace CalamityMod ModLoader.TryGetMod("Redemption", out redemption); soa = null; ModLoader.TryGetMod("SacredTools", out soa); + subworldLibrary = null; + ModLoader.TryGetMod("SubworldLibrary", out subworldLibrary); summonersAssociation = null; ModLoader.TryGetMod("SummonersAssociation", out summonersAssociation); thorium = null; ModLoader.TryGetMod("ThoriumMod", out thorium); varia = null; ModLoader.TryGetMod("Varia", out varia); - subworldLibrary = null; - ModLoader.TryGetMod("SubworldLibrary", out subworldLibrary); + wikithis = null; + ModLoader.TryGetMod("Wikithis", out wikithis); // Initialize the EnemyStats struct as early as it is safe to do so NPCStats.Load(); @@ -206,6 +217,10 @@ namespace CalamityMod { LoadClient(); GeneralParticleHandler.Load(); + ForegroundDrawing.ForegroundManager.Load(); + + // Wikithis support + WeakReferenceSupport.WikiThisSupport(); } CooldownRegistry.Load(); @@ -266,6 +281,9 @@ namespace CalamityMod Filters.Scene["CalamityMod:ExoMechs"] = new Filter(new ExoMechsScreenShaderData("FilterMiniTower").UseColor(ExoMechsSky.DrawColor).UseOpacity(0.25f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:ExoMechs"] = new ExoMechsSky(); + Filters.Scene["CalamityMod:MonolithAccursed"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:MonolithAccursed"] = new MonolithSky(); + SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); @@ -331,6 +349,7 @@ namespace CalamityMod public override void Unload() { musicMod = null; + ancientsAwakened = null; bossChecklist = null; census = null; @@ -339,9 +358,11 @@ namespace CalamityMod overhaul = null; redemption = null; soa = null; + subworldLibrary = null; summonersAssociation = null; thorium = null; varia = null; + wikithis = null; AstralSky = null; @@ -385,8 +406,8 @@ namespace CalamityMod if (!Main.dedServ) { - TextureAssets.Heart = heartOriginal2; - TextureAssets.Heart2 = heartOriginal; + TextureAssets.Heart = heartOriginal; + TextureAssets.Heart2 = heartOriginal2; TextureAssets.Rain = rainOriginal; TextureAssets.Mana = manaOriginal; TextureAssets.FlyingCarpet = carpetOriginal; @@ -402,8 +423,8 @@ namespace CalamityMod SceneMetrics.GraveyardTileMin = 16; SceneMetrics.GraveyardTileThreshold = 28; - heartOriginal2 = null; heartOriginal = null; + heartOriginal2 = null; rainOriginal = null; manaOriginal = null; carpetOriginal = null; @@ -414,14 +435,6 @@ namespace CalamityMod } #endregion - #region Late Loading - public override void PostAddRecipes() - { - // This is placed here so that all tiles from all mods are guaranteed to be loaded at this point. - TileFraming.Load(); - } - #endregion - #region Render Target Management public static void PrepareRenderTargets(GameTime gameTime) @@ -578,11 +591,11 @@ namespace CalamityMod { NPCID.EaterofWorldsHead, 7200 }, // 2:00 (120 seconds) { NPCID.EaterofWorldsBody, 7200 }, { NPCID.EaterofWorldsTail, 7200 }, - { NPCID.BrainofCthulhu, 5400 }, // 1:30 (90 seconds) - { NPCID.Creeper, 1800 }, // 0:30 (30 seconds) + { NPCID.BrainofCthulhu, 5400 }, // 1:30 (90 seconds, total length of fight including Creepers phase) + { NPCID.Creeper, 1800 }, // 0:30 (30 seconds, length of Creepers phase) { NPCID.Deerclops, 5400 }, // 1:30 (90 seconds) { NPCID.QueenBee, 7200 }, // 2:00 (120 seconds) - { NPCID.SkeletronHead, 9000 }, // 2:30 (150 seconds) + { NPCID.SkeletronHead, 7200 }, // 2:00 (120 seconds) { NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds) { NPCID.WallofFleshEye, 7200 }, { NPCID.QueenSlimeBoss, 7200 }, // 2:00 (120 seconds) @@ -611,11 +624,11 @@ namespace CalamityMod { ModContent.NPCType(), 5400 }, // 1:30 (90 seconds) { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) - { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) -- total length of Slime God fight - { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) - { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) - { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) -- split slimes should spawn at 1:00 and die at around 2:00 - { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) + { ModContent.NPCType(), 9000 }, // 2:30 (150 seconds) -- total length of Slime God fight + { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) + { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) + { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30 + { ModContent.NPCType(), 4500 }, // 1:15 (75 seconds) { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) { ModContent.NPCType(), 7200 }, @@ -643,8 +656,8 @@ namespace CalamityMod { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) - { ModContent.NPCType(), 14400 }, // NOTE: Sentinels Phase takes 1:00, so with that included it's 5:00 - { ModContent.NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 + { ModContent.NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 + { ModContent.NPCType(), 14400 }, { ModContent.NPCType(), 14700 }, // 4:05 (245 seconds) -- he spends 5 seconds invincible where you can't do anything { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) { ModContent.NPCType(), 21600 }, @@ -794,12 +807,6 @@ namespace CalamityMod public override object Call(params object[] args) => ModCalls.Call(args); #endregion - #region Recipes - public override void AddRecipeGroups() => CalamityRecipes.AddRecipeGroups(); - - public override void AddRecipes() => CalamityRecipes.AddRecipes(); - #endregion - #region Seasons public static Season CurrentSeason { diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 5b9c7a9e0c..21d9595985 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -24,41 +24,6 @@ namespace CalamityMod CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); switch (msgType) { - // - // Proficiency levels - // - - case CalamityModMessageType.MeleeLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0); - break; - case CalamityModMessageType.RangedLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1); - break; - case CalamityModMessageType.MagicLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2); - break; - case CalamityModMessageType.SummonLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3); - break; - case CalamityModMessageType.RogueLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4); - break; - case CalamityModMessageType.ExactMeleeLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0); - break; - case CalamityModMessageType.ExactRangedLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1); - break; - case CalamityModMessageType.ExactMagicLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2); - break; - case CalamityModMessageType.ExactSummonLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3); - break; - case CalamityModMessageType.ExactRogueLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4); - break; - // // Player mechanic syncs // @@ -246,17 +211,6 @@ namespace CalamityMod CalamityWorld.DraedonMechToSummon = (ExoMech)reader.ReadInt32(); break; - // - // Reforge syncs - // - - case CalamityModMessageType.ItemTypeLastReforgedSync: - Main.player[reader.ReadInt32()].Calamity().HandleItemTypeLastReforged(reader); - break; - case CalamityModMessageType.ReforgeTierSafetySync: - Main.player[reader.ReadInt32()].Calamity().HandleReforgeTierSafety(reader); - break; - // // Mouse control syncs // @@ -269,6 +223,19 @@ namespace CalamityMod break; + // + // Difficulty syncs + // + + case CalamityModMessageType.SyncDifficulties: + int sender = reader.ReadInt32(); + CalamityWorld.revenge = reader.ReadBoolean(); + CalamityWorld.death = reader.ReadBoolean(); + //TODO - Something so that other mods that hijack the difficulty ui can also use the remainder of the reader to have their own shit + + if (Main.netMode == NetmodeID.Server) + SyncCalamityWorldDifficulties(sender); + break; // // Default case: with no idea how long the packet is, we can't safely read data. @@ -288,7 +255,7 @@ namespace CalamityMod else if (e is IOException ioe) CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: An unknown I/O error occurred.", ioe); else - throw e; // this either will crash the game or be caught by TML's packet policing + throw; // this either will crash the game or be caught by TML's packet policing } } @@ -298,6 +265,21 @@ namespace CalamityMod NetMessage.SendData(MessageID.WorldData); } + public static void SyncCalamityWorldDifficulties(int sender) + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncDifficulties); + netMessage.Write(sender); + netMessage.Write(CalamityWorld.revenge); + netMessage.Write(CalamityWorld.death); + + //TODO - Let other mods also add their own bits in that sync. Ideally would be done through the difficultystem itself + netMessage.Send(-1, sender); + } + public static void NewNPC_ClientSide(Vector2 spawnPosition, int npcType, Player player) { if (Main.netMode == NetmodeID.SinglePlayer) @@ -318,19 +300,6 @@ namespace CalamityMod public enum CalamityModMessageType : byte { - // Proficiency levels - // TODO -- simplify proficiency netcode, there do not need to be this many separate packet types - MeleeLevelSync, - RangedLevelSync, - MagicLevelSync, - SummonLevelSync, - RogueLevelSync, - ExactMeleeLevelSync, - ExactRangedLevelSync, - ExactMagicLevelSync, - ExactSummonLevelSync, - ExactRogueLevelSync, - // Player mechanic syncs DefenseDamageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced when the player gets hit, or every time it heals up RageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is @@ -380,12 +349,11 @@ namespace CalamityMod AcidRainOldDukeSummonSync, EncounteredOldDukeSync, - // Reforge syncs - ItemTypeLastReforgedSync, // TODO -- reforge netcode is no longer needed thanks to 1.4 clone fixes - ReforgeTierSafetySync, - // Mouse Controls syncs RightClickSync, - MousePositionSync + MousePositionSync, + + // World state sync + SyncDifficulties } } diff --git a/Cooldowns/CooldownInstance.cs b/Cooldowns/CooldownInstance.cs index 510fcb7bb8..d1d7542d1a 100644 --- a/Cooldowns/CooldownInstance.cs +++ b/Cooldowns/CooldownInstance.cs @@ -2,6 +2,7 @@ using System.IO; using Terraria; using Terraria.ModLoader.IO; +using CalamityMod.UI; namespace CalamityMod.Cooldowns { @@ -108,7 +109,7 @@ namespace CalamityMod.Cooldowns /// /// A ratio of how "completed" an instance of a cooldown is. /// - public float Completion => duration != 0 ? timeLeft / (float)duration : 0; + public float Completion => CooldownRackUI.DebugFullDisplay ? CooldownRackUI.DebugForceCompletion : (duration != 0 ? timeLeft / (float)duration : 0); /// /// The handler which implements the behavior of this cooldown instance. diff --git a/Cooldowns/SandsmokeBomb.cs b/Cooldowns/SandsmokeBomb.cs new file mode 100644 index 0000000000..52685ba685 --- /dev/null +++ b/Cooldowns/SandsmokeBomb.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Items.Armor.DesertProwler; +using CalamityMod.Particles; +using CalamityMod.UI; + +namespace CalamityMod.Cooldowns +{ + public class SandsmokeBomb : CooldownHandler + { + public bool PowerActive => instance.timeLeft > DesertProwlerHat.SmokeCooldown; + public float PowerPercent => (instance.timeLeft - DesertProwlerHat.SmokeCooldown) / (float)DesertProwlerHat.SmokeDuration; + + + public static new string ID => "SandsmokeBomb"; + public override bool ShouldDisplay => true; + public override string DisplayName => PowerActive ? "Sandsmoke Bomb Duration" : "Sandsmoke Bomb Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/SandsmokeBomb"; + public override string OutlineTexture => "CalamityMod/Cooldowns/SandsmokeBombOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/SandsmokeBombOverlay"; + public override Color OutlineColor => new Color(255, 299, 156); + public override Color CooldownStartColor => PowerActive ? Color.Lerp(new Color(204, 181, 72), new Color(169, 142, 16), PowerPercent) : new Color(204, 181, 72); + public override Color CooldownEndColor => PowerActive ? Color.Lerp(new Color(204, 181, 72), new Color(169, 142, 16), PowerPercent) : new Color(169, 142, 16); + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombReload"); + + public override void OnCompleted() + { + for (int i = 0; i < 16; i++) + { + Vector2 dustDisplace = Main.rand.NextVector2Circular(80f, 50f); + Vector2 dustPosition = instance.player.MountedCenter + dustDisplace; + Vector2 dustSpeed = Main.rand.NextVector2Circular(0.5f, 0.5f) + instance.player.velocity / 8f - Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 0.06f; + dustSpeed.X += 1.4f * (float)Math.Sin(((dustDisplace.X + 80f) / 160f) * MathHelper.Pi) * (Main.rand.NextBool() ? -1 : 1); + Particle dust = new SandyDustParticle(dustPosition, dustSpeed, Color.White, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(20, 50), 0.03f, Vector2.UnitY * 0.03f); + GeneralParticleHandler.SpawnParticle(dust); + } + } + + //Charge down at first, and then charge back up + private float AdjustedCompletion => CooldownRackUI.DebugFullDisplay ? CooldownRackUI.DebugForceCompletion : PowerActive ? PowerPercent : 1 - (instance.timeLeft / (float)DesertProwlerHat.SmokeCooldown); + + public override void ApplyBarShaders(float opacity) + { + //Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + //Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Cooldowns/SandsmokeBomb.png b/Cooldowns/SandsmokeBomb.png new file mode 100644 index 0000000000..97eebf42e5 Binary files /dev/null and b/Cooldowns/SandsmokeBomb.png differ diff --git a/Cooldowns/SandsmokeBombOutline.png b/Cooldowns/SandsmokeBombOutline.png new file mode 100644 index 0000000000..a0acdea638 Binary files /dev/null and b/Cooldowns/SandsmokeBombOutline.png differ diff --git a/Cooldowns/SandsmokeBombOverlay.png b/Cooldowns/SandsmokeBombOverlay.png new file mode 100644 index 0000000000..324516aa3f Binary files /dev/null and b/Cooldowns/SandsmokeBombOverlay.png differ diff --git a/Cooldowns/WulfrumBastion.cs b/Cooldowns/WulfrumBastion.cs new file mode 100644 index 0000000000..84311ff237 --- /dev/null +++ b/Cooldowns/WulfrumBastion.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Items.Armor.Wulfrum; +using CalamityMod.UI; + +namespace CalamityMod.Cooldowns +{ + public class WulfrumBastion : CooldownHandler + { + public bool PowerActive => instance.timeLeft > WulfrumHat.BastionCooldown; + public float DurabilityPercent => (instance.timeLeft - WulfrumHat.BastionCooldown) / (float)WulfrumHat.BastionTime; + + + public static new string ID => "WulfrumBastion"; + public override bool ShouldDisplay => true; + public override string DisplayName => PowerActive ? "Power Armor Durability" : "Wulfrum Bastion Cooldown"; + public override string Texture => PowerActive ? "CalamityMod/Cooldowns/WulfrumBastionActive" : "CalamityMod/Cooldowns/WulfrumBastion"; + public override string OutlineTexture => "CalamityMod/Cooldowns/WulfrumBastionOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/WulfrumBastionOverlay"; + public override Color OutlineColor => PowerActive ? new Color(194, 255, 67) : new Color(206, 201, 170); + public override Color CooldownStartColor => PowerActive ? Color.Lerp(new Color(112, 244, 244), new Color(54, 177, 221), DurabilityPercent) : new Color(92, 187, 99); + public override Color CooldownEndColor => PowerActive ? Color.Lerp(new Color(112, 244, 244), new Color(54, 177, 221), DurabilityPercent) : new Color(160, 232, 77); + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionRecharge"); + //public override bool SavedWithPlayer => false; + + public override void OnCompleted() + { + for (int i = 0; i < 6; i++) + { + Vector2 dustDirection = Main.rand.NextVector2CircularEdge(1f, 1f); + Dust d = Dust.NewDustPerfect(instance.player.Center + dustDirection * Main.rand.NextFloat(0.4f, 10f), 226, dustDirection * Main.rand.NextFloat(1f, 4f), 100, Color.Transparent, Main.rand.NextFloat(0.8f, 1.2f)); + d.noGravity = true; + d.noLight = true; + d.fadeIn = 1f; + } + } + + //Charge down at first, and then charge back up + private float AdjustedCompletion => CooldownRackUI.DebugFullDisplay ? CooldownRackUI.DebugForceCompletion : PowerActive ? (instance.timeLeft - WulfrumHat.BastionCooldown) / (float)WulfrumHat.BastionTime : 1 - (instance.timeLeft / (float)WulfrumHat.BastionCooldown); + + public override void ApplyBarShaders(float opacity) + { + //Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + //Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Cooldowns/WulfrumBastion.png b/Cooldowns/WulfrumBastion.png new file mode 100644 index 0000000000..af341785a7 Binary files /dev/null and b/Cooldowns/WulfrumBastion.png differ diff --git a/Cooldowns/WulfrumBastionActive.png b/Cooldowns/WulfrumBastionActive.png new file mode 100644 index 0000000000..485d708e34 Binary files /dev/null and b/Cooldowns/WulfrumBastionActive.png differ diff --git a/Cooldowns/WulfrumBastionOutline.png b/Cooldowns/WulfrumBastionOutline.png new file mode 100644 index 0000000000..522a00d293 Binary files /dev/null and b/Cooldowns/WulfrumBastionOutline.png differ diff --git a/Cooldowns/WulfrumBastionOverlay.png b/Cooldowns/WulfrumBastionOverlay.png new file mode 100644 index 0000000000..36a775e1c8 Binary files /dev/null and b/Cooldowns/WulfrumBastionOverlay.png differ diff --git a/Cooldowns/WulfrumRoverDrive.cs b/Cooldowns/WulfrumRoverDrive.cs new file mode 100644 index 0000000000..6eb90943ff --- /dev/null +++ b/Cooldowns/WulfrumRoverDrive.cs @@ -0,0 +1,93 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Items.Accessories; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using System; + +namespace CalamityMod.Cooldowns +{ + public class WulfrumRoverDriveDurability : CooldownHandler + { + private static Color ringColorLerpStart = new Color(49, 220, 221); + private static Color ringColorLerpEnd = new Color(99, 226, 142); + + private float AdjustedCompletion => (instance.timeLeft) / (float)RoverDrive.ProtectionMatrixDurabilityMax; + + public static new string ID => "WulfrumRoverDriveDurability"; + public override bool CanTickDown => !instance.player.GetModPlayer().RoverDriveOn || instance.timeLeft <= 0; + public override bool ShouldDisplay => instance.player.GetModPlayer().RoverDriveOn; + public override string DisplayName => "Protective Matrix Durability"; + public override string Texture => "CalamityMod/Cooldowns/WulfrumRoverDriveActive"; + public override string OutlineTexture => "CalamityMod/Cooldowns/WulfrumRoverDriveOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/WulfrumRoverDriveOverlay"; + public override Color OutlineColor => new Color(112, 244, 244); + public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override bool SavedWithPlayer => false; + public override bool PersistsThroughDeath => false; + + + public override void ApplyBarShaders(float opacity) + { + //Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + float Xoffset = instance.timeLeft > 9 ? -10f : -5; + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + new Vector2(Xoffset, 4) * scale, Color.Lerp(ringColorLerpStart, Color.OrangeRed, 1 - instance.Completion), Color.Black, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + //Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + float Xoffset = instance.timeLeft > 9 ? -10f : -5; + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + new Vector2(Xoffset, 4) * scale, Color.Lerp(ringColorLerpStart, Color.OrangeRed, 1 - instance.Completion), Color.Black, scale); + } + } + + public class WulfrumRoverDriveRecharge : CooldownHandler + { + private static Color ringColorLerpStart = new Color(194, 255, 57); + private static Color ringColorLerpEnd = new Color(92, 187, 99); + + public static new string ID => "WulfrumRoverDriveRecharge"; + public override bool ShouldDisplay => true; + public override string DisplayName => "Protective Matrix Recharge"; + public override string Texture => "CalamityMod/Cooldowns/WulfrumRoverDrive"; + public override bool SavedWithPlayer => false; + public override bool PersistsThroughDeath => false; + public override Color OutlineColor => new Color(194, 255, 67); + public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + + public override void OnCompleted() => instance.player.GetModPlayer().ProtectionMatrixDurability = RoverDrive.ProtectionMatrixDurabilityMax; + public override SoundStyle? EndSound => null; + } +} diff --git a/Cooldowns/WulfrumRoverDrive.png b/Cooldowns/WulfrumRoverDrive.png new file mode 100644 index 0000000000..f1166cb024 Binary files /dev/null and b/Cooldowns/WulfrumRoverDrive.png differ diff --git a/Cooldowns/WulfrumRoverDriveActive.png b/Cooldowns/WulfrumRoverDriveActive.png new file mode 100644 index 0000000000..ba476787c7 Binary files /dev/null and b/Cooldowns/WulfrumRoverDriveActive.png differ diff --git a/Cooldowns/WulfrumRoverDriveOutline.png b/Cooldowns/WulfrumRoverDriveOutline.png new file mode 100644 index 0000000000..0bf2e0315a Binary files /dev/null and b/Cooldowns/WulfrumRoverDriveOutline.png differ diff --git a/Cooldowns/WulfrumRoverDriveOverlay.png b/Cooldowns/WulfrumRoverDriveOverlay.png new file mode 100644 index 0000000000..ff2e2f376b Binary files /dev/null and b/Cooldowns/WulfrumRoverDriveOverlay.png differ diff --git a/DataStructures/BezierCurve.cs b/DataStructures/BezierCurve.cs index a97725294e..983bdde572 100644 --- a/DataStructures/BezierCurve.cs +++ b/DataStructures/BezierCurve.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System.Collections.Generic; namespace CalamityMod.DataStructures @@ -34,6 +34,9 @@ namespace CalamityMod.DataStructures points = nextPoints; } + if (points.Length <= 1) + return Vector2.Zero; + return Vector2.Lerp(points[0], points[1], T); } } diff --git a/DataStructures/DeadMinionProperties.cs b/DataStructures/DeadMinionProperties.cs index ea82b81f93..3543e28288 100644 --- a/DataStructures/DeadMinionProperties.cs +++ b/DataStructures/DeadMinionProperties.cs @@ -98,9 +98,7 @@ namespace CalamityMod.DataStructures return; Player owner = Main.player[ownerIndex]; - Endogenesis.SummonEndoCooper(new EntitySource_Misc("1"), AttackMode, Main.MouseWorld, Damage, OriginalKnockback, owner, out int bodyIndex, out int limbsIndex); - Main.projectile[bodyIndex].originalDamage = OriginalDamage; - Main.projectile[limbsIndex].originalDamage = OriginalDamage; + Endogenesis.SummonEndoCooper(new EntitySource_Misc("1"), AttackMode, Main.MouseWorld, Damage, OriginalDamage, OriginalKnockback, owner, out int bodyIndex, out int limbsIndex); Main.projectile[bodyIndex].Calamity().RequiresManualResurrection = true; Main.projectile[limbsIndex].Calamity().RequiresManualResurrection = true; } diff --git a/DataStructures/IAdditiveDrawer.cs b/DataStructures/IAdditiveDrawer.cs new file mode 100644 index 0000000000..1081cf511b --- /dev/null +++ b/DataStructures/IAdditiveDrawer.cs @@ -0,0 +1,17 @@ +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.DataStructures +{ + + // Restarting the sprite batch for each different projectile is analogously equivalent to creating an entire new factory just to build a single car. + // It is inefficient and leads to performance problems as many projectiles do it. + // To mitigate this problem, a special interface exists for the purpose of deferring drawing of certain entities to a time in which they all may be + // subject to the same additive draw state before all of the spritebatch's contents are flushed. + // Manual drawing hooks should not be utilized when using this interface, such as ModNPC.PreDraw. + + // The implementation of this is almost identical to that of SLR but they're both so simple that it really shouldn't matter. + public interface IAdditiveDrawer + { + void AdditiveDraw(SpriteBatch spriteBatch); + } +} diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 6628b6ed76..03907ff8bf 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -567,7 +567,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(NPCID.QueenBee, ProjectileID.Stinger), new int[] { 22, 44, 64, 72, 96 } }, // 66 damage in non-rev master mode + { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 72, 96 } }, // 66 damage in non-rev master mode { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 68, 84, 92, 126 } }, // 102 damage in non-rev master mode { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 40, 60, 76, 84, 114 } }, @@ -627,11 +627,11 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 240, 252, 342 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 100, 124, 136, 186 } }, { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 160, 222 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.SaucerMissile), new int[] { 60, 120, 148, 160, 222 } }, { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 160, 222 } }, { new Tuple(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 240 } }, { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, // 150 in non-rev master mode diff --git a/DataStructures/VerletSimulatedSegments.cs b/DataStructures/VerletSimulatedSegments.cs new file mode 100644 index 0000000000..8f9a1d031e --- /dev/null +++ b/DataStructures/VerletSimulatedSegments.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using System.Collections.Generic; + +namespace CalamityMod.DataStructures +{ + public class VerletSimulatedSegment + { + public Vector2 position, oldPosition; + public bool locked; + + public VerletSimulatedSegment(Vector2 _position, bool _locked = false) + { + position = _position; + oldPosition = _position; + locked = _locked; + } + + public static List SimpleSimulation(List segments, float segmentDistance, int loops = 10, float gravity = 0.3f) + { + //https://youtu.be/PGk0rnyTa1U?t=400 verlet integration chains reference here + foreach (VerletSimulatedSegment segment in segments) + { + if (!segment.locked) + { + Vector2 positionBeforeUpdate = segment.position; + + segment.position += (segment.position - segment.oldPosition); // This adds conservation of energy to the segments. This makes it super bouncy and shouldnt be used but it's really funny + segment.position += Vector2.UnitY * gravity; //=> This adds gravity to the segments. + + segment.oldPosition = positionBeforeUpdate; + } + } + + int segmentCount = segments.Count; + + for (int k = 0; k < loops; k++) + { + for (int j = 0; j < segmentCount - 1; j++) + { + VerletSimulatedSegment pointA = segments[j]; + VerletSimulatedSegment pointB = segments[j + 1]; + Vector2 segmentCenter = (pointA.position + pointB.position) / 2f; + Vector2 segmentDirection = Terraria.Utils.SafeNormalize(pointA.position - pointB.position, Vector2.UnitY); + + if (!pointA.locked) + pointA.position = segmentCenter + segmentDirection * segmentDistance / 2f; + + if (!pointB.locked) + pointB.position = segmentCenter - segmentDirection * segmentDistance / 2f; + + segments[j] = pointA; + segments[j + 1] = pointB; + } + } + + return segments; + } + } +} diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index b43eca0ba8..a2830d2e3c 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -36,6 +36,12 @@ namespace CalamityMod.Effects public static Effect LocalLinearTransformationShader; public static Effect BasicPrimitiveShader; public static Effect ArtemisLaserShader; + public static Effect ExobladeSlashShader; + public static Effect ExobladePierceShader; + public static Effect ExoVortexShader; + public static Effect SideStreakTrailShader; + public static Effect HeavenlyGaleTrailShader; + public static Effect HeavenlyGaleLightningShader; public static Effect BaseFusableParticleEdgeShader; public static Effect AdditiveFusableParticleEdgeShader; @@ -75,6 +81,12 @@ namespace CalamityMod.Effects LocalLinearTransformationShader = CalamityMod.Instance.Assets.Request("Effects/LocalLinearTransformationShader", AssetRequestMode.ImmediateLoad).Value; BasicPrimitiveShader = CalamityMod.Instance.Assets.Request("Effects/BasicPrimitiveShader", AssetRequestMode.ImmediateLoad).Value; ArtemisLaserShader = CalamityMod.Instance.Assets.Request("Effects/ArtemisLaserShader", AssetRequestMode.ImmediateLoad).Value; + ExobladeSlashShader = CalamityMod.Instance.Assets.Request("Effects/ExobladeSlashShader", AssetRequestMode.ImmediateLoad).Value; + ExobladePierceShader = CalamityMod.Instance.Assets.Request("Effects/ExobladePierceShader", AssetRequestMode.ImmediateLoad).Value; + ExoVortexShader = CalamityMod.Instance.Assets.Request("Effects/ExoVortexShader", AssetRequestMode.ImmediateLoad).Value; + SideStreakTrailShader = CalamityMod.Instance.Assets.Request("Effects/SideStreakTrail", AssetRequestMode.ImmediateLoad).Value; + HeavenlyGaleTrailShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleTrailShader", AssetRequestMode.ImmediateLoad).Value; + HeavenlyGaleLightningShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleLightningShader", AssetRequestMode.ImmediateLoad).Value; BaseFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/BaseFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; AdditiveFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; @@ -111,6 +123,12 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:LinearTransformation"] = new MiscShaderData(new Ref(LocalLinearTransformationShader), "TransformationPass"); GameShaders.Misc["CalamityMod:PrimitiveDrawer"] = new MiscShaderData(new Ref(BasicPrimitiveShader), "TrailPass"); GameShaders.Misc["CalamityMod:ArtemisLaser"] = new MiscShaderData(new Ref(ArtemisLaserShader), "TrailPass"); + GameShaders.Misc["CalamityMod:ExobladeSlash"] = new MiscShaderData(new Ref(ExobladeSlashShader), "TrailPass"); + GameShaders.Misc["CalamityMod:ExobladePierce"] = new MiscShaderData(new Ref(ExobladePierceShader), "PiercePass"); + GameShaders.Misc["CalamityMod:ExoVortex"] = new MiscShaderData(new Ref(ExoVortexShader), "VortexPass"); + GameShaders.Misc["CalamityMod:SideStreakTrail"] = new MiscShaderData(new Ref(SideStreakTrailShader), "TrailPass"); + GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"] = new MiscShaderData(new Ref(HeavenlyGaleTrailShader), "PiercePass"); + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"] = new MiscShaderData(new Ref(HeavenlyGaleLightningShader), "TrailPass"); GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"] = new MiscShaderData(new Ref(BaseFusableParticleEdgeShader), "ParticlePass"); GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"] = new MiscShaderData(new Ref(AdditiveFusableParticleEdgeShader), "ParticlePass"); @@ -125,6 +143,26 @@ namespace CalamityMod.Effects screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/PixelatedSightLine", AssetRequestMode.ImmediateLoad).Value); Filters.Scene["PixelatedSightLine"] = new Filter(new ScreenShaderData(screenRef, "SightLinePass"), EffectPriority.High); Filters.Scene["PixelatedSightLine"].Load(); + + screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/WulfrumTilePing", AssetRequestMode.ImmediateLoad).Value); + Filters.Scene["WulfrumTilePing"] = new Filter(new ScreenShaderData(screenRef, "TilePingPass"), EffectPriority.High); + Filters.Scene["WulfrumTilePing"].Load(); + + screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/WulfrumScaffoldSelection", AssetRequestMode.ImmediateLoad).Value); + Filters.Scene["WulfrumScaffoldSelection"] = new Filter(new ScreenShaderData(screenRef, "TilePingPass"), EffectPriority.High); + Filters.Scene["WulfrumScaffoldSelection"].Load(); + + screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/RoverDriveShield", AssetRequestMode.ImmediateLoad).Value); + Filters.Scene["RoverDriveShield"] = new Filter(new ScreenShaderData(screenRef, "ShieldPass"), EffectPriority.High); + Filters.Scene["RoverDriveShield"].Load(); + + screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/RotateSprite", AssetRequestMode.ImmediateLoad).Value); + Filters.Scene["RotateSprite"] = new Filter(new ScreenShaderData(screenRef, "RotationPass"), EffectPriority.High); + Filters.Scene["RotateSprite"].Load(); + + screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/SwingSprite", AssetRequestMode.ImmediateLoad).Value); + Filters.Scene["SwingSprite"] = new Filter(new ScreenShaderData(screenRef, "SwingPass"), EffectPriority.High); + Filters.Scene["SwingSprite"].Load(); } } } diff --git a/Effects/ExoVortexShader.fx b/Effects/ExoVortexShader.fx new file mode 100644 index 0000000000..a56cd1b0c0 --- /dev/null +++ b/Effects/ExoVortexShader.fx @@ -0,0 +1,35 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float4 uShaderSpecificData; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // Calculate the swirl coordinates. + float2 centeredCoords = coords - 0.5; + float swirlRotation = length(centeredCoords) * 17.2 - uTime * 6; + float swirlColorFade = 1 - saturate(length(centeredCoords) * 1.8); + float swirlSine = sin(swirlRotation); + float swirlCosine = sin(swirlRotation + 1.5707); + float2x2 swirlRotationMatrix = float2x2(swirlCosine, -swirlSine, swirlSine, swirlCosine); + float2 swirlCoordinates = mul(centeredCoords, swirlRotationMatrix) + 0.5; + return tex2D(uImage0, swirlCoordinates) * sampleColor * swirlColorFade; +} +technique Technique1 +{ + pass VortexPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/ExoVortexShader.xnb b/Effects/ExoVortexShader.xnb new file mode 100644 index 0000000000..2a3c3b1e0e Binary files /dev/null and b/Effects/ExoVortexShader.xnb differ diff --git a/Effects/ExobladePierceShader.fx b/Effects/ExobladePierceShader.fx new file mode 100644 index 0000000000..59198ebfd6 --- /dev/null +++ b/Effects/ExobladePierceShader.fx @@ -0,0 +1,72 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +sampler uImage2 : register(s2); +float3 uColor; +float3 uSecondaryColor; +float3 fireColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float2 uImageSize2; +matrix uWorldViewProjection; +float4 uShaderSpecificData; +bool flipped; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float InverseLerp(float from, float to, float x) +{ + return saturate((x - from) / (to - from)); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + float bloomOpacity = pow(sin(coords.y * 3.141), 5.6); + float noise = tex2D(uImage1, coords * 3 - float2(uTime * 2.44, 0)); + float brightnessStreak = tex2D(uImage2, coords * float2(2, 1) - float2(uTime * 1.61, 0)) + noise * bloomOpacity; + float4 energyColor = float4(lerp(uColor, uSecondaryColor, noise), 1); + + return (energyColor * bloomOpacity + brightnessStreak * bloomOpacity) * color.a * pow(1 - coords.x, 1.6); +} + +technique Technique1 +{ + pass PiercePass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/ExobladePierceShader.xnb b/Effects/ExobladePierceShader.xnb new file mode 100644 index 0000000000..8a491cee1d Binary files /dev/null and b/Effects/ExobladePierceShader.xnb differ diff --git a/Effects/ExobladeSlashShader.fx b/Effects/ExobladeSlashShader.fx new file mode 100644 index 0000000000..906e61476b --- /dev/null +++ b/Effects/ExobladeSlashShader.fx @@ -0,0 +1,90 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +sampler uImage2 : register(s2); +float3 uColor; +float3 uSecondaryColor; +float3 fireColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float2 uImageSize2; +matrix uWorldViewProjection; +float4 uShaderSpecificData; +bool flipped; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float InverseLerp(float from, float to, float x) +{ + return saturate((x - from) / (to - from)); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + if (flipped) + coords.y = 1 - coords.y; + + float2 noiseCoords = coords * float2(0.5, 3) - float2(uTime * 0.45, 0); + noiseCoords.x = sin(noiseCoords.x * 5.4) * 0.5 + 0.5; + float noise = tex2D(uImage1, noiseCoords).r; + float noise2 = pow(tex2D(uImage1, noiseCoords * 2.2).r, 1.6); + float noise3 = pow(tex2D(uImage1, noiseCoords * 1.1).r, 1.3); + float opacity = noise * pow(saturate((1 - coords.x) - noise * coords.y * 0.54), 3); + + // Fade to the second primary color. + color = lerp(color, float4(uColor, 1), noise2); + + // Create dark colors. + float darkColorWeight = saturate(coords.y * 1.8 + coords.x * 0.45 + noise * 0.1); + color = lerp(color, float4(uSecondaryColor, 1), darkColorWeight); + + // Create a fire streak. + float fireColorWeight = InverseLerp(0.3, 0, coords.y) * pow(1 - coords.x, 1.56); + color = lerp(color, float4(fireColor, 1), fireColorWeight); + + float4 noiseColor = color * opacity * (noise3 * 2.4 + 2.4); + noiseColor.a = lerp(noiseColor.a, 0, 1 - fireColorWeight); + return noiseColor; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/ExobladeSlashShader.xnb b/Effects/ExobladeSlashShader.xnb new file mode 100644 index 0000000000..81e2e5191b Binary files /dev/null and b/Effects/ExobladeSlashShader.xnb differ diff --git a/Effects/HeavenlyGaleLightningShader.fx b/Effects/HeavenlyGaleLightningShader.fx new file mode 100644 index 0000000000..449fe01b37 --- /dev/null +++ b/Effects/HeavenlyGaleLightningShader.fx @@ -0,0 +1,60 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + float distortion = lerp(-1, 1, tex2D(uImage1, coords + float2(0, uTime * sign(coords.y > 0.5 ? -1 : 1) * 1.81)).r); + float opacity = pow(sin((coords.y + distortion * 0.15) * 3.141), distortion * 3.95 + 7); + return color * pow(opacity, 0.25) + opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/HeavenlyGaleLightningShader.xnb b/Effects/HeavenlyGaleLightningShader.xnb new file mode 100644 index 0000000000..fce4bd53d8 Binary files /dev/null and b/Effects/HeavenlyGaleLightningShader.xnb differ diff --git a/Effects/HeavenlyGaleTrailShader.fx b/Effects/HeavenlyGaleTrailShader.fx new file mode 100644 index 0000000000..bece1e91a6 --- /dev/null +++ b/Effects/HeavenlyGaleTrailShader.fx @@ -0,0 +1,73 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +sampler uImage2 : register(s2); +float3 uColor; +float3 uSecondaryColor; +float3 fireColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float2 uImageSize2; +matrix uWorldViewProjection; +float4 uShaderSpecificData; +bool flipped; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float InverseLerp(float from, float to, float x) +{ + return saturate((x - from) / (to - from)); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + float bloomOpacity = pow(sin(coords.y * 3.141), 5.6); + float noise = tex2D(uImage1, coords * 3 - float2(uTime * 2.44, 0)); + float brightnessStreak = tex2D(uImage2, coords * float2(2, 1) - float2(uTime * 1.61, 0)) + noise * bloomOpacity; + float4 energyColor = float4(lerp(uColor, uSecondaryColor, noise), 1); + float widthOpacity = pow(sin(coords.y * 3.141), InverseLerp(0.1, 0, coords.x) * 20); + + return (energyColor * bloomOpacity + brightnessStreak * bloomOpacity) * color.a * pow(1 - coords.x, 1.6) * widthOpacity; +} + +technique Technique1 +{ + pass PiercePass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/HeavenlyGaleTrailShader.xnb b/Effects/HeavenlyGaleTrailShader.xnb new file mode 100644 index 0000000000..5f3eb77dcd Binary files /dev/null and b/Effects/HeavenlyGaleTrailShader.xnb differ diff --git a/Effects/RotateSprite.fx b/Effects/RotateSprite.fx new file mode 100644 index 0000000000..bd91a83ed0 --- /dev/null +++ b/Effects/RotateSprite.fx @@ -0,0 +1,38 @@ +float rotation; // The rotation of the sprite. +float4 color; + + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +float realCos(float value) +{ + return sin(value + 1.57079); +} + +//This only works on square sprites. +float4 main(float2 uv : TEXCOORD) : COLOR +{ + float2x2 rotate = float2x2(realCos(rotation), -sin(rotation), sin(rotation), realCos(rotation)); + float spriteDiagonal = 1 / (sqrt(2) / 2); + float2x2 downscale = float2x2(spriteDiagonal, 0, 0, spriteDiagonal); + + uv += float2(-0.5, -0.5); //remap the uv to (-0.5, -0.5) - (0.5, 0.5) for trig to work. + uv = mul(uv, rotate); + uv = mul(uv, downscale); + uv += float2(0.5, 0.5); //remap the uv properly + + //Crop (Attempting to sample a texture with coordinates that arent between 0 to 1 wraps it around + if (uv.x < 0 || uv.x >= 1 || uv.y < 0 || uv.y >= 1) + return float4(0, 0, 0, 0); + + return tex2D(Texture1Sampler, uv) * color; +} + +technique Technique1 +{ + pass RotationPass + { + PixelShader = compile ps_2_0 main(); + } +} diff --git a/Effects/RotateSprite.xnb b/Effects/RotateSprite.xnb new file mode 100644 index 0000000000..a4475a6c47 Binary files /dev/null and b/Effects/RotateSprite.xnb differ diff --git a/Effects/RoverDriveShield.fx b/Effects/RoverDriveShield.fx new file mode 100644 index 0000000000..ef427472cf --- /dev/null +++ b/Effects/RoverDriveShield.fx @@ -0,0 +1,53 @@ +float time; +float blowUpPower; //The power the blow up effect is set as. Ideally betwen 0 and 1 +float blowUpSize; //The strenght of the expansion caused by the blow up effect +float3 shieldColor; +float shieldOpacity; +float3 shieldEdgeColor; +float shieldEdgeBlendStrenght; +float noiseScale; +float resolution; + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +float4 main(float2 uv : TEXCOORD) : COLOR +{ + //Pixelate? + //uv.x -= uv.x % (1 / resolution); + //uv.y -= uv.y % (1 / resolution); + + //Crop in a circle + float distanceFromCenter = length(uv - float2(0.5, 0.5)) * 2; + if (distanceFromCenter > 1) + return float4(0, 0, 0, 0); + + //"Blow up" the noise map so it looks circular. + float blownUpUVX = pow((abs(uv.x - 0.5)) * 2, blowUpPower); + float blownUpUVY = pow((abs(uv.y - 0.5)) * 2, blowUpPower); + float2 blownUpUV = float2(-blownUpUVY * blowUpSize * 0.5 + uv.x * (1 + blownUpUVY * blowUpSize), -blownUpUVX * blowUpSize * 0.5 + uv.y * (1 + blownUpUVX * blowUpSize)); + + //Rescale + blownUpUV *= noiseScale; + //Scroll effect + blownUpUV.x = (blownUpUV.x + time) % 1; + + //Get the noise color + float4 noiseColor = tex2D(Texture1Sampler, blownUpUV); + + //Apply a layers of fake fresnel + noiseColor += pow(distanceFromCenter, 6); // + pow(distanceFromCenter, 3) * 0.6; <- Brings us over into ps 3.0 territory if we have pixelation on. + //Fade the edges + if (distanceFromCenter > 0.95) + noiseColor *= (1 - ((distanceFromCenter - 0.95) / 0.05)); + + return noiseColor * float4(lerp(shieldColor, shieldEdgeColor, pow(distanceFromCenter, shieldEdgeBlendStrenght)), shieldOpacity); +} + +technique Technique1 +{ + pass ShieldPass + { + PixelShader = compile ps_2_0 main(); + } +} \ No newline at end of file diff --git a/Effects/RoverDriveShield.xnb b/Effects/RoverDriveShield.xnb new file mode 100644 index 0000000000..f26b005c5d Binary files /dev/null and b/Effects/RoverDriveShield.xnb differ diff --git a/Effects/SideStreakTrail.fx b/Effects/SideStreakTrail.fx new file mode 100644 index 0000000000..a4fcdc08e3 --- /dev/null +++ b/Effects/SideStreakTrail.fx @@ -0,0 +1,72 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float innerBrightnessIntensity = 2.7; + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + float bloomOpacity = pow(cos(coords.y * 4.8 - 0.8), 55 + pow(coords.x, 4) * 700); + + // Create some noisy opaque blotches in the inner part of the trail. + if (coords.y > 0.15 && coords.y < 0.85) + { + float minOpacity = pow(1 - sin(coords.y * 3.141) + tex2D(uImage1, coords * 1.1 + float2(uTime * -0.6, 0)).r * 2.2, 0.2); + bloomOpacity += pow(coords.x, 0.3) * lerp(0.04, 0.4, minOpacity); + } + + // Make the front half of the trail have a strong bloom effect. + if (coords.x < 0.5) + bloomOpacity *= (1 - coords.x * 2) * innerBrightnessIntensity + 1; + + return color * lerp(0, 3.6, bloomOpacity * pow(coords.x, 0.1)) * pow(1 - coords.x, 1.1); +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/SideStreakTrail.xnb b/Effects/SideStreakTrail.xnb new file mode 100644 index 0000000000..a9983c063f Binary files /dev/null and b/Effects/SideStreakTrail.xnb differ diff --git a/Effects/SwingSprite.fx b/Effects/SwingSprite.fx new file mode 100644 index 0000000000..62e1157275 --- /dev/null +++ b/Effects/SwingSprite.fx @@ -0,0 +1,68 @@ +float rotation; // The rotation of the sword sprite. +//float2 spriteDimensions; //The size of the sprite (necessary as the shader only gives us a map between 0 and 1). +float pommelToOriginPercent; //I have no idea for a better variable name. This is the perccentage of the full lenght between the rotation origin and the sword's tip that is an empty gap between it and the bottom left of the sword. +float4 color; + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +float realCos(float value) +{ + return sin(value + 1.57079); +} + +//This only works on square sprites. Commented out code can be found for attempts to make it work on non square sprites but my god is it a headache to work with transform matrices +//In a context like that. Gee. +//At this point i barely understand why some of it works but yea it just happens. +float4 main(float2 uv : TEXCOORD) : COLOR +{ + //Transformation matrices + //float2x2 squareify = float2x2(1, 0, 0, 1); + //float2x2 unsquareify = float2x2(1, 0, 0, 1); + + float2x2 rotate = float2x2(realCos(rotation), -sin(rotation), sin(rotation), realCos(rotation)); + float spriteDiagonal = 1 / (sqrt(2) / 4); + float spriteDiagonalReal = spriteDiagonal * (1 / (1 - pommelToOriginPercent)); + + float2x2 downscale = float2x2(spriteDiagonalReal, 0, 0, spriteDiagonalReal); + float displaceFromOrigin = (1 / (1 - pommelToOriginPercent)) * (1 - 0.5 * (1 - pommelToOriginPercent)); //It's complicated as fuck to explain, but this gets the distance of the displacement. + + /* + //Since the rotation effect stretches and squishes sprites that arent square, we have to turn it into a square before the rotation (and then unsquareify it after its done) + if (spriteDimensions.x != spriteDimensions.y) + { + float aspectRatio = max(spriteDimensions.x, spriteDimensions.y) / min(spriteDimensions.x, spriteDimensions.y); + //Rescale matrix + squareify = float2x2(1, 0, 0, aspectRatio); + unsquareify = float2x2(1 / aspectRatio, 0, 0, 1 / aspectRatio); + + if (spriteDimensions.x > spriteDimensions.y) + { + squareify = float2x2(aspectRatio, 0, 0, 1); + unsquareify = float2x2(1 / aspectRatio, 0, 0, 1 / aspectRatio); + } + } + */ + + uv += float2(-0.5, -0.5); //remap the uv to (-0.5, -0.5) - (0.5, 0.5) for trig to work. + //uv = mul(uv, squareify); + uv = mul(uv, rotate); + uv = mul(uv, downscale); + //uv = mul(uv, unsquareify); + uv += float2(-displaceFromOrigin, displaceFromOrigin); + uv += float2(0.5, 0.5); //remap the uv properly + + //Crop (Attempting to sample a texture with coordinates that arent between 0 to 1 wraps it around + if (uv.x < 0 || uv.x >= 1 || uv.y < 0 || uv.y >= 1) + return float4(0, 0, 0, 0); + + return tex2D(Texture1Sampler, uv) * color; +} + +technique Technique1 +{ + pass SwingPass + { + PixelShader = compile ps_2_0 main(); + } +} diff --git a/Effects/SwingSprite.xnb b/Effects/SwingSprite.xnb new file mode 100644 index 0000000000..f3b222ac54 Binary files /dev/null and b/Effects/SwingSprite.xnb differ diff --git a/Effects/WulfrumScaffoldSelection.fx b/Effects/WulfrumScaffoldSelection.fx new file mode 100644 index 0000000000..e97f8f85f6 --- /dev/null +++ b/Effects/WulfrumScaffoldSelection.fx @@ -0,0 +1,189 @@ +float Resolution; //Pixel resolution + +float time; +float tileEdgeBlendStrenght; //How hard the border of a tile should get blended away. +float mainOpacity; +float blinkTime; + +float4 baseTintColor; //Color of the tile's overlay +float3 tileEdgeColor; //Color of the tile's edge effects +float4 scanlineColor; //Color of the scanline effects +float4 placementGlowColor; //Color of the tile when first placed + +float4 ScanLines[10]; +int ScanLinesCount; +int verticalScanLinesIndex; + +//Per tile stuff +float2 tilePosition; //The position of the top left of the tile +bool4 cardinalConnections; //Up, Left, Right, Down connections. + + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +bool AND(bool4 value) +{ + return value.x && value.y && value.z && value.w; +} + +int COUNT(bool4 value) +{ + int count = 0; + + if (value.x) + count++; + if (value.y) + count++; + if (value.z) + count++; + if (value.w) + count++; + + return count; +} + +float MOD(float a, float n) +{ + return a - floor(a / n) * n; +} + +float inverselerp(float x, float start, float end) +{ + return clamp((x - start) / (end - start), 0, 1); +} + +//Checks if a corner should be drawn or excluded, based on how many edges the pixel is near to. +bool cornerDrawCheck(float2 position) +{ + float oneEight = 1 / Resolution; + float sevenEights = 7 / Resolution; + + bool4 edgeChecks = bool4(false, false, false, false); + + //top + if (position.y < oneEight && !cardinalConnections.x) + edgeChecks.x = true; + + //bottom + if (position.y >= sevenEights && !cardinalConnections.w) + edgeChecks.w = true; + + //left + if (position.x < oneEight && !cardinalConnections.y) + edgeChecks.y = true; + + //right + if (position.x >= sevenEights && !cardinalConnections.z) + edgeChecks.z = true; + + //if on 2 edges at once, youre on a corner + return COUNT(edgeChecks) < 2; +} + +//Gets the gradient from the tile outline effects +float getOpacityFromEdge(float2 position) +{ + //If fully surrounded, don't draw anything + if (AND(cardinalConnections)) + return 0; + + float oneFourth = 1 / Resolution; + float twoFourths = 3 / Resolution; + float threeFourths = 4 / Resolution; + float one = 7 / Resolution; + + float baseOpacity = 0; + + //up + if (!cardinalConnections.x) + baseOpacity += pow(inverselerp(position.y, twoFourths, 0), tileEdgeBlendStrenght); + + //down + if (!cardinalConnections.w) + baseOpacity += pow(inverselerp(position.y, threeFourths, one), tileEdgeBlendStrenght); + + //left + if (!cardinalConnections.y) + baseOpacity += pow(inverselerp(position.x, twoFourths, 0), tileEdgeBlendStrenght); + + //right + if (!cardinalConnections.z) + baseOpacity += pow(inverselerp(position.x, threeFourths, one), tileEdgeBlendStrenght); + + return baseOpacity; +} + +//Gets the opacity of the scanline on the specific pixel +float getOpacityFromScanLine(float2 position) +{ + float opacity = 0; + float4 scanline; + + //x = offset from origin, y = period, z = speed, w = opacity. + for (int i = 0; i < ScanLinesCount; i++) + { + scanline = ScanLines[i]; + + float pixelPos; + if (i >= verticalScanLinesIndex) + pixelPos = (position.x + tilePosition.x / 16) % scanline.y; + + else + pixelPos = (position.y + tilePosition.y / 16) % scanline.y; + + //Custom mod in case scanline.z is negative, aka the scanline moves in the opposite direction. + float scanlinePos = MOD((scanline.x + time * scanline.z), scanline.y); + + scanlinePos -= scanlinePos % (1 / Resolution); + + pixelPos -= pixelPos % (1 / Resolution); + + if (pixelPos == scanlinePos) + opacity += scanline.w; + } + + + return opacity * (scanlineColor.a - baseTintColor.a); +} + +float4 main(float2 uv : TEXCOORD) : COLOR +{ + //Pixelate + uv.x -= uv.x % (1 / Resolution); + uv.y -= uv.y % (1 / Resolution); + + //Don't draw the corner the case of a missing corner. + if (!cornerDrawCheck(uv)) + return float4(0, 0, 0, 0); + + + float3 ColorTotal = lerp(baseTintColor.rgb, placementGlowColor.rgb, blinkTime); + float OpacityTotal = lerp(baseTintColor.a, placementGlowColor.a, blinkTime); + + //Do the outlines + float tileEdgeBlend = getOpacityFromEdge(uv); + OpacityTotal = lerp(OpacityTotal, 1, tileEdgeBlend); + ColorTotal = lerp(ColorTotal, tileEdgeColor, tileEdgeBlend); + + float scanlineOpacity = getOpacityFromScanLine(uv); + if (scanlineOpacity > 0) + { + OpacityTotal += scanlineOpacity; + ColorTotal = lerp(ColorTotal, scanlineColor.rgb, scanlineOpacity); + } + + //General fade out + OpacityTotal *= mainOpacity; + + ColorTotal = ColorTotal * OpacityTotal; + return float4(ColorTotal, OpacityTotal); +} + +technique Technique1 +{ + pass TileSelectPass + { + PixelShader = compile ps_3_0 main(); + } +} \ No newline at end of file diff --git a/Effects/WulfrumScaffoldSelection.xnb b/Effects/WulfrumScaffoldSelection.xnb new file mode 100644 index 0000000000..61ac0a7311 Binary files /dev/null and b/Effects/WulfrumScaffoldSelection.xnb differ diff --git a/Effects/WulfrumTilePing.fx b/Effects/WulfrumTilePing.fx new file mode 100644 index 0000000000..fc44e3ecc8 --- /dev/null +++ b/Effects/WulfrumTilePing.fx @@ -0,0 +1,212 @@ +float Resolution; //Pixel resolution + +float time; +float2 pingCenter; //The origin of the ping wave. +float pingRadius; //The max radius of the ping. +float pingWaveThickness; //The thickness of the wave before it entirely fades out. +float pingProgress; //How far along the ping progressed +float pingTravelTime; //Percent of the ping's duration during which the ping expands to reach its full radius. +float pingFadePoint; //Percent of the ping's duration at which to start fading away. +float edgeBlendStrength; //How starkly should the ping's edge fade off. +float edgeBlendOutLenght; //Small lenght at the edge of the wave to blend away smoothly. +float tileEdgeBlendStrenght; //How hard the border of a tile should get blended away. + +float4 baseTintColor; //Color of the tile's overlay +float3 tileEdgeColor; //Color of the tile's edge effects +float4 scanlineColor; //Color of the scanline effects +float4 waveColor; //Color of the ping wave + +float4 ScanLines[10]; +int ScanLinesCount; +int verticalScanLinesIndex; + +//Per tile stuff +float2 tilePosition; //The position of the top left of the tile +bool4 cardinalConnections; //Up, Left, Right, Down connections. + + +texture sampleTexture; +sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; + +bool AND(bool4 value) +{ + return value.x && value.y && value.z && value.w; +} + +int COUNT(bool4 value) +{ + int count = 0; + + if (value.x) + count++; + if (value.y) + count++; + if (value.z) + count++; + if (value.w) + count++; + + return count; +} + +float MOD(float a, float n) +{ + return a - floor(a / n) * n; +} + +float inverselerp(float x, float start, float end) +{ + return clamp((x - start) / (end - start), 0, 1); +} + +//Checks if a corner should be drawn or excluded, based on how many edges the pixel is near to. +bool cornerDrawCheck(float2 position) +{ + float oneEight = 1 / Resolution; + float sevenEights = 7 / Resolution; + + bool4 edgeChecks = bool4(false, false, false, false); + + //top + if (position.y < oneEight && !cardinalConnections.x) + edgeChecks.x = true; + + //bottom + if (position.y >= sevenEights && !cardinalConnections.w) + edgeChecks.w = true; + + //left + if (position.x < oneEight && !cardinalConnections.y) + edgeChecks.y = true; + + //right + if (position.x >= sevenEights && !cardinalConnections.z) + edgeChecks.z = true; + + //if on 2 edges at once, youre on a corner + return COUNT(edgeChecks) < 2; +} + +//Gets the gradient from the tile outline effects +float getOpacityFromEdge(float2 position) +{ + //If fully surrounded, don't draw anything + if (AND(cardinalConnections)) + return 0; + + float oneFourth = 1 / Resolution; + float twoFourths = 3 / Resolution; + float threeFourths = 4 / Resolution; + float one = 7 / Resolution; + + float baseOpacity = 0; + + //up + if (!cardinalConnections.x) + baseOpacity += pow(inverselerp(position.y, twoFourths, 0), tileEdgeBlendStrenght); + + //down + if (!cardinalConnections.w) + baseOpacity += pow(inverselerp(position.y, threeFourths, one), tileEdgeBlendStrenght); + + //left + if (!cardinalConnections.y) + baseOpacity += pow(inverselerp(position.x, twoFourths, 0), tileEdgeBlendStrenght); + + //right + if (!cardinalConnections.z) + baseOpacity += pow(inverselerp(position.x, threeFourths, one), tileEdgeBlendStrenght); + + return baseOpacity; +} + +//Gets the opacity of the scanline on the specific pixel +float getOpacityFromScanLine(float2 position) +{ + float opacity = 0; + float4 scanline; + + //x = offset from origin, y = period, z = speed, w = opacity. + for (int i = 0; i < ScanLinesCount; i++) + { + scanline = ScanLines[i]; + + float pixelPos; + if (i >= verticalScanLinesIndex) + pixelPos = (position.x + tilePosition.x / 16) % scanline.y; + + else + pixelPos = (position.y + tilePosition.y / 16) % scanline.y; + + //Custom mod in case scanline.z is negative, aka the scanline moves in the opposite direction. + float scanlinePos = MOD((scanline.x + time * scanline.z), scanline.y); + + scanlinePos -= scanlinePos % (1 / Resolution); + + pixelPos -= pixelPos % (1 / Resolution); + + if (pixelPos == scanlinePos) + opacity += scanline.w; + } + + + return opacity * (scanlineColor.a - baseTintColor.a); +} + +float4 main(float2 uv : TEXCOORD) : COLOR +{ + //Pixelate + uv.x -= uv.x % (1 / Resolution); + uv.y -= uv.y % (1 / Resolution); + + //Don't draw the corner the case of a missing corner. + if (!cornerDrawCheck(uv)) + return float4(0, 0, 0, 0); + + float distanceFromPingOrigin = length(pingCenter - (tilePosition + uv * 16)); + float waveExpansionPercent = pingProgress / pingTravelTime; + float currentPingRadius = pingRadius * waveExpansionPercent; + float realWaveExpansionPercent = min(waveExpansionPercent, 1); + float realPingRadius = pingRadius * realWaveExpansionPercent; + + + //Crop the ping wave into a circle + if (distanceFromPingOrigin > realPingRadius) + return float4(0, 0, 0, 0); + + float waveEdgeDistanceFromCenter = max(currentPingRadius - pingWaveThickness, 0); + float edgeBlendFactor = pow(min(max((distanceFromPingOrigin - (waveEdgeDistanceFromCenter)), 0) / (pingWaveThickness - edgeBlendOutLenght), 1), edgeBlendStrength); + + float3 ColorTotal = lerp(baseTintColor.rgb, waveColor.rgb, edgeBlendFactor); + float OpacityTotal = lerp(baseTintColor.a, waveColor.a, edgeBlendFactor); + + //Do the outlines + float tileEdgeBlend = getOpacityFromEdge(uv); + OpacityTotal = lerp(OpacityTotal, 1, tileEdgeBlend); + ColorTotal = lerp(ColorTotal, tileEdgeColor, tileEdgeBlend); + + float scanlineOpacity = getOpacityFromScanLine(uv); + if (scanlineOpacity > 0) + { + OpacityTotal += scanlineOpacity; + ColorTotal = lerp(ColorTotal, scanlineColor.rgb, scanlineOpacity); + } + + //Fade away the border + if (realPingRadius - distanceFromPingOrigin < edgeBlendOutLenght) + OpacityTotal *= (realPingRadius - distanceFromPingOrigin) / edgeBlendOutLenght; + + //General fade out at the end. + OpacityTotal *= 1 - max(pingProgress - pingFadePoint, 0) / (1 - pingFadePoint); + + ColorTotal = ColorTotal * OpacityTotal; + return float4(ColorTotal, OpacityTotal); +} + +technique Technique1 +{ + pass TilePingPass + { + PixelShader = compile ps_3_0 main(); + } +} \ No newline at end of file diff --git a/Effects/WulfrumTilePing.xnb b/Effects/WulfrumTilePing.xnb new file mode 100644 index 0000000000..62b423ebaf Binary files /dev/null and b/Effects/WulfrumTilePing.xnb differ diff --git a/Enums/CalamityRarity.cs b/Enums/CalamityRarity.cs deleted file mode 100644 index a20ae26d07..0000000000 --- a/Enums/CalamityRarity.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace CalamityMod -{ - public enum CalamityRarity - { - NoEffect = 0, - Turquoise = CalamityUtils.TurquoiseRarityValue, - PureGreen = CalamityUtils.PureGreenRarityValue, - DarkBlue = CalamityUtils.DarkBlueRarityValue, - Violet = CalamityUtils.VioletRarityValue, - HotPink = CalamityUtils.HotPinkRarityValue, - Rainbow = CalamityUtils.RainbowRarityValue, - DraedonRust = CalamityUtils.DraedonRustRarityValue, - } -} diff --git a/Events/AcidRainT1_BossChecklist.png b/Events/AcidRainT1_BossChecklist.png index ad2416a302..ec913fe398 100644 Binary files a/Events/AcidRainT1_BossChecklist.png and b/Events/AcidRainT1_BossChecklist.png differ diff --git a/Events/AcidRainT3_BossChecklist.png b/Events/AcidRainT3_BossChecklist.png index cff4064a5a..f0238de5b3 100644 Binary files a/Events/AcidRainT3_BossChecklist.png and b/Events/AcidRainT3_BossChecklist.png differ diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index a28443b206..1252589ba0 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -252,7 +252,14 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + + SoundEngine.PlaySound(Polterghast.SpawnSound, player.Center); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); + + }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), @@ -569,29 +576,11 @@ namespace CalamityMod.Events } // All Slime God entities must be killed to progress to the next stage. - else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + else if (npc.type == ModContent.NPCType()) { - if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) - { - BossRushStage++; - CalamityUtils.KillAllHostileProjectiles(); - HostileProjectileKillCounter = 3; - } - else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) - { - BossRushStage++; - CalamityUtils.KillAllHostileProjectiles(); - HostileProjectileKillCounter = 3; - } - else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) - { - BossRushStage++; - CalamityUtils.KillAllHostileProjectiles(); - HostileProjectileKillCounter = 3; - } + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + HostileProjectileKillCounter = 3; } // This is the generic form of "Are there any remaining NPCs on the boss list for this boss rush stage?" check. diff --git a/ExtraTextures/BasicTrail.png b/ExtraTextures/BasicTrail.png new file mode 100644 index 0000000000..f2cc0db10f Binary files /dev/null and b/ExtraTextures/BasicTrail.png differ diff --git a/ExtraTextures/Bestiary/GulperEel_Bestiary.png b/ExtraTextures/Bestiary/GulperEel_Bestiary.png index ee6323a03e..85eab7d9db 100644 Binary files a/ExtraTextures/Bestiary/GulperEel_Bestiary.png and b/ExtraTextures/Bestiary/GulperEel_Bestiary.png differ diff --git a/ExtraTextures/BlobbyNoise.png b/ExtraTextures/BlobbyNoise.png new file mode 100644 index 0000000000..4d7b4b179f Binary files /dev/null and b/ExtraTextures/BlobbyNoise.png differ diff --git a/ExtraTextures/BloomFlare.png b/ExtraTextures/BloomFlare.png new file mode 100644 index 0000000000..a47ae0671b Binary files /dev/null and b/ExtraTextures/BloomFlare.png differ diff --git a/ExtraTextures/DoubleTrail.png b/ExtraTextures/DoubleTrail.png new file mode 100644 index 0000000000..00770c92db Binary files /dev/null and b/ExtraTextures/DoubleTrail.png differ diff --git a/ExtraTextures/Heart3.png b/ExtraTextures/Heart3.png deleted file mode 100644 index b156f587f3..0000000000 Binary files a/ExtraTextures/Heart3.png and /dev/null differ diff --git a/ExtraTextures/Heart4.png b/ExtraTextures/Heart4.png deleted file mode 100644 index fc55418856..0000000000 Binary files a/ExtraTextures/Heart4.png and /dev/null differ diff --git a/ExtraTextures/Heart5.png b/ExtraTextures/Heart5.png deleted file mode 100644 index 383ac27108..0000000000 Binary files a/ExtraTextures/Heart5.png and /dev/null differ diff --git a/ExtraTextures/Heart6.png b/ExtraTextures/Heart6.png deleted file mode 100644 index 43018d08df..0000000000 Binary files a/ExtraTextures/Heart6.png and /dev/null differ diff --git a/ExtraTextures/MediumLongThrust.png b/ExtraTextures/MediumLongThrust.png new file mode 100644 index 0000000000..ecae43f936 Binary files /dev/null and b/ExtraTextures/MediumLongThrust.png differ diff --git a/ExtraTextures/SimpleGradient.png b/ExtraTextures/SimpleGradient.png new file mode 100644 index 0000000000..88f38ac438 Binary files /dev/null and b/ExtraTextures/SimpleGradient.png differ diff --git a/ExtraTextures/TechyNoise.png b/ExtraTextures/TechyNoise.png new file mode 100644 index 0000000000..ea7775cb9d Binary files /dev/null and b/ExtraTextures/TechyNoise.png differ diff --git a/ExtraTextures/TestTexture.png b/ExtraTextures/TestTexture.png new file mode 100644 index 0000000000..2e1de03467 Binary files /dev/null and b/ExtraTextures/TestTexture.png differ diff --git a/ExtraTextures/TestTextureTall.png b/ExtraTextures/TestTextureTall.png new file mode 100644 index 0000000000..dac34409cc Binary files /dev/null and b/ExtraTextures/TestTextureTall.png differ diff --git a/ExtraTextures/UI/HealthMana/BarBloodOrange.png b/ExtraTextures/UI/HealthMana/BarBloodOrange.png new file mode 100644 index 0000000000..529b2cd9c7 Binary files /dev/null and b/ExtraTextures/UI/HealthMana/BarBloodOrange.png differ diff --git a/ExtraTextures/UI/HealthMana/BarDragonfruit.png b/ExtraTextures/UI/HealthMana/BarDragonfruit.png new file mode 100644 index 0000000000..5bcdea9037 Binary files /dev/null and b/ExtraTextures/UI/HealthMana/BarDragonfruit.png differ diff --git a/ExtraTextures/UI/HealthMana/BarElderberry.png b/ExtraTextures/UI/HealthMana/BarElderberry.png new file mode 100644 index 0000000000..27b00c5584 Binary files /dev/null and b/ExtraTextures/UI/HealthMana/BarElderberry.png differ diff --git a/ExtraTextures/UI/HealthMana/BarMiracleFruit.png b/ExtraTextures/UI/HealthMana/BarMiracleFruit.png new file mode 100644 index 0000000000..e3712b2563 Binary files /dev/null and b/ExtraTextures/UI/HealthMana/BarMiracleFruit.png differ diff --git a/ExtraTextures/UI/HealthMana/BarOriginal.png b/ExtraTextures/UI/HealthMana/BarOriginal.png new file mode 100644 index 0000000000..a616c6d13a Binary files /dev/null and b/ExtraTextures/UI/HealthMana/BarOriginal.png differ diff --git a/ExtraTextures/UI/HealthMana/BarOriginal2.png b/ExtraTextures/UI/HealthMana/BarOriginal2.png new file mode 100644 index 0000000000..6031f669e7 Binary files /dev/null and b/ExtraTextures/UI/HealthMana/BarOriginal2.png differ diff --git a/ExtraTextures/UI/HealthMana/HeartBloodOrange.png b/ExtraTextures/UI/HealthMana/HeartBloodOrange.png new file mode 100644 index 0000000000..3f0c35fbe0 Binary files /dev/null and b/ExtraTextures/UI/HealthMana/HeartBloodOrange.png differ diff --git a/ExtraTextures/UI/HealthMana/HeartDragonfruit.png b/ExtraTextures/UI/HealthMana/HeartDragonfruit.png new file mode 100644 index 0000000000..d3d89de24f Binary files /dev/null and b/ExtraTextures/UI/HealthMana/HeartDragonfruit.png differ diff --git a/ExtraTextures/UI/HealthMana/HeartElderberry.png b/ExtraTextures/UI/HealthMana/HeartElderberry.png new file mode 100644 index 0000000000..1c1119c37b Binary files /dev/null and b/ExtraTextures/UI/HealthMana/HeartElderberry.png differ diff --git a/ExtraTextures/UI/HealthMana/HeartMiracleFruit.png b/ExtraTextures/UI/HealthMana/HeartMiracleFruit.png new file mode 100644 index 0000000000..bec7cf554f Binary files /dev/null and b/ExtraTextures/UI/HealthMana/HeartMiracleFruit.png differ diff --git a/ExtraTextures/HeartOriginal2.png b/ExtraTextures/UI/HealthMana/HeartOriginal.png similarity index 100% rename from ExtraTextures/HeartOriginal2.png rename to ExtraTextures/UI/HealthMana/HeartOriginal.png diff --git a/ExtraTextures/HeartOriginal.png b/ExtraTextures/UI/HealthMana/HeartOriginal2.png similarity index 100% rename from ExtraTextures/HeartOriginal.png rename to ExtraTextures/UI/HealthMana/HeartOriginal2.png diff --git a/ExtraTextures/Mana2.png b/ExtraTextures/UI/HealthMana/ManaCometShard.png similarity index 100% rename from ExtraTextures/Mana2.png rename to ExtraTextures/UI/HealthMana/ManaCometShard.png diff --git a/ExtraTextures/Mana3.png b/ExtraTextures/UI/HealthMana/ManaEtherealCore.png similarity index 100% rename from ExtraTextures/Mana3.png rename to ExtraTextures/UI/HealthMana/ManaEtherealCore.png diff --git a/ExtraTextures/ManaOriginal.png b/ExtraTextures/UI/HealthMana/ManaOriginal.png similarity index 100% rename from ExtraTextures/ManaOriginal.png rename to ExtraTextures/UI/HealthMana/ManaOriginal.png diff --git a/ExtraTextures/Mana4.png b/ExtraTextures/UI/HealthMana/ManaPhantomHeart.png similarity index 100% rename from ExtraTextures/Mana4.png rename to ExtraTextures/UI/HealthMana/ManaPhantomHeart.png diff --git a/ExtraTextures/UI/ModeIndicator.png b/ExtraTextures/UI/ModeIndicator.png deleted file mode 100644 index 82cfc906fb..0000000000 Binary files a/ExtraTextures/UI/ModeIndicator.png and /dev/null differ diff --git a/ExtraTextures/UI/ModeIndicatorArea.png b/ExtraTextures/UI/ModeIndicatorArea.png deleted file mode 100644 index a00841110c..0000000000 Binary files a/ExtraTextures/UI/ModeIndicatorArea.png and /dev/null differ diff --git a/ExtraTextures/UI/ModeIndicatorLock.png b/ExtraTextures/UI/ModeIndicatorLock.png new file mode 100644 index 0000000000..f440e5748d Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorLock.png differ diff --git a/ExtraTextures/UI/ModeIndicatorOutline.png b/ExtraTextures/UI/ModeIndicatorOutline.png new file mode 100644 index 0000000000..d4f1f87ee3 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorOutline.png differ diff --git a/ExtraTextures/UI/ModeIndicator_Death.png b/ExtraTextures/UI/ModeIndicator_Death.png new file mode 100644 index 0000000000..5729ede7b4 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicator_Death.png differ diff --git a/ExtraTextures/UI/ModeIndicator_Malice.png b/ExtraTextures/UI/ModeIndicator_Malice.png new file mode 100644 index 0000000000..f8306ffcad Binary files /dev/null and b/ExtraTextures/UI/ModeIndicator_Malice.png differ diff --git a/ExtraTextures/UI/ModeIndicator_None.png b/ExtraTextures/UI/ModeIndicator_None.png new file mode 100644 index 0000000000..58648ff4ed Binary files /dev/null and b/ExtraTextures/UI/ModeIndicator_None.png differ diff --git a/ExtraTextures/UI/ModeIndicator_Rev.png b/ExtraTextures/UI/ModeIndicator_Rev.png new file mode 100644 index 0000000000..64eec475d7 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicator_Rev.png differ diff --git a/ExtraTextures/UI/ModeIndicator_WhereMalice.png b/ExtraTextures/UI/ModeIndicator_WhereMalice.png new file mode 100644 index 0000000000..0719d62996 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicator_WhereMalice.png differ diff --git a/ExtraTextures/ZapTrail.png b/ExtraTextures/ZapTrail.png new file mode 100644 index 0000000000..7397f1a4c4 Binary files /dev/null and b/ExtraTextures/ZapTrail.png differ diff --git a/ForegroundDrawing/ForegroundManager.cs b/ForegroundDrawing/ForegroundManager.cs new file mode 100644 index 0000000000..01c279313a --- /dev/null +++ b/ForegroundDrawing/ForegroundManager.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using Terraria; +using Terraria.ModLoader; +using Terraria.ModLoader.Core; + +namespace CalamityMod.ForegroundDrawing +{ + interface IForegroundTile + { + void ForegroundDraw(int x, int y, SpriteBatch spriteBatch); + } + + public static class ForegroundManager + { + private static List _foregroundElements; + private static int _foregroundElementCount; + + internal static void Load() + { + _foregroundElements = new List(1000); + _foregroundElementCount = 0; + } + + public static void AddForegroundDrawingPoint(int x, int y) + { + _foregroundElements.Add(new Point(x, y)); + _foregroundElementCount++; + } + + + public static void DrawTiles() + { + for (int i = 0; i < _foregroundElementCount; i++) + { + ushort type = Main.tile[_foregroundElements[i]].TileType; + if (TileLoader.GetTile(type) is IForegroundTile fgTile) + fgTile.ForegroundDraw(_foregroundElements[i].X, _foregroundElements[i].Y, Main.spriteBatch); + } + } + + public static void ClearTiles() + { + _foregroundElements.Clear(); + _foregroundElementCount = 0; + } + } +} diff --git a/Gores/GulperEel.png b/Gores/GulperEel.png index 65a12da214..36ef10f644 100644 Binary files a/Gores/GulperEel.png and b/Gores/GulperEel.png differ diff --git a/Gores/GulperEel2.png b/Gores/GulperEel2.png index 306eef3487..2b23fba06e 100644 Binary files a/Gores/GulperEel2.png and b/Gores/GulperEel2.png differ diff --git a/Gores/GulperEel3.png b/Gores/GulperEel3.png index 3186171c0f..ea5230067f 100644 Binary files a/Gores/GulperEel3.png and b/Gores/GulperEel3.png differ diff --git a/Gores/GulperEel4.png b/Gores/GulperEel4.png index b8b9bcb777..e2f3d001eb 100644 Binary files a/Gores/GulperEel4.png and b/Gores/GulperEel4.png differ diff --git a/Gores/Trees/AstralLeaf.cs b/Gores/Trees/AstralLeaf.cs new file mode 100644 index 0000000000..b7971acba6 --- /dev/null +++ b/Gores/Trees/AstralLeaf.cs @@ -0,0 +1,13 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Gores.Trees +{ + public class AstralLeaf : ModGore + { + public override void SetStaticDefaults() + { + GoreID.Sets.SpecialAI[Type] = 3; + } + } +} \ No newline at end of file diff --git a/Gores/Trees/AstralLeaf.png b/Gores/Trees/AstralLeaf.png new file mode 100644 index 0000000000..eac34af291 Binary files /dev/null and b/Gores/Trees/AstralLeaf.png differ diff --git a/Gores/Trees/SulphurLeaf.cs b/Gores/Trees/SulphurLeaf.cs new file mode 100644 index 0000000000..e2f70b40df --- /dev/null +++ b/Gores/Trees/SulphurLeaf.cs @@ -0,0 +1,13 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Gores.Trees +{ + public class SulphurLeaf : ModGore + { + public override void SetStaticDefaults() + { + GoreID.Sets.SpecialAI[Type] = 3; + } + } +} \ No newline at end of file diff --git a/Gores/Trees/SulphurLeaf.png b/Gores/Trees/SulphurLeaf.png new file mode 100644 index 0000000000..6b22a64db9 Binary files /dev/null and b/Gores/Trees/SulphurLeaf.png differ diff --git a/Gores/Wulfrum/WulfrumAmplifierGore.png b/Gores/Wulfrum/WulfrumAmplifierGore.png new file mode 100644 index 0000000000..bbf69c0ab5 Binary files /dev/null and b/Gores/Wulfrum/WulfrumAmplifierGore.png differ diff --git a/Gores/Wulfrum/WulfrumDroneGore1.png b/Gores/Wulfrum/WulfrumDroneGore1.png new file mode 100644 index 0000000000..2a4dc62347 Binary files /dev/null and b/Gores/Wulfrum/WulfrumDroneGore1.png differ diff --git a/Gores/Wulfrum/WulfrumDroneGore2.png b/Gores/Wulfrum/WulfrumDroneGore2.png new file mode 100644 index 0000000000..c2e999b8ee Binary files /dev/null and b/Gores/Wulfrum/WulfrumDroneGore2.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore1.png b/Gores/Wulfrum/WulfrumEnemyGore1.png new file mode 100644 index 0000000000..bf0014d7e9 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore1.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore10.png b/Gores/Wulfrum/WulfrumEnemyGore10.png new file mode 100644 index 0000000000..c4ad75ae90 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore10.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore11.png b/Gores/Wulfrum/WulfrumEnemyGore11.png new file mode 100644 index 0000000000..b02d197e2c Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore11.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore2.png b/Gores/Wulfrum/WulfrumEnemyGore2.png new file mode 100644 index 0000000000..f347d01341 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore2.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore3.png b/Gores/Wulfrum/WulfrumEnemyGore3.png new file mode 100644 index 0000000000..17af023406 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore3.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore4.png b/Gores/Wulfrum/WulfrumEnemyGore4.png new file mode 100644 index 0000000000..4a3961cff9 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore4.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore5.png b/Gores/Wulfrum/WulfrumEnemyGore5.png new file mode 100644 index 0000000000..31ba53122d Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore5.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore6.png b/Gores/Wulfrum/WulfrumEnemyGore6.png new file mode 100644 index 0000000000..fc977df5b2 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore6.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore7.png b/Gores/Wulfrum/WulfrumEnemyGore7.png new file mode 100644 index 0000000000..d3338e2e50 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore7.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore8.png b/Gores/Wulfrum/WulfrumEnemyGore8.png new file mode 100644 index 0000000000..b416b858d2 Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore8.png differ diff --git a/Gores/Wulfrum/WulfrumEnemyGore9.png b/Gores/Wulfrum/WulfrumEnemyGore9.png new file mode 100644 index 0000000000..aa098b46aa Binary files /dev/null and b/Gores/Wulfrum/WulfrumEnemyGore9.png differ diff --git a/Gores/Wulfrum/WulfrumGyratorGore.png b/Gores/Wulfrum/WulfrumGyratorGore.png new file mode 100644 index 0000000000..f8abb8d138 Binary files /dev/null and b/Gores/Wulfrum/WulfrumGyratorGore.png differ diff --git a/Gores/Wulfrum/WulfrumHovercraftGore1.png b/Gores/Wulfrum/WulfrumHovercraftGore1.png new file mode 100644 index 0000000000..c4eb84daae Binary files /dev/null and b/Gores/Wulfrum/WulfrumHovercraftGore1.png differ diff --git a/Gores/Wulfrum/WulfrumHovercraftGore2.png b/Gores/Wulfrum/WulfrumHovercraftGore2.png new file mode 100644 index 0000000000..025bb717fb Binary files /dev/null and b/Gores/Wulfrum/WulfrumHovercraftGore2.png differ diff --git a/Gores/Wulfrum/WulfrumPinger1.png b/Gores/Wulfrum/WulfrumPinger1.png new file mode 100644 index 0000000000..07f24ee202 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPinger1.png differ diff --git a/Gores/Wulfrum/WulfrumPinger2.png b/Gores/Wulfrum/WulfrumPinger2.png new file mode 100644 index 0000000000..f28048d437 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPinger2.png differ diff --git a/Gores/Wulfrum/WulfrumPinger3.png b/Gores/Wulfrum/WulfrumPinger3.png new file mode 100644 index 0000000000..c4ad75ae90 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPinger3.png differ diff --git a/Gores/Wulfrum/WulfrumPinger4.png b/Gores/Wulfrum/WulfrumPinger4.png new file mode 100644 index 0000000000..7226f0e705 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPinger4.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit1.png b/Gores/Wulfrum/WulfrumPowerSuit1.png new file mode 100644 index 0000000000..dfeccdc09e Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit1.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit2.png b/Gores/Wulfrum/WulfrumPowerSuit2.png new file mode 100644 index 0000000000..1d44fceb23 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit2.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit3.png b/Gores/Wulfrum/WulfrumPowerSuit3.png new file mode 100644 index 0000000000..cd20ec1934 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit3.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit4.png b/Gores/Wulfrum/WulfrumPowerSuit4.png new file mode 100644 index 0000000000..2e6319494a Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit4.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit5.png b/Gores/Wulfrum/WulfrumPowerSuit5.png new file mode 100644 index 0000000000..47b6f809f0 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit5.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit6.png b/Gores/Wulfrum/WulfrumPowerSuit6.png new file mode 100644 index 0000000000..8a0c43f910 Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit6.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit7.png b/Gores/Wulfrum/WulfrumPowerSuit7.png new file mode 100644 index 0000000000..75b19240bf Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit7.png differ diff --git a/Gores/Wulfrum/WulfrumPowerSuit8.png b/Gores/Wulfrum/WulfrumPowerSuit8.png new file mode 100644 index 0000000000..b272d74cea Binary files /dev/null and b/Gores/Wulfrum/WulfrumPowerSuit8.png differ diff --git a/Gores/Wulfrum/WulfrumRoverGore1.png b/Gores/Wulfrum/WulfrumRoverGore1.png new file mode 100644 index 0000000000..c5d6c68666 Binary files /dev/null and b/Gores/Wulfrum/WulfrumRoverGore1.png differ diff --git a/Gores/Wulfrum/WulfrumRoverGore2.png b/Gores/Wulfrum/WulfrumRoverGore2.png new file mode 100644 index 0000000000..51bef03777 Binary files /dev/null and b/Gores/Wulfrum/WulfrumRoverGore2.png differ diff --git a/Gores/Wulfrum/WulfrumScrewGore.png b/Gores/Wulfrum/WulfrumScrewGore.png new file mode 100644 index 0000000000..a5d96ffcff Binary files /dev/null and b/Gores/Wulfrum/WulfrumScrewGore.png differ diff --git a/Gores/Wulfrum/WulfrumTurtle1.png b/Gores/Wulfrum/WulfrumTurtle1.png new file mode 100644 index 0000000000..aa098b46aa Binary files /dev/null and b/Gores/Wulfrum/WulfrumTurtle1.png differ diff --git a/Gores/Wulfrum/WulfrumTurtle2.png b/Gores/Wulfrum/WulfrumTurtle2.png new file mode 100644 index 0000000000..ea5be5e19d Binary files /dev/null and b/Gores/Wulfrum/WulfrumTurtle2.png differ diff --git a/Gores/Wulfrum/WulfrumTurtle3.png b/Gores/Wulfrum/WulfrumTurtle3.png new file mode 100644 index 0000000000..cceeaeeb1b Binary files /dev/null and b/Gores/Wulfrum/WulfrumTurtle3.png differ diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 476766f60a..0bc996a458 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -1,4 +1,5 @@ -using CalamityMod.Balancing; +using System; +using CalamityMod.Balancing; using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; @@ -76,7 +77,7 @@ namespace CalamityMod.ILEditing LogFailure("Magiluminescence Nerf", "Could not locate the Magiluminescence max run speed multiplier."); return; } - cursor.Next.Operand = 1f; + cursor.Next.Operand = 1.05f; // Nerf the acc run speed boost from 1.2x to 1x. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.2f))) @@ -84,7 +85,7 @@ namespace CalamityMod.ILEditing LogFailure("Magiluminescence Nerf", "Could not locate the Magiluminescence acc run speed multiplier."); return; } - cursor.Next.Operand = 1f; + cursor.Next.Operand = 1.05f; // Nerf the run slowdown boost from 2x to 1.25x. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(2f))) @@ -96,7 +97,7 @@ namespace CalamityMod.ILEditing } #endregion - #region Jump Speed Changes + #region Jump Height Changes private static void FixJumpHeightBoosts(ILContext il) { // Remove the code that makes Shiny Red Balloon SET jump height to a specific value to make balancing jump speed easier. @@ -150,17 +151,22 @@ namespace CalamityMod.ILEditing cursor.Next.Operand = 0; } - private static void JumpSpeedAdjustment(ILContext il) + private const float VanillaBaseJumpHeight = 5.01f; + private static void BaseJumpHeightAdjustment(ILContext il) { - // Increase the base jump speed of the player to make early game less of a slog. + // Increase the base jump height of the player to make early game less of a slog. var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(5.01f))) // The jumpSpeed variable is set to this specific value before anything else occurs. + + // The jumpSpeed variable is set to this specific value before anything else occurs. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(VanillaBaseJumpHeight))) { - LogFailure("Base Jump Speed Buff", "Could not locate the jump speed variable."); + LogFailure("Base Jump Height Buff", "Could not locate the jump height variable."); return; } cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 5.51f); // Increase by 10%. + + // Increase by 10% if the higher jump speed is enabled. + cursor.EmitDelegate>(() => CalamityConfig.Instance.FasterJumpSpeed ? BalancingConstants.ConfigBoostedBaseJumpHeight : VanillaBaseJumpHeight); } #endregion diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index e123db78f5..66b3830167 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -42,7 +42,6 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.Update_NPCCollision += NerfShieldOfCthulhuBonkSafety; On.Terraria.WorldGen.OpenDoor += OpenDoor_LabDoorOverride; On.Terraria.WorldGen.CloseDoor += CloseDoor_LabDoorOverride; - On.Terraria.Wiring.Teleport += DisableTeleporters; // only applies in boss rush IL.Terraria.Main.DrawInterface_40_InteractItemIcon += MakeMouseHoverItemsSupportAnimations; On.Terraria.Item.AffixName += IncorporateEnchantmentInAffix; On.Terraria.Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float += IncorporateMinionExplodingCountdown; @@ -50,14 +49,22 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.QuickHeal += ConditionallyReplaceManaSickness; IL.Terraria.Player.QuickMana += ConditionallyReplaceManaSickness; IL.Terraria.Player.ItemCheck_Inner += ConditionallyReplaceManaSickness; + IL.Terraria.Main.DoDraw += AdditiveDrawing; On.Terraria.Main.SortDrawCacheWorms += DrawFusableParticles; + On.Terraria.Main.DrawInfernoRings += DrawForegroundParticles; On.Terraria.Main.SetDisplayMode += ResetRenderTargetSizes; - IL.Terraria.GameContent.Drawing.TileDrawing.DrawPartialLiquid += DrawCustomLava; + On.Terraria.GameContent.Drawing.TileDrawing.DrawPartialLiquid += DrawCustomLava; IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw += DrawCustomLava2; IL.Terraria.Main.oldDrawWater += DrawCustomLava3; - - // TODO -- Revisit this. It's not an extremely important thing, but it'd be ideal to not just abandon it. - // IL.Terraria.WaterfallManager.DrawWaterfall += DrawCustomLavafalls; + IL.Terraria.Player.CollectTaxes += MakeTaxCollectorUseful; + On.Terraria.Main.DrawGore += DrawForegroundStuff; + On.Terraria.GameContent.Drawing.TileDrawing.PreDrawTiles += ClearForegroundStuff; + On.Terraria.GameContent.Drawing.TileDrawing.Draw += ClearTilePings; + On.Terraria.Player.GrappleMovement += CustomGrappleMovementCheck; + On.Terraria.Player.UpdatePettingAnimal += CustomGrapplePreDefaultMovement; + On.Terraria.Player.PlayerFrame += CustomGrapplePostFrame; + On.Terraria.Player.SlopeDownMovement += CustomGrapplePreStepUp; + IL.Terraria.WaterfallManager.DrawWaterfall += DrawCustomLavafalls; // TODO -- This should be unnecessary. There is now a TML hook for platform collision for ModNPCs. On.Terraria.NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; IL.Terraria.Wiring.HitWireSingle += AddTwinklersToStatue; @@ -69,7 +76,7 @@ namespace CalamityMod.ILEditing // Movement speed balance IL.Terraria.Player.UpdateJumpHeight += FixJumpHeightBoosts; - IL.Terraria.Player.Update += JumpSpeedAdjustment; + IL.Terraria.Player.Update += BaseJumpHeightAdjustment; IL.Terraria.Player.Update += RunSpeedAdjustments; IL.Terraria.Initializers.WingStatsInitializer.Load += ReduceWingHoverVelocities; IL.Terraria.Player.Update += NerfMagiluminescence; @@ -96,6 +103,7 @@ namespace CalamityMod.ILEditing IL.Terraria.WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits; IL.Terraria.GameContent.UI.States.UIWorldCreation.SetDefaultOptions += ChangeDefaultWorldSize; IL.Terraria.GameContent.UI.States.UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey; + On.Terraria.IO.WorldFile.ClearTempTiles += ClearModdedTempTiles; // Removal of vanilla stupidity IL.Terraria.GameContent.Events.Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; @@ -117,6 +125,13 @@ namespace CalamityMod.ILEditing IL.Terraria.NPC.NPCLoot += FixSplittingWormBannerDrops; On.Terraria.Item.Prefix += LetRogueItemsBeReforgeable; // IL.Terraria.Main.DoUpdate += FixProjectileUpdatePriorityProblems; + + + //Additional detours that are in their own item files given they are only relevant to these specific items: + + //Rover drive detours on Player.DrawInfernoRings to draw its shield + //Wulfrum armor hooks on Player.KeyDoubleTap and DrawPendingMouseText to activate its set bonus and spoof the mouse text to display the stats of the activated weapon if shift is held + //HeldOnlyItem detours Player.dropItemCheck, ItemSlot.Draw (Sb, itemarray, int, int, vector2, color) and ItemSlot.LeftClick_ItemArray to make its stuff work } /// @@ -138,7 +153,6 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.Update_NPCCollision -= NerfShieldOfCthulhuBonkSafety; On.Terraria.WorldGen.OpenDoor -= OpenDoor_LabDoorOverride; On.Terraria.WorldGen.CloseDoor -= CloseDoor_LabDoorOverride; - On.Terraria.Wiring.Teleport -= DisableTeleporters; IL.Terraria.Main.DrawInterface_40_InteractItemIcon -= MakeMouseHoverItemsSupportAnimations; On.Terraria.Item.AffixName -= IncorporateEnchantmentInAffix; On.Terraria.Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float -= IncorporateMinionExplodingCountdown; @@ -146,14 +160,24 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.QuickHeal -= ConditionallyReplaceManaSickness; IL.Terraria.Player.QuickMana -= ConditionallyReplaceManaSickness; IL.Terraria.Player.ItemCheck_Inner -= ConditionallyReplaceManaSickness; + IL.Terraria.Main.DoDraw -= AdditiveDrawing; On.Terraria.Main.SortDrawCacheWorms -= DrawFusableParticles; + On.Terraria.Main.DrawInfernoRings -= DrawForegroundParticles; On.Terraria.Main.SetDisplayMode -= ResetRenderTargetSizes; - IL.Terraria.GameContent.Drawing.TileDrawing.DrawPartialLiquid -= DrawCustomLava; + On.Terraria.GameContent.Drawing.TileDrawing.DrawPartialLiquid -= DrawCustomLava; IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw -= DrawCustomLava2; IL.Terraria.Main.oldDrawWater -= DrawCustomLava3; - IL.Terraria.WaterfallManager.DrawWaterfall -= DrawCustomLavafalls; + IL.Terraria.Player.CollectTaxes -= MakeTaxCollectorUseful; + // IL.Terraria.WaterfallManager.DrawWaterfall -= DrawCustomLavafalls; On.Terraria.NPC.Collision_DecideFallThroughPlatforms -= EnableCalamityBossPlatformCollision; IL.Terraria.Wiring.HitWireSingle -= AddTwinklersToStatue; + On.Terraria.Main.DrawGore -= DrawForegroundStuff; + On.Terraria.GameContent.Drawing.TileDrawing.PreDrawTiles -= ClearForegroundStuff; + On.Terraria.GameContent.Drawing.TileDrawing.Draw -= ClearTilePings; + On.Terraria.Player.GrappleMovement -= CustomGrappleMovementCheck; + On.Terraria.Player.UpdatePettingAnimal -= CustomGrapplePreDefaultMovement; + On.Terraria.Player.PlayerFrame -= CustomGrapplePostFrame; + On.Terraria.Player.SlopeDownMovement -= CustomGrapplePreStepUp; // Damage and health balance IL.Terraria.Main.DamageVar -= AdjustDamageVariance; @@ -162,7 +186,7 @@ namespace CalamityMod.ILEditing // Movement speed balance IL.Terraria.Player.UpdateJumpHeight -= FixJumpHeightBoosts; - IL.Terraria.Player.Update -= JumpSpeedAdjustment; + IL.Terraria.Player.Update -= BaseJumpHeightAdjustment; IL.Terraria.Player.Update -= RunSpeedAdjustments; IL.Terraria.Initializers.WingStatsInitializer.Load -= ReduceWingHoverVelocities; IL.Terraria.Player.Update -= NerfMagiluminescence; @@ -189,6 +213,7 @@ namespace CalamityMod.ILEditing IL.Terraria.WorldGen.Chlorophyte -= AdjustChlorophyteSpawnLimits; IL.Terraria.GameContent.UI.States.UIWorldCreation.SetDefaultOptions -= ChangeDefaultWorldSize; IL.Terraria.GameContent.UI.States.UIWorldCreation.AddWorldSizeOptions -= SwapSmallDescriptionKey; + On.Terraria.IO.WorldFile.ClearTempTiles -= ClearModdedTempTiles; // Removal of vanilla stupidity IL.Terraria.GameContent.Events.Sandstorm.HasSufficientWind -= DecreaseSandstormWindSpeedRequirement; diff --git a/ILEditing/ILHelperMethods.cs b/ILEditing/ILHelperMethods.cs index d0348f4456..5b3f53aefa 100644 --- a/ILEditing/ILHelperMethods.cs +++ b/ILEditing/ILHelperMethods.cs @@ -87,13 +87,16 @@ namespace CalamityMod.ILEditing return initialTexture; } - private static Color SelectLavaColor(Texture2D initialTexture, Color initialLightColor) + private static Color SelectLavaColor(Texture2D initialTexture, Color initialLightColor, bool forceTrue = false) { // Use the initial color if it isn't lava. - if (initialTexture != CustomLavaManagement.LavaTexture && - initialTexture != CustomLavaManagement.LavaBlockTexture && - initialTexture != CustomLavaManagement.LavaSlopeTexture) - return initialLightColor; + if (!forceTrue) + { + if (initialTexture != CustomLavaManagement.LavaTexture && + initialTexture != CustomLavaManagement.LavaBlockTexture && + initialTexture != CustomLavaManagement.LavaSlopeTexture) + return initialLightColor; + } foreach (CustomLavaStyle lavaStyle in CustomLavaManagement.CustomLavaStyles) { diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index c796d86704..4616938634 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -2,9 +2,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; +using CalamityMod.ForegroundDrawing; using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.Items.Dyes; +using CalamityMod.NPCs; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.Crabulon; @@ -14,6 +16,8 @@ using CalamityMod.Projectiles; using CalamityMod.Systems; using CalamityMod.Waters; using CalamityMod.World; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; @@ -33,6 +37,11 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.UI.Gamepad; using Terraria.Utilities; +using Terraria.Graphics.Light; +using Terraria.GameContent.Events; +using CalamityMod.DataStructures; +using CalamityMod.Particles.Metaballs; +using Terraria.GameContent.Drawing; namespace CalamityMod.ILEditing { @@ -236,7 +245,7 @@ namespace CalamityMod.ILEditing { if (Main.dayTime || BossRushEvent.BossRushActive) return true; - + return orig(); } #endregion Allow Empress to Enrage in Boss Rush @@ -443,16 +452,6 @@ namespace CalamityMod.ILEditing } #endregion Platform Collision Checks for Grounded Bosses - #region Teleporter Disabling During Boss Fights - private static void DisableTeleporters(On.Terraria.Wiring.orig_Teleport orig) - { - if (CalamityPlayer.areThereAnyDamnBosses) - return; - - orig(); - } - #endregion Teleporter Disabling During Boss Fights - #region Incorporate Enchantments in Item Names private static string IncorporateEnchantmentInAffix(On.Terraria.Item.orig_AffixName orig, Item self) { @@ -515,14 +514,16 @@ namespace CalamityMod.ILEditing #region Fire Cursor Effect for the Calamity Accessory private static void UseCoolFireCursorEffect(On.Terraria.Main.orig_DrawCursor orig, Vector2 bonus, bool smart) { + Player player = Main.LocalPlayer; + // Do nothing special if the player has a regular mouse or is on the menu/map. - if (Main.gameMenu || Main.mapFullscreen || !Main.LocalPlayer.Calamity().blazingCursorVisuals) + if (Main.gameMenu || Main.mapFullscreen || !player.Calamity().blazingCursorVisuals) { orig(bonus, smart); return; } - if (Main.LocalPlayer.dead) + if (player.dead) { Main.ClearSmartInteract(); Main.TileInteractionLX = (Main.TileInteractionHX = (Main.TileInteractionLY = (Main.TileInteractionHY = -1))); @@ -547,14 +548,14 @@ namespace CalamityMod.ILEditing Vector2 desaturatedDrawPosition = drawPosition + Vector2.One; // If the blazing mouse is actually going to do damage, draw an indicator aura. - if (Main.LocalPlayer.Calamity().blazingCursorDamage && !Main.mapFullscreen) + if (!Main.mapFullscreen) { int size = 450; FluidFieldManager.AdjustSizeRelativeToGraphicsQuality(ref size); float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size; - ref FluidField calamityFireDrawer = ref Main.LocalPlayer.Calamity().CalamityFireDrawer; - ref Vector2 firePosition = ref Main.LocalPlayer.Calamity().FireDrawerPosition; + ref FluidField calamityFireDrawer = ref player.Calamity().CalamityFireDrawer; + ref Vector2 firePosition = ref player.Calamity().FireDrawerPosition; if (calamityFireDrawer is null || calamityFireDrawer.Size != size) calamityFireDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); @@ -566,13 +567,13 @@ namespace CalamityMod.ILEditing int horizontalArea = (int)Math.Ceiling(5f / calamityFireDrawer.Scale); int verticalArea = (int)Math.Ceiling(5f / calamityFireDrawer.Scale); - calamityFireDrawer.ShouldUpdate = true; + calamityFireDrawer.ShouldUpdate = player.miscCounter % 4 == 0; calamityFireDrawer.UpdateAction = () => { Color color = Color.Lerp(Color.Red, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + 0.5f); // Use a rainbow color if the player has the rainbow cursor equipped as well as Calamity. - if (Main.LocalPlayer.hasRainbowCursor) + if (player.hasRainbowCursor) color = Color.Lerp(color, Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.97f % 1f, 1f, 0.6f), 0.75f); for (int i = -horizontalArea; i <= horizontalArea; i++) @@ -595,7 +596,7 @@ namespace CalamityMod.ILEditing velocity *= Main.rand.NextFloat(0.9f, 1.1f); for (int j = -verticalArea; j <= verticalArea; j++) - Main.LocalPlayer.Calamity().CalamityFireDrawer.CreateSource(x + size / 2 + i, y + size / 2 + j, 1f, color, velocity); + player.Calamity().CalamityFireDrawer.CreateSource(x + size / 2 + i, y + size / 2 + j, 1f, color, velocity); } }; @@ -641,10 +642,45 @@ namespace CalamityMod.ILEditing } #endregion Fire Cursor Effect for the Calamity Accessory + #region Custom Draw Layers + private static void AdditiveDrawing(ILContext il) + { + ILCursor cursor = new(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("DrawWhite"))) + return; + + cursor.EmitDelegate(() => + { + Main.spriteBatch.SetBlendState(BlendState.Additive); + + // Draw Projectiles. + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (!Main.projectile[i].active) + continue; + + if (Main.projectile[i].ModProjectile is IAdditiveDrawer d) + d.AdditiveDraw(Main.spriteBatch); + } + + // Draw NPCs. + for (int i = 0; i < Main.maxNPCs; i++) + { + if (!Main.npc[i].active) + continue; + + if (Main.npc[i].ModNPC is IAdditiveDrawer d) + d.AdditiveDraw(Main.spriteBatch); + } + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + }); + } + #endregion Custom Draw Layers + #region General Particle Rendering private static void DrawFusableParticles(On.Terraria.Main.orig_SortDrawCacheWorms orig, Main self) { - GeneralParticleHandler.DrawAllParticles(Main.spriteBatch); DeathAshParticle.DrawAll(); FusableParticleManager.RenderAllFusableParticles(); @@ -654,77 +690,59 @@ namespace CalamityMod.ILEditing orig(self); } - #endregion General Particle Rendering + private static void DrawForegroundParticles(On.Terraria.Main.orig_DrawInfernoRings orig, Main self) + { + GeneralParticleHandler.DrawAllParticles(Main.spriteBatch); + orig(self); + } - #region Custom Lava Visuals private static void ResetRenderTargetSizes(On.Terraria.Main.orig_SetDisplayMode orig, int width, int height, bool fullscreen) { if (FusableParticleManager.HasBeenFormallyDefined) FusableParticleManager.LoadParticleRenderSets(true, width, height); orig(width, height, fullscreen); } + #endregion General Particle Rendering - private static void DrawCustomLava(ILContext il) + #region Custom Lava Visuals + private static void DrawCustomLava(On.Terraria.GameContent.Drawing.TileDrawing.orig_DrawPartialLiquid orig, TileDrawing self, Tile tileCache, Vector2 position, Rectangle liquidSize, int liquidType, Color aColor) { - ILCursor cursor = new ILCursor(il); - - FieldInfo liquidTexturesField = typeof(TextureAssets).GetField("Liquid"); - FieldInfo liquidSlopeTexturesField = typeof(TextureAssets).GetField("LiquidSlope"); - - void replaceLiquidTexture(LiquidTileType type) + if (liquidType != 1) { - // Move to the end of the get_Value() call and then use the resulting texture to check if a new one should replace it. - // Adding to the index directly would seem like a simple, direct way of achieving this since the operation is incredibly light, but - // it also unsafe due to the potential for NOP operations to appear. - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchCallvirt(textureGetValueMethod))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid texture Value call."); - return; - } - cursor.EmitDelegate>(initialTexture => SelectLavaTexture(initialTexture, type)); - } - - void replaceLiquidColor(bool sloped) - { - // Pass the texture in so that the method can ensure it is not messing around with non-lava textures. - cursor.Emit(OpCodes.Ldsfld, sloped ? liquidSlopeTexturesField : liquidTexturesField); - cursor.Emit(OpCodes.Ldarg, 4); - cursor.Emit(OpCodes.Ldelem_Ref); - cursor.Emit(OpCodes.Callvirt, textureGetValueMethod); - cursor.EmitDelegate>((initialColor, initialTexture) => SelectLavaColor(initialTexture, initialColor)); - } - - // Replace initial textures and colors. - if (!cursor.TryGotoNext(c => c.MatchLdsfld(liquidTexturesField))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid texture array load."); + orig(self, tileCache, position, liquidSize, liquidType, aColor); return; } - replaceLiquidTexture(LiquidTileType.Waterflow); + + Texture2D initialTexture = TextureAssets.LiquidSlope[liquidType].Value; + Texture2D slopeTexture = SelectLavaTexture(liquidType == 1 ? CustomLavaManagement.LavaSlopeTexture : initialTexture, LiquidTileType.Slope); + aColor = SelectLavaColor(initialTexture, aColor, liquidType == 1); - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchLdarg(5))) + int slope = (int)tileCache.Slope; + if (!TileID.Sets.BlocksWaterDrawingBehindSelf[tileCache.TileType] || slope == 0) { - LogFailure("Custom Lava Drawing", "Could not locate the liquid light color."); + Texture2D liquidTexture = SelectLavaTexture(liquidType == 1 ? CustomLavaManagement.LavaBlockTexture : TextureAssets.Liquid[liquidType].Value, LiquidTileType.Block); + Main.spriteBatch.Draw(liquidTexture, position, liquidSize, aColor, 0f, default, 1f, 0, 0f); return; } - replaceLiquidColor(false); - - // Replace sloped textures and colors. - for (int i = 0; i < 4; i++) + liquidSize.X += 18 * (slope - 1); + if (tileCache.Slope == SlopeType.SlopeDownLeft) { - if (!cursor.TryGotoNext(c => c.MatchLdsfld(liquidSlopeTexturesField))) - { - LogFailure("Custom Lava Drawing", "Could not locate the sloped liquid texture array load."); - return; - } - replaceLiquidTexture(LiquidTileType.Slope); - - if (!cursor.TryGotoNext(MoveType.After, c => c.MatchLdarg(5))) - { - LogFailure("Custom Lava Drawing", "Could not locate the liquid light color."); - return; - } - replaceLiquidColor(true); + Main.spriteBatch.Draw(slopeTexture, position, liquidSize, aColor, 0f, Vector2.Zero, 1f, 0, 0f); + return; + } + if (tileCache.Slope == SlopeType.SlopeDownRight) + { + Main.spriteBatch.Draw(slopeTexture, position, liquidSize, aColor, 0f, Vector2.Zero, 1f, 0, 0f); + return; + } + if (tileCache.Slope == SlopeType.SlopeUpLeft) + { + Main.spriteBatch.Draw(slopeTexture, position, liquidSize, aColor, 0f, Vector2.Zero, 1f, 0, 0f); + return; + } + if (tileCache.Slope == SlopeType.SlopeUpRight) + { + Main.spriteBatch.Draw(slopeTexture, position, liquidSize, aColor, 0f, Vector2.Zero, 1f, 0, 0f); } } @@ -759,12 +777,13 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldfld, typeof(LiquidRenderer).GetField("_liquidTextures")); cursor.Emit(OpCodes.Ldloc, 8); cursor.Emit(OpCodes.Ldelem_Ref); - cursor.EmitDelegate>((initialColor, initialTexture) => + cursor.Emit(OpCodes.Ldloc, 8); + cursor.EmitDelegate>((initialColor, initialTexture, liquidType) => { - initialColor.TopLeftColor = SelectLavaColor(initialTexture, initialColor.TopLeftColor); - initialColor.TopRightColor = SelectLavaColor(initialTexture, initialColor.TopRightColor); - initialColor.BottomLeftColor = SelectLavaColor(initialTexture, initialColor.BottomLeftColor); - initialColor.BottomRightColor = SelectLavaColor(initialTexture, initialColor.BottomRightColor); + initialColor.TopLeftColor = SelectLavaColor(initialTexture, initialColor.TopLeftColor, liquidType == 1); + initialColor.TopRightColor = SelectLavaColor(initialTexture, initialColor.TopRightColor, liquidType == 1); + initialColor.BottomLeftColor = SelectLavaColor(initialTexture, initialColor.BottomLeftColor, liquidType == 1); + initialColor.BottomRightColor = SelectLavaColor(initialTexture, initialColor.BottomRightColor, liquidType == 1); return initialColor; }); } @@ -773,6 +792,33 @@ namespace CalamityMod.ILEditing { ILCursor cursor = new ILCursor(il); + // Locate the local index for the liquid color. + int liquidColorLocalIndex = 0; + MethodInfo lightingGetColorMethod = typeof(Lighting).GetMethod("GetColor", new Type[] { typeof(int), typeof(int) }); + if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchCallOrCallvirt(lightingGetColorMethod))) + { + LogFailure("Custom Lava Drawing", "Could not lighting GetColor call."); + return; + } + if (!cursor.TryGotoNext(c => c.MatchStloc(out liquidColorLocalIndex))) + { + LogFailure("Custom Lava Drawing", "Could not lighting GetColor local variable index."); + return; + } + + // Shortly after the liquid color local is the liquid type integer. Locate it. + int liquidTypeLocalIndex = 0; + if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchLdcI4(0))) + { + LogFailure("Custom Lava Drawing", "Could not default value for the liquid type."); + return; + } + if (!cursor.TryGotoNext(c => c.MatchStloc(out liquidTypeLocalIndex))) + { + LogFailure("Custom Lava Drawing", "Could not liquid type local variable index."); + return; + } + // Select the lava color. if (!cursor.TryGotoNext(MoveType.After, c => c.MatchCallOrCallvirt("get_NotRetro"))) { @@ -781,13 +827,13 @@ namespace CalamityMod.ILEditing } // Pass the texture in so that the method can ensure it is not messing around with non-lava textures. - cursor.Emit(OpCodes.Ldloc, 13); + cursor.Emit(OpCodes.Ldloc, liquidColorLocalIndex); cursor.Emit(OpCodes.Ldsfld, typeof(TextureAssets).GetField("Liquid")); - cursor.Emit(OpCodes.Ldloc, 15); + cursor.Emit(OpCodes.Ldloc, liquidTypeLocalIndex); cursor.Emit(OpCodes.Ldelem_Ref); cursor.Emit(OpCodes.Call, textureGetValueMethod); cursor.EmitDelegate>((initialColor, initialTexture) => SelectLavaColor(initialTexture, initialColor)); - cursor.Emit(OpCodes.Stloc, 13); + cursor.Emit(OpCodes.Stloc, liquidColorLocalIndex); // Go back to the start and change textures as necessary. cursor.Index = 0; @@ -820,14 +866,14 @@ namespace CalamityMod.ILEditing // Determine the waterfall type. This happens after all the "If Lava do blahblahblah" color checks, meaning it will have the same // color properties as lava. - cursor.Emit(OpCodes.Ldloc, 13); + cursor.Emit(OpCodes.Ldloc, 12); cursor.EmitDelegate>(initialWaterfallStyle => CustomLavaManagement.SelectLavafallStyle(initialWaterfallStyle)); - cursor.Emit(OpCodes.Stloc, 13); + cursor.Emit(OpCodes.Stloc, 12); - cursor.Emit(OpCodes.Ldloc, 13); - cursor.Emit(OpCodes.Ldloc, 56); + cursor.Emit(OpCodes.Ldloc, 12); + cursor.Emit(OpCodes.Ldloc, 54); cursor.EmitDelegate>((initialWaterfallStyle, initialLavafallColor) => CustomLavaManagement.SelectLavafallColor(initialWaterfallStyle, initialLavafallColor)); - cursor.Emit(OpCodes.Stloc, 56); + cursor.Emit(OpCodes.Stloc, 54); } #endregion Custom Lava Visuals @@ -903,8 +949,8 @@ namespace CalamityMod.ILEditing c.EmitDelegate>(arr => { // resize the array and add our custom firefly - Array.Resize(ref arr, arr.Length+1); - arr[arr.Length-1] = (short)ModContent.NPCType(); + Array.Resize(ref arr, arr.Length + 1); + arr[arr.Length - 1] = (short)ModContent.NPCType(); return arr; }); @@ -916,5 +962,145 @@ namespace CalamityMod.ILEditing throw new Exception("Hook location not found, switch(*) { case 54: ..."); } #endregion Statue Additions + + #region Make Tax Collector Worth it + private static void MakeTaxCollectorUseful(ILContext il) + { + ILCursor cursor = new(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("buyPrice"))) + { + LogFailure("Tax Collector Money Boosts", "Could not locate the amount of money to collect per town NPC."); + return; + } + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Call, "get_TotalTaxesPerNPC"); + + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("buyPrice"))) + { + LogFailure("Tax Collector Money Boosts", "Could not locate the maximum amount of money to collect."); + return; + } + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Call, "get_TaxesToCollectLimit"); + } + #endregion Make Tax Collector Worth it + #region Foreground tiles drawing + private static void DrawForegroundStuff(On.Terraria.Main.orig_DrawGore orig, Main self) + { + orig(self); + if (Main.PlayerLoaded && !Main.gameMenu) + ForegroundManager.DrawTiles(); + } + + private static void ClearForegroundStuff(On.Terraria.GameContent.Drawing.TileDrawing.orig_PreDrawTiles orig, Terraria.GameContent.Drawing.TileDrawing self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets) + { + orig(self, solidLayer, forRenderTargets, intoRenderTargets); + + if (!solidLayer && (intoRenderTargets || Lighting.UpdateEveryFrame)) + ForegroundManager.ClearTiles(); + } + #endregion + + #region Tile ping overlay + private static void ClearTilePings(On.Terraria.GameContent.Drawing.TileDrawing.orig_Draw orig, Terraria.GameContent.Drawing.TileDrawing self, bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride) + { + //Retro & Trippy light modes are fine. Just reset the cache before every time stuff gets drawn. + if (Lighting.UpdateEveryFrame) + { + //But only if its not on the non solid layer, assumedly because it draws first or something + if (!solidLayer) + TilePingerSystem.ClearTiles(); + } + + else + { + //For the white color mode, we also can simply clear all the cache at once, but this time its only on the solid layers. Don't ask me why i don't know it just works + if (Lighting.Mode == LightMode.White) + { + if (solidLayer) + TilePingerSystem.ClearTiles(); + } + + //In color mode, the tiles get cleared alternating between solid and non solid tiles + else + TilePingerSystem.ClearTiles(solidLayer); + + } + orig(self, solidLayer, forRenderTargets, intoRenderTargets, waterStyleOverride); + } + #endregion + + #region Custom Grappling hooks + + /// + /// Determines if the custom grapple movement should take place or not. Useful for hooks that only do movement tricks in some cases + /// + private static void CustomGrappleMovementCheck(On.Terraria.Player.orig_GrappleMovement orig, Player self) + { + WulfrumPackPlayer mp = self.GetModPlayer(); + + if (mp.GrappleMovementDisabled) + return; + + orig(self); + } + + /// + /// This is called right before the game decides wether or not to update the players velocity based on "real" physics (aka not tongued or hooked or with a pulley) + /// + private static void CustomGrapplePreDefaultMovement(On.Terraria.Player.orig_UpdatePettingAnimal orig, Player self) + { + orig(self); + + WulfrumPackPlayer mp = self.GetModPlayer(); + mp.hookCache = -1; + + //if tongued, dnc. + if (self.tongued) + return; + + //Cache the player's grapple and remove it temporarily (Gets re added in the modplayer's PostUpdateRunSpeeds) + if (self.grappling[0] >= 0 && mp.GrappleMovementDisabled && Main.projectile[self.grappling[0]].type == ModContent.ProjectileType()) + { + mp.hookCache = self.grappling[0]; + self.grappling[0] = -1; + self.grapCount = 0; + } + } + + /// + /// Used before the player steps up a half tile. If we don't do that, players that are grappled but don't use hook movement won't be able to go over tiles. + /// The hook cache is reset in PreUpdateMovement + /// + private static void CustomGrapplePreStepUp(On.Terraria.Player.orig_SlopeDownMovement orig, Player self) + { + orig(self); + + WulfrumPackPlayer mp = self.GetModPlayer(); + if (self.grappling[0] >= 0 && mp.GrappleMovementDisabled && Main.projectile[self.grappling[0]].type == ModContent.ProjectileType()) + { + mp.hookCache = self.grappling[0]; + self.grappling[0] = -1; + self.grapCount = 0; + } + } + + /// + /// This is done to put the hook if it was cacehd during the frame instruction. + /// + private static void CustomGrapplePostFrame(On.Terraria.Player.orig_PlayerFrame orig, Player self) + { + orig(self); + WulfrumPackPlayer mp = self.GetModPlayer(); + + if (mp.hookCache > -1) + { + self.grappling[0] = mp.hookCache; + self.grapCount = 1; + } + + mp.hookCache = -1; + } + #endregion } } diff --git a/ILEditing/VanillaBugfixingILChanges.cs b/ILEditing/VanillaBugfixingILChanges.cs index 0cd1d964cd..e7ed8c81fd 100644 --- a/ILEditing/VanillaBugfixingILChanges.cs +++ b/ILEditing/VanillaBugfixingILChanges.cs @@ -174,7 +174,7 @@ namespace CalamityMod.ILEditing { cache.Add(new OrderedProjectileEntry() { - Proj = Main.projectile[i] ?? new Projectile(), + Proj = Main.projectile[i] ?? new(), OriginalIndex = i }); } @@ -182,12 +182,18 @@ namespace CalamityMod.ILEditing }); cursor.Emit(OpCodes.Stsfld, typeof(ILChanges).GetField("OrderedProjectiles", BindingFlags.Static | BindingFlags.Public)); + // Find the update loop update local index. + int updateLoopLocalIndex = -1; + cursor.GotoNext(i => i.MatchStloc(out updateLoopLocalIndex)); + // Go before the declaration of the projectile loop index and declare the ordered projectile. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStsfld
("ProjectileUpdateLoopIndex"))) + cursor.Goto(0); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStsfld
("ProjectileUpdateLoopIndex"))) { LogFailure("Projectile Update Priority fix", "Could not locate the ProjectileUpdateLoopIndex field."); return; } + int updateIndexPosition = cursor.Index; // Replace the projectile reference on the Projectile.Update call. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdelemRef())) @@ -199,14 +205,21 @@ namespace CalamityMod.ILEditing // Pop the Main.projectile[i] reference and replace it with OrderedProjectiles[i].Proj. cursor.Emit(OpCodes.Pop); cursor.Emit(OpCodes.Ldsfld, typeof(ILChanges).GetField("OrderedProjectiles", BindingFlags.Static | BindingFlags.Public)); - cursor.Emit(OpCodes.Ldloc, 29); + cursor.Emit(OpCodes.Ldloc, updateLoopLocalIndex); cursor.Emit(OpCodes.Callvirt, typeof(List).GetMethod("get_Item")); cursor.Emit(OpCodes.Ldfld, typeof(OrderedProjectileEntry).GetField("Proj")); - // Remove the direct i reference in the Update call and replace it with the original index in the cache, to prevent update ID + // Pop the direct i reference in the Update call and replace it with the original index in the cache, to prevent update ID // mismatches. - cursor.Remove(); - cursor.Emit(OpCodes.Ldloc, 29); + cursor.Goto(updateIndexPosition); + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCall("Call"))) + { + LogFailure("Projectile Update Priority fix", "Could not locate the projectile Update call."); + return; + } + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Ldloc, updateLoopLocalIndex); cursor.EmitDelegate>(i => OrderedProjectiles[i].OriginalIndex); } #endregion Fix Projectile Update Priority Problems diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 1ae35d7587..78678e8139 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -7,6 +7,8 @@ using Terraria; using Terraria.GameContent.UI.States; using Terraria.ID; using Terraria.WorldBuilding; +using CalamityMod.Systems; +using System.Linq; namespace CalamityMod.ILEditing { @@ -206,5 +208,21 @@ namespace CalamityMod.ILEditing c.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.SmallWorldWarning"); } #endregion + + #region Clear temporary modded tiles + private static void ClearModdedTempTiles(On.Terraria.IO.WorldFile.orig_ClearTempTiles orig) + { + orig(); + + for (int i = 0; i < Main.maxTilesX; i++) + { + for (int j = 0; j < Main.maxTilesY; j++) + { + if (TempTilesManagerSystem.TemporaryTileIDs.Contains(Main.tile[i, j].TileType)) + WorldGen.KillTile(i, j); + } + } + } + #endregion } } diff --git a/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs b/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs new file mode 100644 index 0000000000..4ba0b13b44 --- /dev/null +++ b/InverseKinematics/CyclicCoordinateDescentUpdateRule.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; + +namespace CalamityMod.InverseKinematics +{ + public class CyclicCoordinateDescentUpdateRule : IInverseKinematicsUpdateRule + { + public float AngularOffsetAcceleration; + public float AngularDeviationLenience; + public CyclicCoordinateDescentUpdateRule(float angularOffsetAcceleration, float angularDeviationLenience) + { + AngularOffsetAcceleration = angularOffsetAcceleration; + AngularDeviationLenience = angularDeviationLenience; + } + + public void Update(LimbCollection limbs, Vector2 destination) + { + float distanceFromStart = Vector2.Distance(destination, limbs.ConnectPoint); + float distanceFromEnd = Vector2.Distance(destination, limbs.EndPoint); + float slowdownInterpolant = Utils.GetLerpValue(8f, 40f, distanceFromEnd, true); + slowdownInterpolant *= Utils.GetLerpValue(8f, 40f, distanceFromStart, true); + + Vector2 originalEndPoint = limbs.EndPoint; + for (int i = limbs.Limbs.Length - 1; i >= 0; i--) + { + // Move based on angular offsets. Movement is dampened the closer a limb is to being the first limb. + Vector2 currentToEndOffset = originalEndPoint - limbs.Limbs[i].ConnectPoint; + Vector2 currentToDestinationOffset = destination - limbs.Limbs[i].ConnectPoint; + Vector2 perpendicularDirection = currentToDestinationOffset.RotatedBy(MathHelper.PiOver2); + float angularOffset = currentToEndOffset.AngleBetween(currentToDestinationOffset) * (float)Math.Sqrt((i + 1f) / limbs.Limbs.Length); + + // Determine direction by choosing the angle which approaches the destination faster. + float leftAngularOffset = currentToEndOffset.AngleBetween(currentToDestinationOffset - perpendicularDirection); + float rightAngularOffset = currentToEndOffset.AngleBetween(currentToDestinationOffset + perpendicularDirection); + if (leftAngularOffset > rightAngularOffset) + angularOffset *= -1f; + + // Perform safety checks on the result of the underlying arccosines. + if (float.IsNaN(angularOffset)) + break; + + // Update rotation. + limbs.Limbs[i].Rotation += angularOffset * slowdownInterpolant * AngularOffsetAcceleration; + + // And limit it so that it doesn't look weird. + if (i > 0) + { + float behindRotation = (float)limbs.Limbs[i - 1].Rotation; + limbs.Limbs[i].Rotation = MathHelper.Clamp((float)limbs.Limbs[i].Rotation, behindRotation - AngularDeviationLenience, behindRotation + AngularDeviationLenience); + } + } + } + } +} diff --git a/InverseKinematics/IInverseKinematicsUpdateRule.cs b/InverseKinematics/IInverseKinematicsUpdateRule.cs new file mode 100644 index 0000000000..1e90ddefc1 --- /dev/null +++ b/InverseKinematics/IInverseKinematicsUpdateRule.cs @@ -0,0 +1,9 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.InverseKinematics +{ + public interface IInverseKinematicsUpdateRule + { + void Update(LimbCollection limbs, Vector2 destination); + } +} diff --git a/InverseKinematics/Limb.cs b/InverseKinematics/Limb.cs new file mode 100644 index 0000000000..be5e1c43d2 --- /dev/null +++ b/InverseKinematics/Limb.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.InverseKinematics +{ + public class Limb + { + // Doubles are used instead of floats as a means of providing sufficient precision to not cause erroneous results when + // doing approximations of derivative limits with small divisors. + public double Rotation; + public double Length; + public Vector2 ConnectPoint; + public Vector2 EndPoint => ConnectPoint + ((float)Rotation).ToRotationVector2() * (float)Length; + + public Limb(float rotation, float length) + { + Rotation = rotation; + Length = length; + } + } +} diff --git a/InverseKinematics/LimbCollection.cs b/InverseKinematics/LimbCollection.cs new file mode 100644 index 0000000000..071baa3122 --- /dev/null +++ b/InverseKinematics/LimbCollection.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using System.Linq; + +namespace CalamityMod.InverseKinematics +{ + public class LimbCollection + { + public Limb[] Limbs; + public IInverseKinematicsUpdateRule UpdateRule; + public Vector2 ConnectPoint => Limbs.First().ConnectPoint; + public Vector2 EndPoint => Limbs.Last().EndPoint; + public double TotalLength => Limbs.Sum(l => l.Length); + + public LimbCollection(IInverseKinematicsUpdateRule updateRule, int limbCount, float limbLength) + { + UpdateRule = updateRule; + + Limbs = new Limb[limbCount]; + for (int i = 0; i < limbCount; i++) + Limbs[i] = new Limb(0f, limbLength); + } + + public LimbCollection(IInverseKinematicsUpdateRule updateRule, params float[] limbLengths) + { + UpdateRule = updateRule; + + int limbCount = limbLengths.Length; + Limbs = new Limb[limbCount]; + for (int i = 0; i < limbCount; i++) + Limbs[i] = new Limb(0f, limbLengths[i]); + } + + public void UpdateConnectPoints(Vector2? connectPoint = null) + { + if (connectPoint.HasValue) + Limbs[0].ConnectPoint = connectPoint.Value; + + for (int i = 1; i < Limbs.Length; i++) + Limbs[i].ConnectPoint = Limbs[i - 1].EndPoint; + } + + public Limb this[int index] + { + get => Limbs[index]; + set => Limbs[index] = value; + } + + public void Update(Vector2 connectPoint, Vector2 destination) + { + UpdateRule.Update(this, destination); + Limbs[0].ConnectPoint = connectPoint; + UpdateConnectPoints(connectPoint); + } + } +} diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index e905fc8cba..f14059a7a0 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -34,14 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.GoldCrown). - AddIngredient(5). - AddIngredient(10). - AddTile(TileID.MythrilAnvil). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.PlatinumCrown). + AddRecipeGroup("AnyGoldCrown"). AddIngredient(5). AddIngredient(10). AddTile(TileID.MythrilAnvil). diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index aab4b74fef..bb21684024 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -6,17 +6,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - //[AutoloadEquip(EquipType.Face)] + [AutoloadEquip(EquipType.Face)] public class AbyssalDivingGear : ModItem { - public override void Load() - { - if (Main.netMode != NetmodeID.Server) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AbyssalDivingGear_Face", EquipType.Head, this); - } - } - public override void SetStaticDefaults() { SacrificeTotal = 1; @@ -30,9 +22,9 @@ namespace CalamityMod.Items.Accessories if (Main.netMode != NetmodeID.Server) { - int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawFullHair[equipSlot] = false; - ArmorIDs.Head.Sets.DrawHatHair[equipSlot] = false; + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); + ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -50,8 +42,6 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; - if (!hideVisual) - modPlayer.abyssDivingGear = true; //this bool is just used for drawing player.arcticDivingGear = true; player.accFlipper = true; player.accDivingHelm = true; @@ -62,18 +52,6 @@ namespace CalamityMod.Items.Accessories } } - public override bool IsVanitySet(int head, int body, int legs) => true; - - public override void PreUpdateVanitySet(Player player) - { - player.Calamity().abyssDivingGear = true; - } - - public override void UpdateVanity(Player player) - { - player.Calamity().abyssDivingGear = true; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Affliction.cs b/Items/Accessories/Affliction.cs index c2277c11a5..0dd2438f6d 100644 --- a/Items/Accessories/Affliction.cs +++ b/Items/Accessories/Affliction.cs @@ -1,10 +1,11 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Accessories Item.height = 44; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index cdc398a5ca..00cb5e505d 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 36; - Item.height = 32; + Item.width = 32; + Item.height = 36; Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.accessory = true; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.angelTreads = true; player.accRunSpeed = 7.5f; - player.rocketBoots = 3; + player.rocketBoots = player.vanityRocketBoots = 3; player.moveSpeed += 0.12f; player.iceSkate = true; player.waterWalk = true; @@ -45,6 +45,11 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.OnFire] = true; } + public override void UpdateVanity(Player player) + { + player.vanityRocketBoots = 3; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/AngelTreads.png b/Items/Accessories/AngelTreads.png index b3eb3b6477..dce060d027 100644 Binary files a/Items/Accessories/AngelTreads.png and b/Items/Accessories/AngelTreads.png differ diff --git a/Items/Accessories/AngelTreads_Shoes.png b/Items/Accessories/AngelTreads_Shoes.png index 7b75c4e9ec..b8df54aaa2 100644 Binary files a/Items/Accessories/AngelTreads_Shoes.png and b/Items/Accessories/AngelTreads_Shoes.png differ diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index 1bd6ddd2b0..47905d6bb2 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -1,12 +1,13 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using System.Collections.Generic; +using System.Linq; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; -using Terraria.Audio; namespace CalamityMod.Items.Accessories { @@ -36,8 +37,7 @@ namespace CalamityMod.Items.Accessories Item.height = 92; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.accessory = true; - Item.rare = 10; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -66,8 +66,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddRecipeGroup("AnyHallowedHelmet"). - AddIngredient(ItemID.HallowedPlateMail). - AddIngredient(ItemID.HallowedGreaves). + AddRecipeGroup("AnyHallowedPlatemail"). + AddRecipeGroup("AnyHallowedGreaves"). AddIngredient(ItemID.PaladinsShield). AddIngredient(ItemID.TrueExcalibur). AddIngredient(ItemID.CrossNecklace). diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 17a0347647..b6dccbe1cc 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -1,13 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; -using CalamityMod.CalPlayer.Dashes; namespace CalamityMod.Items.Accessories { @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 28; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List list) @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.DashID = AsgardianAegisDash.ID; - player.dash = 0; + player.dashType = 0; modPlayer.elysianAegis = true; player.noKnockback = true; player.fireWalk = true; diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 10996da30b..975574bcc5 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.DashID = AsgardsValorDash.ID; - player.dash = 0; + player.dashType = 0; player.noKnockback = true; player.fireWalk = true; player.buffImmune[BuffID.OnFire] = true; @@ -66,7 +66,6 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.LifeFruit, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index d2db7b964d..3f3f08a757 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -1,11 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Accessories Item.height = 26; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 84df0cf95d..b7dd011858 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,17 +15,16 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Badge of Bravery"); Tooltip.SetDefault("15% increased melee speed\n" + "Increases melee damage and melee crit by 5%\n" + - "+5 armor penetration"); + "+5 melee armor penetration"); } public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.badgeOfBravery = true; player.GetAttackSpeed() += 0.15f; + player.GetArmorPenetration() += 5; } public override void AddRecipes() diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index c9bb6c10c7..f8b4076880 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -1,7 +1,8 @@ using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Terraria; -using Terraria.ID; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Accessories Item.height = 46; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index cac19c3ce7..df99e9f8b9 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,8 +20,7 @@ namespace CalamityMod.Items.Accessories Item.width = 26; Item.height = 26; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/BloodstainedGlove_HandsOff.png b/Items/Accessories/BloodstainedGlove_HandsOff.png index 7e8bd96f31..726674e1a0 100644 Binary files a/Items/Accessories/BloodstainedGlove_HandsOff.png and b/Items/Accessories/BloodstainedGlove_HandsOff.png differ diff --git a/Items/Accessories/BloodstainedGlove_HandsOn.png b/Items/Accessories/BloodstainedGlove_HandsOn.png index 7b98ab21b2..906e1a3345 100644 Binary files a/Items/Accessories/BloodstainedGlove_HandsOn.png and b/Items/Accessories/BloodstainedGlove_HandsOn.png differ diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index bf8b394224..e66fd4a3a4 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodyWormTooth = true; - player.GetAttackSpeed() += 0.07f; } public override void AddRecipes() diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 63147f3973..f2cd522540 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 44; Item.height = 108; - Item.Calamity().customRarity = CalamityRarity.Violet; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 2904a7d398..53089018fe 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Coin of Deceit"); - Tooltip.SetDefault("Stealth strikes only expend 75% of your max stealth\n" + - "6% increased rogue crit chance"); + Tooltip.SetDefault("Stealth strikes only expend 85% of your max stealth\n" + + "6% increased rogue crit chance"); } public override void SetDefaults() @@ -26,16 +26,16 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + player.Calamity().stealthStrike85Cost = true; player.GetCritChance() += 6; - player.Calamity().stealthStrike75Cost = true; } public override void AddRecipes() { CreateRecipe(). AddRecipeGroup("AnyGoldBar", 4). - AddRecipeGroup("AnyCopperBar", 8). - AddIngredient(5). + AddRecipeGroup("AnyEvilBar", 8). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index 0a88dccd7e..23361d6548 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.DataStructures; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Accessories Item.width = Item.height = 48; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.coreOfTheBloodGod = true; modPlayer.fleshTotem = true; + modPlayer.healingPotBonus += 0.25f; } public override void AddRecipes() diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index d5b34991d2..9c6aa04075 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Corrosive Spine"); - Tooltip.SetDefault("10% increased movement speed\n" + + Tooltip.SetDefault("5% increased movement speed\n" + "All rogue weapons inflict venom and spawn clouds on enemy hits\n" + "You release a ton of clouds everywhere on hit"); } @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 46; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 4; Item.accessory = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed += 0.1f; + player.moveSpeed += 0.05f; player.Calamity().corrosiveSpine = true; if (player.immune) { diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index e540a1815d..5c1e3917f3 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.dodgeScarf = true; modPlayer.DashID = CounterScarfDash.ID; - player.dash = 0; + player.dashType = 0; } } } diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 005f809f6a..be0144203c 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Dark God's Sheath"); - Tooltip.SetDefault("+20 maximum stealth\n" + + Tooltip.SetDefault("+10 maximum stealth\n" + "Mobile stealth generation accelerates while not attacking\n" + - "Stealth strikes have a 100% critical hit chance\n" + "Stealth strikes only expend 50% of your max stealth\n" + "6% increased rogue damage, and 6% increased rogue crit chance"); } @@ -31,9 +30,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.stealthStrikeAlwaysCrits = true; modPlayer.stealthStrikeHalfCost = true; - modPlayer.rogueStealthMax += 0.2f; + modPlayer.rogueStealthMax += 0.1f; modPlayer.darkGodSheath = true; player.GetCritChance() += 6; player.GetDamage() += 0.06f; diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 7d9fa3451f..3ddfefe845 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.DataStructures; @@ -30,11 +31,10 @@ namespace CalamityMod.Items.Accessories Item.width = 42; Item.height = 60; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; Item.defense = 10; Item.lifeRegen = 1; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index 39d35ad055..0eb7f5d27a 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.deepDiver = true; modPlayer.DashID = DeepDiverDash.ID; - player.dash = 0; + player.dashType = 0; } } } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 0ba2000eb6..0d0923bcb8 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 28; Item.accessory = true; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity14BuyPrice; } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 090f785df7..a812f30962 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; -using System.Linq; -using CalamityMod.Balancing; +using CalamityMod.Balancing; using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using CalamityMod.World; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Accessories "Reduces defense damage taken by 50%\n" + "Replaces Adrenaline with the Nanomachines meter\n" + $"Unlike Adrenaline, you lose no Nanomachines when you take damage, but they stop accumulating for {pauseDurationTooltip}\n" + $"With full Nanomachines, press & to heal {totalHealTooltip} health over {healDurationTooltip} seconds\n" + - "While healing, you take &% less damage\n" + + "While healing, you take @% less damage\n" + "'Nanomachines, son.'"); } @@ -47,9 +48,8 @@ namespace CalamityMod.Items.Accessories Item.height = 68; Item.accessory = true; Item.defense = 48; - Item.rare = ItemRarityID.Red; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -89,13 +89,14 @@ namespace CalamityMod.Items.Accessories hotkeyLine.Text = tooltipWithHotkey; } - // The 6th tooltip line "While healing..." has the & replaced with full adrenaline DR. - string fullAdrenDRString = (100f * BalancingConstants.FullAdrenalineDR).ToString("n0"); + // The 6th tooltip line "While healing..." has the @ replaced with full adrenaline DR. + // For whatever reason this method overrides the entire line instead of replacing the character as intended, so we duplicate the line. + string fullAdrenDRString = (100f * BalancingConstants.FullAdrenalineDR).ToString("N0"); TooltipLine healingDRLine = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip5"); if (healingDRLine != null) { - string tooltipWithDR = fullAdrenDRString.Replace("&", fullAdrenDRString); - healingDRLine.Text = tooltipWithDR; + string tooltipWithDR = fullAdrenDRString.Replace("@", fullAdrenDRString); + healingDRLine.Text = "While healing, you take " + tooltipWithDR + "% less damage"; } } } diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 2ed8feb5ce..305af709e8 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -1,8 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -26,8 +27,7 @@ namespace CalamityMod.Items.Accessories Item.width = 32; Item.height = 34; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 57330b9ee3..6e31178ea2 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -14,12 +15,11 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Eclipse Mirror"); Tooltip.SetDefault("Its reflection shows naught but darkness\n" + - "+20 maximum stealth\n" + + "+10 maximum stealth\n" + "6% increased rogue damage, and 6% increased rogue crit chance\n" + "Vastly reduces enemy aggression, even in the abyss\n" + "Stealth generates 20% faster when standing still\n" + "Mobile stealth generation exponentially accelerates while not attacking\n" + - "Stealth strikes have a 100% critical hit chance\n" + "Stealth strikes only expend 50% of your max stealth\n" + "Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" + "Evading an attack grants full stealth but has a 90 second cooldown\n" + @@ -30,9 +30,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 38; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.accessory = true; } @@ -40,9 +39,8 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.stealthGenStandstill += 0.2f; - modPlayer.rogueStealthMax += 0.2f; + modPlayer.rogueStealthMax += 0.1f; modPlayer.eclipseMirror = true; - modPlayer.stealthStrikeAlwaysCrits = true; modPlayer.stealthStrikeHalfCost = true; player.GetCritChance() += 6; player.GetDamage() += 0.06f; diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index b477a59d6e..dfd1e287e0 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Eldritch Soul Artifact"); Tooltip.SetDefault("Knowledge\n" + - "Boosts melee speed by 10%, ranged velocity by 25%, rogue damage by 15%, max minions by 2 and reduces mana cost by 15%\n" + + "Boosts melee speed by 10%, ranged velocity by 25%, rogue stealth regen by 10%, max minions by 2 and reduces mana cost by 15%\n" + "Grants immunity to Whispering Death"); } diff --git a/Items/Accessories/ElectriciansGlove_HandsOff.png b/Items/Accessories/ElectriciansGlove_HandsOff.png index 263981e5cc..6ad5c51edf 100644 Binary files a/Items/Accessories/ElectriciansGlove_HandsOff.png and b/Items/Accessories/ElectriciansGlove_HandsOff.png differ diff --git a/Items/Accessories/ElectriciansGlove_HandsOn.png b/Items/Accessories/ElectriciansGlove_HandsOn.png index 26ea192d71..895446d22b 100644 Binary files a/Items/Accessories/ElectriciansGlove_HandsOn.png and b/Items/Accessories/ElectriciansGlove_HandsOn.png differ diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index e182d3a910..348c32addb 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -29,13 +30,14 @@ namespace CalamityMod.Items.Accessories Item.height = 38; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.eGauntlet = true; + player.kbGlove = true; player.autoReuseGlove = true; player.meleeScaleGlove = true; player.GetAttackSpeed() += 0.15f; diff --git a/Items/Accessories/ElementalGauntlet_HandsOff.png b/Items/Accessories/ElementalGauntlet_HandsOff.png index cfcb9561de..d7f8edfaac 100644 Binary files a/Items/Accessories/ElementalGauntlet_HandsOff.png and b/Items/Accessories/ElementalGauntlet_HandsOff.png differ diff --git a/Items/Accessories/ElementalGauntlet_HandsOn.png b/Items/Accessories/ElementalGauntlet_HandsOn.png index d0b8ae7806..f766f05234 100644 Binary files a/Items/Accessories/ElementalGauntlet_HandsOn.png and b/Items/Accessories/ElementalGauntlet_HandsOn.png differ diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 40e9a723a8..59fa9259fc 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 911e105e49..ca39d60a2d 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -1,11 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Rarities; using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; -using CalamityMod.CalPlayer.Dashes; namespace CalamityMod.Items.Accessories { @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Accessories Item.width = 48; Item.height = 42; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.defense = 18; Item.accessory = true; } @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.DashID = ElysianAegisDash.ID; - player.dash = 0; + player.dashType = 0; modPlayer.elysianAegis = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index a30aa715e9..395ea49ed3 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Ethereal Extorter"); Tooltip.SetDefault(@"Rogue projectiles explode into homing souls on death -10% increased rogue damage and +10 maximum stealth, however, life regen is reduced by 1"); +10% increased rogue damage and +10 maximum stealth"); } public override void SetDefaults() @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.etherealExtorter = true; player.GetDamage() += 0.1f; - player.lifeRegen -= 1; modPlayer.rogueStealthMax += 0.1f; } } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index fbe4656b95..3241748764 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index 1119e7d099..c99177d730 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories modPlayer.dodgeScarf = true; modPlayer.evasionScarf = true; modPlayer.DashID = CounterScarfDash.ID; - player.dash = 0; + player.dashType = 0; } public override void AddRecipes() diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index dcd7d27f7a..47bff7522a 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -6,16 +6,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [AutoloadEquip(EquipType.Face)] public class FeatherCrown : ModItem { - public override void Load() - { - if (Main.netMode != NetmodeID.Server) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/FeatherCrown_Face", EquipType.Head, this); - } - } - public override void SetStaticDefaults() { SacrificeTotal = 1; @@ -25,9 +18,8 @@ namespace CalamityMod.Items.Accessories if (Main.netMode != NetmodeID.Server) { - int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawFullHair[equipSlot] = false; - ArmorIDs.Head.Sets.DrawHatHair[equipSlot] = false; + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -45,33 +37,12 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.rogueVelocity += 0.15f; modPlayer.featherCrown = true; - if (!hideVisual) - modPlayer.featherCrownDraw = true; //this bool is just used for drawing - } - - public override bool IsVanitySet(int head, int body, int legs) => true; - - public override void PreUpdateVanitySet(Player player) - { - player.Calamity().featherCrownDraw = true; //this bool is just used for drawing - } - - public override void UpdateVanity(Player player) - { - player.Calamity().featherCrownDraw = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.GoldCrown). - AddIngredient(6). - AddIngredient(ItemID.Feather, 8). - AddTile(TileID.SkyMill). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.PlatinumCrown). + AddRecipeGroup("AnyGoldCrown"). AddIngredient(6). AddIngredient(ItemID.Feather, 8). AddTile(TileID.SkyMill). diff --git a/Items/Accessories/FilthyGlove_HandsOff.png b/Items/Accessories/FilthyGlove_HandsOff.png index 9819d4ecfc..d54a915136 100644 Binary files a/Items/Accessories/FilthyGlove_HandsOff.png and b/Items/Accessories/FilthyGlove_HandsOff.png differ diff --git a/Items/Accessories/FilthyGlove_HandsOn.png b/Items/Accessories/FilthyGlove_HandsOn.png index c9ac854ed2..e7a4ed9800 100644 Binary files a/Items/Accessories/FilthyGlove_HandsOn.png and b/Items/Accessories/FilthyGlove_HandsOn.png differ diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index 859b6841fe..7850c277ae 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -21,15 +21,13 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 20; - Item.height = 26; + Item.width = 38; + Item.height = 42; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().fungalClump; - public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -43,8 +41,8 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { var source = player.GetSource_Accessory(Item); - int damage = (int)player.GetTotalDamage().ApplyTo(FungalClumpDamage); - int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 1f, player.whoAmI, 0f, 0f); + int damage = (int)player.GetBestClassDamage().ApplyTo(FungalClumpDamage); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 1f, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = FungalClumpDamage; } diff --git a/Items/Accessories/FungalClump.png b/Items/Accessories/FungalClump.png index 6a150e9a15..4a90b9c0e1 100644 Binary files a/Items/Accessories/FungalClump.png and b/Items/Accessories/FungalClump.png differ diff --git a/Items/Accessories/GloveOfPrecision_HandsOff.png b/Items/Accessories/GloveOfPrecision_HandsOff.png index 93b2a15cc8..49ed5c8da1 100644 Binary files a/Items/Accessories/GloveOfPrecision_HandsOff.png and b/Items/Accessories/GloveOfPrecision_HandsOff.png differ diff --git a/Items/Accessories/GloveOfPrecision_HandsOn.png b/Items/Accessories/GloveOfPrecision_HandsOn.png index 95ecec86fe..18494a9f18 100644 Binary files a/Items/Accessories/GloveOfPrecision_HandsOn.png and b/Items/Accessories/GloveOfPrecision_HandsOn.png differ diff --git a/Items/Accessories/GloveOfRecklessness.cs b/Items/Accessories/GloveOfRecklessness.cs index 24bb13e885..852458b693 100644 --- a/Items/Accessories/GloveOfRecklessness.cs +++ b/Items/Accessories/GloveOfRecklessness.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Glove of Recklessness"); - Tooltip.SetDefault("Increases rogue attack speed by 12% but decreases damage by 10%\n" + + Tooltip.SetDefault("Increases rogue attack speed by 15% but decreases damage by 10%\n" + "Adds inaccuracy to rogue weapons"); } @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.gloveOfRecklessness = true; player.GetDamage() -= 0.1f; - player.GetAttackSpeed() += 0.12f; + player.GetAttackSpeed() += 0.15f; } } } diff --git a/Items/Accessories/GloveOfRecklessness_HandsOff.png b/Items/Accessories/GloveOfRecklessness_HandsOff.png index b964f44974..e53dd764cf 100644 Binary files a/Items/Accessories/GloveOfRecklessness_HandsOff.png and b/Items/Accessories/GloveOfRecklessness_HandsOff.png differ diff --git a/Items/Accessories/GloveOfRecklessness_HandsOn.png b/Items/Accessories/GloveOfRecklessness_HandsOn.png index 9618763844..7bc135f578 100644 Binary files a/Items/Accessories/GloveOfRecklessness_HandsOn.png and b/Items/Accessories/GloveOfRecklessness_HandsOn.png differ diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index e1c2130511..4c72bf827d 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Glove of Precision"); - Tooltip.SetDefault("Decreases rogue attack speed by 20% but increases damage and crit by 12% and velocity by 25%"); + Tooltip.SetDefault("Decreases rogue attack speed by 15% but increases damage and crit by 12% and velocity by 25%"); } public override void SetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories player.GetDamage() += 0.12f; player.GetCritChance() += 12; modPlayer.rogueVelocity += 0.25f; - player.GetAttackSpeed() -= 0.2f; + player.GetAttackSpeed() -= 0.15f; } } } diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index 6a401398e9..869e56d333 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 28; Item.accessory = true; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; } diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs index 96b62b5ab4..7ee5bac4fd 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index cbe789631a..9042a5583e 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -28,9 +29,8 @@ namespace CalamityMod.Items.Accessories Item.width = 20; Item.height = 20; Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.Rainbow; + Item.rare = ModContent.RarityType(); } public override bool CanEquipAccessory(Player player, int slot, bool modded) diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 5e392504a1..4dc3b44658 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Ink Bomb"); Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" + "Gain a lot of stealth when struck\n" + - "This effect has a 20s cooldown before it can occur again"); + "This effect has a 25 second cooldown before it can occur again"); } public override void SetDefaults() diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 15a23ad743..2de7258d20 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Laudanum"); Tooltip.SetDefault("Converts certain debuffs into buffs and extends their durations\n" + - "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, Broken Armor,\n" + - "Armor Crunch, War Cleave, Chilled, Ichor and Obstructed\n" + + "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak,\n" + + "Broken Armor, Armor Crunch, Chilled, Ichor, and Obstructed\n" + "Revengeance drop"); } diff --git a/Items/Accessories/MagicLevelMeter.cs b/Items/Accessories/MagicLevelMeter.cs deleted file mode 100644 index 39f04106b1..0000000000 --- a/Items/Accessories/MagicLevelMeter.cs +++ /dev/null @@ -1,129 +0,0 @@ -using CalamityMod.CalPlayer; -using System.Collections.Generic; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using System.Linq; - -namespace CalamityMod.Items.Accessories -{ - public class MagicLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Magic Level Meter"); - Tooltip.SetDefault("Tells you how high your magic proficiency is"); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - Item.value = Item.buyPrice(0, 6, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].Calamity().magicLevel; - int exactLevel = Main.player[Main.myPlayer].Calamity().exactMagicLevel; - int damageGain = 0; - int manaUsage = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - manaUsage = 1; - break; - case 4: - damageGain = 2; - manaUsage = 1; - critGain = 1; - break; - case 5: - damageGain = 2; - manaUsage = 2; - critGain = 1; - break; - case 6: - damageGain = 3; - manaUsage = 2; - critGain = 1; - break; - case 7: - damageGain = 3; - manaUsage = 2; - critGain = 2; - break; - case 8: - damageGain = 3; - manaUsage = 3; - critGain = 2; - break; - case 9: - damageGain = 4; - manaUsage = 3; - critGain = 2; - break; - case 10: - damageGain = 4; - manaUsage = 4; - critGain = 2; - break; - case 11: - damageGain = 4; - manaUsage = 4; - critGain = 3; - break; - case 12: - damageGain = 4; - manaUsage = 5; - critGain = 3; - break; - case 13: - damageGain = 5; - manaUsage = 5; - critGain = 3; - break; - case 14: - damageGain = 5; - manaUsage = 6; - critGain = 3; - break; - case 15: - damageGain = 6; - manaUsage = 6; - critGain = 3; - break; - } - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); - - if (line != null) - line.Text = "Tells you how high your magic proficiency is\n" + - "While equipped you will gain magic proficiency faster\n" + - "The higher your magic level the higher your magic damage, critical strike chance, and the lower your mana cost\n" + - "Magic proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Magic level (max of 15): " + exactLevel + "\n" + - "Magic damage increase: " + damageGain + "%\n" + - "Mana usage decrease: " + manaUsage + "%\n" + - "Magic crit increase: " + critGain + "%"; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fasterMagicLevel = true; - } - } -} diff --git a/Items/Accessories/MagicLevelMeter.png b/Items/Accessories/MagicLevelMeter.png deleted file mode 100644 index c3e5bff4fc..0000000000 Binary files a/Items/Accessories/MagicLevelMeter.png and /dev/null differ diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs new file mode 100644 index 0000000000..ddf5026c1e --- /dev/null +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -0,0 +1,157 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System.Collections.Generic; +using System.Linq; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Back)] + //Its not like its a renamed version of the bayonet, but i put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. + [LegacyName("MarniteBayonet")] + public class MarniteRepulsionShield : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Marnite Repulsion Shield"); + Tooltip.SetDefault("Enemies behind you are struck by high-knockback hardlight quills\n" + + "[c/FFF191:Backstabbers Beware!]"); + } + + public override void SetDefaults() + { + Item.width = 24; + Item.height = 30; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.accessory = true; + Item.defense = 2; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + MarniteRepulsionShieldPlayer modPlayer = player.GetModPlayer(); + modPlayer.shieldEquipped = true; + + if (player.whoAmI == Main.myPlayer) + { + int baseDamage = 5; + var source = player.GetSource_Accessory(Item); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), baseDamage, 10f, Main.myPlayer); + hitbox.originalDamage = baseDamage; + } + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("AnyGoldBar", 5). + AddIngredient(ItemID.Granite, 15). + AddIngredient(ItemID.Marble, 15). + AddTile(TileID.Anvils). + Register(); + + } + } + + public class MarniteRepulsionShieldPlayer : ModPlayer + { + public bool shieldEquipped = false; + + public override void ResetEffects() + { + shieldEquipped = false; + } + + public override void UpdateDead() + { + shieldEquipped = false; + } + } + + public class MarniteRepulsionHitbox : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Repulsion Matrix"); + } + + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 80; + Projectile.friendly = true; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = 700; + Projectile.tileCollide = false; + Projectile.netImportant = true; + } + + public override void AI() + { + if (Owner.active && Owner.GetModPlayer().shieldEquipped) + { + Projectile.Center = Owner.Center + Vector2.UnitX * Owner.direction * -20f; + if (Owner.mount.Active) + { + Projectile.Center += -Vector2.UnitY * Owner.mount.PlayerOffset; + } + + if (Main.rand.NextBool(6)) + { + Vector2 dustOrigin = Owner.MountedCenter; + Vector2 dustDirection = (Vector2.UnitX * -1 * Owner.direction).RotatedByRandom(MathHelper.PiOver2 * 0.93f); + dustOrigin += dustDirection * 14f; + float spikeSpeed = Main.rand.NextFloat(1f, 3f); + + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(dustOrigin, 229, dustDirection * spikeSpeed + Owner.velocity, 120, Scale: Main.rand.NextFloat(0.6f, 1f)); + dust.noGravity = true; + dustOrigin += dustDirection * 4f; + } + } + } + + else + Projectile.active = false; + } + + public override bool? CanHitNPC(NPC target) + { + //Only enemies that are behind the player (shouldn't happen but just in case + if (Math.Sign((Owner.Center - target.Center).X) != Owner.direction) + return false; + + //Don't hit friendly enemies and such (it would look really off) + if (target.CountsAsACritter || target.friendly || !target.chaseable) + return false; + + return base.CanHitNPC(target); + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + hitDirection = Math.Sign(-Owner.direction); + } + + public override bool? CanCutTiles() => false; + } +} diff --git a/Items/Accessories/MarniteRepulsionShield.png b/Items/Accessories/MarniteRepulsionShield.png new file mode 100644 index 0000000000..d4cce44411 Binary files /dev/null and b/Items/Accessories/MarniteRepulsionShield.png differ diff --git a/Items/Accessories/MarniteRepulsionShield_Back.png b/Items/Accessories/MarniteRepulsionShield_Back.png new file mode 100644 index 0000000000..d178532eaf Binary files /dev/null and b/Items/Accessories/MarniteRepulsionShield_Back.png differ diff --git a/Items/Accessories/MeleeLevelMeter.cs b/Items/Accessories/MeleeLevelMeter.cs deleted file mode 100644 index aa0307bf2c..0000000000 --- a/Items/Accessories/MeleeLevelMeter.cs +++ /dev/null @@ -1,130 +0,0 @@ -using CalamityMod.CalPlayer; -using System.Collections.Generic; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using System.Linq; - -namespace CalamityMod.Items.Accessories -{ - public class MeleeLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Melee Level Meter"); - Tooltip.SetDefault("Tells you how high your melee proficiency is"); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - Item.value = Item.buyPrice(0, 6, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].Calamity().meleeLevel; - int exactLevel = Main.player[Main.myPlayer].Calamity().exactMeleeLevel; - int damageGain = 0; - int meleeSpeed = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - meleeSpeed = 1; - break; - case 4: - damageGain = 2; - meleeSpeed = 1; - critGain = 1; - break; - case 5: - damageGain = 3; - meleeSpeed = 1; - critGain = 1; - break; - case 6: - damageGain = 4; - meleeSpeed = 1; - critGain = 1; - break; - case 7: - damageGain = 4; - meleeSpeed = 2; - critGain = 1; - break; - case 8: - damageGain = 4; - meleeSpeed = 2; - critGain = 2; - break; - case 9: - damageGain = 5; - meleeSpeed = 2; - critGain = 2; - break; - case 10: - damageGain = 5; - meleeSpeed = 3; - critGain = 2; - break; - case 11: - damageGain = 5; - meleeSpeed = 3; - critGain = 3; - break; - case 12: - damageGain = 5; - meleeSpeed = 4; - critGain = 3; - break; - case 13: - damageGain = 6; - meleeSpeed = 4; - critGain = 3; - break; - case 14: - damageGain = 6; - meleeSpeed = 5; - critGain = 3; - break; - case 15: - damageGain = 6; - meleeSpeed = 6; - critGain = 3; - break; - } - - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); - - if (line != null) - line.Text = "Tells you how high your melee proficiency is\n" + - "While equipped you will gain melee proficiency faster\n" + - "The higher your melee level the higher your melee damage, speed, and critical strike chance\n" + - "Melee proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Melee level (max of 15): " + exactLevel + "\n" + - "Melee damage increase: " + damageGain + "%\n" + - "Melee speed increase: " + meleeSpeed + "%\n" + - "Melee crit increase: " + critGain + "%"; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fasterMeleeLevel = true; - } - } -} diff --git a/Items/Accessories/MeleeLevelMeter.png b/Items/Accessories/MeleeLevelMeter.png deleted file mode 100644 index c3e5bff4fc..0000000000 Binary files a/Items/Accessories/MeleeLevelMeter.png and /dev/null differ diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 34310283ee..429f65a02b 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -6,19 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [AutoloadEquip(EquipType.Face)] public class MoonstoneCrown : ModItem { // Base damage of lunar flares on stealth strikes. Increased by rogue damage stats, but not stealth damage. internal const int BaseDamage = 85; - public override void Load() - { - if (Main.netMode != NetmodeID.Server) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/MoonstoneCrown_Face", EquipType.Head, this); - } - } - public override void SetStaticDefaults() { SacrificeTotal = 1; @@ -29,9 +22,8 @@ namespace CalamityMod.Items.Accessories if (Main.netMode != NetmodeID.Server) { - int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawFullHair[equipSlot] = false; - ArmorIDs.Head.Sets.DrawHatHair[equipSlot] = false; + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; } } @@ -49,21 +41,6 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.rogueVelocity += 0.15f; modPlayer.moonCrown = true; - if (!hideVisual) - modPlayer.moonCrownDraw = true; //this bool is just used for drawing - } - - - public override bool IsVanitySet(int head, int body, int legs) => true; - - public override void PreUpdateVanitySet(Player player) - { - player.Calamity().moonCrownDraw = true; //this bool is just used for drawing - } - - public override void UpdateVanity(Player player) - { - player.Calamity().moonCrownDraw = true; } public override void AddRecipes() diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index a3d3307eb3..12c32f8655 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -1,10 +1,11 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Accessories Item.width = 24; Item.height = 26; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 6dd3df1438..eeecec2443 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -1,11 +1,10 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -19,10 +18,8 @@ namespace CalamityMod.Items.Accessories "Stealth strikes summon nanobeams and sparks on enemy hits\n" + "Stealth strikes have +20 armor penetration, deal 5% more damage, and heal for 1 HP\n" + "15% increased rogue damage and 15% increased rogue velocity\n" + - "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + - "This effect can stack up to 150 times\n" + - "Max rogue damage boost is 15%\n" + - "This line is modified below"); + $"Landing a stealth strike grants a {(int)RaidersTalisman.RaiderBonus}% crit bonus to non-stealth strikes\n" + + $"This crit bonus decays over {RaidersTalisman.RaiderCooldown} seconds"); } public override void SetDefaults() @@ -31,16 +28,7 @@ namespace CalamityMod.Items.Accessories Item.height = 46; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; - } - - public override void ModifyTooltips(List list) - { - int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack; - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip7"); - - if (line != null) - line.Text = "Rogue Crit Level: " + critLevel; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 079c1a41fe..916ccc014b 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -1,9 +1,10 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -25,8 +26,7 @@ namespace CalamityMod.Items.Accessories Item.height = 14; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 8784593dc0..765987db2e 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 1afc0b3e2b..1d468aa568 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -1,12 +1,13 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(EquipType.Head)] + [AutoloadEquip(EquipType.Face)] public class OccultSkullCrown : ModItem { public override void SetStaticDefaults() @@ -16,12 +17,18 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Only a fool would ever wear this...\n" + "You constantly gain rage over time and rage does not fade away when out of combat\n" + "Converts certain debuffs into buffs and extends their durations\n" + - "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, Broken Armor,\n" + - "Armor Crunch, War Cleave, Chilled, Ichor and Obstructed\n" + + "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak,\n" + + "Broken Armor, Armor Crunch, Chilled, Ichor and Obstructed\n" + "Adrenaline charges 20% faster\n" + "Increases your max movement speed and acceleration by 5%\n" + - "Can also be worn as a helmet\n" + "Revengeance item"); + + if (Main.netMode != NetmodeID.Server) + { + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); + ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; + ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; + } } public override void SetDefaults() @@ -29,8 +36,7 @@ namespace CalamityMod.Items.Accessories Item.width = 82; Item.height = 62; Item.defense = 5; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/OccultSkullCrown_Head.png b/Items/Accessories/OccultSkullCrown_Face.png similarity index 100% rename from Items/Accessories/OccultSkullCrown_Head.png rename to Items/Accessories/OccultSkullCrown_Face.png diff --git a/Items/Accessories/OldDukeScales.cs b/Items/Accessories/OldDukeScales.cs index 24496581bc..0900d30fa2 100644 --- a/Items/Accessories/OldDukeScales.cs +++ b/Items/Accessories/OldDukeScales.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Terraria; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Accessories Item.height = 26; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index bbb214bb36..51eb405cea 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories player.statLifeMax2 += 20; } player.Calamity().DashID = OrnateShieldDash.ID; - player.dash = 0; + player.dashType = 0; } public override void AddRecipes() diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index eef1f764a8..005f83ddec 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Accessories Item.width = 50; Item.height = 40; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 32ede2d1d7..8cfcace48e 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Accessories Item.height = 40; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 3c8f97d2de..15b8d5a9c4 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -1,16 +1,17 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System.Collections.Generic; +using System.Linq; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System.Linq; -using CalamityMod.Buffs.StatBuffs; namespace CalamityMod.Items.Accessories { @@ -65,7 +66,7 @@ namespace CalamityMod.Items.Accessories Item.height = 50; Item.accessory = true; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -80,11 +81,20 @@ namespace CalamityMod.Items.Accessories bool draedon = DownedBossSystem.downedExoMechs; if (!scal || !draedon) { - string rejectionReason = (!draedon) ? "[c/f05a5a:The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations]" : "[c/f05a5a:The soul within this crystal has been defiled by the powerful magic of a supreme witch]"; //there might be a better way to word the draedon line, not sure + string rejectionReason = (!draedon) ? "The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations" : "The soul within this crystal has been defiled by the powerful magic of a supreme witch"; //there might be a better way to word the draedon line, not sure TooltipLine lineLock = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); if (lineLock != null) - lineLock.Text = rejectionReason + "\nMerchants will reject a defiled soul such as this."; + { + lineLock.Text = rejectionReason; + lineLock.OverrideColor = new Color(240, 90, 90); + } + int insertIndex = tooltips.FindIndex(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine rejectLine = new TooltipLine(this.Mod, "CalamityMod:RejectLine", "Merchants will reject a defiled soul such as this."); + tooltips.Insert(insertIndex + 1, rejectLine); + } TooltipLine linePrice = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Sell price"); if (linePrice != null) @@ -100,16 +110,37 @@ namespace CalamityMod.Items.Accessories if (line != null) line.Text = "Requires 10 minion slots to use in order to grant the following effects\n" + "All non-summon weapons are converted into powerful summon variations\n" + - "Falling below 50% life will empower these attacks\n" + - "[c/f05a5a:Transforms Melee attacks into a barrage of spears]\n" + - "[c/3a83e4:Transforms Magic attacks into a powerful splitting fireball for " + manaCost + " mana per cast]\n" + - "[c/85e092:Transforms Ranged attacks into a flurry of fireballs and meteors]\n" + - "[c/e97451:Transforms Rogue attacks into a deadly crystalline spiral]\n" + - "Summons and empowers the profaned babs to fight alongside you\n" + - "You are no longer affected by burn out when hit\n" + - "Provides buffs depending on the time of day\n" + - "Thinking back, it was a boring life\n" + - "[c/FFBF49:And so we burn it all in the name of purity]"; + "Falling below 50% life will empower these attacks"; + + int insertIndex = tooltips.FindIndex(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine meleeAttack = new TooltipLine(this.Mod, "CalamityMod:MeleeAttack", "Transforms Melee attacks into a barrage of spears"); + meleeAttack.OverrideColor = new Color(240, 90, 90); + tooltips.Insert(insertIndex + 1, meleeAttack); + + TooltipLine mageAttack = new TooltipLine(this.Mod, "CalamityMod:MageAttack", $"Transforms Magic attacks into a powerful splitting fireball for {manaCost} mana per cast"); + mageAttack.OverrideColor = new Color(58, 131, 228); + tooltips.Insert(insertIndex + 2, mageAttack); + + TooltipLine rangedAttack = new TooltipLine(this.Mod, "CalamityMod:RangedAttack", "Transforms Ranged attacks into a flurry of fireballs and meteors"); + rangedAttack.OverrideColor = new Color(133, 224, 146); + tooltips.Insert(insertIndex + 3, rangedAttack); + + TooltipLine rogueAttack = new TooltipLine(this.Mod, "CalamityMod:RogueAttack", "Transforms Rogue attacks into a deadly crystalline spiral"); + rogueAttack.OverrideColor = new Color(233, 116, 81); + tooltips.Insert(insertIndex + 4, rogueAttack); + + TooltipLine remainingTip = new TooltipLine(this.Mod, "CalamityMod:RemainingTip", "Summons and empowers the profaned babs to fight alongside you\n" + + "You are no longer affected by burn out when hit\n" + + "Provides buffs depending on the time of day\n" + + "Thinking back, it was a boring life"); + tooltips.Insert(insertIndex + 5, remainingTip); + + TooltipLine purityTip = new TooltipLine(this.Mod, "CalamityMod:PurityTip", "And so we burn it all in the name of purity"); + purityTip.OverrideColor = new Color(255, 191, 73); + tooltips.Insert(insertIndex + 6, purityTip); + } } } @@ -176,7 +207,12 @@ namespace CalamityMod.Items.Accessories int spearBaseDamage = shouldNerf ? 175 : 350; int spearDamage = (int)player.GetTotalDamage().ApplyTo(spearBaseDamage); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), spearDamage, 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + int proj = Projectile.NewProjectile(source, player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), spearDamage, 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].DamageType = DamageClass.Summon; + Main.projectile[proj].originalDamage = spearBaseDamage; + } spread -= Main.rand.Next(2, 4); SoundEngine.PlaySound(SoundID.Item20, player.Center); } @@ -186,7 +222,12 @@ namespace CalamityMod.Items.Accessories { int spearBaseDamage = shouldNerf ? 125 : 250; int spearDamage = (int)player.GetTotalDamage().ApplyTo(spearBaseDamage); - Projectile.NewProjectile(source, player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), spearDamage, 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + int proj = Projectile.NewProjectile(source, player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), spearDamage, 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].DamageType = DamageClass.Summon; + Main.projectile[proj].originalDamage = spearBaseDamage; + } SoundEngine.PlaySound(SoundID.Item20, player.Center); } diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs new file mode 100644 index 0000000000..dbbc5154b5 --- /dev/null +++ b/Items/Accessories/QuiverofNihility.cs @@ -0,0 +1,67 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Back)] + public class QuiverofNihility : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Quiver of Nihility"); + Tooltip.SetDefault("'Filled with a substance darker than the night sky'\n"+"5% increased ranged critical strike chance\n"+"Summons a ring of four void fields to orbit you\n" + "Arrows that pass through these fields gain a 100% damage boost and double the speed"); + } + + public override void SetDefaults() + { + Item.width = 42; + Item.height = 36; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + Item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot, bool modded) + { + if (player.Calamity().voidField) + return false; + + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.GetCritChance() += 5; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.voidField = true; + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_Accessory(Item); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 4) + { + for (int v = 0; v < 4; v++) + { + Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, v); + } + } + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("QuiversGroup"). + AddIngredient(3). + AddIngredient(5). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Accessories/QuiverofNihility.png b/Items/Accessories/QuiverofNihility.png new file mode 100644 index 0000000000..57136e2c62 Binary files /dev/null and b/Items/Accessories/QuiverofNihility.png differ diff --git a/Items/Accessories/QuiverofNihility_Back.png b/Items/Accessories/QuiverofNihility_Back.png new file mode 100644 index 0000000000..67710577a0 Binary files /dev/null and b/Items/Accessories/QuiverofNihility_Back.png differ diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index cfcb489c52..024f66e3ac 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -1,22 +1,21 @@ using CalamityMod.CalPlayer; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Accessories { public class RaidersTalisman : ModItem { + public const float RaiderBonus = 12f; + public const int RaiderCooldown = 5; + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Raider's Talisman"); - Tooltip.SetDefault("Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + - "This effect can stack up to 150 times\n" + - "Max rogue damage boost is 15%\n" + - "This line is modified below"); + Tooltip.SetDefault($"Landing a stealth strike grants a {(int)RaiderBonus}% crit bonus to non-stealth strikes\n" + + $"This crit bonus decays over {RaiderCooldown} seconds"); } public override void SetDefaults() @@ -28,15 +27,6 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void ModifyTooltips(List list) - { - int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack; - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); - - if (line != null) - line.Text = "Rogue Crit Level: " + critLevel; - } - public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index bfd1106607..766cf9c53f 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using System; using Terraria; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 18; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RangedLevelMeter.cs b/Items/Accessories/RangedLevelMeter.cs deleted file mode 100644 index f02888fe21..0000000000 --- a/Items/Accessories/RangedLevelMeter.cs +++ /dev/null @@ -1,130 +0,0 @@ -using CalamityMod.CalPlayer; -using System.Collections.Generic; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using System.Linq; - -namespace CalamityMod.Items.Accessories -{ - public class RangedLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Ranged Level Meter"); - Tooltip.SetDefault("Tells you how high your ranged proficiency is"); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - Item.value = Item.buyPrice(0, 6, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].Calamity().rangedLevel; - int exactLevel = Main.player[Main.myPlayer].Calamity().exactRangedLevel; - int damageGain = 0; - int moveSpeed = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - critGain = 1; - break; - case 4: - damageGain = 2; - moveSpeed = 1; - critGain = 1; - break; - case 5: - damageGain = 2; - moveSpeed = 2; - critGain = 1; - break; - case 6: - damageGain = 2; - moveSpeed = 3; - critGain = 1; - break; - case 7: - damageGain = 2; - moveSpeed = 3; - critGain = 2; - break; - case 8: - damageGain = 3; - moveSpeed = 3; - critGain = 2; - break; - case 9: - damageGain = 3; - moveSpeed = 4; - critGain = 2; - break; - case 10: - damageGain = 4; - moveSpeed = 4; - critGain = 2; - break; - case 11: - damageGain = 4; - moveSpeed = 4; - critGain = 3; - break; - case 12: - damageGain = 4; - moveSpeed = 5; - critGain = 3; - break; - case 13: - damageGain = 5; - moveSpeed = 5; - critGain = 3; - break; - case 14: - damageGain = 5; - moveSpeed = 6; - critGain = 3; - break; - case 15: - damageGain = 6; - moveSpeed = 6; - critGain = 3; - break; - } - - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); - - if (line != null) - line.Text = "Tells you how high your ranged proficiency is\n" + - "While equipped you will gain ranged proficiency faster\n" + - "The higher your ranged level the higher your ranged damage, critical strike chance, and movement speed\n" + - "Ranged proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Ranged level (max of 15): " + exactLevel + "\n" + - "Ranged damage increase: " + damageGain + "%\n" + - "Movement speed increase: " + moveSpeed + "%\n" + - "Ranged crit increase: " + critGain + "%"; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fasterRangedLevel = true; - } - } -} diff --git a/Items/Accessories/RangedLevelMeter.png b/Items/Accessories/RangedLevelMeter.png deleted file mode 100644 index c3e5bff4fc..0000000000 Binary files a/Items/Accessories/RangedLevelMeter.png and /dev/null differ diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index 3136229d9c..ee4f92850c 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Accessories Item.height = 50; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RogueLevelMeter.cs b/Items/Accessories/RogueLevelMeter.cs deleted file mode 100644 index 057bfa077c..0000000000 --- a/Items/Accessories/RogueLevelMeter.cs +++ /dev/null @@ -1,130 +0,0 @@ -using CalamityMod.CalPlayer; -using System.Collections.Generic; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using System.Linq; - -namespace CalamityMod.Items.Accessories -{ - public class RogueLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Rogue Level Meter"); - Tooltip.SetDefault("Tells you how high your rogue proficiency is"); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - Item.value = Item.buyPrice(0, 6, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].Calamity().rogueLevel; - int exactLevel = Main.player[Main.myPlayer].Calamity().exactRogueLevel; - int damageGain = 0; - int velocityGain = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - velocityGain = 1; - break; - case 4: - damageGain = 2; - velocityGain = 1; - critGain = 1; - break; - case 5: - damageGain = 2; - velocityGain = 2; - critGain = 1; - break; - case 6: - damageGain = 2; - velocityGain = 3; - critGain = 1; - break; - case 7: - damageGain = 3; - velocityGain = 3; - critGain = 1; - break; - case 8: - damageGain = 3; - velocityGain = 3; - critGain = 2; - break; - case 9: - damageGain = 3; - velocityGain = 4; - critGain = 2; - break; - case 10: - damageGain = 4; - velocityGain = 4; - critGain = 2; - break; - case 11: - damageGain = 4; - velocityGain = 4; - critGain = 3; - break; - case 12: - damageGain = 4; - velocityGain = 5; - critGain = 3; - break; - case 13: - damageGain = 5; - velocityGain = 5; - critGain = 3; - break; - case 14: - damageGain = 5; - velocityGain = 6; - critGain = 3; - break; - case 15: - damageGain = 6; - velocityGain = 6; - critGain = 3; - break; - } - - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); - - if (line != null) - line.Text = "Tells you how high your rogue proficiency is\n" + - "While equipped you will gain rogue proficiency faster\n" + - "The higher your rogue level the higher your rogue damage, critical strike chance, and velocity\n" + - "Rogue proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Rogue level (max of 15): " + exactLevel + "\n" + - "Rogue damage increase: " + damageGain + "%\n" + - "Rogue velocity increase: " + velocityGain + "%\n" + - "Rogue crit increase: " + critGain + "%"; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fasterRogueLevel = true; - } - } -} diff --git a/Items/Accessories/RogueLevelMeter.png b/Items/Accessories/RogueLevelMeter.png deleted file mode 100644 index c3e5bff4fc..0000000000 Binary files a/Items/Accessories/RogueLevelMeter.png and /dev/null differ diff --git a/Items/Accessories/RottenDogtooth.cs b/Items/Accessories/RottenDogtooth.cs index 0f230499bc..08826cd09d 100644 --- a/Items/Accessories/RottenDogtooth.cs +++ b/Items/Accessories/RottenDogtooth.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Rotten Dogtooth"); - Tooltip.SetDefault($"Makes Stealth strikes inflict Armor Crunch, deal {(int)(StealthStrikeDamageMultiplier * 100)}% more damage and cost 1 less unit of stealth."); + Tooltip.SetDefault($"Makes Stealth strikes inflict Armor Crunch and deal {(int)(StealthStrikeDamageMultiplier * 100)}% more damage"); } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().rottenDogTooth = true; - player.Calamity().flatStealthLossReduction++; + player.Calamity().bonusStealthDamage += StealthStrikeDamageMultiplier; } } } diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 7672596263..c97d4a384b 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -2,18 +2,163 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using Terraria.Audio; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.Graphics.Effects; +using System; +using CalamityMod.Particles; +using ReLogic.Content; namespace CalamityMod.Items.Accessories { public class RoverDrive : ModItem { + public static readonly SoundStyle ShieldHurtSound = new("CalamityMod/Sounds/Custom/RoverDriveHit") { PitchVariance = 0.6f, Volume = 0.6f, MaxInstances = 0 }; + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/RoverDriveActivate") { Volume = 0.85f }; + public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f }; + + public static int ProtectionMatrixDurabilityMax = 50; + public static int ProtectionMatrixRechargeTime = 60 * 10; + public static int ProtectionMatrixDefenseBoost = 10; + + public static Asset NoiseTex; + + + public override void Load() + { + On.Terraria.Main.DrawInfernoRings += DrawRoverDriveShields; + } + public override void Unload() + { + On.Terraria.Main.DrawInfernoRings -= DrawRoverDriveShields; + } + + + private void DrawRoverDriveShields(On.Terraria.Main.orig_DrawInfernoRings orig, Main self) + { + bool playerFound = false; + + for (int i = 0; i < 255; i++) + { + if (!Main.player[i].active || Main.player[i].outOfRange || Main.player[i].dead) + continue; + + RoverDrivePlayer modPlayer = Main.player[i].GetModPlayer(); + bool forcedVisibility = !modPlayer.ShieldVisibility.HasValue ? false : modPlayer.ShieldVisibility.Value; + + //Skip if not forced, if it has a value (aka false since if it was true forced visibility would be true + if (!forcedVisibility && (modPlayer.ShieldVisibility.HasValue || (modPlayer.ProtectionMatrixDurability <= 0))) + continue; + + float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); + + if (playerFound == false) + { + float shieldStrentgh = forcedVisibility ? 1f : (float)Math.Pow(Main.LocalPlayer.GetModPlayer().ProtectionMatrixDurability / (float)ProtectionMatrixDurabilityMax, 0.5f); + float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); + + Effect shieldEffect = Filters.Scene["RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f); + shieldEffect.Parameters["blowUpPower"].SetValue(2.5f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.5f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + //shieldEffect.Parameters["resolution"].SetValue(resolution); + + float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f); + shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity * (0.5f + 0.5f * shieldStrentgh)); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + Color edgeColor; + Color shieldColor; + + if (Main.netMode != NetmodeID.SinglePlayer && Main.player[i].team != 0) + { + switch (Main.player[i].team) + { + case 1: //Red team + shieldColor = new Color(178, 24, 31); + edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.Tomato, Color.Crimson, shieldColor); + break; + case 2: //Green team + shieldColor = new Color(194, 255, 67) * 0.7f; + edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.Chartreuse, Color.YellowGreen, new Color(194, 255, 67)); + break; + case 3: //Blue team + shieldColor = new Color(64, 207, 200); + edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.MediumSpringGreen, Color.DeepSkyBlue, new Color(64, 207, 200)); + break; + case 4: //Yellow team + shieldColor = new Color(176, 156, 45); + edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.Gold, Color.Coral, Color.LightGoldenrodYellow); + break; + case 5: //Purple team + default: + shieldColor = new Color(173, 111, 221); + edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.DeepPink, Color.MediumOrchid, Color.MediumPurple); + break; + } + + } + + else + { + Color blueTint = new Color(51, 102, 255); + Color cyanTint = new Color(71, 202, 255); + Color wulfGreen = new Color(194, 255, 67) * 0.8f; + edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen); + shieldColor = blueTint; + } + + + + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + + + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + + } + + + + playerFound = true; + Player myPlayer = Main.player[i]; + if (NoiseTex == null) + NoiseTex = ModContent.Request("CalamityMod/ExtraTextures/TechyNoise"); + + Texture2D tex = NoiseTex.Value; + Vector2 pos = myPlayer.MountedCenter + myPlayer.gfxOffY * Vector2.UnitY - Main.screenPosition; + + Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); + } + + if (playerFound) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + } + + orig(self); + } + + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Rover Drive"); - Tooltip.SetDefault("Activates a protective shield that grants 15 defense for 10 seconds\n" + - //Actually 10.1 seconds at full power with a dissipation across 0.1666 seconds but whatever - "The shield then dissipates and recharges for 20 seconds before being reactivated"); + Tooltip.SetDefault($"Activates a protective matrix that can absorb {ProtectionMatrixDurabilityMax} damage and grants {ProtectionMatrixDefenseBoost} defense\n" + + $"However, the systems are fickle and the shield will need {ProtectionMatrixRechargeTime / 60} seconds to charge up fully\n" + + "Getting hit during the shield recharge period will reset it back to zero\n" + + "Can also be scrapped at an extractinator"); + + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; } public override void SetDefaults() @@ -23,12 +168,139 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; + + //Needed for extractination + Item.useStyle = ItemUseStyleID.HiddenAnimation; + Item.useAnimation = 10; + Item.useTime = 2; + Item.consumable = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.roverDrive = true; + RoverDrivePlayer modPlayer = player.GetModPlayer(); + //modPlayer.roverDrive = true; + + modPlayer.RoverDriveOn = true; + modPlayer.ShieldVisibility = hideVisual ? false : null; + + if (modPlayer.ProtectionMatrixDurability > 0) + player.statDefense += ProtectionMatrixDefenseBoost; + } + + public override void UpdateVanity(Player player) + { + player.GetModPlayer().ShieldVisibility = true; + } + + //Scrappable for 3-6 wulfrum scrap or a 20% chance to get an energy core + public override void ExtractinatorUse(ref int resultType, ref int resultStack) + { + resultType = ModContent.ItemType(); + resultStack = Main.rand.Next(3, 6); + + if (Main.rand.NextFloat() > 0.8f) + { + resultStack = 1; + resultType = ModContent.ItemType(); + } + } + } + + public class RoverDrivePlayer : ModPlayer + { + public bool RoverDriveOn; + public bool? ShieldVisibility; //Null for default, false for never, true for always + public int ProtectionMatrixDurability = 0; + public int ProtectionMatrixCharge = 0; + + public override void ResetEffects() + { + //Turn this into armor health when we can + if (RoverDriveOn) + Player.statLifeMax2 += ProtectionMatrixDurability; + + else + ProtectionMatrixDurability = 0; + + RoverDriveOn = false; + ShieldVisibility = false; + } + + public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter) + { + if (RoverDriveOn) + { + if (ProtectionMatrixDurability > 0) + { + ProtectionMatrixDurability -= (int)damage; + if (ProtectionMatrixDurability <= 0) + { + ProtectionMatrixDurability = 0; + SoundEngine.PlaySound(RoverDrive.BreakSound, Player.Center); + Player.Calamity().GeneralScreenShakePower += 2f; + } + + int numParticles = Main.rand.Next(2, 6); + for (int i = 0; i < numParticles; i++) + { + Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3, 14); + velocity.X += 5f * hitDirection; + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(Player.Center, velocity, Main.rand.NextFloat(2.5f, 3f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25)); + } + } + + if (Player.Calamity().cooldowns.TryGetValue(WulfrumRoverDriveDurability.ID, out var cdDurability)) + { + cdDurability.timeLeft = ProtectionMatrixDurability; + } + + + //Reset recharge time. + if (Player.Calamity().cooldowns.TryGetValue(WulfrumRoverDriveRecharge.ID, out var cd)) + { + cd.timeLeft = RoverDrive.ProtectionMatrixRechargeTime; + } + } + } + + public override void UpdateDead() + { + ProtectionMatrixDurability = 0; + } + + + public override void PostUpdateMiscEffects() + { + if (!RoverDriveOn) + { + if (Player.Calamity().cooldowns.TryGetValue(WulfrumRoverDriveDurability.ID, out var cdDurability) && !RoverDriveOn) + cdDurability.timeLeft = 0; + + if (Player.Calamity().cooldowns.TryGetValue(WulfrumRoverDriveRecharge.ID, out var cdRecharge) && !RoverDriveOn) + cdRecharge.timeLeft = 0; + } + + else + { + if (ProtectionMatrixDurability == 0 && !Player.Calamity().cooldowns.TryGetValue(WulfrumRoverDriveRecharge.ID, out var cd)) + { + Player.AddCooldown(WulfrumRoverDriveRecharge.ID, RoverDrive.ProtectionMatrixRechargeTime); + } + + if (ProtectionMatrixDurability > 0 && !Player.Calamity().cooldowns.TryGetValue(WulfrumRoverDriveDurability.ID, out cd)) + { + CooldownInstance durabilityCooldown = Player.AddCooldown(WulfrumRoverDriveDurability.ID, RoverDrive.ProtectionMatrixDurabilityMax); + durabilityCooldown.timeLeft = ProtectionMatrixDurability; + + SoundEngine.PlaySound(RoverDrive.ActivationSound, Player.Center); + } + + if (ProtectionMatrixDurability > 0) + { + Lighting.AddLight(Player.Center, Color.DeepSkyBlue.ToVector3() * 0.2f); + } + } } } } diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index 755bafe0eb..822847edf0 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Ruin Medallion"); - Tooltip.SetDefault("Stealth strikes only expend 50% of your max stealth\n" + + Tooltip.SetDefault("Stealth strikes only expend 75% of your max stealth\n" + "6% increased rogue damage, and 6% increased rogue crit chance"); } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.stealthStrikeHalfCost = true; + modPlayer.stealthStrike75Cost = true; player.GetCritChance() += 6; player.GetDamage() += 0.06f; } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index e4626916e4..9abaa49f93 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Sand Cloak"); - Tooltip.SetDefault("+1 defense and 5% increased movement speed\n" + + Tooltip.SetDefault("+2 defense and 5% increased movement speed\n" + "TOOLTIP LINE HERE\n" + - "This effect has a 30 second cooldown before it can be used again"); + "This effect has a 25 second cooldown before it can be used again"); } public override void SetDefaults() @@ -32,12 +32,12 @@ namespace CalamityMod.Items.Accessories TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); if (line != null) - line.Text = "Press " + hotkey + " to consume 25% of your maximum stealth to create a protective dust veil which provides +6 defense and +2 life regen"; + line.Text = "Press " + hotkey + " to consume 10% of your maximum stealth to create a protective dust veil which provides +6 defense and +2 life regen"; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.statDefense += 1; + player.statDefense += 2; player.moveSpeed += 0.05f; player.Calamity().sandCloak = true; } diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs index ef222e6f7c..da1346fd49 100644 --- a/Items/Accessories/ScuttlersJewel.cs +++ b/Items/Accessories/ScuttlersJewel.cs @@ -11,7 +11,9 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Scuttler's Jewel"); - Tooltip.SetDefault("Stealth strike projectiles spawn a jewel spike when destroyed"); + Tooltip.SetDefault("Stealth strike projectiles spawn a jewel spike when destroyed\n" + + "Can also be broken down at an extractinator"); + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; } public override void SetDefaults() @@ -21,6 +23,12 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; + + Item.useStyle = ItemUseStyleID.HiddenAnimation; + Item.useAnimation = 10; + Item.useTime = 2; + Item.consumable = true; + } public override void UpdateAccessory(Player player, bool hideVisual) @@ -28,5 +36,26 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.scuttlersJewel = true; } + + public override void ExtractinatorUse(ref int resultType, ref int resultStack) + { + float dropRand = Main.rand.Next(1, 8); + resultStack = Main.rand.Next(1, 3); + + if (dropRand == 1f) + resultType = ItemID.Ruby; + else if (dropRand == 2f) + resultType = ItemID.Diamond; + else if (dropRand == 3f) + resultType = ItemID.Emerald; + else if (dropRand == 4f) + resultType = ItemID.Topaz; + else if (dropRand == 5f) + resultType = ItemID.Sapphire; + else if (dropRand == 6f) + resultType = ItemID.Amethyst; + else if (dropRand >= 7f) + resultType = ItemID.Amber; + } } } diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index 9a05b7ff2f..236285c32e 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -1,10 +1,11 @@ -using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Rarities; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using CalamityMod.CalPlayer; -using CalamityMod.World; -using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -29,11 +30,11 @@ namespace CalamityMod.Items.Accessories // Each successive level costs (400,000 * level) MORE damage, so the total required goes up quadratically. // Total required to reach level 60 is 732,000,000 damage dealt. // This is within one order of magnitude of the integer limit, so relevant values are stored as longs. - private const long BaseLevelCost = 400000L; - private static long LevelCost(int level) => BaseLevelCost * level; - private static long CumulativeLevelCost(int level) => (BaseLevelCost / 2L) * level * (level + 1); - private const int MaxLevel = 25; // was 60. - private const float RageDamagePerLevel = 0.01f; // x1.35 --> x1.60 (used to be x1.95, jesus) + internal const long BaseLevelCost = 400000L; + internal static long LevelCost(int level) => BaseLevelCost * level; + internal static long CumulativeLevelCost(int level) => (BaseLevelCost / 2L) * level * (level + 1); + internal const int MaxLevel = 25; // was 60. + internal const float RageDamagePerLevel = 0.01f; // x1.35 --> x1.60 (used to be x1.95, jesus) internal int level = 0; internal long totalRageDamage = 0L; @@ -57,8 +58,7 @@ namespace CalamityMod.Items.Accessories Item.height = 20; Item.accessory = true; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -77,6 +77,8 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.shatteredCommunity = true; + ShatteredCommunityPlayer scp = player.GetModPlayer(); + scp.sc = this; // Shattered Community gives (mostly) the same boosts as normal Community // It does not give melee speed or minion knockback, but always gives life regen (instead of only conditionally) @@ -102,61 +104,6 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight(Item.Center, 0.92f * brightness, 0.42f * brightness, 0.92f * brightness); } - internal static void AccumulateRageDamage(Player player, CalamityPlayer mp, long damage) - { - if (!mp.shatteredCommunity) - return; - // Static context, so the item ID has to be retrieved from TML. - int thisItemID = ModContent.ItemType(); - ShatteredCommunity sc = null; - - // First, find the Shattered Community in the player's inventory. - // slots 3, 4, 5, 6, 7, 8, 9 are valid non-vanity accessories - for (int i = 3; i <= 9; ++i) - { - Item acc = player.armor[i]; - if (acc.type == thisItemID) - sc = acc.ModItem as ShatteredCommunity; - } - - // Safety check in case for some reason the equipped Shattered Community isn't found. - if (sc is null) - return; - - // Actually accumulate the damage. - sc.totalRageDamage += damage; - - // Level up if applicable. - if (sc.level < MaxLevel && sc.totalRageDamage > CumulativeLevelCost(sc.level + 1)) - { - ++sc.level; - sc.LevelUpEffects(player); - } - } - - private void LevelUpEffects(Player player) - { - // Spawn the purple laser beam from failing the Dungeon Defenders event. - var source = player.GetSource_Accessory(Item); - int projID = ProjectileID.DD2ElderWins; - Vector2 offset = new Vector2(0f, 800f); // The effect is extremely tall, so start it very low down - Projectile fx = Projectile.NewProjectileDirect(source, player.Center + offset, Vector2.Zero, projID, 0, 0f, player.whoAmI); - fx.friendly = false; - fx.hostile = false; - // On the 108th update, crystal debris is spawned, so we avoid that. - fx.timeLeft = 107; - fx.MaxUpdates = 2; // Make the animation play at double speed. - - // Play a weird dimensional lightning sound simultaneously. - var extraSound = SoundID.DD2_EtherianPortalDryadTouch with { Volume = SoundID.DD2_EtherianPortalDryadTouch.Volume * 1.4f }; - SoundEngine.PlaySound(extraSound, player.Center); - - // Display a level up text notification. - Rectangle textArea = new Rectangle((int)player.Center.X, (int)player.Center.Y, 1, 1); - Color textColor = new Color(236, 209, 236); - CombatText.NewText(textArea, textColor, "The Community cracks...", false, false); - } - public override void ModifyTooltips(List tooltips) { // Stat tooltips are added dynamically. @@ -224,4 +171,50 @@ namespace CalamityMod.Items.Accessories totalRageDamage = reader.ReadInt64(); } } + + public class ShatteredCommunityPlayer : ModPlayer + { + internal ShatteredCommunity sc = null; + + public override void ResetEffects() => sc = null; + + internal void AccumulateRageDamage(long damage) + { + if (sc is null) + return; + + // Actually accumulate the damage. + sc.totalRageDamage += damage; + + // Level up if applicable. + if (sc.level < ShatteredCommunity.MaxLevel && sc.totalRageDamage > ShatteredCommunity.CumulativeLevelCost(sc.level + 1)) + { + ++sc.level; + LevelUpEffects(sc.Item); + } + } + + private void LevelUpEffects(Item item) + { + // Spawn the purple laser beam from failing the Dungeon Defenders event. + var source = Player.GetSource_Accessory(item); + int projID = ProjectileID.DD2ElderWins; + Vector2 offset = new Vector2(0f, 800f); // The effect is extremely tall, so start it very low down + Projectile fx = Projectile.NewProjectileDirect(source, Player.Center + offset, Vector2.Zero, projID, 0, 0f, Player.whoAmI); + fx.friendly = false; + fx.hostile = false; + // On the 108th update, crystal debris is spawned, so we avoid that. + fx.timeLeft = 107; + fx.MaxUpdates = 2; // Make the animation play at double speed. + + // Play a weird dimensional lightning sound simultaneously. + var extraSound = SoundID.DD2_EtherianPortalDryadTouch with { Volume = SoundID.DD2_EtherianPortalDryadTouch.Volume * 1.4f }; + SoundEngine.PlaySound(extraSound, Player.Center); + + // Display a level up text notification. + Rectangle textArea = new Rectangle((int)Player.Center.X, (int)Player.Center.Y, 1, 1); + Color textColor = new Color(236, 209, 236); + CombatText.NewText(textArea, textColor, "The Community cracks...", false, false); + } + } } diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 56de6175fe..1af18c95e8 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.Coral, 5). + AddIngredient(ItemID.Starfish, 5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 72c4b93e10..0f3b389106 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.CelestialEmblem). AddRecipeGroup("AnyEvilWater", 10). - AddIngredient(5). + AddIngredient(10). AddIngredient(5). AddIngredient(2). AddTile(TileID.MythrilAnvil). diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index 461da0fb36..d8d3302764 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Silencing Sheath"); - Tooltip.SetDefault("+20 maximum stealth\n" + - "Stealth generates 15% faster"); + Tooltip.SetDefault("+10 maximum stealth"); } public override void SetDefaults() @@ -27,9 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rogueStealthMax += 0.2f; - modPlayer.stealthGenStandstill += 0.15f; - modPlayer.stealthGenMoving += 0.15f; + modPlayer.rogueStealthMax += 0.1f; } public override void AddRecipes() diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index e80e23d6ad..f83ab1d297 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; +using CalamityMod.Rarities; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -25,8 +26,7 @@ namespace CalamityMod.Items.Accessories Item.width = 30; Item.height = 38; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index b6951f3973..f7ea0fea72 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -1,9 +1,9 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text; -using CalamityMod.Balancing; +using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.World; +using System.Collections.Generic; +using System.Linq; +using System.Text; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,8 +24,9 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = Item.buyPrice(0, 6, 0, 0); - Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; } public override void ModifyTooltips(List list) @@ -124,6 +125,7 @@ namespace CalamityMod.Items.Accessories if (heldItem != null && !heldItem.IsAir) { DamageClass dc = heldItem.DamageType; + bool displayCrit = true; bool displayAttackSpeed = true; string damageClassName = "Unsupported"; @@ -146,10 +148,14 @@ namespace CalamityMod.Items.Accessories else if (dc == DamageClass.Summon) { damageClassName = "Minion"; + displayCrit = false; displayAttackSpeed = false; // Minions specifically don't display attack speed. Whips do. } else if (dc == DamageClass.SummonMeleeSpeed) + { damageClassName = "Whip"; + displayCrit = false; + } else if (dc == RogueDamageClass.Instance) damageClassName = "Rogue"; else if (dc == DamageClass.Throwing) @@ -193,8 +199,11 @@ namespace CalamityMod.Items.Accessories } // Newline between damage and crit - sb.Append('\n').Append(damageClassName).Append(" Crit Chance: "); - sb.Append(TwoPlaces(totalCrit)).Append('%'); + if (displayCrit) + { + sb.Append('\n').Append(damageClassName).Append(" Crit Chance: "); + sb.Append(TwoPlaces(totalCrit)).Append('%'); + } if (displayAttackSpeed) { diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index fedf579891..6d408fe3e2 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -1,11 +1,12 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -43,7 +44,7 @@ namespace CalamityMod.Items.Accessories player.noFallDmg = true; player.blackBelt = true; modPlayer.DashID = StatisVoidSashDash.ID; - player.dash = 0; + player.dashType = 0; player.spikedBoots = 2; } diff --git a/Items/Accessories/SummonLevelMeter.cs b/Items/Accessories/SummonLevelMeter.cs deleted file mode 100644 index 224fc0a570..0000000000 --- a/Items/Accessories/SummonLevelMeter.cs +++ /dev/null @@ -1,115 +0,0 @@ -using CalamityMod.CalPlayer; -using System.Collections.Generic; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using System.Linq; - -namespace CalamityMod.Items.Accessories -{ - public class SummonLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Summon Level Meter"); - Tooltip.SetDefault("Tells you how high your summon proficiency is"); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 26; - Item.value = Item.buyPrice(0, 6, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].Calamity().summonLevel; - int exactLevel = Main.player[Main.myPlayer].Calamity().exactSummonLevel; - int damageGain = 0; - int minionKB = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - minionKB = 30; - break; - case 4: - damageGain = 3; - minionKB = 30; - break; - case 5: - damageGain = 3; - minionKB = 60; - break; - case 6: - damageGain = 4; - minionKB = 90; - break; - case 7: - damageGain = 4; - minionKB = 120; - break; - case 8: - damageGain = 5; - minionKB = 150; - break; - case 9: - damageGain = 6; - minionKB = 180; - break; - case 10: - damageGain = 7; - minionKB = 180; - break; - case 11: - damageGain = 7; - minionKB = 210; - break; - case 12: - damageGain = 8; - minionKB = 240; - break; - case 13: - damageGain = 9; - minionKB = 270; - break; - case 14: - damageGain = 10; - minionKB = 300; - break; - case 15: - damageGain = 12; - minionKB = 300; - break; - } - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); - - if (line != null) - line.Text = "Tells you how high your summon proficiency is\n" + - "While equipped you will gain summon proficiency faster\n" + - "The higher your summon level the higher your minion damage and knockback\n" + - "Summon proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Summon level (max of 15): " + exactLevel + "\n" + - "Minion damage increase: " + damageGain + "%\n" + - "Minion knockback increase: " + minionKB; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fasterSummonLevel = true; - } - } -} diff --git a/Items/Accessories/SummonLevelMeter.png b/Items/Accessories/SummonLevelMeter.png deleted file mode 100644 index c3e5bff4fc..0000000000 Binary files a/Items/Accessories/SummonLevelMeter.png and /dev/null differ diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index ea876ca9d8..7cfa78bfaf 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.DataStructures; @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Accessories Item.height = 34; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index 54288e7eba..a3ea91fab6 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -29,9 +30,8 @@ namespace CalamityMod.Items.Accessories Item.width = 34; Item.height = 64; Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.Lime; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.Rainbow; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index 92ca601188..be7b32e180 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -26,8 +27,7 @@ namespace CalamityMod.Items.Accessories Item.width = 58; Item.height = 44; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index 15b1f2c1aa..5f7172d754 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Accessories Item.height = 20; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ThiefsDime.cs b/Items/Accessories/ThiefsDime.cs index c18308de06..4dcbe6fcfe 100644 --- a/Items/Accessories/ThiefsDime.cs +++ b/Items/Accessories/ThiefsDime.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs new file mode 100644 index 0000000000..733b766136 --- /dev/null +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -0,0 +1,114 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Items.Accessories.Vanity +{ + [AutoloadEquip(EquipType.Head)] + + //A lot of legacy names that's for sure. A combo of the pre "WulfrumHeadX" names, and the aforementionned "WulfrumHeadX" names. + //This is done so that non summoners don't end up with a helmet they don't really care about anyways, and is a cute reference to the old look. + [LegacyName("WulfrumMask")] + [LegacyName("WulfrumHeadRogue")] + [LegacyName("WulfrumHeadgear")] + [LegacyName("WulfrumHeadRanged")] + [LegacyName("WulfrumHelm")] + [LegacyName("WulfrumHeadMelee")] + [LegacyName("WulfrumHood")] + [LegacyName("WulfrumHeadMagic")] + public class AbandonedWulfrumHelmet : ModItem + { + public override void Load() + { + if (Main.netMode != NetmodeID.Server) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet", EquipType.Head, name: "WulfrumOldSetHead"); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Legs", EquipType.Legs, this); + } + } + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Abandoned Wulfrum Helmet"); + Tooltip.SetDefault("A worn and rusty helmet ressembling older models of wulfrum armor\n" + + "Transforms the holder into a wulfrum robot\n" + + "Can also be worn in the helmet slot as a regular helm\n" + + "[c/83B87E:This rather flimsy armor was commonly worn by scavengers and looters]\n" + + "[c/83B87E:Its versatility and common nature led it to be used as currency in trades]"); + + if (Main.netMode == NetmodeID.Server) + return; + + int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); + ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; + + int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); + ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; + ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; + + int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); + ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 30; + Item.accessory = true; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Green; + Item.vanity = true; + } + + public override void UpdateVanity(Player player) + { + player.GetModPlayer().transformationActive = true; + player.GetModPlayer().vanityEquipped = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + { + player.GetModPlayer().transformationActive = true; + player.GetModPlayer().vanityEquipped = true; + } + } + } + + public class WulfrumTransformationPlayer : ModPlayer + { + public bool vanityEquipped = false; + public bool transformationActive = false; + public bool forceHelmetOn = false; + + public override void ResetEffects() + { + vanityEquipped = false; + transformationActive = false; + forceHelmetOn = false; + } + + public override void FrameEffects() + { + if (forceHelmetOn || transformationActive) + { + Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); + Player.face = -1; + } + + if (transformationActive) + { + Player.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body); + + Player.HideAccessories(); + } + } + } +} diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.png b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.png new file mode 100644 index 0000000000..35e1b18178 Binary files /dev/null and b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.png differ diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body.png b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body.png new file mode 100644 index 0000000000..a03c783ea9 Binary files /dev/null and b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body.png differ diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Head.png b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Head.png new file mode 100644 index 0000000000..e6ad485960 Binary files /dev/null and b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Head.png differ diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet.png b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet.png new file mode 100644 index 0000000000..ecafe90f05 Binary files /dev/null and b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet.png differ diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Legs.png b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Legs.png new file mode 100644 index 0000000000..8583861f46 Binary files /dev/null and b/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Legs.png differ diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 8fd99d12f3..70a895df70 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -1,6 +1,7 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Accessories Item.width = 34; Item.height = 36; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/VoltaicJelly.cs b/Items/Accessories/VoltaicJelly.cs index 9916a493bc..50f4bd432b 100644 --- a/Items/Accessories/VoltaicJelly.cs +++ b/Items/Accessories/VoltaicJelly.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Green; } diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index b38cd3ed7d..4cc95f09f5 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -1,12 +1,13 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings { @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.height = 32; Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index 976d59d34b..89eabbda78 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index 4215045b72..304469c9b5 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -1,10 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; using Terraria.DataStructures; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.height = 32; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 2487145c76..3743c75dda 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Accessories.Wings SacrificeTotal = 1; DisplayName.SetDefault("Elysian Wings"); Tooltip.SetDefault("Blessed by the Profaned Flame\n" + - "Horizontal speed: 9.75\n" + + "Horizontal speed: 9.50\n" + "Acceleration multiplier: 2.7\n" + "Great vertical speed\n" + "Flight time: 240\n" + @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 218bd6c86d..7e713e8565 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -1,7 +1,10 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.DataStructures; +using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +19,7 @@ namespace CalamityMod.Items.Accessories.Wings SacrificeTotal = 1; DisplayName.SetDefault("Hadarian Wings"); Tooltip.SetDefault("Powered by the Astral Infection\n" + - "Hold down to hover during flight, greatly extending flight duration\n" + + "This line gets modified below\n" + "Horizontal speed: 9.00\n" + "Acceleration multiplier: 1.75\n" + "Good vertical speed\n" + @@ -32,35 +35,52 @@ namespace CalamityMod.Items.Accessories.Wings Item.rare = ItemRarityID.Lime; Item.accessory = true; } + public override void ModifyTooltips(List tooltips) + { + string down = PlayerInput.GenerateInputTag_ForCurrentGamemode(true, "Down"); + string jump = PlayerInput.GenerateInputTag_ForCurrentGamemode(true, "Jump"); + string up = PlayerInput.GenerateInputTag_ForCurrentGamemode(true, "Up"); + string hoverText = Player.Settings.HoverControl == Player.Settings.HoverControlMode.Hold ? "Hold " + down + " and " + jump + " to hover" : "Press " + down + " to toggle hover\nPress " + up + " to deactivate hover"; + + TooltipLine hover = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); + if (hover != null) + hover.Text = hoverText; + } public override void UpdateAccessory(Player player, bool hideVisual) { if (player.controlJump && player.wingTime > 0f && !player.canJumpAgain_Cloud && player.jump == 0) { - if (player.controlDown && !player.merman) - { - player.velocity.Y *= 0.9f; - if (player.velocity.Y > -2f && player.velocity.Y < 1f) - { - player.velocity.Y = 1E-05f; - } - player.wingTime += 0.75f; - } + bool hovering = player.TryingToHoverDown && !player.merman; + if (hovering) + { + player.velocity.Y *= 0.2f; + if (player.velocity.Y > -2f && player.velocity.Y < 2f) + { + // I can't get the player to have zero y velocity (setting it to 0 doesn't work and I tried a lot of numbers) + player.velocity.Y = 0.105f; + } + player.wingTime += 0.75f; + } + if (player.velocity.Y != 0f && !hideVisual) { - int num59 = 4; + float xOffset = 4f; if (player.direction == 1) { - num59 = -40; + xOffset = -40f; } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, ModContent.DustType(), 0f, 0f, 100, default, 1.75f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[num60].fadeIn = 2f; - } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + if (!hovering || Main.rand.NextBool(3)) + { + int idx = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, ModContent.DustType(), 0f, 0f, 100, default, 1.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[idx].fadeIn = 2f; + } + Main.dust[idx].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } } } player.noFallDmg = true; diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index 407965be72..c2e285894d 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -31,9 +32,8 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 628bd951ef..1953b549ca 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,9 +31,8 @@ namespace CalamityMod.Items.Accessories.Wings { Item.width = 22; Item.height = 20; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs new file mode 100644 index 0000000000..96ac181043 --- /dev/null +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -0,0 +1,518 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameInput; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Back)] + public class WulfrumAcrobaticsPack : ModItem + { + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Custom/WulfrumHookShoot") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest}; + public static readonly SoundStyle GrabSound = new("CalamityMod/Sounds/Custom/WulfrumHookGrapple") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; + public static readonly SoundStyle ReleaseSound = new("CalamityMod/Sounds/Custom/WulfrumHookDisengage") { Volume = 0.7f, MaxInstances = 1, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; + + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Wulfrum Acrobatics Pack"); + Tooltip.SetDefault("This mess of cogs and wires in a box retools the winch mechanism of hooks to transform them into a wulfrum slingshot\n" + + "The wulfrum slingshot trades the ability to reel you back in for advanced rope physics, letting you swing around the hook as you please\n" + + "Additionally, the pack automatically attempts to grapple a nearby wall if it detects danger from fall damage\n" + + "This safety feature won't activate if the down key is being held\n" + + "8% increased movement speed"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 22; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.accessory = true; + Item.rare = ItemRarityID.Blue; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed += 0.08f; + player.GetModPlayer().WulfrumPackEquipped = true; + player.GetModPlayer().PackItem = Item; + + Lighting.AddLight(player.Center, Color.Lerp(Color.DeepSkyBlue,Color.GreenYellow, (float)Math.Sin( Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f).ToVector3()); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Chain, 2). + AddIngredient(6). + AddIngredient(1). + AddTile(TileID.Anvils). + Register(); + } + } + + public class WulfrumPackProjectile : GlobalProjectile + { + public override bool? CanUseGrapple(int type, Player player) + { + //Player can shoot up to 2 wulfrum hooks, but only 2 is allowed to stay grappled. + if (player.GetModPlayer().WulfrumPackEquipped) + { + if (Main.projectile.Count(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType()) > 1) + return false; + } + + //This should never happen. This is for the case in which the player shoots a hook without having the wulfrum pack equipped but somehow having a wulfrum hook out. + //Under no real circumstances should this happen, given wulfrum hooks instantly get killed if the player doesn't have the wulfrum pack. + else if (Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType())) + return false; + + return base.CanUseGrapple(type, player); + } + + //Prevent players with a wulfrum pack to spawn any non-wulfrum hooks. + public override void OnSpawn(Projectile projectile, IEntitySource source) + { + Player owner = Main.player[projectile.owner]; + if (projectile.aiStyle == 7 && projectile.type != ProjectileType() && owner.GetModPlayer().WulfrumPackEquipped && projectile.type != ProjectileID.TrackHook) + { + projectile.active = false; + } + } + } + + public class WulfrumPackPlayer : ModPlayer + { + public bool WulfrumPackEquipped = false; + public Item PackItem = null; + public bool AutoGrappleActivated + { + get + { + if (!WulfrumPackEquipped || Grappled || //Ignore if player isnt wearing the grapple pack, or is already grappled. + Player.noFallDmg || Player.equippedWings != null || //Ignore if player can't take fall damage + Player.controlDown || //Ignore if player disables the auto grapple by holding down + Player.velocity.Y * Player.gravDir < 0 || //Ignore if not falling *down* + (Player.fallStart >= (int)(Player.position.Y / 16f) && Player.gravDir > 0) || (!(Player.fallStart <= (int)(Player.position.Y / 16f)) && Player.gravDir < 0) || //Ignore if the player is not falling below their last fall point + Player.mount.Active || //ignore if player is on a mount + Player.webbed || Player.stoned || Player.frozen || Player.vortexDebuff //Ignore if players movement is compromised + ) + return false; + + return true; + } + } + /// + /// The index of the grapple projectile currently grappled. + /// + public int Grapple = 0; + /// + /// The lenght of the current rope. Determined when the grapple lands. + /// + public float SwingLenght = 0f; + /// + /// Used when we need to store the hook between instructions. + /// + public int hookCache = -1; + /// + /// The cooldown is only set when firing a hook straight downwards + /// + public int hookCooldown = 0; + /// + /// Is the player grappled? + /// + public bool Grappled => WulfrumPackEquipped && Main.projectile[Grapple].active && Main.projectile[Grapple].ModProjectile is WulfrumHook hook && hook.State == WulfrumHook.HookState.Grappling; + public bool GrappleMovementDisabled + { + get + { + if (!Grappled) + return false; + + if (!PlayerOnGround) + return false; + + if ((Player.Center - Main.projectile[Grapple].Center).Length() > SwingLenght) + return false; + + return true; + } + } + + public Vector2 CurrentPosition; + public Vector2 OldPosition; + public List Segments; + + public static int SimulationResolution = 3; + public static int HookUpdates = 3; + public static float GrappleVelocity = 17f; + public static float ReturnVelocity = 5f; + public static float MaxHopVelocity = 4f; //The maximum velocity at which the player gets any amount of vertical boost from hopping out of the hook + public static int SafetySteps = 3; + public static float SafetyHookAngle = MathHelper.PiOver2 * 1.2f; + public static float SafetyHookAngleResolution = 50f; + + public bool PlayerOnGround => Collision.SolidCollision(Player.position + Vector2.UnitY* 2f * Player.gravDir, Player.width, Player.height, false); + + public override void ResetEffects() + { + WulfrumPackEquipped = false; + PackItem = null; + + if (hookCooldown > 0) + hookCooldown--; + } + + //Initialize the segments between the player and the hook's end point. + public void SetSegments(Vector2 endPoint) + { + if (Segments == null) + Segments = new List(); + + Segments.Clear(); + + for (int i = 0; i <= SimulationResolution; i++) + { + float progress = i / (float)SimulationResolution; + VerletSimulatedSegment segment = new VerletSimulatedSegment(Vector2.Lerp(endPoint, Player.Center, progress)); + if (i == 0) + segment.locked = true; + + if (i == SimulationResolution) + segment.oldPosition = Player.oldPosition + new Vector2(Player.width, Player.height) * 0.5f; + + Segments.Add(segment); + } + } + + public override void PostUpdateRunSpeeds() + { + if (hookCache != -1) + { + Player.grappling[0] = hookCache; + Player.grapCount = 1; + } + + hookCache = -1; + } + + public override void PreUpdateMovement() + { + //If the hook cache was set from -1 in the part before the player stepped up,reset it. + //Should this be detoured before the PlayerLoaders PreUpdateMovement call? In case another mod uses hooks in this call and their modplayer gets called before this one? + if (hookCache > -1) + { + Player.grappling[0] = hookCache; + Player.grapCount = 1; + } + + hookCache = -1; + + if (Grappled) + { + if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLenght + 80f) + { + SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, Main.projectile[Grapple].Center); + Main.projectile[Grapple].Kill(); + } + else + SimulateMovement(Main.projectile[Grapple]); + } + } + + public void SimulateMovement(Projectile grapple) + { + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLenght / SimulationResolution, 50, 0.3f * Player.gravDir); + + Vector2 CurrentPosition; + + foreach (VerletSimulatedSegment position in Segments) + { + CurrentPosition = position.position; + + //Control point markers + //Dust doost = Dust.NewDustPerfect(CurrentPosition, 1, Vector2.Zero); + //doost.noGravity = true; + } + + + if (!GrappleMovementDisabled) + { + CurrentPosition = Segments[SimulationResolution].position; + Player.velocity = CurrentPosition - Player.Center; + + //let the player swing themselves around if they are under the hook. + if (Player.gravDir * (Player.Center.Y - Segments[0].position.Y) > 0) + { + float swing = 0; + + if (Math.Sign(Player.velocity.X) < 0) + { + if (Player.controlLeft) + swing -= 0.1f; + + else if (Player.controlRight) + swing += 0.1f; + } + + else if (Math.Sign(Player.velocity.X) > 0) + { + if (Player.controlRight) + swing += 0.1f; + + else if (Player.controlLeft) + swing -= 0.1f; + } + + Player.velocity.X += swing; + } + + else if (Math.Abs(Player.Center.X - Segments[0].position.X) < 30f && Math.Abs(Player.velocity.X) < 1) + { + Player.velocity.X = Player.velocity.X == 0 ? 1.5f : 1.5f * Math.Sign(Player.velocity.X); + } + + } + + if (Grappled) + { + for (int i = 1; i < Segments.Count; i++) + { + Lighting.AddLight(Segments[i].position, Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, i / (float)SimulationResolution).ToVector3()); + } + } + + //Set the old position of the simulation's segments to be the players current center (before the velocity gets applied + //We can't set the new position here by simply adding the velocity to the players current position because it leads to.. funny bugs if you collide with tiles. + Segments[SimulationResolution].oldPosition = Player.Center; + } + + public override void PostUpdate() + { + //After the player's movements are finished being calculated, set the current position of the hook chain to be at their new center. + if (Grappled) + { + Segments[SimulationResolution].position = Player.Center; + + + if (!GrappleMovementDisabled) + { + //Play a swoosh sound if the player changed sides and moved fast + bool playerCrossedSides = Math.Sign(Segments[SimulationResolution].oldPosition.X - Segments[0].position.X) != Math.Sign(Segments[SimulationResolution].position.X - Segments[0].position.X); + float swingSpeed = (Segments[SimulationResolution].oldPosition - Segments[SimulationResolution].position).Length(); + if (swingSpeed > 6f && playerCrossedSides) + SoundEngine.PlaySound(CommonCalamitySounds.LouderSwingWoosh with { Volume = CommonCalamitySounds.LouderSwingWoosh.Volume * (Math.Clamp((swingSpeed - 6f) / 12f, 0, 1)) }, Player.Center); + } + } + + else if (AutoGrappleActivated) + { + Vector2 checkedPlayerPosition = Player.position; + bool imminentDanger = false; + + for (int i = 0; i < SafetySteps; i++) + { + Vector2 collisionVector = Collision.TileCollision(checkedPlayerPosition, Player.velocity, Player.width, Player.height, gravDir: (int)Player.gravDir); + if (collisionVector.Y < Player.velocity.Y) + { + imminentDanger = true; + checkedPlayerPosition += collisionVector; + break; + } + + checkedPlayerPosition += collisionVector; + } + + if (!imminentDanger) + return; + + int fallDistance = (int)(checkedPlayerPosition.Y / 16f) - Player.fallStart; + int fallDmgThreshold = 25 + Player.extraFall; + + //Technically doesn't ignore clouds but oh well. + if (fallDistance * Player.gravDir > fallDmgThreshold) + { + float halfSpread = SafetyHookAngle / 2f; + Point bestGrapplePos = Point.Zero; + float bestGrappleScore = 0; + + for (float angle = -halfSpread; angle < halfSpread; angle += SafetyHookAngle / SafetyHookAngleResolution) + { + for (int i = 0; i < (int)(WulfrumHook.MaxReach / 16f); i++ ) + { + Vector2 checkSpot = Player.Center + (-Vector2.UnitY * Player.gravDir * i * 16f).RotatedBy(angle); + Point tilePos = checkSpot.ToSafeTileCoordinates(); + Tile tile = Main.tile[tilePos]; + if (tile.HasUnactuatedTile && tile.CanTileBeLatchedOnTo() && !Player.IsBlacklistedForGrappling(tilePos)) + { + if (bestGrappleScore < EvaluatePotentialSafetyHookPos((checkSpot - Player.Center).Length(), angle)) + { + bestGrapplePos = tilePos; + bestGrappleScore = EvaluatePotentialSafetyHookPos((checkSpot - Player.Center).Length(), angle); + } + break; + } + } + } + + if (bestGrapplePos != Point.Zero) + { + //Clear any hooks that might have been flying before then. + for (int i = 0; i < Main.maxProjectiles; ++i) + { + Projectile p = Main.projectile[i]; + if (!p.active || p.owner != Player.whoAmI || p.type != ProjectileType()) + continue; + + if (p.ModProjectile is WulfrumHook) + { + SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, p.Center); + p.Kill(); + + } + } + + //Reset the players fall height, because if they take fall dmg in teh frame right after this one it may have a chance of still killing the player due to the + //code where the grapple resets the players fall speed hasnt been called yet + Player.fallStart = (int)(Player.position.Y / 16); + + if (Player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(Player.GetSource_ItemUse(PackItem), bestGrapplePos.ToWorldCoordinates(), Vector2.Zero, ProjectileType(), 3, 0, Player.whoAmI); + } + } + } + } + } + + public float EvaluatePotentialSafetyHookPos(float distance, float angle) + { + float score = 0.0001f; + + if (distance < 2 * WulfrumHook.MaxReach / 3f) + score += distance / (2 * WulfrumHook.MaxReach / 3f); + + else + score += 1 - (distance - (2 * WulfrumHook.MaxReach / 3f)) / (WulfrumHook.MaxReach / 3f); + + score += (1 - Math.Abs(angle) / (SafetyHookAngle / 2f)) * 0.5f; + + return score; + } + + public override void ProcessTriggers(TriggersSet triggersSet) + { + if (!WulfrumPackEquipped) + return; + + //Shoot a new hook + if (triggersSet.Grapple && Player.releaseHook) + { + //Clear any previous non-wulfrum hooks / Any hooks that just got shot (should already be handled by the global proj + for (int i = 0; i < Main.maxProjectiles; ++i) + { + Projectile p = Main.projectile[i]; + if (!p.active || p.owner != Player.whoAmI || p.aiStyle != 7 || p.type == ProjectileType()) + continue; + + p.Kill(); + } + + + if (hookCooldown <= 0 && Main.projectile.Count(n => n.active && n.owner == Player.whoAmI && n.type == ProjectileType()) <= 1) + { + SoundEngine.PlaySound(WulfrumAcrobaticsPack.ShootSound, Player.Center); + if (Player.whoAmI == Main.myPlayer) + { + Vector2 velocity = (Main.MouseWorld - Player.Center).SafeNormalize(Vector2.One) * GrappleVelocity; + Projectile.NewProjectile(Player.GetSource_ItemUse(PackItem), Player.Center, velocity, ProjectileType(), 0, 0, Player.whoAmI); + + float angleToRightBelow = velocity.AngleBetween(Vector2.UnitY); + if (angleToRightBelow < MathHelper.PiOver2) //Put a cooldown on hooking down below. + { + int extraCooldown = (int)(Utils.GetLerpValue(MathHelper.PiOver2, 0f, angleToRightBelow) * 15); //Get more cooldown the straightest down youre aiming + hookCooldown = 15 + extraCooldown; + } + } + } + } + + //Jumping out of the hook + if (triggersSet.Jump && Player.releaseJump) + { + for (int i = 0; i < Main.maxProjectiles; ++i) + { + Projectile p = Main.projectile[i]; + if (!p.active || p.owner != Player.whoAmI || p.type != ProjectileType()) + continue; + + //Only clear hooks that are attached to stuff + if (p.ModProjectile is WulfrumHook claw && claw.State == WulfrumHook.HookState.Grappling) + { + + float angleToUpright = (Player.Center - p.Center).AngleBetween(-Vector2.UnitY); + bool canJumpOffHook = angleToUpright > MathHelper.PiOver2 || Player.Distance(p.Center) < 38;// Don't do any jump stuff if the player is jumping from above the hook. + + if (canJumpOffHook) + { + Vector2 velocityBoost = Vector2.Zero; + + //Additionally, accelerate the player a lil' if they were holding down the buttons in the direction of their swing. + if ((Math.Sign(Player.velocity.X) < 0 && Player.controlLeft) || (Math.Sign(Player.velocity.X) > 0 && Player.controlRight)) + { + velocityBoost += Player.velocity * 0.15f; + } + //Additionally^2, if the player isnt moving very fast, make them do a straight up hop. + //Don't do the hop if the player isnt moving at all though because thats handled by vanilla. + if (Player.velocity.Length() < MaxHopVelocity && Player.velocity.Length() > 0.0001f || PlayerOnGround) + { + velocityBoost -= Vector2.UnitY * Player.jumpSpeed * (1 - (float)Math.Pow(Player.velocity.Length() / MaxHopVelocity, 5f)); + } + + + Player.velocity += velocityBoost; + Player.jump = Player.jumpHeight / 2; + } + + else + { + //Prevents double jumps from getting activated + Player.releaseJump = false; + } + + SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, p.Center); + p.Kill(); + + } + } + + } + } + + + public override void FrameEffects() + { + //Cache the hook. This is done so that the player may walk around animated if the grapple's movement is disabled. + //The cache is retrieved in the postFrame detour. + if (Player.grappling[0] >= 0 && GrappleMovementDisabled && Main.projectile[Player.grappling[0]].type == ProjectileType()) + { + hookCache = Player.grappling[0]; + Player.grappling[0] = -1; + Player.grapCount = 0; + } + } + } +} diff --git a/Items/Accessories/WulfrumAcrobaticsPack.png b/Items/Accessories/WulfrumAcrobaticsPack.png new file mode 100644 index 0000000000..8d22fe6247 Binary files /dev/null and b/Items/Accessories/WulfrumAcrobaticsPack.png differ diff --git a/Items/Accessories/WulfrumAcrobaticsPack_Back.png b/Items/Accessories/WulfrumAcrobaticsPack_Back.png new file mode 100644 index 0000000000..fb7d7e000b Binary files /dev/null and b/Items/Accessories/WulfrumAcrobaticsPack_Back.png differ diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index 565a8e90a6..4bd28a1464 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -1,30 +1,92 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class WulfrumBattery : ModItem { + public static readonly SoundStyle ExtraDropSound = new("CalamityMod/Sounds/Custom/WulfrumExtraDrop") { PitchVariance = 0.3f }; + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Wulfrum Battery"); - Tooltip.SetDefault("7% increased summon damage"); + Tooltip.SetDefault( "Empowers your summons with wulfrum energy, letting them emit light around them\n" + + "7% increased summon damage\n" + + "50% chance to get an extra scrap when killing wulfrum robots\n" + + "Can also be scrapped at an extractinator"); + + ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; } public override void SetDefaults() { Item.width = 20; Item.height = 22; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Blue; + + //Needed for extractination + Item.useStyle = ItemUseStyleID.HiddenAnimation; + Item.useAnimation = 10; + Item.useTime = 2; + Item.consumable = true; } public override void UpdateAccessory(Player player, bool hideVisual) { player.GetDamage() += 0.07f; + player.GetModPlayer().battery = true; + } + + //Scrappable for 3-6 wulfrum scrap or a 20% chance to get an energy core + public override void ExtractinatorUse(ref int resultType, ref int resultStack) + { + resultType = ModContent.ItemType(); + resultStack = Main.rand.Next(3, 6); + + if (Main.rand.NextFloat() > 0.8f) + { + resultStack = 1; + resultType = ModContent.ItemType(); + } + } + } + + public class WulfrumBatteryPlayer : ModPlayer + { + public bool battery = false; + public override void ResetEffects() => battery = false; + public override void UpdateDead() => battery = false; + } + + public class WulfrumBatteryGlobalProjectile : GlobalProjectile + { + public override void AI(Projectile projectile) + { + if (!projectile.npcProj && !projectile.trap && projectile.minion && !ProjectileID.Sets.MinionShot[projectile.type] && Main.player[projectile.owner].GetModPlayer().battery) + { + float lightMult = 2f; + if (Lighting.UpdateEveryFrame) //The light loks wayyy too bright in retro/trippy + lightMult *= 0.5f; + + Lighting.AddLight(projectile.Center, Color.DeepSkyBlue.ToVector3() * lightMult); + + + + if (Main.rand.NextBool(16)) + { + float size = (projectile.Hitbox.Size() / 2f).Length(); + + Dust zapDust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * size, 226, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(1f, 2.3f)); + zapDust.noGravity = true; + } + } } } } diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index ca30b252a8..7029d6585e 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -1,8 +1,10 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Items.Accessories { @@ -27,8 +29,7 @@ namespace CalamityMod.Items.Accessories Item.height = 22; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 8f9a9f76ed..7703adcab0 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +25,9 @@ namespace CalamityMod.Items.Accessories { Item.width = 22; Item.height = 38; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.accessory = true; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Ammo/AccelerationRound.cs b/Items/Ammo/AccelerationRound.cs index e40adfc7d4..91c14c8ae6 100644 --- a/Items/Ammo/AccelerationRound.cs +++ b/Items/Ammo/AccelerationRound.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Ammo { CreateRecipe(150). AddIngredient(ItemID.MusketBall, 150). - AddIngredient(). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index 08aa7bfda9..ae42147fbc 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Ammo DisplayName.SetDefault("Astral Solution"); Tooltip.SetDefault("Used by the Clentaminator\n" + "Spreads the Astral Infection"); + ItemID.Sets.SortingPriorityTerraforming[Type] = 95; // Red Solution } public override void SetDefaults() @@ -29,6 +30,11 @@ namespace CalamityMod.Items.Ammo return; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Solutions; + } + public override bool CanConsumeAmmo(Item ammo, Player player) { return !(player.itemAnimation < player.ActiveItem().useAnimation - 3); diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index 6d4ca62387..e24096da97 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Terraria; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 10f; Item.value = Item.buyPrice(gold: 1); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0f; diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 6292c61ca2..72886ea6c0 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,8 +26,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 3.5f; Item.value = Item.sellPrice(copper: 24); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.ammo = AmmoID.Arrow; diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index 0194e1af37..ad128e79d5 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,8 +26,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 4.5f; Item.value = Item.sellPrice(copper: 24); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4.8f; Item.ammo = ItemID.MusketBall; diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index b2120a439b..199ab45947 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 3f; Item.value = Item.sellPrice(copper: 28); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; Item.ammo = ItemID.MusketBall; diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index 1edc29fd95..ab9e2432d2 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 7.5f; Item.value = Item.sellPrice(copper: 20); - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.ammo = AmmoID.Bullet; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 15093dabea..5e7bb5d2a6 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 7.5f; Item.value = Item.sellPrice(copper: 20); - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.ammo = AmmoID.Bullet; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Ammo/SuperballBullet.cs b/Items/Ammo/SuperballBullet.cs index 0001a989bc..5435b6cae9 100644 --- a/Items/Ammo/SuperballBullet.cs +++ b/Items/Ammo/SuperballBullet.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Ammo { CreateRecipe(150). AddIngredient(ItemID.MeteorShot, 150). - AddIngredient(). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 612516465c..b2cde7ebce 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Ammo Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.ammo = AmmoID.Arrow; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/AntiCystOintment.cs b/Items/AntiCystOintment.cs index 165b69bc97..2c70fc323f 100644 --- a/Items/AntiCystOintment.cs +++ b/Items/AntiCystOintment.cs @@ -20,6 +20,11 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Blue; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + public override void UpdateInventory(Player player) { if (Item.favorited) diff --git a/Items/AntiTumorOintment.cs b/Items/AntiTumorOintment.cs index bb0c321623..cd141cf49d 100644 --- a/Items/AntiTumorOintment.cs +++ b/Items/AntiTumorOintment.cs @@ -20,6 +20,11 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Blue; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + public override void UpdateInventory(Player player) { if (Item.favorited) diff --git a/Items/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index 88fe5f61d7..862d59bf9d 100644 --- a/Items/Armor/Aerospec/AerospecBreastplate.cs +++ b/Items/Armor/Aerospec/AerospecBreastplate.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 7; } diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHat.cs index 47c78e2456..d7bd845968 100644 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ b/Items/Armor/Aerospec/AerospecHat.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 3; //15 } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index f8cd46f0a7..e6b3d249d7 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 4; //17 } @@ -41,12 +41,9 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased movement speed and rogue critical strike chance\n" + + "+100 maximum stealth\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + - "Allows you to fall more quickly and disables fall damage\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Allows you to fall more quickly and disables fall damage"; var modPlayer = player.Calamity(); modPlayer.aeroSet = true; modPlayer.rogueStealthMax += 1f; diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHelm.cs index 55bd7fe9f1..bb931db546 100644 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ b/Items/Armor/Aerospec/AerospecHelm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 7; //20 } diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHelmet.cs index 2e096a1231..3f3cc0d646 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHelmet.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 2; //13 } diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHood.cs index ff9116a1d5..903ea84e52 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHood.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 5; //18 } diff --git a/Items/Armor/Aerospec/AerospecLeggings.cs b/Items/Armor/Aerospec/AerospecLeggings.cs index 147506a48c..054fcd1760 100644 --- a/Items/Armor/Aerospec/AerospecLeggings.cs +++ b/Items/Armor/Aerospec/AerospecLeggings.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Aerospec { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 3, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.defense = 6; } diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index abfb8fcf09..c1ef0b823b 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Astral { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 32, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.defense = 25; } diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index b1afd3efdf..6b9027c9ff 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Astral { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 40, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.defense = 17; //63 } diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index 6386243624..619a4c0614 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Astral { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.defense = 21; } diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index baff093e1c..7fa9e6fcc1 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 38; Item.height = 34; - Item.value = Item.buyPrice(1, 44, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 48; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaCuisses.cs b/Items/Armor/Auric/AuricTeslaCuisses.cs index 3f6e73aca1..cea753b42d 100644 --- a/Items/Armor/Auric/AuricTeslaCuisses.cs +++ b/Items/Armor/Auric/AuricTeslaCuisses.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -26,9 +27,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(1, 8, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 44; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs index 238ca0a88b..38a21e90df 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -25,9 +26,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(1, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 40; //132 - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -57,8 +58,8 @@ namespace CalamityMod.Items.Armor.Auric player.ignoreWater = true; player.crimsonRegen = true; - if (modPlayer.godSlayerDashHotKeyPressed) - modPlayer.DashID = GodslayerArmorDash.ID; + if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) + modPlayer.DeferredDashID = GodslayerArmorDash.ID; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs index d5c97bf056..106f0144f0 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(1, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 34; //132 - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -43,10 +44,7 @@ namespace CalamityMod.Items.Armor.Auric { player.setBonus = "Rogue Tarragon, Bloodflare and God Slayer armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 130\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "+130 maximum stealth"; var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; @@ -62,8 +60,8 @@ namespace CalamityMod.Items.Armor.Auric player.ignoreWater = true; player.crimsonRegen = true; - if (modPlayer.godSlayerDashHotKeyPressed) - modPlayer.DashID = GodslayerArmorDash.ID; + if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) + modPlayer.DeferredDashID = GodslayerArmorDash.ID; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs index bd3c89dfef..b6c33a061e 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -26,9 +27,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(1, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 54; //132 - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -60,8 +61,8 @@ namespace CalamityMod.Items.Armor.Auric player.crimsonRegen = true; player.aggro += 1200; - if (modPlayer.godSlayerDashHotKeyPressed) - modPlayer.DashID = GodslayerArmorDash.ID; + if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) + modPlayer.DeferredDashID = GodslayerArmorDash.ID; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index 66964167f6..4a20f72592 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -26,9 +27,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(1, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 12; //132 - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs index 7e0f17ba02..97a6d30993 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.Auric { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(1, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.defense = 24; //132 - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs index d5444cef65..2f362f4701 100644 --- a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs +++ b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,9 +21,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 48, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 35; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Bloodflare/BloodflareCuisses.cs b/Items/Armor/Bloodflare/BloodflareCuisses.cs index d3484f877e..3bab91f108 100644 --- a/Items/Armor/Bloodflare/BloodflareCuisses.cs +++ b/Items/Armor/Bloodflare/BloodflareCuisses.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,9 +20,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 29; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index ce1e720e96..d4814db344 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 22; //85 - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index 82e4f87fab..8de74fdb5d 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 49; //85 - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index 700ab532d4..47b243f925 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -1,9 +1,10 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Armor.Bloodflare { @@ -25,9 +26,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 34; //85 - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index 364b96d7ef..524feb0257 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 28; //85 - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -48,13 +49,10 @@ namespace CalamityMod.Items.Armor.Bloodflare "Enemies below 50% life drop a heart when struck\n" + "This effect has a 5 second cooldown\n" + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "+120 maximum stealth\n" + "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + "Being below 80% life boosts your rogue damage by 10%\n" + - "Rogue critical strikes have a 50% chance to heal you\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue critical strikes have a 50% chance to heal you"; player.crimsonRegen = true; } diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 8521a2effc..34e02c5211 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 16; //85 - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Brimflame/BrimflameBoots.cs b/Items/Armor/Brimflame/BrimflameBoots.cs index e4d4ccbffa..342d268a7b 100644 --- a/Items/Armor/Brimflame/BrimflameBoots.cs +++ b/Items/Armor/Brimflame/BrimflameBoots.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Brimflame { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 15; } diff --git a/Items/Armor/Brimflame/BrimflameRobes.cs b/Items/Armor/Brimflame/BrimflameRobes.cs index d4cca307d3..be9b03a493 100644 --- a/Items/Armor/Brimflame/BrimflameRobes.cs +++ b/Items/Armor/Brimflame/BrimflameRobes.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor.Brimflame { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 15; } diff --git a/Items/Armor/Brimflame/BrimflameScowl.cs b/Items/Armor/Brimflame/BrimflameScowl.cs index 6c868a2fb8..023a2f0c71 100644 --- a/Items/Armor/Brimflame/BrimflameScowl.cs +++ b/Items/Armor/Brimflame/BrimflameScowl.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor.Brimflame { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 11; } @@ -86,7 +86,7 @@ namespace CalamityMod.Items.Armor.Brimflame "Press " + hotkey + " to trigger a brimflame frenzy effect\n" + "While under this effect, your damage is significantly boosted\n" + "However, this comes at the cost of rapid life loss and no mana regeneration\n" + - "This can be toggled off, however, a brimstone frenzy has a 30 second cooldown"; + "This can be toggled off, however, a brimflame frenzy has a 30 second cooldown"; } public override void AddRecipes() diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs index 2dad0edb28..3658b179d9 100644 --- a/Items/Armor/CirrusDress.cs +++ b/Items/Armor/CirrusDress.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Armor Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.defense = 8; } diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 4c7578ce1c..9e0d2b3f0d 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 20, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 19; //41 } diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index 272d62fc23..1eaad669f9 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 25, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 5; //35 } diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index c2fb0c053d..72f5854a49 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 25, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 21; //51 } diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index b799e2c048..f29e8c3b2c 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 25, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 9; //39 } diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index f354b1524e..52aaab8064 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 25, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 7; //37 } @@ -41,11 +41,8 @@ namespace CalamityMod.Items.Armor.Daedalus public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased rogue damage\n" + - "Rogue projectiles throw out crystal shards as they travel\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 105\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "+105 maximum stealth\n" + + "Rogue projectiles throw out crystal shards as they travel"; var modPlayer = player.Calamity(); modPlayer.daedalusSplit = true; modPlayer.rogueStealthMax += 1.05f; diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index 1575da3fc0..64e9a0ab48 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 25, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 3; //33 } diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 07bd2b02c4..99045d726c 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Daedalus { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 15, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 15; //41 } diff --git a/Items/Armor/Demonshade/DemonshadeBreastplate.cs b/Items/Armor/Demonshade/DemonshadeBreastplate.cs index e7e84c325c..0f3f9dbd74 100644 --- a/Items/Armor/Demonshade/DemonshadeBreastplate.cs +++ b/Items/Armor/Demonshade/DemonshadeBreastplate.cs @@ -1,22 +1,18 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Demonshade { [AutoloadEquip(EquipType.Body)] - public class DemonshadeBreastplate : ModItem + public class DemonshadeBreastplate : ModItem, IDrawArmOverShoulderpad { - public override void Load() - { - if (Main.netMode != NetmodeID.Server) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Demonshade/DemonshadeBreastplate_Arms", EquipType.Front, this); - } - } + public string FrontArmTexture => "CalamityMod/Items/Armor/Demonshade/DemonshadeBreastplate_Arms"; + public override void SetStaticDefaults() { @@ -34,7 +30,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.height = 18; Item.defense = 50; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Armor/Demonshade/DemonshadeGreaves.cs b/Items/Armor/Demonshade/DemonshadeGreaves.cs index ad8f1d57f1..5bfdc706f9 100644 --- a/Items/Armor/Demonshade/DemonshadeGreaves.cs +++ b/Items/Armor/Demonshade/DemonshadeGreaves.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.defense = 50; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 97c2e9afcd..734bde4a84 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -2,12 +2,13 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.DataStructures; -using Terraria.Audio; namespace CalamityMod.Items.Armor.Demonshade { @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.height = 18; Item.defense = 50; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Armor/DesertProwler/DesertProwlerHat.cs b/Items/Armor/DesertProwler/DesertProwlerHat.cs deleted file mode 100644 index fc76d67628..0000000000 --- a/Items/Armor/DesertProwler/DesertProwlerHat.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.DesertProwler -{ - [AutoloadEquip(EquipType.Head)] - public class DesertProwlerHat : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Desert Prowler Hat"); - Tooltip.SetDefault("4% increased ranged critical strike chance and 20% chance to not consume ammo"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; - Item.defense = 1; //6 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Ranged attacks deal an extra 1 flat damage\n" + - "Ranged crits can rarely whip up a sandstorm"; - var modPlayer = player.Calamity(); - modPlayer.desertProwler = true; - } - - public override void UpdateEquip(Player player) - { - player.GetCritChance() += 4; - player.ammoCost80 = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(2). - AddIngredient(ItemID.Silk, 8). - AddTile(TileID.Loom). - Register(); - } - } -} diff --git a/Items/Armor/DesertProwler/DesertProwlerHat.png b/Items/Armor/DesertProwler/DesertProwlerHat.png index 874bd3bddd..2f7649133d 100644 Binary files a/Items/Armor/DesertProwler/DesertProwlerHat.png and b/Items/Armor/DesertProwler/DesertProwlerHat.png differ diff --git a/Items/Armor/DesertProwler/DesertProwlerHat_Head.png b/Items/Armor/DesertProwler/DesertProwlerHat_Head.png index 6a07f81bbd..f943349929 100644 Binary files a/Items/Armor/DesertProwler/DesertProwlerHat_Head.png and b/Items/Armor/DesertProwler/DesertProwlerHat_Head.png differ diff --git a/Items/Armor/DesertProwler/DesertProwlerPants.cs b/Items/Armor/DesertProwler/DesertProwlerPants.cs deleted file mode 100644 index 04970dde6b..0000000000 --- a/Items/Armor/DesertProwler/DesertProwlerPants.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.DesertProwler -{ - [AutoloadEquip(EquipType.Legs)] - public class DesertProwlerPants : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Desert Prowler Pants"); - Tooltip.SetDefault("10% increased movement speed and immunity to the Mighty Wind debuff"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; - Item.defense = 2; - } - - public override void UpdateEquip(Player player) - { - player.buffImmune[BuffID.WindPushed] = true; - player.moveSpeed += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.Silk, 5). - AddTile(TileID.Loom). - Register(); - } - } -} diff --git a/Items/Armor/DesertProwler/DesertProwlerPants.png b/Items/Armor/DesertProwler/DesertProwlerPants.png index 23e4e0456b..c0bed623ca 100644 Binary files a/Items/Armor/DesertProwler/DesertProwlerPants.png and b/Items/Armor/DesertProwler/DesertProwlerPants.png differ diff --git a/Items/Armor/DesertProwler/DesertProwlerPants_Legs.png b/Items/Armor/DesertProwler/DesertProwlerPants_Legs.png index ac51bcf4a4..df0a6fd4a5 100644 Binary files a/Items/Armor/DesertProwler/DesertProwlerPants_Legs.png and b/Items/Armor/DesertProwler/DesertProwlerPants_Legs.png differ diff --git a/Items/Armor/DesertProwler/DesertProwlerSet.cs b/Items/Armor/DesertProwler/DesertProwlerSet.cs new file mode 100644 index 0000000000..29b27e16f4 --- /dev/null +++ b/Items/Armor/DesertProwler/DesertProwlerSet.cs @@ -0,0 +1,480 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Cooldowns; +using static Terraria.ModLoader.ModContent; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using CalamityMod.Particles; +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Melee; +using Terraria.Audio; +using Terraria.DataStructures; +using CalamityMod.Dusts; +using ReLogic.Utilities; + +namespace CalamityMod.Items.Armor.DesertProwler +{ + [AutoloadEquip(EquipType.Head)] + public class DesertProwlerHat : ModItem + { + public static readonly SoundStyle SmokeBombSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBomb"); + public static readonly SoundStyle SmokeBombEndSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombEnd"); + public static readonly SoundStyle CDResetSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DesertProwlerCDReset"); + + public static int SmokeCooldown = 25 * 60; + public static int SmokeDuration = 5 * 60; + public static int LightsOutReset = (int)(1.5f * 60); + public static int FreeCrit = 200; + public static int BonusDamageCap = 100; + + public static bool ShroudedInSmoke(Player player, out CooldownInstance cd) + { + cd = null; + bool hasSmokebombCD = player.Calamity().cooldowns.TryGetValue(SandsmokeBomb.ID, out cd); + return (hasSmokebombCD && cd.timeLeft > SmokeCooldown); + } + + public override void Load() + { + On.Terraria.Player.KeyDoubleTap += ActivateSetBonus; + } + + public override void Unload() + { + On.Terraria.Player.KeyDoubleTap -= ActivateSetBonus; + } + + private void ActivateSetBonus(On.Terraria.Player.orig_KeyDoubleTap orig, Player player, int keyDir) + { + if (keyDir == 0 && HasArmorSet(player) && !player.mount.Active) + { + // The set bonus can only be activated if the player does not have the cooldown. + if (!player.Calamity().cooldowns.TryGetValue(SandsmokeBomb.ID, out CooldownInstance cd)) + { + player.AddCooldown(SandsmokeBomb.ID, SmokeCooldown + SmokeDuration); + } + } + + orig(player, keyDir); + } + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Desert Prowler Hat"); + Tooltip.SetDefault("4% increased ranged critical strike chance and 20% chance to not consume ammo"); + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 1; //6 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); + public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); + public bool IsPartOfSet(Item item) => item.type == ItemType() || + item.type == ItemType() || + item.type == ItemType(); + + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Ranged attacks deal an extra 1 flat damage"; //More gets edited in elsewhere + + DesertProwlerPlayer armorPlayer = player.GetModPlayer(); + armorPlayer.desertProwlerSet = true; + + if (ShroudedInSmoke(player, out var cd)) + { + if (cd.timeLeft == SmokeCooldown + SmokeDuration) + armorPlayer.SetBonusStartEffect(); + + player.moveSpeed *= 1.5f; + player.invis = true; + player.aggro = (int)(player.aggro * 0.5f); + player.noKnockback = true; + + for (int i = 0; i < 2; i++) + { + Vector2 dustDisplace = Main.rand.NextVector2Circular(80f, 50f); + Vector2 dustPosition = player.MountedCenter + dustDisplace; + Vector2 dustSpeed = Main.rand.NextVector2Circular(0.5f, 0.5f) + player.velocity / 8f - Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 0.06f; + dustSpeed.X += 1.4f * (float)Math.Sin(((dustDisplace.X + 80f) / 160f) * MathHelper.Pi) * (Main.rand.NextBool() ? -1 : 1); + Particle dust = new SandyDustParticle(dustPosition, dustSpeed, Color.White, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(20, 50), 0.03f, Vector2.UnitY * 0.03f); + GeneralParticleHandler.SpawnParticle(dust); + } + + int sandSmokeCount = Main.rand.Next(2, 3); + for (int i = 0; i < sandSmokeCount; i++) + { + Color startColor = new Color(173, 156, 112); + Color endColor = new Color(143, 120, 63); + if (Main.rand.NextBool()) + { + startColor = new Color(173, 139, 100); + endColor = new Color(149, 106, 50); + } + + //Add some random hue shift & sat shift + Vector3 hslStartColor = Main.rgbToHsl(startColor); + Vector3 hslEndColor = Main.rgbToHsl(endColor); + + float valueShift = Main.rand.NextFloat(0f, 0.5f); + float satShift = Main.rand.NextFloat(-0.1f, 0f); + float hueShiftPercent = Main.rand.NextFloat(); + + hslStartColor.Z = Math.Clamp(hslStartColor.Z + valueShift, 0f, 1f); + hslEndColor.Z = Math.Clamp(hslEndColor.Z + valueShift, 0f, 1f); + + hslStartColor.Y = Math.Clamp(hslStartColor.Y + satShift, 0f, 1f); + hslEndColor.Y = Math.Clamp(hslEndColor.Y + satShift, 0f, 1f); + + hslStartColor.X = MathHelper.Lerp(hslStartColor.X, 43 / 255f, hueShiftPercent); + hslEndColor.X = MathHelper.Lerp(hslEndColor.X, 43 / 255f, hueShiftPercent); + + startColor = Main.hslToRgb(hslStartColor); + endColor = Main.hslToRgb(hslEndColor); + + Vector2 smokeRandomPos = Main.rand.NextVector2Circular(40f, player.height); + Vector2 smokePos = player.MountedCenter + smokeRandomPos; + float burstAngle = MathHelper.Pi - ((smokeRandomPos.X + 40) / 80f) * MathHelper.Pi; + Vector2 smokeSpeed = Main.rand.NextVector2Circular(1f, 0.5f) - Vector2.UnitY * 0.05f + player.velocity * 0.5f + burstAngle.ToRotationVector2() * ((1 - (float)Math.Sin(burstAngle)) * 0.9f + 0.1f) * 1.5f; + smokeSpeed.X += (float)Math.Sin(((smokeRandomPos.X + 40) / 80f) * MathHelper.Pi) * (Main.rand.NextBool() ? -1 : 1); + Particle smoke = new TimedSmokeParticle(smokePos, smokeSpeed, startColor, endColor, Main.rand.NextFloat(0.7f, 1.6f), Main.rand.NextFloat(0.4f, 0.55f), Main.rand.Next(20, 36), 0.01f); + GeneralParticleHandler.SpawnParticle(smoke); + } + + // Dust + Vector2 dustDirection = Main.rand.NextVector2CircularEdge(1f, 1f); + float dustDistance = Main.rand.NextFloat(30f); + Vector2 dustPos = player.MountedCenter + dustDirection * dustDistance; + int dustType = Main.rand.NextBool() ? 32 : 31; + + Dust dhusvtt = Dust.NewDustPerfect(dustPos, dustType); + dhusvtt.noGravity = true; + dhusvtt.fadeIn = 1f; + Vector2 dustVelocity = dustDirection.RotatedBy(MathHelper.PiOver2) * 0.04f * dustDistance; + dhusvtt.velocity = dustVelocity; + + } + } + + public static void ModifySetTooltips(ModItem item, List tooltips) + { + if (HasArmorSet(Main.LocalPlayer)) + { + int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); + + if (setBonusIndex != -1) + { + TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", "Sandsmoke Bomb - Double tap DOWN to shroud yourself in a small cloud of sand"); + setBonus1.OverrideColor = Color.Lerp(new Color(255, 229, 156), new Color(233, 225, 198), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); + tooltips.Insert(setBonusIndex + 1, setBonus1); + + TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", "While the sand cloud is active, gain increased mobility but heavily reduced defense"); + setBonus2.OverrideColor = new Color(204, 181, 72); + tooltips.Insert(setBonusIndex + 2, setBonus2); + + TooltipLine setBonus3 = new TooltipLine(item.Mod, "CalamityMod:SetBonus3", $"Using a ranged weapon instantly dispels the sand cloak, but guarantees a supercrit for {FreeCrit}% damage\n" + + $"The super crit applies only as long as the resulting hit wouldn't exceed {BonusDamageCap} damage\n" + + $"Landing the killing blow on an enemy with this shot shortens the ability's cooldown to {LightsOutReset / 60f} seconds"); + setBonus3.OverrideColor = new Color(204, 181, 72); + tooltips.Insert(setBonusIndex + 3, setBonus3); + } + } + } + + public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); + + public override void UpdateEquip(Player player) + { + player.GetCritChance() += 4; + player.ammoCost80 = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(2). + AddIngredient(ItemID.Silk, 8). + AddTile(TileID.Loom). + Register(); + } + } + + [AutoloadEquip(EquipType.Body)] + public class DesertProwlerShirt : ModItem, IBulkyArmor + { + public string BulkTexture => "CalamityMod/Items/Armor/DesertProwler/DesertProwlerShirt_Bulk"; + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Desert Prowler Shirt"); + Tooltip.SetDefault("5% increased ranged critical strike chance"); + + if (Main.netMode == NetmodeID.Server) + return; + + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); + + ArmorIDs.Body.Sets.HidesTopSkin[equipSlot] = true; + ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 3; + } + + public override void ModifyTooltips(List tooltips) => DesertProwlerHat.ModifySetTooltips(this, tooltips); + + + public override void UpdateEquip(Player player) + { + player.GetCritChance() += 5; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddIngredient(ItemID.Silk, 10). + AddTile(TileID.Loom). + Register(); + } + } + + [AutoloadEquip(EquipType.Legs)] + public class DesertProwlerPants : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Desert Prowler Pants"); + Tooltip.SetDefault("10% increased movement speed and immunity to the Mighty Wind debuff"); + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 2; + } + public override void ModifyTooltips(List tooltips) => DesertProwlerHat.ModifySetTooltips(this, tooltips); + public override void UpdateEquip(Player player) + { + player.buffImmune[BuffID.WindPushed] = true; + player.moveSpeed += 0.1f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.Silk, 5). + AddTile(TileID.Loom). + Register(); + } + } + + public class DesertProwlerPlayer : ModPlayer + { + public static int BastionShootDamage = 10; + public static float BastionShootSpeed = 18f; + public static int BastionShootTime = 10; + internal SlotId SmokeBombSoundSlot; + + public bool desertProwlerSet = false; + public bool stopSmokeBomb = false; + + public override void ResetEffects() + { + desertProwlerSet = false; + } + + public override void UpdateDead() + { + desertProwlerSet = false; + } + + public override void ModifyWeaponDamage(Item item, ref StatModifier damage) + { + // Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me + if (desertProwlerSet && (item.CountsAsClass() || item.type == ModContent.ItemType()) && item.ammo == AmmoID.None) + damage.Flat += 1f; + } + + public override void PostUpdate() + { + if (Player.Calamity().cooldowns.TryGetValue(SandsmokeBomb.ID, out var cd)) + { + if (stopSmokeBomb) + { + cd.timeLeft = DesertProwlerHat.SmokeCooldown; + SetBonusBounceEffect(); + stopSmokeBomb = false; + } + + if (cd.timeLeft == DesertProwlerHat.SmokeCooldown) + SetBonusEndEffect(); + } + } + + public void SetBonusStartEffect() + { + SmokeBombSoundSlot = SoundEngine.PlaySound(DesertProwlerHat.SmokeBombSound, Player.Center); + } + + public void SetBonusEndEffect() + { + if (SoundEngine.TryGetActiveSound(SmokeBombSoundSlot, out var sound)) + { + sound.Stop(); + SmokeBombSoundSlot = SlotId.Invalid; + } + } + + //BANDIT RISK OF RAIN 2! JAce would b e proud + public void SetBonusBounceEffect() + { + SoundEngine.PlaySound(DesertProwlerHat.SmokeBombEndSound, Player.Center); + Player.velocity.Y = Math.Min(-6f, Player.velocity.Y - 6f); + Player.jump = Player.jumpHeight / 2; + + for (int i = 0; i < 30; i++) + { + Vector2 dustDisplace = Main.rand.NextVector2Circular(80f, 30f); + Vector2 dustPosition = Player.MountedCenter + Vector2.UnitY * Player.height * 0.5f + dustDisplace; + Vector2 dustSpeed = Main.rand.NextVector2Circular(0.5f, 0.5f) + Player.velocity / 8f - Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 0.06f; + dustSpeed.X += 1.4f * (float)Math.Sin(((dustDisplace.X + 80f) / 160f) * MathHelper.Pi) * (Main.rand.NextBool() ? -1 : 1); + Particle dust = new SandyDustParticle(dustPosition, dustSpeed, Color.White, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(20, 50), 0.03f, Vector2.UnitY * 0.03f); + GeneralParticleHandler.SpawnParticle(dust); + } + + + if (!Main.dedServ) + { + for (int i = 0; i < 10; i++) + { + float dustOrientation = i / 10f * MathHelper.TwoPi + MathHelper.PiOver4 * 0.6f; + Vector2 dustDirection = Vector2.UnitX * (float)Math.Sin(dustOrientation) + Vector2.UnitY * (float)Math.Cos(dustOrientation) * 0.2f; + + Vector2 dustPos = Player.MountedCenter + Vector2.UnitY * Player.height / 2f + dustDirection * 20f; + Vector2 dustVel = Player.velocity * 0.3f + dustDirection * 1.4f; + + int sandstormJump = Gore.NewGore(Player.GetSource_Misc("Jump"), dustPos, dustVel, Main.rand.Next(220, 223), 1f); + Main.gore[sandstormJump].velocity = dustVel; + Main.gore[sandstormJump].alpha = 100; + + + for (int j = 0; j < 1; j++) + { + Dust miniDust = Dust.NewDustDirect(dustPos, 32, 32, 124, dustVel.X, dustVel.Y * 0.3f, 150, default(Color), 1f); + miniDust.fadeIn = 1.5f; + } + } + } + } + + public override void PostUpdateMiscEffects() + { + if (!desertProwlerSet && DesertProwlerHat.ShroudedInSmoke(Player, out var cd)) + { + cd.timeLeft = DesertProwlerHat.SmokeCooldown; + } + } + } + + public class DesertProwlerProjectile : GlobalProjectile + { + public bool LightsOut = false; + public int ExtraCrit = 0; + public override bool InstancePerEntity => true; + + public override void OnSpawn(Projectile projectile, IEntitySource source) + { + if (projectile.damage > 0 && !Main.gameMenu) + { + if (projectile.owner >= 0 && DesertProwlerHat.ShroudedInSmoke(Main.player[projectile.owner], out var cd) && projectile.DamageType.CountsAsClass(DamageClass.Ranged)) + { + int critPool = DesertProwlerHat.FreeCrit; + + int achievedDamage = projectile.damage; + + //Increase the crit cance of the projectile for as long as theres free crits to be handed out. + //Only increase the crit chance if the additional 100% damage wouldnt make the projectile deal more than the damage cap + while (critPool >= 100) + { + if (achievedDamage + projectile.damage <= DesertProwlerHat.BonusDamageCap) + { + ExtraCrit += 100; + critPool -= 100; + + achievedDamage += projectile.damage; + } + + else + { + //Don't do anything to projectiles that reached the damage cap + if (achievedDamage < DesertProwlerHat.BonusDamageCap) + { + //Give some compensation crit if there's still some crit left but adding one full 100% crit chance would make the projectile go over the damage cap + //For example, if the free crit was 200%, the projectile dealt 40 damage, and the damage cap was 100. + //The projectile would get one layer of extra crit, bringing it to 80 damage, but we still have 100% crit leftover + //Adding an extra layer of crit would make the projectile deal 120 damage, which we do not want. + //To compensate for the 20 potential damage loss, we instead add 20/40 crit, making it have 50% extra crit + + int remainingDamageTilCap = DesertProwlerHat.BonusDamageCap - achievedDamage; + ExtraCrit += (int)(100 * remainingDamageTilCap / (float)projectile.damage); + } + + //Avoid infinite loops + break; + } + } + + projectile.CritChance += ExtraCrit; + + projectile.Calamity().supercritHits = 1; + LightsOut = true; + Main.player[projectile.owner].GetModPlayer().stopSmokeBomb = true; + } + } + } + + public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) + { + if (LightsOut) + { + Player owner = Main.player[projectile.owner]; + projectile.CritChance -= ExtraCrit; + + if (target.life <= 0 && owner.Calamity().cooldowns.TryGetValue(SandsmokeBomb.ID, out var cd) && cd.timeLeft <= DesertProwlerHat.SmokeCooldown && cd.timeLeft > DesertProwlerHat.LightsOutReset) + { + cd.timeLeft = DesertProwlerHat.LightsOutReset; + SoundEngine.PlaySound(DesertProwlerHat.CDResetSound); + + Particle skully = new DesertProwlerSkullParticle(target.Center, Vector2.UnitY * -3f, Color.Gold, Color.DarkGoldenrod, Main.rand.NextFloat(1f, 2f), 250f); + GeneralParticleHandler.SpawnParticle(skully); + } + + LightsOut = false; + } + } + } +} diff --git a/Items/Armor/DesertProwler/DesertProwlerShirt.cs b/Items/Armor/DesertProwler/DesertProwlerShirt.cs deleted file mode 100644 index a0767bbf9e..0000000000 --- a/Items/Armor/DesertProwler/DesertProwlerShirt.cs +++ /dev/null @@ -1,49 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.DesertProwler -{ - [AutoloadEquip(EquipType.Body)] - public class DesertProwlerShirt : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Desert Prowler Shirt"); - Tooltip.SetDefault("5% increased ranged critical strike chance"); - - if (Main.netMode == NetmodeID.Server) - return; - - int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - - ArmorIDs.Body.Sets.HidesTopSkin[equipSlot] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; - Item.defense = 3; - } - - public override void UpdateEquip(Player player) - { - player.GetCritChance() += 5; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddIngredient(ItemID.Silk, 10). - AddTile(TileID.Loom). - Register(); - } - } -} diff --git a/Items/Armor/DesertProwler/DesertProwlerShirt.png b/Items/Armor/DesertProwler/DesertProwlerShirt.png index 23f35ce0b0..0ab90ad272 100644 Binary files a/Items/Armor/DesertProwler/DesertProwlerShirt.png and b/Items/Armor/DesertProwler/DesertProwlerShirt.png differ diff --git a/Items/Armor/DesertProwler/DesertProwlerShirt_Body.png b/Items/Armor/DesertProwler/DesertProwlerShirt_Body.png index e388ea4ed3..3b1b4ef4dc 100644 Binary files a/Items/Armor/DesertProwler/DesertProwlerShirt_Body.png and b/Items/Armor/DesertProwler/DesertProwlerShirt_Body.png differ diff --git a/Items/Armor/DesertProwler/DesertProwlerShirt_Bulk.png b/Items/Armor/DesertProwler/DesertProwlerShirt_Bulk.png new file mode 100644 index 0000000000..bcf2cd2765 Binary files /dev/null and b/Items/Armor/DesertProwler/DesertProwlerShirt_Bulk.png differ diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 85ddf261c0..908d4c23fa 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor.Empyrean { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 32, 0, 0); + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.defense = 27; } diff --git a/Items/Armor/Empyrean/EmpyreanCuisses.cs b/Items/Armor/Empyrean/EmpyreanCuisses.cs index fb40758062..1f433933f5 100644 --- a/Items/Armor/Empyrean/EmpyreanCuisses.cs +++ b/Items/Armor/Empyrean/EmpyreanCuisses.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Empyrean { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.defense = 24; } diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 38643169b5..fe9be6cbad 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor.Empyrean { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 40, 0, 0); + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.defense = 20; //71 } @@ -69,12 +69,9 @@ namespace CalamityMod.Items.Armor.Empyrean modPlayer.xerocSet = true; modPlayer.rogueStealthMax += 1.15f; player.setBonus = "9% increased rogue damage and velocity\n" + + "+115 maximum stealth\n" + "Rogue projectiles have special effects on enemy hits\n" + - "Imbued with cosmic wrath and rage when you are damaged\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 115\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Imbued with cosmic wrath and rage when you are damaged"; if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.AddBuff(BuffID.Wrath, 2); diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs index c8afee78ff..fd915b5a80 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 18, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 15; } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index c2fabd387b..0e428bfa3e 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 22; } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index 3d7d23307f..783703bf07 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 10; //47 +10 underwater } diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 47a04ab9a1..3bddaafe79 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.Fearmonger { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(gold: 75); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 38; // 132 total - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Fearmonger/FearmongerGreaves.cs b/Items/Armor/Fearmonger/FearmongerGreaves.cs index a9418146f3..6c1b22b1c8 100644 --- a/Items/Armor/Fearmonger/FearmongerGreaves.cs +++ b/Items/Armor/Fearmonger/FearmongerGreaves.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -23,9 +24,9 @@ namespace CalamityMod.Items.Armor.Fearmonger { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(gold: 45); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 44; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Fearmonger/FearmongerPlateMail.cs b/Items/Armor/Fearmonger/FearmongerPlateMail.cs index 20918822db..11646cb6f1 100644 --- a/Items/Armor/Fearmonger/FearmongerPlateMail.cs +++ b/Items/Armor/Fearmonger/FearmongerPlateMail.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -21,9 +22,9 @@ namespace CalamityMod.Items.Armor.Fearmonger { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(gold: 60); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 50; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index 04508e4c70..d2f3681621 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -45,14 +45,11 @@ namespace CalamityMod.Items.Armor { int stormMana = (int)(manaCost * player.manaCost); string hotkey = CalamityKeybinds.SetBonusHotKey.TooltipHotkeyString(); - player.setBonus = "Press " + hotkey + " to call an ancient storm to the cursor location\n" + + player.setBonus = "+40 maximum stealth\n" + + "Press " + hotkey + " to call an ancient storm to the cursor location\n" + "The ancient storm costs " + stormMana + " mana and benefits from both summon and rogue bonuses\n" + "Rogue stealth strikes spawn homing eaters on enemy hits\n" + - "Rogue and summon attacks will scale off of the stat with a higher boost\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 40\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue and summon attacks will scale off of the stat with a higher boost"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.forbiddenCirclet = true; modPlayer.rogueStealthMax += 0.4f; diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index 56b9da3aea..d4b651a79f 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,14 +23,14 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 48; Item.height = 32; Item.defense = 31; - Item.rare = ItemRarityID.Purple; // Exact worth of the armor piece's constituents. Item.value = Item.sellPrice(platinum: 9, gold: 79, silver: 80); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } + public override void ModifyTooltips(List tooltips) => GemTechHeadgear.ModifySetTooltips(this, tooltips); public override void AddRecipes() { CreateRecipe() diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index 837e226ee1..7d409e6073 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -1,8 +1,14 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Microsoft.Xna.Framework.Input.Keys; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Armor.GemTech { @@ -59,11 +65,10 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 40; Item.height = 32; Item.defense = 14; - Item.rare = ItemRarityID.Purple; // Exact worth of the armor piece's constituents. Item.value = Item.sellPrice(platinum: 6, gold: 14, silver: 88); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -71,6 +76,7 @@ namespace CalamityMod.Items.Armor.GemTech { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); } + public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); public override void UpdateArmorSet(Player player) { @@ -79,28 +85,89 @@ namespace CalamityMod.Items.Armor.GemTech if (player.Calamity().GemTechState.IsRedGemActive) player.Calamity().rogueStealthMax += RogueStealthBoost * 0.01f; - var redGemText = $"The red gem grants {RogueStealthBoost} maximum stealth, increased rogue stats, and makes stealth only consumable by rogue weapons\n"; - var yellowGemText = $"The yellow gem provides increased melee stats and makes melee attacks release shards on hit with a cooldown. This cooldown is shorter for true melee attacks\n"; - var greenGemText = $"The green gem provides increased ranged stats and causes flechettes to fly swiftly towards targets when they are damaged by a ranged projectile\n"; - var blueGemText = $"The blue gem grants {SummonMinionCountBoost} extra maximum minions, increased minion damage, and reduces the penalty for summoner items while holding a non-summoner weapon\n"; - var purpleGemText = $"The violet gem grants {MagicManaBoost} extra maximum mana, increased magic stats, and makes mana rapidly regenerate when holding a non-magic weapon\n"; - var pinkGemText = $"The pink base gem grants {BaseGemDefenseBoost} extra defense, extra damage reduction, increased movement speed, jump speed, and +{BaseGemLifeRegenBoost} life regen\n"; - - player.setBonus = "Six gem fragments idly orbit you; one for each class, and a base gem\n" + - $"A gem is lost when you take more than {GemBreakDamageLowerBound} damage in a single hit. The type of gem lost is the same as the class of the previous when you used\n" + - "If said gem has already been lost, the base gem is lost instead\n" + - $"When a gem is lost, it breaks off and homes towards the nearest enemy or boss, if one is present, dealing a base of {GemDamage} damage\n" + - $"Gems have a {GemRegenTime / 60} second delay before they appear again\n" + - redGemText + - yellowGemText + - greenGemText + - blueGemText + - purpleGemText + - pinkGemText + - $"When all gems exist simultaneously, hitting a target with any weapon grants you +{AllGemsWeaponUseLifeRegenBoost} life regen for {AllGemsLifeRegenBoostTime / 60} seconds\n" + - $"This is increased to +{AllGemsMultiWeaponUseLifeRegenBoost} life regen if a weapon of another class is used during that {AllGemsLifeRegenBoostTime / 60} second period for {AllGemsMultiWeaponLifeRegenBoostTime / 60f} seconds"; + player.setBonus = "Mucho Texto"; } + public static void ModifySetTooltips(ModItem item, List tooltips) + { + if (HasArmorSet(Main.LocalPlayer)) + { + int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); + + if (setBonusIndex != -1) + { + tooltips[setBonusIndex].Text = "Power Gems - Six gem fragments idly orbit you; one for each class, and a base gem"; + tooltips[setBonusIndex].OverrideColor = Color.Lerp(Color.White, Main.DiscoColor, 0.3f); + + + if (!Main.keyState.IsKeyDown(LeftShift)) + { + TooltipLine briefDescription = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", + "Each active gem provides a bonus for its respective class, while the defensive gem grants defensive boosts\n" + + "Powerful enemy hits will dislodge gems, launching them into the nearest enemy for huge damage\n" + + "Lost gems regenerate after a while\n" + + "The lost gem is the same class as the weapon you are using, so better prepare for some weapon switching action!"); + briefDescription.OverrideColor = Color.Lerp(Color.White, Main.DiscoColor, 0.5f); + tooltips.Insert(setBonusIndex + 1, briefDescription); + + TooltipLine itemDisplay = new TooltipLine(item.Mod, "CalamityMod:ExpandedDisplay", "Hold SHIFT to see an expanded description"); + itemDisplay.OverrideColor = new Color(190, 190, 190); + tooltips.Add(itemDisplay); + } + + else + { + setBonusIndex++; + TooltipLine largerDescription = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", + $"A gem is lost when you take more than { GemBreakDamageLowerBound } damage in a single hit. The type of gem lost is the same as the class of the previous when you used\n" + + "If said gem has already been lost, the base gem is lost instead\n" + + $"When a gem is lost, it breaks off and homes towards the nearest enemy or boss, if one is present, dealing a base of {GemDamage} damage\n" + + $"Gems have a {GemRegenTime / 60} second delay before they appear again"); + largerDescription.OverrideColor = Color.Lerp(Color.White, Main.DiscoColor, 0.5f); + tooltips.Insert(setBonusIndex, largerDescription); + + setBonusIndex++; + TooltipLine redGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", "[i:" + ItemID.Ruby + "]" + $"The red gem grants { RogueStealthBoost } maximum stealth, increased rogue stats, and makes stealth only consumable by rogue weapons"); + redGemTooltip.OverrideColor = new Color(224, 24, 0); + tooltips.Insert(setBonusIndex, redGemTooltip); + + setBonusIndex++; + TooltipLine yellowGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus3", "[i:" + ItemID.Topaz + "]" + $"The yellow gem provides increased melee stats and makes melee attacks release shards on hit with a cooldown. This cooldown is shorter for true melee attacks"); + yellowGemTooltip.OverrideColor = new Color(237, 170, 43); + tooltips.Insert(setBonusIndex, yellowGemTooltip); + + setBonusIndex++; + TooltipLine greenGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus4", "[i:" + ItemID.Emerald + "]" + $"The green gem provides increased ranged stats and causes flechettes to fly swiftly towards targets when they are damaged by a ranged projectile"); + greenGemTooltip.OverrideColor = new Color(37, 188, 108); + tooltips.Insert(setBonusIndex, greenGemTooltip); + + setBonusIndex++; + TooltipLine blueGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus5", "[i:" + ItemID.Sapphire + "]" + $"The blue gem grants {SummonMinionCountBoost} extra maximum minions, increased minion damage, and reduces the penalty for summoner items while holding a non-summoner weapon"); + blueGemTooltip.OverrideColor = new Color(37, 119, 206); + tooltips.Insert(setBonusIndex, blueGemTooltip); + + setBonusIndex++; + TooltipLine purpleGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus6", "[i:" + ItemID.Amethyst + "]" + $"The violet gem grants {MagicManaBoost} extra maximum mana, increased magic stats, and makes mana rapidly regenerate when holding a non-magic weapon"); + purpleGemTooltip.OverrideColor = new Color(200, 58, 209); + tooltips.Insert(setBonusIndex, purpleGemTooltip); + + setBonusIndex++; + TooltipLine pinkGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus7", "[i:" + ItemID.Diamond + "]" + $"The pink base gem grants {BaseGemDefenseBoost} extra defense, extra damage reduction, increased movement speed, jump speed, and +{BaseGemLifeRegenBoost} life regen"); + pinkGemTooltip.OverrideColor = new Color(255, 115, 206); + tooltips.Insert(setBonusIndex, pinkGemTooltip); + + setBonusIndex++; + TooltipLine liferegenTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus8", + $"When all gems exist simultaneously, hitting a target with any weapon grants you +{AllGemsWeaponUseLifeRegenBoost} life regen for {AllGemsLifeRegenBoostTime / 60} seconds\n" + + $"This is increased to +{AllGemsMultiWeaponUseLifeRegenBoost} life regen if a weapon of another class is used during that {AllGemsLifeRegenBoostTime / 60} second period for {AllGemsMultiWeaponLifeRegenBoostTime / 60f} seconds"); + liferegenTooltip.OverrideColor = new Color(230, 230, 230); + tooltips.Insert(setBonusIndex, liferegenTooltip); + } + } + } + } + public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index d7269ca7c1..8720063370 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,14 +23,15 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 28; Item.height = 26; Item.defense = 24; - Item.rare = ItemRarityID.Purple; // Exact worth of the armor piece's constituents. Item.value = Item.sellPrice(platinum: 7, gold: 35, silver: 84); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } + public override void ModifyTooltips(List tooltips) => GemTechHeadgear.ModifySetTooltips(this, tooltips); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index 2b4fe554b1..71be545c19 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 41; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index 2e7d82cdc2..2c8d5f14f9 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -1,9 +1,10 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; namespace CalamityMod.Items.Armor.GodSlayer { @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 75, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 48; //96 - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -47,7 +48,7 @@ namespace CalamityMod.Items.Armor.GodSlayer "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + "Enemies you dash through take massive damage\n" + "During the dash you are immune to most debuffs\n" + - "The dash has a 35 second cooldown\n" + + "The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" + "Enemies are more likely to target you\n" + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + "Enemies take a lot of damage when they hit you\n" + @@ -55,9 +56,9 @@ namespace CalamityMod.Items.Armor.GodSlayer player.thorns += 2.5f; player.aggro += 1000; - if (modPlayer.godSlayerDashHotKeyPressed) + if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) { - modPlayer.DashID = GodslayerArmorDash.ID; + modPlayer.DeferredDashID = GodslayerArmorDash.ID; player.dash = 0; } } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index fba5bd9a51..d3dede6140 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -1,9 +1,10 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; namespace CalamityMod.Items.Armor.GodSlayer { @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 75, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 35; //96 - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -47,12 +48,12 @@ namespace CalamityMod.Items.Armor.GodSlayer "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + "Enemies you dash through take massive damage\n" + "During the dash you are immune to most debuffs\n" + - "The dash has a 35 second cooldown\n" + + "The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" + "You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds"; - if (modPlayer.godSlayerDashHotKeyPressed) + if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) { - modPlayer.DashID = GodslayerArmorDash.ID; + modPlayer.DeferredDashID = GodslayerArmorDash.ID; player.dash = 0; } } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index 1b301737b7..f12d9c2138 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -1,9 +1,10 @@ using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; namespace CalamityMod.Items.Armor.GodSlayer { @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 75, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 29; //96 - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -49,17 +50,14 @@ namespace CalamityMod.Items.Armor.GodSlayer "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + "Enemies you dash through take massive damage\n" + "During the dash you are immune to most debuffs\n" + - "The dash has a 35 second cooldown\n" + + "The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" + + "+120 maximum stealth\n" + "While at full HP all of your rogue stats are boosted by 10%\n" + - "If you take over 80 damage in one hit you will be given extra immunity frames\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "If you take over 80 damage in one hit you will be given extra immunity frames"; - if (modPlayer.godSlayerDashHotKeyPressed) + if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) { - modPlayer.DashID = GodslayerArmorDash.ID; + modPlayer.DeferredDashID = GodslayerArmorDash.ID; player.dash = 0; } } diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index 3ef5af5061..0970e02888 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ModLoader; @@ -20,9 +21,9 @@ namespace CalamityMod.Items.Armor.GodSlayer { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 45, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 35; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index 9e4498b440..0054a0ec3c 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 20; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index b2abc0f3b1..457e65b7a8 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 9; //45 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index dbb8596f32..71583f3299 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 33; //67 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 9f323169e2..eb63f62997 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 15; //53 } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index c2e369e4f5..79cbbf1ee8 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 12; //49 } @@ -42,13 +42,10 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased rogue damage\n" + + "+110 maximum stealth\n" + "Inferno effect when below 50% life\n" + "Rogue weapons unleash a volley of homing chaos flames around the player every 2.5 seconds\n" + - "You emit a blazing explosion when you are hit\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "You emit a blazing explosion when you are hit"; var modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaVolley = true; diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index 5f45754ef2..b7f5fecd5a 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 6; //40 } diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index 6ec0ffa368..85144b6e88 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 18, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 14; } diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectHeadgear.png b/Items/Armor/MarniteArchitect/MarniteArchitectHeadgear.png new file mode 100644 index 0000000000..5d9e41a13f Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteArchitectHeadgear.png differ diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectHeadgear_Head.png b/Items/Armor/MarniteArchitect/MarniteArchitectHeadgear_Head.png new file mode 100644 index 0000000000..3a9521322e Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteArchitectHeadgear_Head.png differ diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs new file mode 100644 index 0000000000..b526acf7f4 --- /dev/null +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -0,0 +1,475 @@ +using CalamityMod.Buffs.Mounts; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameInput; +using static Microsoft.Xna.Framework.Input.Keys; +using static Terraria.ModLoader.ModContent; + + +namespace CalamityMod.Items.Armor.MarniteArchitect +{ + [AutoloadEquip(EquipType.Head)] + public class MarniteArchitectHeadgear : ModItem + { + + public static readonly SoundStyle LiftSpawnSound = new("CalamityMod/Sounds/Item/MarniteLiftSummon"); + public static readonly SoundStyle LiftGoAwaySound = new("CalamityMod/Sounds/Item/MarniteLiftUnsummon"); + public static readonly SoundStyle LiftHummSound = new("CalamityMod/Sounds/Item/MarniteLiftHumm") { IsLooped = true}; + + public static float LiftRaiseSpeed = 2f; + public static float MaxLiftHeight = 138f; + + public override void Load() + { + On.Terraria.Player.QuickMount += ActivateLift; + } + + public override void Unload() + { + On.Terraria.Player.QuickMount -= ActivateLift; + } + + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Marnite Architect Headgear"); + Tooltip.SetDefault("Increases block placement range by 5"); + + if (Main.netMode == NetmodeID.Server) + return; + + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); + ArmorIDs.Head.Sets.DrawFullHair[equipSlot] = true; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 0; + } + + private void ActivateLift(On.Terraria.Player.orig_QuickMount orig, Player self) + { + //Spoof the mount thing + if (!self.mount.Active && HasArmorSet(self) && self.miscEquips[Player.miscSlotMount].IsAir) + { + if (self.frozen || self.tongued || self.webbed || self.stoned || self.gravDir == -1f || self.dead || self.noItems) + return; + + int liftMountType = MountType(); + + if (self.mount.CanMount(liftMountType, self)) + { + self.mount.SetMount(liftMountType, self); + SoundEngine.PlaySound(LiftSpawnSound, self.Center); + } + + } + + else + orig(self); + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType(); + public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType(); + public bool IsPartOfSet(Item item) => item.type == ItemType() || + item.type == ItemType(); + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Marnite Lift"; + player.GetModPlayer().setEquipped = true; + } + + public override void UpdateEquip(Player player) + { + //Tile range is a static variable did you know that? That's quite funny. I assume it's just because its not like other players would need to know about the players reach + if (Main.myPlayer == player.whoAmI) + { + Player.tileRangeX += 5; + Player.tileRangeY += 4; //Extendo grip also increases vertical tile range by one less than horizontal + } + } + + public static void ModifySetTooltips(ModItem item, List tooltips) + { + if (HasArmorSet(Main.LocalPlayer)) + { + int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); + + if (setBonusIndex != -1) + { + TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", "Marnite Lift - You can summon a lift under your feet to reach higher up"); + setBonus1.OverrideColor = Color.Lerp(new Color(255, 243, 161), new Color(137, 162, 255), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); + tooltips[setBonusIndex] = setBonus1; + + TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", "The lift gets summoned when the mount hotkey gets pressed [c/D4C870:without any mounts equipped]"); + setBonus2.OverrideColor = new Color(145, 197, 239); + tooltips.Insert(setBonusIndex + 1, setBonus2); + + TooltipLine setBonus3 = new TooltipLine(item.Mod, "CalamityMod:SetBonus3", "Using the Up and Down keys can change the lift's height"); + setBonus3.OverrideColor = new Color(145, 197, 239); + tooltips.Insert(setBonusIndex + 2, setBonus3); + } + + } + } + public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); + + + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("AnyGoldCrown"). + AddIngredient(ItemID.Granite, 5). + AddIngredient(ItemID.Marble, 5). + AddTile(TileID.Anvils). + Register(); + } + } + + [AutoloadEquip(EquipType.Body)] + public class MarniteArchitectToga : ModItem + { + public override void Load() + { + if (Main.netMode == NetmodeID.Server) + return; + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs", EquipType.Legs, this); + } + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Marnite Architect Toga"); + Tooltip.SetDefault("Increases tile placement speed by 50%"); + + if (Main.netMode == NetmodeID.Server) + return; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 1; + } + + public override void UpdateEquip(Player player) + { + player.tileSpeed += 0.5f; + } + + public override void ModifyTooltips(List tooltips) => MarniteArchitectHeadgear.ModifySetTooltips(this, tooltips); + + + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("AnyGoldBar", 2). + AddIngredient(ItemID.Silk, 15). + AddIngredient(ItemID.Granite, 15). + AddIngredient(ItemID.Marble, 15). + AddTile(TileID.Anvils). + Register(); + } + + public override void SetMatch(bool male, ref int equipSlot, ref bool robes) + { + robes = true; + equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); + } + } + + public class MarniteArchitectPlayer : ModPlayer + { + public bool setEquipped = false; + public bool mounted = false; + public SlotId liftDroningSoundSlot; + + public override void ResetEffects() + { + setEquipped = false; + mounted = false; + } + + public override void UpdateDead() + { + setEquipped = false; + mounted = false; + } + + public override void PostUpdateMiscEffects() + { + if (!setEquipped && Player.mount.Type == ModContent.MountType() && Player.mount.Active) + Player.mount.Dismount(Player); + + if (mounted) + { + if (!SoundEngine.TryGetActiveSound(liftDroningSoundSlot, out var soundPlaying)) + liftDroningSoundSlot = SoundEngine.PlaySound(MarniteArchitectHeadgear.LiftHummSound, Player.Center); + + else + { + soundPlaying.Position = Player.Center; + float distanceToGround = RaycastGround(true).Y; + soundPlaying.Volume = 1 - (distanceToGround / MarniteArchitectHeadgear.MaxLiftHeight) * 0.3f; + } + + + + //Do something to prevent the player from having only one feet showing?? + } + + else + { + if (SoundEngine.TryGetActiveSound(liftDroningSoundSlot, out var soundPlaying)) + { + soundPlaying.Stop(); + liftDroningSoundSlot = SlotId.Invalid; + } + } + } + + public Vector2 RaycastGround(bool centerOnly = false) + { + float closestDistance = (MarniteArchitectHeadgear.MaxLiftHeight + 1); + + if (centerOnly) + { + Vector2 basePosition = Player.Bottom; + + for (float j = 0; j < closestDistance; j += 8f) + { + Point tileToCheck = (basePosition + Vector2.UnitY * j).ToSafeTileCoordinates(); + + if (Main.tile[tileToCheck].IsTileSolidGround()) + { + closestDistance = j; + break; + } + } + + return Vector2.UnitY * closestDistance; + } + + for (float i = 0; i < Player.width; i += Player.width / 6f) + { + Vector2 basePosition = Player.BottomLeft + Vector2.UnitX * i; + + for (float j = 0; j < closestDistance; j += 8f) + { + Point tileToCheck = (basePosition + Vector2.UnitY * j).ToSafeTileCoordinates(); + + if (Main.tile[tileToCheck].IsTileSolidGround()) + { + closestDistance = j; + break; + } + } + } + + return Vector2.UnitY * closestDistance; + } + + public float BestLiftDistanceFromGround() + { + Vector2 closestGround = RaycastGround(); + if (closestGround.Y > MarniteArchitectHeadgear.MaxLiftHeight) + return -1; + + return closestGround.Y; + } + + public override void PreUpdateMovement() + { + if (mounted) + { + float distanceToGround = BestLiftDistanceFromGround(); + + if (distanceToGround >= 0) + { + float newVelocity; + + if (Player.controlUp || Player.controlJump) + { + newVelocity = -MarniteArchitectHeadgear.LiftRaiseSpeed; + + if (distanceToGround + MarniteArchitectHeadgear.LiftRaiseSpeed > MarniteArchitectHeadgear.MaxLiftHeight - 3) + { + newVelocity = ((MarniteArchitectHeadgear.MaxLiftHeight - 3) - distanceToGround) * -1; + } + + Player.fallStart = (int)(Player.Center.Y / 16); + } + + else if (Player.controlDown) + { + newVelocity = MarniteArchitectHeadgear.LiftRaiseSpeed; + + if (Collision.TileCollision(Player.position, new Vector2(Player.velocity.X, newVelocity), Player.width, Player.height, true, false, (int)Player.gravDir).Y == 0f) + newVelocity = 0.5f; + } + else + newVelocity = 0f; + + + if (Math.Abs(Player.velocity.Y) < 4f) + { + Player.velocity.Y = newVelocity; + Player.fallStart = (int)(Player.Center.Y / 16); + } + + else + Player.velocity.Y = MathHelper.Lerp(Player.velocity.Y, newVelocity, 0.12f); + } + + } + } + } + + public class MarniteLift : ModMount + { + + public override void SetStaticDefaults() + { + // Movement + MountData.jumpHeight = 0; // How high the mount can jump. + MountData.acceleration = 0.2f; // The rate at which the mount speeds up. + MountData.jumpSpeed = 0f; // The rate at which the player and mount ascend towards (negative y velocity) the jump height when the jump button is presssed. + MountData.blockExtraJumps = true; // Determines whether or not you can use a double jump (like cloud in a bottle) while in the mount. + MountData.constantJump = false; // Allows you to hold the jump button down. + MountData.fallDamage = 1f; // Fall damage multiplier. + MountData.runSpeed = 2f; // The speed of the mount + MountData.dashSpeed = 2f; // The speed the mount moves when in the state of dashing. + MountData.flightTimeMax = 0; // The amount of time in frames a mount can be in the state of flying. + MountData.fatigueMax = 0; + MountData.usesHover = false; + + // Misc + MountData.buff = BuffType(); // The ID number of the buff assigned to the mount. + + // Effects + MountData.spawnDust = 6; // The ID of the dust spawned when mounted or dismounted. + + // Frame data and player offsets + MountData.totalFrames = 1; // Amount of animation frames for the mount + MountData.heightBoost = 0; // Height between the mount and the ground + MountData.playerYOffsets = Enumerable.Repeat(33, 1).ToArray(); // Fills an array with values for less repeating code + MountData.xOffset = 0; + MountData.yOffset = 0; + MountData.bodyFrame = 0; + MountData.playerHeadOffset = 4; + + //Sprites + if (Main.netMode != NetmodeID.Server) + { + MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); + } + } + + public override void UpdateEffects(Player player) + { + Lighting.AddLight(player.Bottom + Vector2.UnitY * 10f, Color.DeepSkyBlue.ToVector3()); + + float centerDistance = player.GetModPlayer().RaycastGround(true).Y; + + if (centerDistance <= MarniteArchitectHeadgear.MaxLiftHeight) + { + if (Main.rand.NextFloat() > (centerDistance / MarniteArchitectHeadgear.MaxLiftHeight) * 0.6f && Main.rand.NextBool()) + { + float scale = 1.2f - (centerDistance / MarniteArchitectHeadgear.MaxLiftHeight) * 0.7f; + Dust dust = Dust.NewDustPerfect(player.Bottom + Vector2.UnitY * centerDistance + Vector2.UnitX * Main.rand.Next(-16, 16), 31, new Vector2((Main.rand.NextFloat(-8, 8) * scale) - player.velocity.X, Main.rand.NextFloat(-1, 1)), 120, Scale : scale * 1.5f); + } + } + + if (Main.rand.NextBool(3)) + { + float speedRotation = player.velocity.X * 0.03f; + + Dust dust = Dust.NewDustPerfect(player.Bottom + Vector2.UnitX.RotatedBy(speedRotation) * Main.rand.Next(-6, 6) + Vector2.UnitY.RotatedBy(speedRotation) * -2f, 229, Vector2.UnitY.RotatedBy(speedRotation) * Main.rand.NextFloat(1f, 3f), 120, Scale: Main.rand.NextFloat(0.6f, 1f)); + dust.noGravity = true; + } + } + + public void DustEffects(Player player) + { + for (int j = 0; j < 17; j++) + { + Vector2 direction = Main.rand.NextVector2CircularEdge(1f, 1f); + int dustType = Main.rand.NextBool() ? 240 : 236; + Dust.NewDustPerfect(player.Bottom + (direction * 3) + Vector2.UnitY * 10f, dustType, direction.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - 1.57f) * Main.rand.Next(1, 3), 0, new Color(255, 255, 60) * 0.8f, 0.6f); + } + } + + public override void SetMount(Player player, ref bool skipDust) + { + DustEffects(player); + skipDust = true; + } + + public override void Dismount(Player player, ref bool skipDust) + { + SoundEngine.PlaySound(MarniteArchitectHeadgear.LiftGoAwaySound, player.Center); + DustEffects(player); + skipDust = true; + } + + public static Vector2 GetFireSquish(float timeOffset, float timeSpeed) + { + return new Vector2((float)Math.Sin(Main.GlobalTimeWrappedHourly * timeSpeed + timeOffset) * 0.1f + 1f, 1.2f - 0.3f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * timeSpeed + timeOffset)); + } + + public override bool Draw(List playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow) + { + rotation = MathHelper.Clamp(drawPlayer.velocity.X * 0.03f, - MathHelper.ToRadians(7f), MathHelper.ToRadians(7f)); + drawPlayer.fullRotation = rotation; + + // Draw is called for each mount texture we provide, so we check drawType to avoid duplicate draws. + if (drawType == 0) + { + Texture2D platformTex = MountData.frontTexture.Value; + Texture2D fireTex = MountData.frontTextureGlow.Value; + + Vector2 fireOrigin = new Vector2(fireTex.Width / 2f, 0f); + Color fireColor = Color.White; + + for (int i = 0; i < 3; i++) + { + fireColor = Color.White; + Vector2 fireScale = GetFireSquish(i * 0.6f, 14f); + fireColor.A = (byte)(210 - i * 70); + fireColor *= (0.3f + 0.35f * i); + fireScale *= drawScale * (1.5f - 0.25f * i); + + playerDrawData.Add(new DrawData(fireTex, drawPosition + new Vector2(0, 8), new Rectangle(0, 0, fireTex.Width, fireTex.Height), fireColor, drawPlayer.fullRotation, fireOrigin, fireScale * drawScale, SpriteEffects.None, 0)); + } + + playerDrawData.Add(new DrawData(platformTex, drawPosition, new Rectangle(0, 0, platformTex.Width, platformTex.Height), drawColor, drawPlayer.fullRotation, platformTex.Size() / 2f, drawScale, SpriteEffects.None, 0)); + } + + return false; + } + } +} diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectToga.png b/Items/Armor/MarniteArchitect/MarniteArchitectToga.png new file mode 100644 index 0000000000..3233cbb33f Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteArchitectToga.png differ diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectToga_Body.png b/Items/Armor/MarniteArchitect/MarniteArchitectToga_Body.png new file mode 100644 index 0000000000..ead3bf33af Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteArchitectToga_Body.png differ diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs.png b/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs.png new file mode 100644 index 0000000000..8ba3f5b115 Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs.png differ diff --git a/Items/Armor/MarniteArchitect/MarniteLiftFire.png b/Items/Armor/MarniteArchitect/MarniteLiftFire.png new file mode 100644 index 0000000000..17c5b7cd7e Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteLiftFire.png differ diff --git a/Items/Armor/MarniteArchitect/MarniteLift_Front.png b/Items/Armor/MarniteArchitect/MarniteLift_Front.png new file mode 100644 index 0000000000..9ce7c7de80 Binary files /dev/null and b/Items/Armor/MarniteArchitect/MarniteLift_Front.png differ diff --git a/Items/Armor/Mollusk/MolluskShelleggings.cs b/Items/Armor/Mollusk/MolluskShelleggings.cs index ccdac0a86a..b287ebf08f 100644 --- a/Items/Armor/Mollusk/MolluskShelleggings.cs +++ b/Items/Armor/Mollusk/MolluskShelleggings.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Mollusk { Item.width = 22; Item.height = 18; - Item.value = Item.buyPrice(0, 15, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 15; } diff --git a/Items/Armor/Mollusk/MolluskShellmet.cs b/Items/Armor/Mollusk/MolluskShellmet.cs index 40d048aeec..670f8ed2bc 100644 --- a/Items/Armor/Mollusk/MolluskShellmet.cs +++ b/Items/Armor/Mollusk/MolluskShellmet.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Mollusk { Item.width = 22; Item.height = 22; - Item.value = Item.buyPrice(0, 25, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 18; } diff --git a/Items/Armor/Mollusk/MolluskShellplate.cs b/Items/Armor/Mollusk/MolluskShellplate.cs index 968a9b97b3..99b9319b2a 100644 --- a/Items/Armor/Mollusk/MolluskShellplate.cs +++ b/Items/Armor/Mollusk/MolluskShellplate.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Mollusk { Item.width = 30; Item.height = 22; - Item.value = Item.buyPrice(0, 20, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.defense = 22; } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index cd1a1b953f..dc122f328c 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,10 +32,9 @@ No positive life regen"); { Item.width = 18; Item.height = 18; - Item.value = Item.sellPrice(0, 38, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 28; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index 45bdfbf923..ada6f5f3c5 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -1,12 +1,13 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer; -using CalamityMod.Cooldowns; -using Terraria.Audio; namespace CalamityMod.Items.Armor.OmegaBlue { @@ -41,10 +42,9 @@ namespace CalamityMod.Items.Armor.OmegaBlue { Item.width = 18; Item.height = 18; - Item.value = Item.sellPrice(0, 35, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 19; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index d80df1b4b4..e6cce20158 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,10 +30,9 @@ namespace CalamityMod.Items.Armor.OmegaBlue { Item.width = 18; Item.height = 18; - Item.value = Item.sellPrice(0, 35, 25, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.defense = 22; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/PlagueReaper/PlagueReaperMask.cs b/Items/Armor/PlagueReaper/PlagueReaperMask.cs index 5f22ddae7f..c41831b7be 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperMask.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 9; //35 } diff --git a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs index 358a6cfa6e..079932aeea 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 18, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 11; } diff --git a/Items/Armor/PlagueReaper/PlagueReaperVest.cs b/Items/Armor/PlagueReaper/PlagueReaperVest.cs index 43091ef590..49e58c40ba 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperVest.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.defense = 14; } diff --git a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs index 5567b1ec4e..9f43d83af3 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer player.Calamity().plaguebringerPatronSet = true; player.Calamity().DashID = PlaguebringerArmorDash.ID; - player.dash = 0; + player.dashType = 0; player.maxMinions += 3; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Armor/Prismatic/PrismaticGreaves.cs b/Items/Armor/Prismatic/PrismaticGreaves.cs index ebefe26a88..d6635b3fa9 100644 --- a/Items/Armor/Prismatic/PrismaticGreaves.cs +++ b/Items/Armor/Prismatic/PrismaticGreaves.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Armor.Prismatic Item.defense = 21; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Prismatic/PrismaticHelmet.cs b/Items/Armor/Prismatic/PrismaticHelmet.cs index aca187f42d..ef2513fc2f 100644 --- a/Items/Armor/Prismatic/PrismaticHelmet.cs +++ b/Items/Armor/Prismatic/PrismaticHelmet.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Armor.Prismatic Item.defense = 18; //71 Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Prismatic/PrismaticRegalia.cs b/Items/Armor/Prismatic/PrismaticRegalia.cs index 8590a6cefa..607b141e7c 100644 --- a/Items/Armor/Prismatic/PrismaticRegalia.cs +++ b/Items/Armor/Prismatic/PrismaticRegalia.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Armor.Prismatic Item.defense = 33; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/Reaver/ReaverCuisses.cs b/Items/Armor/Reaver/ReaverCuisses.cs index 39f1541723..710ad47677 100644 --- a/Items/Armor/Reaver/ReaverCuisses.cs +++ b/Items/Armor/Reaver/ReaverCuisses.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Reaver { Item.width = 22; Item.height = 18; - Item.value = Item.buyPrice(0, 18, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 14; } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index af9ece80af..698bd47417 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Reaver { SacrificeTotal = 1; DisplayName.SetDefault("Reaver Headgear"); - Tooltip.SetDefault("10% increased pick speed and 20% increased block/wall placement speed\n" + + Tooltip.SetDefault("40% increased pick speed and block/wall placement speed\n" + "Temporary immunity to lava and can move freely through liquids"); } @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor.Reaver { Item.width = 22; Item.height = 22; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 7; //40 } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void UpdateArmorSet(Player player) { - player.setBonus = "Causes nearby treasure to sparkle\n" + + player.setBonus = "Highlights all treasure nearby\n" + "Increased item grab range and block placement range\n" + "Mining tiles restores breath while underwater\n" + "Summons a reaver orb to light up the area around you\n" + @@ -53,7 +53,8 @@ namespace CalamityMod.Items.Armor.Reaver var modPlayer = player.Calamity(); modPlayer.reaverExplore = true; modPlayer.wearingRogueArmor = true; - player.blockRange += 2; + player.findTreasure = true; + player.blockRange += 4; player.aggro -= 200; if (player.whoAmI == Main.myPlayer) @@ -68,47 +69,14 @@ namespace CalamityMod.Items.Armor.Reaver Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } } - if (player.miscCounter % 10 == 0) - { - var searchDist = 17; - var x = (int)player.Center.X / 16; - var y = (int)player.Center.Y / 16; - for (var i = x - searchDist; i <= x + searchDist; ++i) - { - for (var j = y - searchDist; j <= y + searchDist; ++j) - { - if (Main.rand.NextBool(4) && new Vector2(x - i, y - j).Length() < searchDist && i > 0 && i < Main.maxTilesX - 1 && j > 0 && j < Main.maxTilesY - 1 && Main.tile[i, j] != null && Main.tile[i, j].HasTile) - { - var shouldSparkle = false; - //Check for the money piles - if (Main.tile[i, j].TileType == TileID.SmallPiles && Main.tile[i, j].TileFrameY == 18) - { - if (Main.tile[i, j].TileFrameX >= 576 && Main.tile[i, j].TileFrameX <= 882) - shouldSparkle = true; - } - else if (Main.tile[i, j].TileType == TileID.LargePiles && Main.tile[i, j].TileFrameX >= 864 && Main.tile[i, j].TileFrameX <= 1170) - shouldSparkle = true; - - if (shouldSparkle || Main.tileSpelunker[Main.tile[i, j].TileType] || Main.tileAlch[Main.tile[i, j].TileType] && Main.tile[i, j].TileType != TileID.ImmatureHerbs) - { - var sparkle = Dust.NewDust(new Vector2(i * 16, j * 16), 16, 16, 204, 0f, 0f, 150, new Color(), 0.3f); - var dust = Main.dust[sparkle]; - dust.fadeIn = 0.75f; - dust.velocity = dust.velocity * 0.1f; - dust.noLight = true; - } - } - } - } - } } public override void UpdateEquip(Player player) { player.ignoreWater = true; - player.pickSpeed -= 0.1f; - player.tileSpeed += 0.2f; - player.wallSpeed += 0.2f; + player.pickSpeed -= 0.4f; + player.tileSpeed += 0.4f; + player.wallSpeed += 0.4f; player.lavaMax += 420; } diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index 662843a257..11013739c3 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Reaver { Item.width = 24; Item.height = 28; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 13; //46 } diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index fd5bda6333..85089d0736 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.Reaver { Item.width = 28; Item.height = 30; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 30; //63 => 73 w/ set bonus (+5 w/ Reaver Rage) } diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index c9e9b4ae82..1bded1cc05 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor.Reaver { Item.width = 34; Item.height = 22; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 19; } diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index 0ae6a5aafa..799687b645 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Items.Armor { Item.width = 24; Item.height = 20; - Item.value = Item.buyPrice(0, 30, 0, 0); + // Same price as the other Shroomite helms + Item.value = Item.buyPrice(0, 37, 50, 0); Item.rare = ItemRarityID.Yellow; Item.defense = 11; //62 } @@ -53,8 +54,7 @@ namespace CalamityMod.Items.Armor CreateRecipe(). AddIngredient(ItemID.ChlorophyteHelmet). AddIngredient(ItemID.GlowingMushroom, 60). - AddIngredient(). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.Autohammer). Register(); } diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index 3604c3d714..b71944d6d5 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -22,10 +23,9 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 34; Item.height = 24; - Item.value = Item.buyPrice(0, 72, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 44; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index 12edcf92a7..f2ae1a7cd4 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -24,10 +25,9 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 24; Item.height = 22; - Item.value = Item.buyPrice(0, 90, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 21; //110 - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index c5f3ac2604..e1acfa5451 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -3,11 +3,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Armor.Silva { @@ -29,10 +30,9 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 28; Item.height = 24; - Item.value = Item.buyPrice(0, 90, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 13; //110 - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 5491df0763..6db9e7b34d 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -22,10 +23,9 @@ namespace CalamityMod.Items.Armor.Silva { Item.width = 22; Item.height = 18; - Item.value = Item.buyPrice(0, 54, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 39; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index 8e3a828192..babf075af0 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 2; //4 } @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian AddRecipeGroup("AnySnowBlock", 30). AddRecipeGroup("AnyIceBlock", 15). AddIngredient(ItemID.BorealWood, 45). + AddIngredient(ItemID.FlinxFur, 2). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs index 2b0665f9ea..92a8ce8358 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 1; //4 } @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian AddRecipeGroup("AnySnowBlock", 20). AddRecipeGroup("AnyIceBlock", 10). AddIngredient(ItemID.BorealWood, 30). + AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index a11260d91d..69d2fb259e 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { private bool shouldBoost = false; + public override void Load() { if (Main.netMode != NetmodeID.Server) @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.defense = 1; //4 } @@ -45,13 +46,11 @@ namespace CalamityMod.Items.Armor.SnowRuffian modPlayer.snowRuffianSet = true; modPlayer.rogueStealthMax += 0.5f; player.setBonus = "5% increased rogue damage\n" + - "You can glide to negate fall damage\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 50\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "+50 maximum stealth\n" + + "You can glide to negate fall damage"; player.GetDamage() += 0.05f; player.Calamity().wearingRogueArmor = true; + if (player.controlJump) { player.noFallDmg = true; @@ -80,6 +79,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian AddRecipeGroup("AnySnowBlock", 10). AddRecipeGroup("AnyIceBlock", 5). AddIngredient(ItemID.BorealWood, 15). + AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Armor/Statigel/StatigelArmor.cs b/Items/Armor/Statigel/StatigelArmor.cs index 1f3af3c8bb..5cf78847b3 100644 --- a/Items/Armor/Statigel/StatigelArmor.cs +++ b/Items/Armor/Statigel/StatigelArmor.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 10; } diff --git a/Items/Armor/Statigel/StatigelGreaves.cs b/Items/Armor/Statigel/StatigelGreaves.cs index 87c6727b5b..d70779a18f 100644 --- a/Items/Armor/Statigel/StatigelGreaves.cs +++ b/Items/Armor/Statigel/StatigelGreaves.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 3, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 8; } diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index e8d07401c2..ccaadffd12 100644 --- a/Items/Armor/Statigel/StatigelHeadMagic.cs +++ b/Items/Armor/Statigel/StatigelHeadMagic.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 5; //22 } diff --git a/Items/Armor/Statigel/StatigelHeadMelee.cs b/Items/Armor/Statigel/StatigelHeadMelee.cs index d19e0aa3fd..e559bda9b5 100644 --- a/Items/Armor/Statigel/StatigelHeadMelee.cs +++ b/Items/Armor/Statigel/StatigelHeadMelee.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 9; //27 } diff --git a/Items/Armor/Statigel/StatigelHeadRanged.cs b/Items/Armor/Statigel/StatigelHeadRanged.cs index 39159babc3..5f3cf2fcba 100644 --- a/Items/Armor/Statigel/StatigelHeadRanged.cs +++ b/Items/Armor/Statigel/StatigelHeadRanged.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 7; //25 } diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index 22291837ec..0dcf52cd4e 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 6; //23 } @@ -38,10 +38,7 @@ namespace CalamityMod.Items.Armor.Statigel player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + "12% increased jump speed\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "+100 maximum stealth"; var modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.statigelJump = true; diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index 8526c67ad0..a75c6e4c01 100644 --- a/Items/Armor/Statigel/StatigelHeadSummon.cs +++ b/Items/Armor/Statigel/StatigelHeadSummon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Statigel { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 5, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 4; //20 } diff --git a/Items/Armor/Sulphurous/SulphurousBreastplate.cs b/Items/Armor/Sulphurous/SulphurousBreastplate.cs index d044b86d81..cac25f6ba9 100644 --- a/Items/Armor/Sulphurous/SulphurousBreastplate.cs +++ b/Items/Armor/Sulphurous/SulphurousBreastplate.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { Item.width = 24; Item.height = 20; - Item.value = Item.buyPrice(0, 1, 15, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.defense = 6; Item.rare = ItemRarityID.Green; } diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index a4a901477d..22bd008848 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { Item.width = 26; Item.height = 26; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 5; } @@ -37,13 +37,10 @@ namespace CalamityMod.Items.Armor.Sulphurous public override void UpdateArmorSet(Player player) { - player.setBonus = "Attacking and being attacked by enemies inflicts poison\n" + + player.setBonus = "+95 maximum stealth\n" + + "Attacking and being attacked by enemies inflicts poison\n" + "Grants an additional jump that summons a sulphurous bubble\n" + - "Provides increased underwater mobility and reduces the severity of the sulphuric waters\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 95\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Provides increased underwater mobility and reduces the severity of the sulphuric waters"; var modPlayer = player.Calamity(); modPlayer.sulfurSet = true; modPlayer.sulfurJump = true; diff --git a/Items/Armor/Sulphurous/SulphurousLeggings.cs b/Items/Armor/Sulphurous/SulphurousLeggings.cs index 5b0ff929c1..99de8e7313 100644 --- a/Items/Armor/Sulphurous/SulphurousLeggings.cs +++ b/Items/Armor/Sulphurous/SulphurousLeggings.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Sulphurous { Item.width = 22; Item.height = 16; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.defense = 5; Item.rare = ItemRarityID.Green; } diff --git a/Items/Armor/Tarragon/TarragonBreastplate.cs b/Items/Armor/Tarragon/TarragonBreastplate.cs index 5ced8b8e03..834abd16aa 100644 --- a/Items/Armor/Tarragon/TarragonBreastplate.cs +++ b/Items/Armor/Tarragon/TarragonBreastplate.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,9 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.lifeRegen = 2; - Item.value = Item.buyPrice(0, 40, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 37; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index 404e64bed0..f6905b09dd 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 50, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 10; //98 - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index cf7f77fe70..ad177f0dbf 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,9 +26,9 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 50, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 33; //98 - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 3883887f76..5cc259e4be 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 50, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 21; //98 - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index a560c7d1f7..f299a3b901 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +25,9 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 50, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 15; //98 - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -50,13 +51,10 @@ namespace CalamityMod.Items.Armor.Tarragon player.setBonus = "Reduces enemy spawn rates\n" + "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + + "+115 maximum stealth\n" + "After every 25 rogue critical hits you will gain 3 seconds of damage immunity\n" + "This effect can only occur once every 30 seconds\n" + - "While under the effects of a debuff you gain 10% increased rogue damage\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 115\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "While under the effects of a debuff you gain 10% increased rogue damage"; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index dea72a5ff1..f193492035 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,9 +24,9 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 50, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 3; //98 - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Tarragon/TarragonLeggings.cs b/Items/Armor/Tarragon/TarragonLeggings.cs index fa51a3e0e7..a02745d06c 100644 --- a/Items/Armor/Tarragon/TarragonLeggings.cs +++ b/Items/Armor/Tarragon/TarragonLeggings.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,9 @@ namespace CalamityMod.Items.Armor.Tarragon { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.defense = 32; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/TitanHeart/TitanHeartBoots.cs b/Items/Armor/TitanHeart/TitanHeartBoots.cs index 6c2c1de3fd..0693995239 100644 --- a/Items/Armor/TitanHeart/TitanHeartBoots.cs +++ b/Items/Armor/TitanHeart/TitanHeartBoots.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.TitanHeart { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 14; } diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index a4640dce2c..8cb91e000c 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor.TitanHeart { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 17; } diff --git a/Items/Armor/TitanHeart/TitanHeartMask.cs b/Items/Armor/TitanHeart/TitanHeartMask.cs index 3bf93dc3dd..31bdb387cd 100644 --- a/Items/Armor/TitanHeart/TitanHeartMask.cs +++ b/Items/Armor/TitanHeart/TitanHeartMask.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.TitanHeart { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.defense = 12; //43 } @@ -35,12 +35,9 @@ namespace CalamityMod.Items.Armor.TitanHeart public override void UpdateArmorSet(Player player) { player.setBonus = "15% increased rogue damage and knockback\n" + + "+100 maximum stealth\n" + "Stealth strikes deal double knockback and cause an astral explosion\n" + - "Grants immunity to knockback\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Grants immunity to knockback"; var modPlayer = player.Calamity(); modPlayer.titanHeartSet = true; player.GetDamage() += 0.15f; diff --git a/Items/Armor/Umbraphile/UmbraphileBoots.cs b/Items/Armor/Umbraphile/UmbraphileBoots.cs index f104dc6a89..53178bf69d 100644 --- a/Items/Armor/Umbraphile/UmbraphileBoots.cs +++ b/Items/Armor/Umbraphile/UmbraphileBoots.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Umbraphile { Item.width = 22; Item.height = 18; - Item.value = Item.buyPrice(0, 18, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 12; } diff --git a/Items/Armor/Umbraphile/UmbraphileHood.cs b/Items/Armor/Umbraphile/UmbraphileHood.cs index a8739c8bd2..361edcf82f 100644 --- a/Items/Armor/Umbraphile/UmbraphileHood.cs +++ b/Items/Armor/Umbraphile/UmbraphileHood.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Umbraphile { Item.width = 22; Item.height = 20; - Item.value = Item.buyPrice(0, 30, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 8; //36 } @@ -40,13 +40,9 @@ namespace CalamityMod.Items.Armor.Umbraphile var modPlayer = player.Calamity(); modPlayer.umbraphileSet = true; modPlayer.rogueStealthMax += 1.1f; - player.setBonus = "Rogue weapons have a chance to create explosions on hit\n" + - "Stealth strikes always create an explosion\n" + - "Penumbra potions always build stealth at max effectiveness\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + player.setBonus = "+110 maximum stealth\n" + + "Rogue weapons have a chance to create explosions on hit\n" + + "Stealth strikes always create an explosion"; player.Calamity().wearingRogueArmor = true; } diff --git a/Items/Armor/Umbraphile/UmbraphileRegalia.cs b/Items/Armor/Umbraphile/UmbraphileRegalia.cs index d3e5ae0695..b9d9d2eda4 100644 --- a/Items/Armor/Umbraphile/UmbraphileRegalia.cs +++ b/Items/Armor/Umbraphile/UmbraphileRegalia.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Umbraphile { Item.width = 38; Item.height = 24; - Item.value = Item.buyPrice(0, 24, 0, 0); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 16; } diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs index 42d03c21bc..aeed822bf0 100644 --- a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 28; Item.height = 20; - Item.Calamity().customRarity = (CalamityRarity)14; + Item.rare = ModContent.RarityType(); Item.vanity = true; Item.value = Item.buyPrice(0, 60, 0, 0); } diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs index a320dd90d2..3633249ba6 100644 --- a/Items/Armor/Vanity/AncientGodSlayerHelm.cs +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 28; Item.height = 20; - Item.Calamity().customRarity = (CalamityRarity)14; + Item.rare = ModContent.RarityType(); Item.value = Item.buyPrice(0, 75, 0, 0); Item.vanity = true; } diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs index 8233f46ad6..40c5a15e77 100644 --- a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs +++ b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Armor.Vanity { Item.width = 28; Item.height = 20; - Item.Calamity().customRarity = (CalamityRarity)14; + Item.rare = ModContent.RarityType(); Item.value = Item.buyPrice(0, 45, 0, 0); Item.vanity = true; } diff --git a/Items/Armor/Vanity/GodSlayerHornedHelm.cs b/Items/Armor/Vanity/GodSlayerHornedHelm.cs index 4d4958cbb1..e5b37444c8 100644 --- a/Items/Armor/Vanity/GodSlayerHornedHelm.cs +++ b/Items/Armor/Vanity/GodSlayerHornedHelm.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Rarities; using Terraria; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 18; Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/GodSlayerVisage.cs b/Items/Armor/Vanity/GodSlayerVisage.cs index 4432ca3e9c..55c4bcaf0b 100644 --- a/Items/Armor/Vanity/GodSlayerVisage.cs +++ b/Items/Armor/Vanity/GodSlayerVisage.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Rarities; using Terraria; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 18; Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/OldHunterHat.png b/Items/Armor/Vanity/OldHunterHat.png new file mode 100644 index 0000000000..83e0ef983c Binary files /dev/null and b/Items/Armor/Vanity/OldHunterHat.png differ diff --git a/Items/Armor/Vanity/OldHunterHat_Head.png b/Items/Armor/Vanity/OldHunterHat_Head.png new file mode 100644 index 0000000000..c9fa8abfef Binary files /dev/null and b/Items/Armor/Vanity/OldHunterHat_Head.png differ diff --git a/Items/Armor/Vanity/OldHunterPants.png b/Items/Armor/Vanity/OldHunterPants.png new file mode 100644 index 0000000000..e0b41eeb85 Binary files /dev/null and b/Items/Armor/Vanity/OldHunterPants.png differ diff --git a/Items/Armor/Vanity/OldHunterPants_Legs.png b/Items/Armor/Vanity/OldHunterPants_Legs.png new file mode 100644 index 0000000000..b14cda7b3f Binary files /dev/null and b/Items/Armor/Vanity/OldHunterPants_Legs.png differ diff --git a/Items/Armor/Vanity/OldHunterSet.cs b/Items/Armor/Vanity/OldHunterSet.cs new file mode 100644 index 0000000000..2810039ed7 --- /dev/null +++ b/Items/Armor/Vanity/OldHunterSet.cs @@ -0,0 +1,120 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor.DesertProwler; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class OldHunterHat : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Old Hunter Hat"); + Tooltip.SetDefault("Attire fashioned after the appearance of hunters from a faraway land"); + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.BlackInk). + AddTile(TileID.DyeVat). + Register(); + } + } + + [AutoloadEquip(EquipType.Body)] + public class OldHunterShirt : ModItem, IBulkyArmor + { + public string BulkTexture => "CalamityMod/Items/Armor/Vanity/OldHunterShirt_Bulk"; + + public override void Load() + { + if (Main.netMode == NetmodeID.Server) + return; + + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/OldHunterShirt_Back", EquipType.Back, this); + } + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Old Hunter Shirt"); + Tooltip.SetDefault("Attire fashioned after the appearance of hunters from a faraway land"); + + if (Main.netMode == NetmodeID.Server) + return; + + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); + + ArmorIDs.Body.Sets.HidesTopSkin[equipSlot] = true; + ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + } + + + public override void EquipFrameEffects(Player player, EquipType type) + { + player.back = (sbyte)EquipLoader.GetEquipSlot(Mod, Name, EquipType.Back); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.BlackInk). + AddTile(TileID.DyeVat). + Register(); + } + } + + [AutoloadEquip(EquipType.Legs)] + public class OldHunterPants : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Old Hunter Pants"); + Tooltip.SetDefault("Attire fashioned after the appearance of hunters from a faraway land"); + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.BlackInk). + AddTile(TileID.DyeVat). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/OldHunterShirt.png b/Items/Armor/Vanity/OldHunterShirt.png new file mode 100644 index 0000000000..78b33e1166 Binary files /dev/null and b/Items/Armor/Vanity/OldHunterShirt.png differ diff --git a/Items/Armor/Vanity/OldHunterShirt_Back.png b/Items/Armor/Vanity/OldHunterShirt_Back.png new file mode 100644 index 0000000000..f43c133994 Binary files /dev/null and b/Items/Armor/Vanity/OldHunterShirt_Back.png differ diff --git a/Items/Armor/Vanity/OldHunterShirt_Body.png b/Items/Armor/Vanity/OldHunterShirt_Body.png new file mode 100644 index 0000000000..4367c93183 Binary files /dev/null and b/Items/Armor/Vanity/OldHunterShirt_Body.png differ diff --git a/Items/Armor/Vanity/OldHunterShirt_Bulk.png b/Items/Armor/Vanity/OldHunterShirt_Bulk.png new file mode 100644 index 0000000000..e555480e5f Binary files /dev/null and b/Items/Armor/Vanity/OldHunterShirt_Bulk.png differ diff --git a/Items/Armor/Vanity/SilvaHelm.cs b/Items/Armor/Vanity/SilvaHelm.cs index 76de417288..af1e5b21fa 100644 --- a/Items/Armor/Vanity/SilvaHelm.cs +++ b/Items/Armor/Vanity/SilvaHelm.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Armor.Silva; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,8 +21,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaHornedHelm.cs b/Items/Armor/Vanity/SilvaHornedHelm.cs index 32bf15510e..8ee1ff68af 100644 --- a/Items/Armor/Vanity/SilvaHornedHelm.cs +++ b/Items/Armor/Vanity/SilvaHornedHelm.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Armor.Silva; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,8 +21,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 24; Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaMask.cs b/Items/Armor/Vanity/SilvaMask.cs index c4e4eef21a..e25e96722e 100644 --- a/Items/Armor/Vanity/SilvaMask.cs +++ b/Items/Armor/Vanity/SilvaMask.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Armor.Silva; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,8 +21,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 26; Item.value = Item.buyPrice(0, 8, 0, 0); Item.vanity = true; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Victide/VictideBreastplate.cs b/Items/Armor/Victide/VictideBreastplate.cs index 5d701514d0..c3a1d46b1e 100644 --- a/Items/Armor/Victide/VictideBreastplate.cs +++ b/Items/Armor/Victide/VictideBreastplate.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 5; //9 } diff --git a/Items/Armor/Victide/VictideGreaves.cs b/Items/Armor/Victide/VictideGreaves.cs index fbf7e64f2d..292de1ffc2 100644 --- a/Items/Armor/Victide/VictideGreaves.cs +++ b/Items/Armor/Victide/VictideGreaves.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 0, 50, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 4; //9 } diff --git a/Items/Armor/Victide/VictideHeadMagic.cs b/Items/Armor/Victide/VictideHeadMagic.cs index 00ba882b34..4d998d6b48 100644 --- a/Items/Armor/Victide/VictideHeadMagic.cs +++ b/Items/Armor/Victide/VictideHeadMagic.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 1, 50, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 2; //9 } diff --git a/Items/Armor/Victide/VictideHeadMelee.cs b/Items/Armor/Victide/VictideHeadMelee.cs index eeb7eaf92f..899cdb59fb 100644 --- a/Items/Armor/Victide/VictideHeadMelee.cs +++ b/Items/Armor/Victide/VictideHeadMelee.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 1, 50, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 4; //11 } diff --git a/Items/Armor/Victide/VictideHeadRanged.cs b/Items/Armor/Victide/VictideHeadRanged.cs index 4d6a1e5e81..48432755db 100644 --- a/Items/Armor/Victide/VictideHeadRanged.cs +++ b/Items/Armor/Victide/VictideHeadRanged.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 1, 50, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 3; //10 } diff --git a/Items/Armor/Victide/VictideHeadRogue.cs b/Items/Armor/Victide/VictideHeadRogue.cs index e13504dd3d..526904b85c 100644 --- a/Items/Armor/Victide/VictideHeadRogue.cs +++ b/Items/Armor/Victide/VictideHeadRogue.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 1, 50, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 3; //10 } @@ -37,10 +37,7 @@ namespace CalamityMod.Items.Armor.Victide "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 90\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "+90 maximum stealth"; var modPlayer = player.Calamity(); modPlayer.victideSet = true; modPlayer.rogueStealthMax += 0.9f; diff --git a/Items/Armor/Victide/VictideHeadSummon.cs b/Items/Armor/Victide/VictideHeadSummon.cs index 219fea7730..9a3ff0e5b7 100644 --- a/Items/Armor/Victide/VictideHeadSummon.cs +++ b/Items/Armor/Victide/VictideHeadSummon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor.Victide { Item.width = 18; Item.height = 18; - Item.value = Item.buyPrice(0, 1, 50, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.defense = 1; //8 } diff --git a/Items/Armor/Wulfrum/WulfrumArmor.cs b/Items/Armor/Wulfrum/WulfrumArmor.cs deleted file mode 100644 index 89a10c8f4e..0000000000 --- a/Items/Armor/Wulfrum/WulfrumArmor.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Body)] - public class WulfrumArmor : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Armor"); - Tooltip.SetDefault("3% increased critical strike chance"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 50, 0); - Item.rare = ItemRarityID.Blue; - Item.defense = 2; - } - - public override void UpdateEquip(Player player) => player.GetCritChance() += 3; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumArmor.png b/Items/Armor/Wulfrum/WulfrumArmor.png deleted file mode 100644 index f99eacd3b0..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumArmor.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumArmor_Body.png b/Items/Armor/Wulfrum/WulfrumArmor_Body.png deleted file mode 100644 index 2145298e8e..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumArmor_Body.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumFusionCannon.cs b/Items/Armor/Wulfrum/WulfrumFusionCannon.cs new file mode 100644 index 0000000000..e604fe89af --- /dev/null +++ b/Items/Armor/Wulfrum/WulfrumFusionCannon.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Cooldowns; +using CalamityMod.Items.BaseItems; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Armor.Wulfrum +{ + public class WulfrumFusionCannon : HeldOnlyItem, IHideFrontArm + { + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisShoot") { PitchVariance = 0.1f, Volume = 0.4f }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Experimental Wulfrum Fusion Array"); + Tooltip.SetDefault("Fires quick bursts of medium-range pellets\n" + "Ignores 10 points of enemy Defense\n" + + "[c/878787:\"Who needs whips when you can simply become the summon yourself?\"]"); + //Imaging hiding actually important/interesting/funny lore in there... :drool: that would be so dark souls + } + public override string Texture => "CalamityMod/Items/Armor/Wulfrum/WulfrumFusionCannon"; + + public bool noAnimation = false; + + public override void SetDefaults() + { + Item.damage = 6; + Item.ArmorPenetration = 10; + Item.DamageType = DamageClass.Summon; + Item.width = 34; + Item.height = 42; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2; + Item.rare = ItemRarityID.Green; + Item.UseSound = ShootSound; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.holdStyle = 16; //Custom hold style + + Item.useAnimation = 10; + Item.useTime = 4; + Item.reuseDelay = 17; + + Item.noUseGraphic = false; + } + + public override void ModifyTooltips(List tooltips) + { + var name = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.Mod == "Terraria"); + name.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + + if (player.whoAmI == Main.myPlayer) + { + if (!WulfrumHat.HasArmorSet(player)) + { + Item.type = 0; + Item.SetDefaults(0); + Item.stack = 0; + + Main.mouseItem = new Item(); + } + } + + Item.noUseGraphic = false; + if (!player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) || cd.timeLeft > WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime) + Item.noUseGraphic = true; + + } + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + velocity = velocity.RotatedByRandom(MathHelper.PiOver4 * 0.1f); + } + + public override bool CanUseItem(Player player) + { + return player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) && cd.timeLeft < WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime; + } + + public void SetItemInHand(Player player, Rectangle heldItemFrame) + { + //Make the player face where they're aiming. + if (player.Calamity().mouseWorld.X > player.Center.X) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + + //Hide the cannon till its visible on the player + if (!player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) || cd.timeLeft > WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime) + return; + + if (player.ItemTimeIsZero) + noAnimation = false; + if (player.itemAnimation > Item.useAnimation) + noAnimation = true; + + float animProgress = 1 - player.itemAnimation / (float)player.itemAnimationMax; + //It beecomes nan if the player loads into a world with the set bonus already active / without shooting any weapons before using it. + //this is because itemAnimationMax isnt set before the item gets used once. + if (noAnimation || animProgress is float.NaN) + animProgress = 1; + + //Default + Vector2 itemPosition = player.MountedCenter + new Vector2(-2f * player.direction, -1f * player.gravDir); + float itemRotation = (player.Calamity().mouseWorld - itemPosition).ToRotation(); + + //Adjust for animation + + if (animProgress < 0.9f) + itemPosition -= itemRotation.ToRotationVector2() * (1 - (float)Math.Pow(1 - (0.9f - animProgress) / 0.9f, 4)) * 3f; + + if (animProgress < 0.6f) + itemRotation += -0.3f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction * player.gravDir; + + //Shakezzz + itemPosition += Main.rand.NextVector2Circular(2f, 2f) * (1 - animProgress); + + + Vector2 itemSize = new Vector2(38, 18); + Vector2 itemOrigin = new Vector2(-12, 0); + CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin, true); + } + + public override void HoldStyle(Player player, Rectangle heldItemFrame) => SetItemInHand(player, heldItemFrame); + public override void UseStyle(Player player, Rectangle heldItemFrame) => SetItemInHand(player, heldItemFrame); + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) => false; + } +} diff --git a/Items/Armor/Wulfrum/WulfrumFusionCannon.png b/Items/Armor/Wulfrum/WulfrumFusionCannon.png new file mode 100644 index 0000000000..c1785a678b Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumFusionCannon.png differ diff --git a/Items/Armor/Wulfrum/WulfrumHat.png b/Items/Armor/Wulfrum/WulfrumHat.png new file mode 100644 index 0000000000..0c859a18e4 Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumHat.png differ diff --git a/Items/Armor/Wulfrum/WulfrumHat_FemaleHead.png b/Items/Armor/Wulfrum/WulfrumHat_FemaleHead.png new file mode 100644 index 0000000000..d731696b3e Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumHat_FemaleHead.png differ diff --git a/Items/Armor/Wulfrum/WulfrumHat_Head.png b/Items/Armor/Wulfrum/WulfrumHat_Head.png new file mode 100644 index 0000000000..6d17c44129 Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumHat_Head.png differ diff --git a/Items/Armor/Wulfrum/WulfrumHat_HeadExtension.png b/Items/Armor/Wulfrum/WulfrumHat_HeadExtension.png new file mode 100644 index 0000000000..6c4a0a4755 Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumHat_HeadExtension.png differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadMagic.cs b/Items/Armor/Wulfrum/WulfrumHeadMagic.cs deleted file mode 100644 index 5e92722e98..0000000000 --- a/Items/Armor/Wulfrum/WulfrumHeadMagic.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("WulfrumHood")] - public class WulfrumHeadMagic : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Visage"); - Tooltip.SetDefault("10% increased magic damage"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); - Item.rare = ItemRarityID.Blue; - Item.defense = 1; //6 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //9 - if (player.statLife <= player.statLifeMax2 * 0.5f) - { - player.statDefense += 5; //14 - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumHeadMagic.png b/Items/Armor/Wulfrum/WulfrumHeadMagic.png deleted file mode 100644 index 82655fd91e..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadMagic.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadMagic_Head.png b/Items/Armor/Wulfrum/WulfrumHeadMagic_Head.png deleted file mode 100644 index 6b273ef5e1..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadMagic_Head.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadMelee.cs b/Items/Armor/Wulfrum/WulfrumHeadMelee.cs deleted file mode 100644 index 4209a2a8f3..0000000000 --- a/Items/Armor/Wulfrum/WulfrumHeadMelee.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("WulfrumHelm")] - public class WulfrumHeadMelee : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Helm"); - Tooltip.SetDefault("10% increased melee damage"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); - Item.rare = ItemRarityID.Blue; - Item.defense = 3; //8 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Enemies are more likely to target you\n" + - "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //11 - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - { - player.statDefense += 5; //16 - } - player.aggro += 100; - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumHeadMelee.png b/Items/Armor/Wulfrum/WulfrumHeadMelee.png deleted file mode 100644 index b2611d63d1..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadMelee.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadMelee_Head.png b/Items/Armor/Wulfrum/WulfrumHeadMelee_Head.png deleted file mode 100644 index 9c56efc53a..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadMelee_Head.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadRanged.cs b/Items/Armor/Wulfrum/WulfrumHeadRanged.cs deleted file mode 100644 index 2b2b43bd70..0000000000 --- a/Items/Armor/Wulfrum/WulfrumHeadRanged.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("WulfrumHeadgear")] - public class WulfrumHeadRanged : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Headgear"); - Tooltip.SetDefault("10% increased ranged damage"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); - Item.rare = ItemRarityID.Blue; - Item.defense = 2; //7 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //10 - if (player.statLife <= player.statLifeMax2 * 0.5f) - { - player.statDefense += 5; //15 - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumHeadRanged.png b/Items/Armor/Wulfrum/WulfrumHeadRanged.png deleted file mode 100644 index e6d08596e8..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadRanged.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadRanged_Head.png b/Items/Armor/Wulfrum/WulfrumHeadRanged_Head.png deleted file mode 100644 index cf9ef4f3ac..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadRanged_Head.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadRogue.cs b/Items/Armor/Wulfrum/WulfrumHeadRogue.cs deleted file mode 100644 index dbc981bc32..0000000000 --- a/Items/Armor/Wulfrum/WulfrumHeadRogue.cs +++ /dev/null @@ -1,66 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.CalPlayer; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("WulfrumMask")] - public class WulfrumHeadRogue : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Mask"); - Tooltip.SetDefault("10% increased rogue damage"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); - Item.rare = ItemRarityID.Blue; - Item.defense = 1; //6 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - var modPlayer = player.Calamity(); - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 50\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - player.statDefense += 3; //9 - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - { - player.statDefense += 5; //14 - } - modPlayer.rogueStealthMax += 0.5f; - modPlayer.wearingRogueArmor = true; - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumHeadRogue.png b/Items/Armor/Wulfrum/WulfrumHeadRogue.png deleted file mode 100644 index 07edc75dce..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadRogue.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadRogue_Head.png b/Items/Armor/Wulfrum/WulfrumHeadRogue_Head.png deleted file mode 100644 index 56756bdf03..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadRogue_Head.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadSummon.cs b/Items/Armor/Wulfrum/WulfrumHeadSummon.cs deleted file mode 100644 index 4d9e4a1636..0000000000 --- a/Items/Armor/Wulfrum/WulfrumHeadSummon.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("WulfrumHelmet")] - public class WulfrumHeadSummon : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Helmet"); - Tooltip.SetDefault("10% increased minion damage"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 75, 0); - Item.rare = ItemRarityID.Blue; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense and +1 max minion\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //8 - player.maxMinions++; - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - { - player.statDefense += 5; //13 - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumHeadSummon.png b/Items/Armor/Wulfrum/WulfrumHeadSummon.png deleted file mode 100644 index e549a7c76e..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadSummon.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumHeadSummon_Head.png b/Items/Armor/Wulfrum/WulfrumHeadSummon_Head.png deleted file mode 100644 index 50ce885f3f..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumHeadSummon_Head.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumJacket.png b/Items/Armor/Wulfrum/WulfrumJacket.png new file mode 100644 index 0000000000..edb59f2d4e Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumJacket.png differ diff --git a/Items/Armor/Wulfrum/WulfrumJacket_Body.png b/Items/Armor/Wulfrum/WulfrumJacket_Body.png new file mode 100644 index 0000000000..a1bc3dbe60 Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumJacket_Body.png differ diff --git a/Items/Armor/Wulfrum/WulfrumLeggings.cs b/Items/Armor/Wulfrum/WulfrumLeggings.cs deleted file mode 100644 index 897f279f2b..0000000000 --- a/Items/Armor/Wulfrum/WulfrumLeggings.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Wulfrum -{ - [AutoloadEquip(EquipType.Legs)] - public class WulfrumLeggings : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Leggings"); - Tooltip.SetDefault("Movement speed increased by 5%"); - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = Item.buyPrice(0, 0, 25, 0); - Item.rare = ItemRarityID.Blue; - Item.defense = 1; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.05f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(8). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumLeggings.png b/Items/Armor/Wulfrum/WulfrumLeggings.png deleted file mode 100644 index ba9f776ea1..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumLeggings.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumLeggings_Legs.png b/Items/Armor/Wulfrum/WulfrumLeggings_Legs.png deleted file mode 100644 index 9b96d20767..0000000000 Binary files a/Items/Armor/Wulfrum/WulfrumLeggings_Legs.png and /dev/null differ diff --git a/Items/Armor/Wulfrum/WulfrumOveralls.png b/Items/Armor/Wulfrum/WulfrumOveralls.png new file mode 100644 index 0000000000..85d420fe10 Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumOveralls.png differ diff --git a/Items/Armor/Wulfrum/WulfrumOveralls_Legs.png b/Items/Armor/Wulfrum/WulfrumOveralls_Legs.png new file mode 100644 index 0000000000..d3785ea0cc Binary files /dev/null and b/Items/Armor/Wulfrum/WulfrumOveralls_Legs.png differ diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs new file mode 100644 index 0000000000..169663c958 --- /dev/null +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -0,0 +1,476 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Cooldowns; +using Terraria.Audio; +using System; +using System.Collections.Generic; +using static Microsoft.Xna.Framework.Input.Keys; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Armor.Wulfrum +{ + #region Armor pieces + + //Datsuzei / Moonstone armor from starlight river was a nice jumping off point for this kind of set. + + [AutoloadEquip(EquipType.Head)] + [LegacyName("WulfrumHelmet")] + [LegacyName("WulfrumHeadSummon")] + public class WulfrumHat : ModItem, IExtendedHat + { + #region big hat + public string ExtensionTexture => "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_HeadExtension"; + public Vector2 ExtensionSpriteOffset(PlayerDrawSet drawInfo) => -Vector2.UnitY * 2f; + public string EquipSlotName(Player drawPlayer) => drawPlayer.Male ? Name : "WulfrumHatFemale"; + #endregion + + public static readonly SoundStyle SetActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionActivate"); + public static readonly SoundStyle SetBreakSound = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreak"); + public static readonly SoundStyle SetBreakSoundSafe = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely"); + + public static int BastionBuildTime = (int)(0.55f * 60); + public static int BastionTime = 30 * 60; + public static int TimeLostPerHit = 2 * 60; + public static int BastionCooldown = 20 * 60; + + + internal static Item DummyCannon = new Item(); //Used for the attack swap. Basically we force the player to hold a fake item. + + public static bool PowerModeEngaged(Player player, out CooldownInstance cd) + { + cd = null; + bool hasWulfrumBastionCD = player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out cd); + return (hasWulfrumBastionCD && cd.timeLeft > BastionCooldown); + } + + public override void Load() + { + if (Main.netMode != NetmodeID.Server) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_FemaleHead", EquipType.Head, name : "WulfrumHatFemale"); + } + + On.Terraria.Player.KeyDoubleTap += ActivateSetBonus; + On.Terraria.Main.DrawPendingMouseText += SpoofMouseItem; + } + + public override void Unload() + { + On.Terraria.Player.KeyDoubleTap -= ActivateSetBonus; + On.Terraria.Main.DrawPendingMouseText -= SpoofMouseItem; + + + DummyCannon.TurnToAir(); + DummyCannon = null; + } + + private void ActivateSetBonus(On.Terraria.Player.orig_KeyDoubleTap orig, Player player, int keyDir) + { + if (keyDir == 0 && HasArmorSet(player) && !player.mount.Active) + { + //Only activate if no cooldown & available scrap. + if (player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out CooldownInstance cd)) + { + if (cd.timeLeft > BastionCooldown && cd.timeLeft < BastionCooldown + BastionTime - 60 * 3) + { + cd.timeLeft = BastionCooldown + 1; + player.Calamity().SyncCooldownDictionary(false); + } + } + + else if (player.HasItem(ModContent.ItemType())) + { + player.ConsumeItem(ModContent.ItemType()); + //I Thiiiinnnk there's no need to add mp syncing packets sicne cooldowns get auto synced right. + player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime); + //Though do i need to sync that or is the player inventory auto synced? + DummyCannon.SetDefaults(ItemType()); + } + } + + orig(player, keyDir); + } + + //Replaces the tooltip of the armor set with the fusion cannon if the player holds shift + private void SpoofMouseItem(On.Terraria.Main.orig_DrawPendingMouseText orig) + { + var player = Main.LocalPlayer; + + if (DummyCannon.IsAir && !Main.gameMenu) + DummyCannon.SetDefaults(ItemType()); + + if (IsPartOfSet(Main.HoverItem) && HasArmorSet(player) && Main.keyState.IsKeyDown(LeftShift)) + { + Main.HoverItem = DummyCannon.Clone(); + Main.hoverItemName = DummyCannon.Name; + } + + orig(); + } + + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Wulfrum Hat & Goggles"); + Tooltip.SetDefault("10% increased minion damage\n"+ + "Comes equipped with hair extensions" ); + } + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); + public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); + public bool IsPartOfSet(Item item) => item.type == ItemType() || + item.type == ItemType() || + item.type == ItemType(); + + public override void UpdateArmorSet(Player player) + { + WulfrumArmorPlayer armorPlayer = player.GetModPlayer(); + WulfrumTransformationPlayer transformationPlayer = player.GetModPlayer(); + + armorPlayer.wulfrumSet = true; + + player.setBonus = "+1 max minion"; //The cooler part of the set bonus happens in modifytooltips because i can't recolor it otherwise. Madge + player.maxMinions++; + if (PowerModeEngaged(player, out var cd)) + { + if (cd.timeLeft == BastionCooldown + BastionTime) + { + ActivationEffects(player); + } + + //Stats + player.statDefense += 13; + player.endurance += 0.05f; //10% Dr in total with the chestplate + + + //Can't account for previous fullbody transformations but at this point, whatever. + Item headItem = player.armor[10].type != 0 ? player.armor[10] : player.armor[0]; + bool hatVisible = !transformationPlayer.transformationActive && headItem.type == ItemType(); + + + //Spawn the hat + if (cd.timeLeft == BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f) && hatVisible) + { + Particle leftoverHat = new WulfrumHatParticle(player, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(3f, 7f), 25); + GeneralParticleHandler.SpawnParticle(leftoverHat); + } + + + //Visuals + if (cd.timeLeft < BastionCooldown + BastionTime - BastionBuildTime) + player.GetModPlayer().transformationActive = true; + else if (cd.timeLeft <= BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f)) + player.GetModPlayer().forceHelmetOn = true; + + + //Swapping the arm. + if (DummyCannon.IsAir) + DummyCannon.SetDefaults(ItemType()); + + if (Main.myPlayer == player.whoAmI) + { + //Drop the player's held item if they were holding something before + if (!(Main.mouseItem.type == DummyCannon.type) && !Main.mouseItem.IsAir) + Main.LocalPlayer.QuickSpawnClonedItem(null, Main.mouseItem, Main.mouseItem.stack); + + Main.mouseItem = DummyCannon; + } + + //Slot 58 is the "fake" slot thats used for the item the player is holding in their mouse. + player.inventory[58] = DummyCannon; + player.selectedItem = 58; + } + + else if (Main.myPlayer == player.whoAmI) + { + //Clear the player's hand + if (Main.mouseItem.type == ItemType()) + Main.mouseItem = new Item(); + + DummyCannon.TurnToAir(); + } + } + + public void ActivationEffects(Player player) + { + SoundEngine.PlaySound(SetActivationSound); + + //Do'nt do the effect ifthe player is already using the wulfrum vanity lol. + bool transformedAlready = player.GetModPlayer().transformationActive; + + if (!transformedAlready) + { + for (int i = 0; i < 5; i++) + { + Particle part = new WulfrumBastionPartsParticle(player, i, BastionBuildTime + 2); + GeneralParticleHandler.SpawnParticle(part); + } + } + + //Do spawn the cannon always though + Particle gun = new WulfrumBastionPartsParticle(player, 5, BastionBuildTime + 2); + + if (transformedAlready) + { + (gun as WulfrumBastionPartsParticle).TimeOffset = 0; + (gun as WulfrumBastionPartsParticle).AnimationTime = BastionBuildTime + 2; + } + GeneralParticleHandler.SpawnParticle(gun); + } + + public static void ModifySetTooltips(ModItem item, List tooltips) + { + if (HasArmorSet(Main.LocalPlayer)) + { + int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); + + if (setBonusIndex != -1) + { + TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", "Wulfrum Bastion - Double tap DOWN while dismounted to equip wulfrum power armor"); + setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); + tooltips.Insert(setBonusIndex + 1, setBonus1); + + TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", "While the armor is active, you can only use the integrated fusion cannon, but your defensive stats are increased"); + setBonus2.OverrideColor = new Color(110, 192, 93); + tooltips.Insert(setBonusIndex + 2, setBonus2); + + TooltipLine setBonus3 = new TooltipLine(item.Mod, "CalamityMod:SetBonus3", "Calling down the armor consumes one piece of wulfrum metal scrap, and the armor will lose durability faster when hit"); + setBonus3.OverrideColor = new Color(110, 192, 93); + tooltips.Insert(setBonusIndex + 3, setBonus3); + + if (!Main.keyState.IsKeyDown(LeftShift)) + { + TooltipLine itemDisplay = new TooltipLine(item.Mod, "CalamityMod:ArmorItemDisplay", "Hold SHIFT to see the stats of the fusion cannon"); + itemDisplay.OverrideColor = new Color(190, 190, 190); + tooltips.Add(itemDisplay); + } + } + + } + } + public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); + + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.1f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } + + [AutoloadEquip(EquipType.Body)] + [LegacyName("WulfrumArmor")] + public class WulfrumJacket : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Wulfrum Jacket"); + Tooltip.SetDefault("5% increased damage reduction"); //Increases to 10 with the wulfrum bastion active + + if (Main.netMode != NetmodeID.Server) + { + var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); + ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; + ArmorIDs.Body.Sets.HidesTopSkin[equipSlot] = true; + } + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 2; + } + + public override void ModifyTooltips(List tooltips) => WulfrumHat.ModifySetTooltips(this, tooltips); + + public override void UpdateEquip(Player player) => player.endurance += 0.05f; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(12). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } + + [AutoloadEquip(EquipType.Legs)] + [LegacyName("WulfrumLeggings")] + public class WulfrumOveralls : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Wulfrum Overalls"); + Tooltip.SetDefault("Movement speed increased by 5%"); + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.defense = 1; + + if (Main.netMode != NetmodeID.Server) + { + var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); + ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; + } + } + public override void ModifyTooltips(List tooltips) => WulfrumHat.ModifySetTooltips(this, tooltips); + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.05f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } + #endregion + + public class WulfrumArmorPlayer : ModPlayer + { + public static int BastionShootDamage = 10; + public static float BastionShootSpeed = 18f; + public static int BastionShootTime = 10; + + public bool wulfrumSet = false; + + public override void ResetEffects() + { + wulfrumSet = false; + } + + public override void UpdateDead() + { + wulfrumSet = false; + } + + public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) + { + if (WulfrumHat.PowerModeEngaged(Player, out var cd) && Main.netMode != NetmodeID.Server) + { + SetBonusEndEffect(true); + if (!Player.GetModPlayer().vanityEquipped) + Player.GetModPlayer().transformationActive = false; + } + } + + public override void PostUpdate() + { + if (wulfrumSet && Player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) && cd.timeLeft == WulfrumHat.BastionCooldown) + { + SetBonusEndEffect(false); + } + } + + public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter) + { + if (WulfrumHat.PowerModeEngaged(Player, out var cd)) + { + cd.timeLeft -= WulfrumHat.TimeLostPerHit; + if (cd.timeLeft < WulfrumHat.BastionCooldown) + { + cd.timeLeft = WulfrumHat.BastionCooldown - 1; + if (Main.netMode != NetmodeID.Server) + SetBonusEndEffect(true); + } + } + } + + public void SetBonusEndEffect(bool violent) + { + SoundStyle breakSound = WulfrumHat.SetBreakSoundSafe; + float goreSpeed = 3f; + int goreCount = 4; + int goreIncrement = 2; + + if (violent) + { + breakSound = WulfrumHat.SetBreakSound; + goreSpeed = 9f; + goreCount = 9; + goreIncrement = 1; + } + + SoundEngine.PlaySound(breakSound, Player.Center); + //Only spawn the cannon gore if the player already has the vanity on. + if (Player.GetModPlayer().vanityEquipped) + { + Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(goreSpeed, goreSpeed); + Gore.NewGore(Player.GetSource_Death(), Player.Center, shrapnelVelocity, Mod.Find("WulfrumPowerSuit1").Type); + } + + else + { + int j = 1; + + for (int i = 1; i < goreCount; i++) + { + Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(goreSpeed, goreSpeed); + string goreType = "WulfrumPowerSuit" + j.ToString(); + Gore.NewGore(Player.GetSource_Death(), Player.Center, shrapnelVelocity, Mod.Find(goreType).Type); + + j += Main.rand.Next(1, goreIncrement); + } + } + } + + + public override void PostUpdateMiscEffects() + { + //This is important. Prevents ppl cheat sheeting the item in from softlocking their mouse button lol + if (Main.mouseItem.ModItem is WulfrumFusionCannon && !WulfrumHat.PowerModeEngaged(Player, out _)) + { + Main.mouseItem.TurnToAir(); + } + + //This shouldn't ever be possible since the power mode prevents you from using or moving items around + if (!wulfrumSet && WulfrumHat.PowerModeEngaged(Player, out var cd)) + { + cd.timeLeft = WulfrumHat.BastionCooldown; + } + } + + public override void FrameEffects() + { + //Give the braids variant to w*men + if (!Player.Male && Player.head == EquipLoader.GetEquipSlot(Mod, "WulfrumHat", EquipType.Head)) + Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumHatFemale", EquipType.Head); + } + } +} diff --git a/Items/BaseItems/HeldOnlyItem.cs b/Items/BaseItems/HeldOnlyItem.cs new file mode 100644 index 0000000000..2c1eb67151 --- /dev/null +++ b/Items/BaseItems/HeldOnlyItem.cs @@ -0,0 +1,67 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Audio; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Items.BaseItems +{ + /// + /// A item that only exists as a held item. Useful if for example, it is used as a mean to temporarily replace the players attack ability. + /// + public abstract class HeldOnlyItem : ModItem + { + public virtual bool VisibleInUI => false; + + public override void Load() + { + On.Terraria.Player.dropItemCheck += DontDropCoolStuff; + On.Terraria.UI.ItemSlot.LeftClick_ItemArray_int_int += LockMouseToSpecialItem; + On.Terraria.UI.ItemSlot.Draw_SpriteBatch_ItemArray_int_int_Vector2_Color += DrawSpecial; + } + public override void Unload() + { + On.Terraria.Player.dropItemCheck -= DontDropCoolStuff; + On.Terraria.UI.ItemSlot.LeftClick_ItemArray_int_int -= LockMouseToSpecialItem; + On.Terraria.UI.ItemSlot.Draw_SpriteBatch_ItemArray_int_int_Vector2_Color -= DrawSpecial; + } + + private void DrawSpecial(On.Terraria.UI.ItemSlot.orig_Draw_SpriteBatch_ItemArray_int_int_Vector2_Color orig, SpriteBatch sb, Item[] inv, int context, int slot, Vector2 position, Color color) + { + if (inv[slot].ModItem is HeldOnlyItem && !(inv[slot].ModItem as HeldOnlyItem).VisibleInUI) + return; + + else + orig(sb, inv, context, slot, position, color); + } + + public override void PostUpdate() + { + //Die if in the world + Item.type = 0; + Item.stack = 0; + } + + public override bool CanPickup(Player player) => false; + + private void LockMouseToSpecialItem(On.Terraria.UI.ItemSlot.orig_LeftClick_ItemArray_int_int orig, Item[] inv, int context, int slot) + { + if (!(Main.mouseItem.ModItem is HeldOnlyItem)) + orig(inv, context, slot); + } + + //https://media.discordapp.net/attachments/458432092301295618/993675527539916850/unknown.png + private void DontDropCoolStuff(On.Terraria.Player.orig_dropItemCheck orig, Terraria.Player self) + { + if (!(Main.mouseItem.ModItem is HeldOnlyItem)) + orig(self); + } + + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) => false; + + } +} diff --git a/Items/BleachBall.cs b/Items/BleachBall.cs index d4e0a7c094..8699ab6359 100644 --- a/Items/BleachBall.cs +++ b/Items/BleachBall.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Blue; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + public override void UpdateInventory(Player player) { if (Item.favorited) diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs index bdcf5d960e..eead7e98e4 100644 --- a/Items/BrimstoneLocus.cs +++ b/Items/BrimstoneLocus.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -19,11 +20,15 @@ namespace CalamityMod.Items { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = 0; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index b32c4be84c..60f476beb5 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -20,11 +20,18 @@ namespace CalamityMod.Items Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + public override void UpdateInventory(Player player) { if (Item.favorited) player.Calamity().noStupidNaturalARSpawns = true; } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index dcac072e2d..0bc5ca2e3f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,8 +1,5 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; -using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -11,7 +8,6 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; -using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; @@ -20,11 +16,14 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -32,6 +31,7 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Utilities; namespace CalamityMod.Items { @@ -79,9 +79,7 @@ namespace CalamityMod.Items #endregion // Miscellaneous stuff - public CalamityRarity customRarity = CalamityRarity.NoEffect; public int timesUsed = 0; - public int reforgeTier = 0; public bool donorItem = false; public bool devItem = false; public bool canFirePointBlankShots = false; @@ -94,13 +92,6 @@ namespace CalamityMod.Items StealthStrikePrefixBonus = 0f; } - public override bool PreReforge(Item item) - { - StealthGenBonus = 1f; - StealthStrikePrefixBonus = 0f; - return true; - } - // Ozzatron 21MAY2022: This function is required by TML 1.4's new clone behavior. // This behavior is sadly mandatory because there are a few places in vanilla Terraria which use cloning. // Most notably: reforging and item tooltips. @@ -129,9 +120,7 @@ namespace CalamityMod.Items myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion; // Miscellaneous - myClone.customRarity = customRarity; myClone.timesUsed = timesUsed; - myClone.reforgeTier = reforgeTier; myClone.donorItem = donorItem; myClone.devItem = devItem; myClone.canFirePointBlankShots = canFirePointBlankShots; @@ -142,11 +131,6 @@ namespace CalamityMod.Items #region SetDefaults public override void SetDefaults(Item item) { - // TODO -- Remove this in 1.4 with ModRarity. - // TODO -- Remove all instances of manually setting the rarity of postML items to Red. - if (customRarity.IsPostML() && item.rare != ItemRarityID.Purple) - item.rare = ItemRarityID.Purple; - // All items that stack to 30, 50, 75, 99 , or 999 now stack to 9999 instead. if (item.maxStack == 30 || item.maxStack == 50 || item.maxStack == 75 || item.maxStack == 99 || item.maxStack == 999) item.maxStack = 9999; @@ -188,14 +172,16 @@ namespace CalamityMod.Items case ItemID.WormScarf: case ItemID.BrainOfConfusion: case ItemID.HiveBackpack: + case ItemID.BoneHelm: case ItemID.BoneGlove: - case ItemID.DemonHeart: + // case ItemID.DemonHeart: case ItemID.VolatileGelatin: case ItemID.MechanicalBatteryPiece: case ItemID.MechanicalWagonPiece: case ItemID.MechanicalWheelPiece: case ItemID.MinecartMech: case ItemID.SporeSac: + case ItemID.WitchBroom: case ItemID.EmpressFlightBooster: case ItemID.ShinyStone: case ItemID.ShrimpyTruffle: @@ -221,6 +207,21 @@ namespace CalamityMod.Items #endregion #region Shoot + public override void ModifyShootStats(Item item, Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockBack) + { + CalamityPlayer modPlayer = player.Calamity(); + + if (item.CountsAsClass()) + { + velocity *= modPlayer.rogueVelocity; + 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) { CalamityPlayer modPlayer = player.Calamity(); @@ -239,16 +240,7 @@ namespace CalamityMod.Items Projectile.NewProjectile(source, player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), monsterDamage, 0f, player.whoAmI); } - if (item.CountsAsClass()) - { - velocity *= modPlayer.rogueVelocity; - if (modPlayer.gloveOfRecklessness && item.useTime == item.useAnimation) - velocity = velocity.RotatedByRandom(MathHelper.ToRadians(6f)); - } - if (modPlayer.eArtifact && item.CountsAsClass()) - velocity *= 1.25f; - - if (modPlayer.luxorsGift) + if (modPlayer.luxorsGift && !item.channel) { // useTime 9 = 0.9 useTime 2 = 0.2 double damageMult = 1.0; @@ -524,9 +516,7 @@ namespace CalamityMod.Items public override void SaveData(Item item, TagCompound tag) { tag.Add("timesUsed", timesUsed); - tag.Add("rarity", (int)customRarity); tag.Add("charge", Charge); - tag.Add("reforgeTier", reforgeTier); tag.Add("enchantmentID", AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); tag.Add("DischargeEnchantExhaustion", DischargeEnchantExhaustion); tag.Add("canFirePointBlankShots", canFirePointBlankShots); @@ -536,7 +526,6 @@ namespace CalamityMod.Items { canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); timesUsed = tag.GetInt("timesUsed"); - customRarity = (CalamityRarity)tag.GetInt("rarity"); // Changed charge from int to float. If an old charge int is present, load that instead. if (tag.ContainsKey("Charge")) @@ -545,7 +534,6 @@ namespace CalamityMod.Items Charge = tag.GetFloat("charge"); DischargeEnchantExhaustion = tag.GetFloat("DischargeEnchantExhaustion"); - reforgeTier = tag.GetInt("reforgeTimer"); Enchantment? savedEnchantment = EnchantmentManager.FindByID(tag.GetInt("enchantmentID")); if (savedEnchantment.HasValue) { @@ -562,10 +550,8 @@ namespace CalamityMod.Items // rip, no other flags. what a byte. writer.Write(flags); - writer.Write((int)customRarity); writer.Write(timesUsed); writer.Write(Charge); - writer.Write(reforgeTier); writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); writer.Write(DischargeEnchantExhaustion); } @@ -575,10 +561,8 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); canFirePointBlankShots = flags[0]; - customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); Charge = reader.ReadSingle(); - reforgeTier = reader.ReadInt32(); Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32()); if (savedEnchantment.HasValue) @@ -598,13 +582,7 @@ namespace CalamityMod.Items if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) { bool boostedHeart = player.Calamity().photosynthesis; - if (NPC.AnyNPCs(ModContent.NPCType())) - { - player.statLife -= boostedHeart ? 5 : 10; - if (Main.myPlayer == player.whoAmI) - player.HealEffect(boostedHeart ? -5 : -10, true); - } - else if (boostedHeart) + if (boostedHeart) { player.statLife += 5; if (Main.myPlayer == player.whoAmI) @@ -895,10 +873,6 @@ namespace CalamityMod.Items { return false; } - if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) - { - return !player.HasBuff(ModContent.BuffType()); - } if (item.type == ItemID.RodofDiscord) { if (player.chaosState) @@ -1016,12 +990,14 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.Calamity(); VanillaArmorChangeManager.CreateTooltipManuallyAsNecessary(player); + VanillaArmorChangeManager.ApplyPotentialEffectsTo(player); if (set == "CrystalAssassin") { player.GetDamage() -= 0.1f; player.GetCritChance() -= 10; player.setBonus = "Allows the ability to dash"; + modPlayer.DashID = string.Empty; } else if (set == "SquireTier2") { @@ -1200,7 +1176,7 @@ namespace CalamityMod.Items // Arcane and Magnet Flower buffs if (item.type == ItemID.ArcaneFlower || item.type == ItemID.MagnetFlower) - player.manaCost -= 0.12f; + player.manaCost -= 0.04f; if (item.type == ItemID.SniperScope) { @@ -1220,6 +1196,9 @@ namespace CalamityMod.Items player.GetAttackSpeed() += 0.02f; } + if (item.type == ItemID.TerrasparkBoots) + player.buffImmune[BuffID.OnFire] = true; + if (item.type == ItemID.AngelWings) // Boost to max life, defense, and life regen { player.statLifeMax2 += 20; @@ -1589,12 +1568,6 @@ namespace CalamityMod.Items player.endurance += 0.01f; } - - // TODO -- make all prefixes relevant. Details in Ozz's todo. - /* - if (item.prefix == PrefixID.Precise || item.prefix == PrefixID.Lucky) - player.armorPenetration += 1; - */ } #endregion @@ -1606,7 +1579,6 @@ namespace CalamityMod.Items float flightSpeedMult = 1f + (modPlayer.soaring ? 0.1f : 0f) + - (modPlayer.profanedRage ? 0.05f : 0f) + (modPlayer.draconicSurge ? 0.1f : 0f) + (modPlayer.reaverSpeed ? 0.1f : 0f) + moveSpeedBoost; @@ -1694,12 +1666,18 @@ namespace CalamityMod.Items } } + if (player.magicQuiver && (item.useAmmo == AmmoID.Arrow || item.useAmmo == AmmoID.Stake) && Main.rand.NextBool(5)) + dontConsumeAmmo = true; + if (player.huntressAmmoCost90 && Main.rand.NextBool(10)) + dontConsumeAmmo = true; if (player.ammoBox && Main.rand.NextBool(5)) dontConsumeAmmo = true; if (player.ammoPotion && Main.rand.NextBool(5)) dontConsumeAmmo = true; if (player.ammoCost80 && Main.rand.NextBool(5)) dontConsumeAmmo = true; + if (player.chloroAmmoCost80 && Main.rand.NextBool(5)) + dontConsumeAmmo = true; if (player.ammoCost75 && Main.rand.NextBool(4)) dontConsumeAmmo = true; if (Main.rand.NextFloat() > player.Calamity().rangedAmmoCost) @@ -1758,326 +1736,61 @@ namespace CalamityMod.Items } #endregion - #region Reforging - private int NewPrefixType(Item item) + #region On Create + public override void OnCreate(Item item, ItemCreationContext context) { - int prefix = -2; - if (item.accessory) - { - if (Main.LocalPlayer.Calamity().finalTierAccessoryReforge) - { - // Warding = 18, Menacing = 19, Quick = 20, Violent = 21, Lucky = 22, Silent = 23 - prefix = Main.rand.Next(18, 24); - } - else - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 6), // Hard = 1, Jagged = 2, Brisk = 3, Wild = 4, Quiet = 5 - 2 => Main.rand.Next(6, 11), // Guarding = 6, Spiked = 7, Fleeting = 8, Rash = 9, Cloaked = 10 - 3 => Main.rand.Next(11, 13), // Precise = 11, Arcane = 12 - 4 => Main.rand.Next(13, 18), // Armored = 13, Angry = 14, Hasty = 15, Intrepid = 16, Camouflaged = 17 - 5 or 6 => Main.rand.Next(18, 24), // Warding = 18, Menacing = 19, Quick = 20, Violent = 21, Lucky = 22, Silent = 23 - _ => prefix - }; - } - - prefix = prefix switch - { - 1 => PrefixID.Hard, - 2 => PrefixID.Jagged, - 3 => PrefixID.Brisk, - 4 => PrefixID.Wild, - 5 => Mod.Find("Quiet").Type, - 6 => PrefixID.Guarding, - 7 => PrefixID.Spiked, - 8 => PrefixID.Fleeting, - 9 => PrefixID.Rash, - 10 => Mod.Find("Cloaked").Type, - 11 => PrefixID.Precise, - 12 => PrefixID.Arcane, - 13 => PrefixID.Armored, - 14 => PrefixID.Angry, - 15 => PrefixID.Hasty2, - 16 => PrefixID.Intrepid, - 17 => Mod.Find("Camouflaged").Type, - 18 => PrefixID.Warding, - 19 => PrefixID.Menacing, - 20 => PrefixID.Quick2, - 21 => PrefixID.Violent, - 22 => PrefixID.Lucky, - 23 => Mod.Find("Silent").Type, - _ => prefix, - }; - } - else if (item.CountsAsClass() || item.IsWhip()) - { - // Yoyos, Flails, Spears, etc. - if ((item.channel || item.noMelee) && !item.IsWhip() && item.type != ItemID.Zenith) - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 3),// Keen = 1, Ruthless = 2 - 2 => Main.rand.Next(3, 5),// Hurtful = 3, Zealous = 4 - 3 => Main.rand.Next(5, 7),// Forceful = 5, Strong = 6 - 4 => 7,// Demonic = 7 - 5 => 8,// Superior = 8 - 6 => 9,// Godly = 9 - _ => prefix, - }; - - prefix = prefix switch - { - 1 => PrefixID.Keen, - 2 => PrefixID.Ruthless, - 3 => PrefixID.Hurtful, - 4 => PrefixID.Zealous, - 5 => PrefixID.Forceful, - 6 => PrefixID.Strong, - 7 => PrefixID.Demonic, - 8 => PrefixID.Superior, - 9 => PrefixID.Godly, - _ => prefix, - }; - } - // All other melee weapons - else - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 7),// Keen = 1, Ruthless = 2, Nimble = 3, Nasty = 4, Heavy = 5, Light = 6 - 2 => Main.rand.Next(7, 12),// Hurtful = 7, Zealous = 8, Quick = 9, Pointy = 10, Bulky = 11 - 3 => Main.rand.Next(12, 18),// Forceful = 12, Strong = 13, Agile = 14, Large = 15, Dangerous = 16, Sharp = 17 - 4 => Main.rand.Next(18, 22),// Murderous = 18, Massive = 19, Unpleasant = 20, Deadly2 = 21 - 5 => Main.rand.Next(22, 25),// Superior = 22, Demonic = 23, Savage = 24 - 6 => item.pick > 0 || item.axe > 0 || item.hammer > 0 ? (Main.rand.NextBool() ? 25 : 6) : 25,// Legendary = 25, Light = 6 ~We are tool friendly (= - _ => prefix, - }; - - prefix = prefix switch - { - 1 => PrefixID.Keen, - 2 => PrefixID.Ruthless, - 3 => PrefixID.Nimble, - 4 => PrefixID.Nasty, - 5 => PrefixID.Heavy, - 6 => PrefixID.Light, - 7 => PrefixID.Hurtful, - 8 => PrefixID.Zealous, - 9 => PrefixID.Quick, - 10 => PrefixID.Pointy, - 11 => PrefixID.Bulky, - 12 => PrefixID.Forceful, - 13 => PrefixID.Strong, - 14 => PrefixID.Agile, - 15 => PrefixID.Large, - 16 => PrefixID.Dangerous, - 17 => PrefixID.Sharp, - 18 => PrefixID.Murderous, - 19 => PrefixID.Massive, - 20 => PrefixID.Unpleasant, - 21 => PrefixID.Deadly2, - 22 => PrefixID.Superior, - 23 => PrefixID.Demonic, - 24 => PrefixID.Savage, - 25 => PrefixID.Legendary, - _ => prefix, - }; - } - } - else if (item.CountsAsClass()) - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 6),// Keen = 1, Ruthless = 2, Nimble = 3, Nasty = 4, Powerful = 5 - 2 => Main.rand.Next(6, 9),// Hurtful = 6, Zealous = 7, Quick = 8 - 3 => Main.rand.Next(9, 14),// Forceful = 9, Strong = 10, Agile = 11, Sighted = 12, Murderous = 13 - 4 => Main.rand.Next(14, 19),// Superior = 14, Demonic = 15, Deadly2 = 16, Intimidating = 17, Unpleasant = 18 - 5 => Main.rand.Next(19, 24),// Godly = 19, Rapid = 20, Hasty = 21, Deadly = 22, Staunch = 23 - 6 => 24,// Unreal = 24 - _ => prefix, - }; - - prefix = prefix switch - { - 1 => PrefixID.Keen, - 2 => PrefixID.Ruthless, - 3 => PrefixID.Nimble, - 4 => PrefixID.Nasty, - 5 => PrefixID.Powerful, - 6 => PrefixID.Hurtful, - 7 => PrefixID.Zealous, - 8 => PrefixID.Quick, - 9 => PrefixID.Forceful, - 10 => PrefixID.Strong, - 11 => PrefixID.Agile, - 12 => PrefixID.Sighted, - 13 => PrefixID.Murderous, - 14 => PrefixID.Superior, - 15 => PrefixID.Demonic, - 16 => PrefixID.Deadly2, - 17 => PrefixID.Intimidating, - 18 => PrefixID.Unpleasant, - 19 => PrefixID.Godly, - 20 => PrefixID.Rapid, - 21 => PrefixID.Hasty, - 22 => PrefixID.Deadly, - 23 => PrefixID.Staunch, - 24 => PrefixID.Unreal, - _ => prefix, - }; - } - else if (item.CountsAsClass()) - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 6),// Keen = 1, Ruthless = 2, Nimble = 3, Nasty = 4, Furious = 5 - 2 => Main.rand.Next(6, 11),// Hurtful = 6, Zealous = 7, Quick = 8, Taboo = 9, Manic = 10 - 3 => Main.rand.Next(11, 17),// Forceful = 11, Strong = 12, Agile = 13, Murderous = 14, Adept = 15, Celestial = 16 - 4 => Main.rand.Next(17, 21),// Superior = 17, Demonic = 18, Deadly2 = 19, Mystic = 20 - 5 => Main.rand.Next(21, 23),// Godly = 21, Masterful = 22 - 6 => 23,// Mythical = 23 - _ => prefix, - }; - - prefix = prefix switch - { - 1 => PrefixID.Keen, - 2 => PrefixID.Ruthless, - 3 => PrefixID.Nimble, - 4 => PrefixID.Nasty, - 5 => PrefixID.Furious, - 6 => PrefixID.Hurtful, - 7 => PrefixID.Zealous, - 8 => PrefixID.Quick, - 9 => PrefixID.Taboo, - 10 => PrefixID.Manic, - 11 => PrefixID.Forceful, - 12 => PrefixID.Strong, - 13 => PrefixID.Agile, - 14 => PrefixID.Murderous, - 15 => PrefixID.Adept, - 16 => PrefixID.Celestial, - 17 => PrefixID.Superior, - 18 => PrefixID.Demonic, - 19 => PrefixID.Deadly2, - 20 => PrefixID.Mystic, - 21 => PrefixID.Godly, - 22 => PrefixID.Masterful, - 23 => PrefixID.Mythical, - _ => prefix, - }; - } - else if (item.CountsAsClass()) - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 3),// Nimble = 1, Furious = 2 - 2 => Main.rand.Next(3, 7),// Hurtful = 3, Quick = 4, Taboo = 5, Manic = 6 - 3 => Main.rand.Next(7, 11),// Forceful = 7, Strong = 8, Adept = 9, Celestial = 10 - 4 => Main.rand.Next(11, 15),// Deadly2 = 11, Mystic = 12, Superior = 13, Demonic = 14 - 5 => Main.rand.Next(15, 18),// Masterful = 15, Mythical = 16, Godly = 17 - 6 => 18,// Ruthless = 18 - _ => prefix, - }; - - prefix = prefix switch - { - 1 => PrefixID.Nimble, - 2 => PrefixID.Furious, - 3 => PrefixID.Hurtful, - 4 => PrefixID.Quick, - 5 => PrefixID.Taboo, - 6 => PrefixID.Manic, - 7 => PrefixID.Forceful, - 8 => PrefixID.Strong, - 9 => PrefixID.Adept, - 10 => PrefixID.Celestial, - 11 => PrefixID.Deadly2, - 12 => PrefixID.Mystic, - 13 => PrefixID.Superior, - 14 => PrefixID.Demonic, - 15 => PrefixID.Masterful, - 16 => PrefixID.Mythical, - 17 => PrefixID.Godly, - 18 => PrefixID.Ruthless, - _ => prefix, - }; - } - else if (item.CountsAsClass()) - { - prefix = reforgeTier switch - { - 1 => Main.rand.Next(1, 3),// Radical = 1, Pointy = 2 - 2 => Main.rand.Next(3, 5),// Sharp = 3, Glorious = 4 - 3 => Main.rand.Next(5, 8),// Feathered = 5, Sleek = 6, Hefty = 7 - 4 => Main.rand.Next(8, 10),// Mighty = 8, Serrated = 9 - 5 => Main.rand.Next(10, 12),// Vicious = 10, Lethal = 11 - 6 => 12,// Flawless = 12 - _ => prefix, - }; - - prefix = prefix switch - { - 1 => Mod.Find("Radical").Type, - 2 => Mod.Find("Pointy").Type, - 3 => Mod.Find("Sharp").Type, - 4 => Mod.Find("Glorious").Type, - 5 => Mod.Find("Feathered").Type, - 6 => Mod.Find("Sleek").Type, - 7 => Mod.Find("Hefty").Type, - 8 => Mod.Find("Mighty").Type, - 9 => Mod.Find("Serrated").Type, - 10 => Mod.Find("Vicious").Type, - 11 => Mod.Find("Lethal").Type, - 12 => Mod.Find("Flawless").Type, - _ => prefix, - }; - } - - return prefix; + // ChoosePrefix also happens on craft so go reset it here too + storedPrefix = -1; } + #endregion - // Cut price in half because fuck the goblin - public override bool ReforgePrice(Item item, ref int reforgePrice, ref bool canApplyDiscount) + #region Reforge Mechanic Rework + private static int storedPrefix = -1; + public override bool PreReforge(Item item) { - reforgePrice /= 2; + StealthGenBonus = 1f; + StealthStrikePrefixBonus = 0f; + storedPrefix = item.prefix; return true; } - // Get cash from dickhead goblin fuck + // Ozzatron 31AUG2022: total rework to the reforge rework for mod compatibility + // you can now disable the rework with config in case it isn't enough to solve your conflicts + // removed data saved on items; reforging is now a coalescing flowchart that has no RNG + public override int ChoosePrefix(Item item, UnifiedRandom rand) + { + if (storedPrefix == -1 && item.CanGetRoguePrefix()) + { + // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla + // Negative modifiers have a 66.66% chance of being voided, Annoying modifier is intentionally ignored by vanilla + int prefix = CalamityUtils.RandomRoguePrefix(); + bool keepPrefix = !CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3); + return keepPrefix ? prefix : 0; + } + + if (!CalamityConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1) + return -1; + + // Pick a prefix using the new system. + return CalamityUtils.GetReworkedReforge(item, rand, storedPrefix); + } + public override void PostReforge(Item item) { - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - if (modPlayer.itemTypeLastReforged != item.type) - { - modPlayer.reforgeTierSafety = 0; - modPlayer.finalTierAccessoryReforge = false; - } - - modPlayer.itemTypeLastReforged = item.type; - - if (modPlayer.reforgeTierSafety >= 6) - { - modPlayer.reforgeTierSafety = 0; - modPlayer.finalTierAccessoryReforge = true; - } - - modPlayer.reforgeTierSafety++; - reforgeTier = modPlayer.reforgeTierSafety; - - bool favorited = item.favorited; - item.netDefaults(item.netID); - item.Prefix(NewPrefixType(item)); - - item.Center = Main.LocalPlayer.Center; - item.favorited = favorited; - + storedPrefix = -1; + // Bandit steals 20% of the total price of the reforge if she's around. if (NPC.AnyNPCs(ModContent.NPCType())) { + // Calculate the item's reforge cost. int value = item.value; - ItemLoader.ReforgePrice(item, ref value, ref Main.LocalPlayer.discount); + Player p = Main.LocalPlayer; + ItemLoader.ReforgePrice(item, ref value, ref p.discount); + + // Steal 20% of that money. CalamityWorld.MoneyStolenByBandit += value / 5; + + // Increment the reforge counter to allow the Bandit to refund + // Also triggers Tinkerer dialogue that hints to the player that money is being stolen CalamityWorld.Reforges++; } } @@ -2096,42 +1809,72 @@ namespace CalamityMod.Items public static readonly int Rarity9BuyPrice = Item.buyPrice(0, 80, 0, 0); public static readonly int Rarity10BuyPrice = Item.buyPrice(1, 0, 0, 0); public static readonly int Rarity11BuyPrice = Item.buyPrice(1, 10, 0, 0); - public static readonly int RarityTurquoiseBuyPrice = Item.buyPrice(1, 20, 0, 0); - public static readonly int RarityPureGreenBuyPrice = Item.buyPrice(1, 30, 0, 0); - public static readonly int RarityDarkBlueBuyPrice = Item.buyPrice(1, 40, 0, 0); - public static readonly int RarityVioletBuyPrice = Item.buyPrice(1, 50, 0, 0); - public static readonly int RarityHotPinkBuyPrice = Item.buyPrice(2, 0, 0, 0); - - //These duplicates are for my sanity... public static readonly int Rarity12BuyPrice = Item.buyPrice(1, 20, 0, 0); public static readonly int Rarity13BuyPrice = Item.buyPrice(1, 30, 0, 0); public static readonly int Rarity14BuyPrice = Item.buyPrice(1, 40, 0, 0); public static readonly int Rarity15BuyPrice = Item.buyPrice(1, 50, 0, 0); public static readonly int Rarity16BuyPrice = Item.buyPrice(2, 0, 0, 0); + public static readonly int RarityWhiteBuyPrice = Item.buyPrice(0, 0, 50, 0); + public static readonly int RarityBlueBuyPrice = Item.buyPrice(0, 1, 0, 0); + public static readonly int RarityGreenBuyPrice = Item.buyPrice(0, 2, 0, 0); + public static readonly int RarityOrangeBuyPrice = Item.buyPrice(0, 4, 0, 0); + public static readonly int RarityLightRedBuyPrice = Item.buyPrice(0, 12, 0, 0); + public static readonly int RarityPinkBuyPrice = Item.buyPrice(0, 24, 0, 0); + public static readonly int RarityLightPurpleBuyPrice = Item.buyPrice(0, 36, 0, 0); + public static readonly int RarityLimeBuyPrice = Item.buyPrice(0, 48, 0, 0); + public static readonly int RarityYellowBuyPrice = Item.buyPrice(0, 60, 0, 0); + public static readonly int RarityCyanBuyPrice = Item.buyPrice(0, 80, 0, 0); + public static readonly int RarityRedBuyPrice = Item.buyPrice(1, 0, 0, 0); + public static readonly int RarityPurpleBuyPrice = Item.buyPrice(1, 10, 0, 0); + public static readonly int RarityTurquoiseBuyPrice = Item.buyPrice(1, 20, 0, 0); + public static readonly int RarityPureGreenBuyPrice = Item.buyPrice(1, 30, 0, 0); + public static readonly int RarityDarkBlueBuyPrice = Item.buyPrice(1, 40, 0, 0); + public static readonly int RarityVioletBuyPrice = Item.buyPrice(1, 50, 0, 0); + public static readonly int RarityHotPinkBuyPrice = Item.buyPrice(2, 0, 0, 0); + public static int GetBuyPrice(int rarity) { - return rarity switch + switch (rarity) { - 0 => Rarity0BuyPrice, - 1 => Rarity1BuyPrice, - 2 => Rarity2BuyPrice, - 3 => Rarity3BuyPrice, - 4 => Rarity4BuyPrice, - 5 => Rarity5BuyPrice, - 6 => Rarity6BuyPrice, - 7 => Rarity7BuyPrice, - 8 => Rarity8BuyPrice, - 9 => Rarity9BuyPrice, - 10 => Rarity10BuyPrice, - 11 => Rarity11BuyPrice, - (int)CalamityRarity.Turquoise => RarityTurquoiseBuyPrice, - (int)CalamityRarity.PureGreen => RarityPureGreenBuyPrice, - (int)CalamityRarity.DarkBlue => RarityDarkBlueBuyPrice, - (int)CalamityRarity.Violet => RarityVioletBuyPrice, - (int)CalamityRarity.HotPink => RarityHotPinkBuyPrice, - _ => 0, - }; + case 0: + return Rarity0BuyPrice; + case 1: + return Rarity1BuyPrice; + case 2: + return Rarity2BuyPrice; + case 3: + return Rarity3BuyPrice; + case 4: + return Rarity4BuyPrice; + case 5: + return Rarity5BuyPrice; + case 6: + return Rarity6BuyPrice; + case 7: + return Rarity7BuyPrice; + case 8: + return Rarity8BuyPrice; + case 9: + return Rarity9BuyPrice; + case 10: + return Rarity10BuyPrice; + case 11: + return Rarity11BuyPrice; + } + if (rarity == ModContent.RarityType()) + return RarityTurquoiseBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityPureGreenBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityDarkBlueBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityVioletBuyPrice; + if (rarity == ModContent.RarityType()) + return RarityHotPinkBuyPrice; + + // Return 0 if it's not a progression based or other mod's rarity + return 0; } public static int GetBuyPrice(Item item) diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 177b0e516e..4ee35ad5e9 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -1,14 +1,16 @@ -using CalamityMod.Items.Accessories; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; -using CalamityMod.Items.Placeables.Ores; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -18,72 +20,83 @@ namespace CalamityMod.Items { public override bool InstancePerEntity => false; - // NOTE: this function applies to all right-click-to-open items, even modded ones (despite the name). - // This means it applies to boss bags, crates, lockboxes, herb bags, goodie bags, and presents. - // The internal names of these cases are as follows (TML 0.11 API): - // bossBag, crate, lockBox, herbBag, goodieBag, present - public override void OpenVanillaBag(string context, Player player, int itemID) + #region Modify Item Loot Main Hook + public override void ModifyItemLoot(Item item, ItemLoot loot) { - if (context == "crate") - CrateLoot(player, itemID); - - else if (context == "bossBag") - BossBagLoot(player, itemID); - - // Bat Hook is now acquired from Vampires. - else if (context == "goodieBag") - DropHelper.BlockDrops(ItemID.BatHook); - } - - #region Boss Bags - private static void BossBagLoot(Player player, int itemID) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(itemID); - - // Give a chance for Laudanum, Stress Pills and Heart of Darkness from every boss bag - DropHelper.DropRevBagAccessories(s, player); - - switch (itemID) + Fraction fifteenPercent = new Fraction(15, 100); + static bool CryonicAvailable() { + if (!DownedBossSystem.downedCryogen) + return false; + return (NPC.downedMechBoss1.ToInt() + NPC.downedMechBoss2.ToInt() + NPC.downedMechBoss3.ToInt()) >= 2; + } + + switch (item.type) + { + #region Boss Treasure Bags case ItemID.KingSlimeBossBag: - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + loot.Add(new CommonDrop(ModContent.ItemType(), 10)); // 10% Crown Jewel + loot.AddRevBagAccessories(); break; case ItemID.EyeOfCthulhuBossBag: - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); // 33% Deathstare Rod + loot.Add(ModContent.ItemType(), 10); // 10% Teardrop Cleaver + loot.AddRevBagAccessories(); break; + // On Rev+, Eater of Worlds segments don't drop partial loot. As such, the bag needs to drop all materials. + // This can theoretically be exploited by killing the boss on Expert, then turning on Rev to open the bags. + // We don't care. case ItemID.EaterOfWorldsBossBag: - DropHelper.DropItemCondition(s, player, ItemID.ShadowScale, CalamityWorld.revenge, 60, 120); - DropHelper.DropItemCondition(s, player, ItemID.DemoniteOre, CalamityWorld.revenge, 120, 240); + var eowRevLCR = loot.DefineConditionalDropSet(DropHelper.If(() => CalamityWorld.revenge)); + eowRevLCR.Add(ItemID.DemoniteOre, 1, 120, 240); // 100% 120-240 Demonite Ore + eowRevLCR.Add(ItemID.ShadowScale, 1, 60, 120); // 100% 60-120 Shadow Scale + loot.AddRevBagAccessories(); break; + + // On Rev+, Brain of Cthulhu's Creepers don't drop partial loot. As such, the bag needs to drop all materials. + // This can theoretically be exploited by killing the boss on Expert, then turning on Rev to open the bags. + // We don't care. case ItemID.BrainOfCthulhuBossBag: - DropHelper.DropItemCondition(s, player, ItemID.TissueSample, CalamityWorld.revenge, 60, 120); - DropHelper.DropItemCondition(s, player, ItemID.CrimtaneOre, CalamityWorld.revenge, 100, 180); + var bocRevLCR = loot.DefineConditionalDropSet(DropHelper.If(() => CalamityWorld.revenge)); + bocRevLCR.Add(ItemID.CrimtaneOre, 1, 100, 180); // 100% 100-180 Crimtane Ore + bocRevLCR.Add(ItemID.TissueSample, 1, 60, 120); // 100% 60-120 Tissue Sample + loot.AddRevBagAccessories(); + break; + + case ItemID.DeerclopsBossBag: + loot.Remove(FindDeerclopsWeapons(loot)); + int[] deerclopsWeapons = new int[] + { + ItemID.LucyTheAxe, + ItemID.PewMaticHorn, + ItemID.WeatherPain, + ItemID.HoundiusShootius + }; + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, deerclopsWeapons)); + loot.AddRevBagAccessories(); break; case ItemID.QueenBeeBossBag: - // Drop weapons Calamity style instead of mutually exclusive. + loot.Remove(FindQueenBeeWeapons(loot)); int[] queenBeeWeapons = new int[] { ItemID.BeeKeeper, ItemID.BeesKnees, ItemID.BeeGun }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, queenBeeWeapons); - DropHelper.BlockDrops(queenBeeWeapons); - - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - - DropHelper.DropItem(s, player, ItemID.Stinger, 8, 12); // Extra stingers - DropHelper.DropItem(s, player, ModContent.ItemType(), 50, 75); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, queenBeeWeapons)); + loot.Add(ModContent.ItemType(), 10); // 10% The Bee + loot.Add(ItemID.Stinger, 1, 8, 12); // 100% 8-12 Stinger + loot.Add(ModContent.ItemType(), 1, 50, 75); // 100% 50-75 Hardened Honeycomb + loot.AddRevBagAccessories(); break; case ItemID.WallOfFleshBossBag: - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + loot.Remove(FindWallOfFleshWeapons(loot)); + loot.Remove(FindWallOfFleshEmblems(loot)); int[] wofWeapons = new int[] { ItemID.BreakerBlade, @@ -91,14 +104,12 @@ namespace CalamityMod.Items ModContent.ItemType(), ItemID.LaserRifle, ModContent.ItemType(), + ItemID.FireWhip, // Firecracker ModContent.ItemType() }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, wofWeapons); - DropHelper.BlockDrops(wofWeapons); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, wofWeapons)); + loot.Add(ModContent.ItemType(), 10); // 10% Carnage - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - - // Drop emblems Calamity style instead of mutually exclusive -- this includes the Rogue Emblem. int[] emblems = new int[] { ItemID.WarriorEmblem, @@ -107,34 +118,36 @@ namespace CalamityMod.Items ItemID.SummonerEmblem, ModContent.ItemType(), }; - DropHelper.DropEntireSet(s, player, 0.25f, emblems); - DropHelper.BlockDrops(emblems); + loot.Add(DropHelper.CalamityStyle(new Fraction(1, 4), emblems)); // Emblems remain 25% + loot.AddRevBagAccessories(); + break; + + case ItemID.QueenSlimeBossBag: + loot.Add(ItemID.SoulofLight, 1, 15, 20); // 100% 15-20 Soul of Light + loot.AddRevBagAccessories(); break; case ItemID.DestroyerBossBag: - // Only drop hallowed bars after all mechs are down. - if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) - DropHelper.BlockDrops(ItemID.HallowedBar); - + loot.Remove(FindHallowedBars(loot)); + loot.AddIf(DropHelper.HallowedBarsCondition, ItemID.HallowedBar, 1, 20, 35); + loot.AddRevBagAccessories(); break; case ItemID.TwinsBossBag: - // Only drop hallowed bars after all mechs are down. - if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) - DropHelper.BlockDrops(ItemID.HallowedBar); - - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + loot.Remove(FindHallowedBars(loot)); + loot.AddIf(DropHelper.HallowedBarsCondition, ItemID.HallowedBar, 1, 20, 35); + loot.Add(ModContent.ItemType(), 10); // 10% Arbalest + loot.AddRevBagAccessories(); break; case ItemID.SkeletronPrimeBossBag: - // Only drop hallowed bars after all mechs are down. - if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) - DropHelper.BlockDrops(ItemID.HallowedBar); - + loot.Remove(FindHallowedBars(loot)); + loot.AddIf(DropHelper.HallowedBarsCondition, ItemID.HallowedBar, 1, 20, 35); + loot.AddRevBagAccessories(); break; case ItemID.PlanteraBossBag: - // Drop weapons Calamity style instead of mutually exclusive. + loot.Remove(FindPlanteraWeapons(loot)); int[] planteraWeapons = new int[] { ItemID.FlowerPow, @@ -143,34 +156,17 @@ namespace CalamityMod.Items ItemID.VenusMagnum, ItemID.LeafBlower, ItemID.NettleBurst, - ItemID.WaspGun, - ModContent.ItemType() + ItemID.WaspGun }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, planteraWeapons); - DropHelper.BlockDrops(planteraWeapons); - - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - - DropHelper.DropItem(s, player, ModContent.ItemType(), 16, 22); - break; - - case ItemID.FairyQueenBossBag: - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. - int[] empressWeapons = new int[] - { - ItemID.FairyQueenMagicItem, - ItemID.FairyQueenRangedItem, - ItemID.EmpressBlade, - ItemID.RainbowWhip, - ItemID.PiercingStarlight, - ItemID.RainbowWings - }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, empressWeapons); - DropHelper.BlockDrops(empressWeapons); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, planteraWeapons)); + loot.Add(ModContent.ItemType(), 10); // 10% Blossom Flux + loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + loot.Add(ModContent.ItemType(), 1, 30, 35); + loot.AddRevBagAccessories(); break; case ItemID.GolemBossBag: - // Drop loot Calamity style instead of mutually exclusive. + loot.Remove(FindGolemItems(loot)); int[] golemItems = new int[] { ItemID.GolemFist, @@ -181,15 +177,14 @@ namespace CalamityMod.Items ItemID.EyeoftheGolem, ItemID.SunStone }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, golemItems); - DropHelper.BlockDrops(golemItems); - - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - DropHelper.DropItem(s, player, ModContent.ItemType(), 8, 13); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, golemItems)); + loot.Add(ModContent.ItemType(), 10); // 10% Aegis Blade + loot.Add(ModContent.ItemType(), 1, 8, 13); // 100% 8-13 Essence of Sunlight + loot.AddRevBagAccessories(); break; case ItemID.BossBagBetsy: - // Drop weapons Calamity style instead of mutually exclusive. + loot.Remove(FindBetsyWeapons(loot)); int[] betsyWeapons = new int[] { ItemID.DD2SquireBetsySword, // Flying Dragon @@ -197,37 +192,50 @@ namespace CalamityMod.Items ItemID.DD2BetsyBow, // Aerial Bane ItemID.ApprenticeStaffT3, // Betsy's Wrath }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, betsyWeapons); - DropHelper.BlockDrops(betsyWeapons); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, betsyWeapons)); break; case ItemID.FishronBossBag: - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. - int[] dukeWeapons = new int[] + RemoveDukeRules(loot); // Separately remove Duke's weapons and wings, because they're both included below + int[] dukeItems = new int[] { ItemID.Flairon, ItemID.Tsunami, ItemID.BubbleGun, ItemID.RazorbladeTyphoon, ItemID.TempestStaff, - ItemID.FishronWings, - ModContent.ItemType() + ModContent.ItemType(), + ItemID.FishronWings, // Duke's wings have a pathetically low drop rate. }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, dukeWeapons); - DropHelper.BlockDrops(dukeWeapons); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, dukeItems)); + loot.Add(ModContent.ItemType(), 10); // 10% Briny Baron + loot.AddRevBagAccessories(); + break; - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + case ItemID.FairyQueenBossBag: + RemoveEmpressRules(loot); // Separately remove EoL's weapons and wings, because they're both included below + int[] empressItems = new int[] + { + ItemID.PiercingStarlight, // Starlight + ItemID.FairyQueenRangedItem, // Eventide + ItemID.FairyQueenMagicItem, // Nightglow + ItemID.SparkleGuitar, // Stellar Tune + ItemID.EmpressBlade, // Terraprisma + ItemID.RainbowWhip, // Kaleidoscope + ItemID.RainbowWings, // Empress Wings have a pathetically low drop rate. + }; + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, empressItems)); + loot.AddRevBagAccessories(); break; case ItemID.MoonLordBossBag: - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + loot.Remove(FindMoonLordWeapons(loot)); int[] moonLordWeapons = new int[] { ItemID.Meowmere, ItemID.StarWrath, ItemID.Terrarian, - ItemID.FireworksLauncher, // Celebration - ItemID.Celeb2, + ItemID.Celeb2, // Celebration Mk II ItemID.SDMG, ItemID.LastPrism, ItemID.LunarFlareBook, @@ -235,156 +243,287 @@ namespace CalamityMod.Items ItemID.RainbowCrystalStaff, ModContent.ItemType(), }; - DropHelper.DropEntireSet(s, player, DropHelper.BagWeaponDropRateInt, moonLordWeapons); - DropHelper.BlockDrops(moonLordWeapons); + loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, moonLordWeapons)); + loot.AddRevBagAccessories(); - // The Celestial Onion only drops if the player hasn't used one and doesn't have one in their inventory. - int celestialOnion = ModContent.ItemType(); - DropHelper.DropItemCondition(s, player, celestialOnion, !player.Calamity().extraAccessoryML && !player.InventoryHas(celestialOnion)); + // The Celestial Onion only drops if the player hasn't used one. + loot.AddIf((info) => !info.player.Calamity().extraAccessoryML, ModContent.ItemType()); break; - } - } - #endregion + #endregion - #region Fishing Crates - private static void CrateLoot(Player player, int itemID) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(itemID); - - switch (itemID) - { + #region Fishing Crates + // TODO -- What is all this shit? case ItemID.WoodenCrate: case ItemID.WoodenCrateHard: - BlockCrateDrops(); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.25f, 3, 5); + loot.Add(ModContent.ItemType(), 4, 3, 5); // 25% 3-5 Wulfrum Scrap break; case ItemID.IronCrate: case ItemID.IronCrateHard: - BlockCrateDrops(); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.25f, 5, 8); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.25f, 5, 8); + loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Wulfrum Scrap + loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Ancient Bone Dust break; + // these drops are not available in hardmode because this crate will stop dropping case ItemID.GoldenCrate: - BlockCrateDrops(); - DropHelper.DropItemChance(s, player, ItemID.FlareGun, 0.1f, 1, 1); - DropHelper.DropItemChance(s, player, ItemID.ShoeSpikes, 0.1f, 1, 1); - DropHelper.DropItemChance(s, player, ItemID.BandofRegeneration, 0.1f, 1, 1); + loot.Add(ItemID.FlareGun, 10); // 10% Flare Gun + loot.Add(ItemID.ShoeSpikes, 10); // 10% Shoe Spikes (BUT NOT CLIMBING CLAWS?) + loot.Add(ItemID.BandofRegeneration, 10); // 10% Band of Regeneration break; - //This is Titanium Crate, apparently. case ItemID.GoldenCrateHard: - BlockCrateDrops(); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedYharon, 0.15f, 30, 40); + // Post-Yharon: 15% 30-40 Auric Ore + loot.AddIf(() => DownedBossSystem.downedYharon, ModContent.ItemType(), fifteenPercent, 30, 40); break; case ItemID.CorruptFishingCrate: case ItemID.CrimsonFishingCrate: case ItemID.CorruptFishingCrateHard: case ItemID.CrimsonFishingCrateHard: - BlockCrateDrops(); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.15f, 5, 8); + loot.Add(ModContent.ItemType(), fifteenPercent, 5, 8); // 15% 5-8 Blighted Gel break; - case ItemID.HallowedFishingCrate: + case ItemID.HallowedFishingCrate: // WHY case ItemID.HallowedFishingCrateHard: - BlockCrateDrops(); - int potion = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 0.15f, 5, 10); - DropHelper.DropItemCondition(s, player, potion, DownedBossSystem.downedProvidence, 0.1f, 1, 2); + var postProv = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); + postProv.Add(ModContent.ItemType(), fifteenPercent, 5, 10); // 15% 5-10 Unholy Essence + postProv.Add(ModContent.ItemType(), fifteenPercent, 1, 2); // 15% 1-2 Holy Wrath Potion + postProv.Add(ModContent.ItemType(), fifteenPercent, 1, 2); // 15% 1-2 Profaned Rage Potion break; case ItemID.DungeonFishingCrate: case ItemID.DungeonFishingCrateHard: - BlockCrateDrops(); - DropHelper.DropItemCondition(s, player, ItemID.Ectoplasm, NPC.downedPlantBoss, 0.1f, 1, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 0.1f, 1, 5); + loot.AddIf(() => NPC.downedPlantBoss, ItemID.Ectoplasm, 10, 1, 5); // 10% 1-5 Ectoplasm + loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Phantoplasm break; case ItemID.JungleFishingCrate: case ItemID.JungleFishingCrateHard: - BlockCrateDrops(); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.2f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(s, player, ItemID.ChlorophyteOre, DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, 0.2f, 16, 28); - DropHelper.DropItemCondition(s, player, ItemID.ChlorophyteBar, DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, 0.15f, 4, 7); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedPlantBoss, 0.2f, 16, 28); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedPlantBoss, 0.15f, 4, 7); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 3, 6); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 0.2f, 16, 28); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 0.15f, 4, 7); + loot.Add(ModContent.ItemType(), new Fraction(1, 5), 1, 3); // 20% 1-3 Murky Paste + var postPlant = loot.DefineConditionalDropSet(() => NPC.downedPlantBoss); + postPlant.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Perennial Ore + postPlant.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Perennial Bar + loot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 5, 3, 6); // 20% 3-6 Plague Cell Canister + var uelibloom = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); + uelibloom.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Uelibloom Ore + uelibloom.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Uelibloom Bar break; case ItemID.FloatingIslandFishingCrate: case ItemID.FloatingIslandFishingCrateHard: - BlockCrateDrops(); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator, 0.2f, 16, 28); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator, 0.15f, 4, 7); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedMoonlord, 0.1f, 1, 3); + var evilBossTwo = loot.DefineConditionalDropSet(() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator); + evilBossTwo.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Aerialite Ore + evilBossTwo.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Aerialite Bar + loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Sunlight break; case ItemID.FrozenCrate: case ItemID.FrozenCrateHard: - BlockCrateDrops(); - int numMechsDown = NPC.downedMechBoss1.ToInt() + NPC.downedMechBoss2.ToInt() + NPC.downedMechBoss3.ToInt(); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCryogen && numMechsDown >= 2, 0.2f, 16, 28); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCryogen && numMechsDown >= 2, 0.15f, 4, 7); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); + var cryonic = loot.DefineConditionalDropSet(CryonicAvailable); + cryonic.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Cryonic Ore + cryonic.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Cryonic Bar + loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Eleum break; case ItemID.LavaCrate: case ItemID.LavaCrateHard: - BlockCrateDrops(); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); + loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Chaos break; + // Calamity does not touch Oasis Crates yet case ItemID.OasisCrate: case ItemID.OasisCrateHard: - BlockCrateDrops(); break; + // Calamity does not touch Ocean Crates yet case ItemID.OceanCrate: case ItemID.OceanCrateHard: - BlockCrateDrops(); break; + #endregion + + #region Miscellaneous + // Bat Hook is now acquired from Vampires. + case ItemID.GoodieBag: + RemoveBatHookFromGoodieBag(loot); + break; + #endregion } } + #endregion - private static void BlockCrateDrops() + #region Calamity Style Items From Bosses + private static IItemDropRule FindDeerclopsWeapons(ItemLoot loot) { - bool twoMechsDowned = - (NPC.downedMechBoss1 && NPC.downedMechBoss2) || - (NPC.downedMechBoss2 && NPC.downedMechBoss3) || - (NPC.downedMechBoss3 && NPC.downedMechBoss1); - int[] preMechBlockedDrops_Crate = new int[] - { - ItemID.MythrilOre, - ItemID.OrichalcumOre, - ItemID.AdamantiteOre, - ItemID.TitaniumOre, - ItemID.MythrilBar, - ItemID.OrichalcumBar, - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; - int[] postOneMechBlockedDrops_Crate = new int[] - { - ItemID.AdamantiteOre, - ItemID.TitaniumOre, - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) - { - if (!NPC.downedMechBossAny) - DropHelper.BlockDrops(preMechBlockedDrops_Crate); - else if (!twoMechsDowned) - DropHelper.BlockDrops(postOneMechBlockedDrops_Crate); - } + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.LucyTheAxe) + return o; + return null; + } + + private static IItemDropRule FindQueenBeeWeapons(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.BeeKeeper) + return o; + return null; + } + + private static IItemDropRule FindWallOfFleshWeapons(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.BreakerBlade) + return o; + return null; + } + + private static IItemDropRule FindWallOfFleshEmblems(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.WarriorEmblem) + return o; + return null; + } + + private static IItemDropRule FindHallowedBars(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is CommonDrop c && c.itemId == ItemID.HallowedBar) + return c; + return null; + } + + private static IItemDropRule FindPlanteraWeapons(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromRulesRule o) + foreach (IItemDropRule r2 in o.options) + // Specifically look up the Grenade Launcher because it has unique rules for its ammo. + if (r2 is CommonDrop c && c.itemId == ItemID.GrenadeLauncher) + return o; + return null; + } + + private static IItemDropRule FindGolemItems(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromRulesRule o) + foreach (IItemDropRule r2 in o.options) + // Specifically look up the Stynger because it has unique rules for its ammo. + if (r2 is CommonDrop c && c.itemId == ItemID.Stynger) + return o; + return null; + } + + private static IItemDropRule FindBetsyWeapons(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.DD2SquireBetsySword) // Flying Dragon + return o; + return null; + } + + private static void RemoveDukeRules(ItemLoot loot) + { + List rules = loot.Get(false); + IItemDropRule toRemove = null; + + // Step 1: Remove Fishron Wings loot rule + foreach (IItemDropRule rule in rules) + if (rule is CommonDropNotScalingWithLuck c && c.itemId == ItemID.FishronWings) + toRemove = c; + + if (toRemove is not null) + loot.Remove(toRemove); + + // Step 2: Remove Fishron's weapons + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.Flairon) + toRemove = o; + + if (toRemove is not null) + loot.Remove(toRemove); + } + + private static void RemoveEmpressRules(ItemLoot loot) + { + List rules = loot.Get(false); + IItemDropRule toRemove = null; + + // Step 1: Remove Empress Wings loot rule + foreach (IItemDropRule rule in rules) + if (rule is CommonDropNotScalingWithLuck c && c.itemId == ItemID.RainbowWings) + toRemove = c; + + if (toRemove is not null) + loot.Remove(toRemove); + + // Step 2: Remove Empress of Light's weapons + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.PiercingStarlight) + toRemove = o; + + if (toRemove is not null) + loot.Remove(toRemove); + + // Step 3: Remove Stellar Tune + foreach (IItemDropRule rule in rules) + if (rule is CommonDropNotScalingWithLuck c && c.itemId == ItemID.SparkleGuitar) + toRemove = c; + + if (toRemove is not null) + loot.Remove(toRemove); + } + + private static IItemDropRule FindMoonLordWeapons(ItemLoot loot) + { + List rules = loot.Get(false); + foreach (IItemDropRule rule in rules) + if (rule is OneFromOptionsNotScaledWithLuckDropRule o) + foreach (int itemID in o.dropIds) + if (itemID == ItemID.Terrarian) + return o; + return null; + } + #endregion + + #region Goodie Bag Bat Hook + private static void RemoveBatHookFromGoodieBag(ItemLoot loot) + { + List rules = loot.Get(false); + SequentialRulesNotScalingWithLuckRule rule1 = null; + foreach (IItemDropRule rule in rules) + if (rule is SequentialRulesNotScalingWithLuckRule s) + rule1 = s; + if (rule1 is null) + return; + foreach (IItemDropRule rule in rule1.rules) + if (rule is CommonDropNotScalingWithLuck rule2 && rule2.itemId == ItemID.BatHook) + { + rule2.chanceNumerator = 0; + rule2.chanceDenominator = 1; + } } #endregion } diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index e5cc962c50..54349a14a3 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -48,6 +48,9 @@ namespace CalamityMod.Items tooltips.Add(line); } + // If the item has a stealth strike damage prefix, show that on the tooltip. + StealthWeaponTooltip(item, tooltips); + // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the // tooltip list. EnchantmentTooltips(item, tooltips); @@ -74,7 +77,7 @@ namespace CalamityMod.Items } if (devItem) { - TooltipLine line = new TooltipLine(Mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.HotPinkRarityColor)); + TooltipLine line = new TooltipLine(Mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.DevItemColor)); tooltips.Add(line); } } @@ -83,11 +86,6 @@ namespace CalamityMod.Items #region Rarity Coloration private void ApplyRarityColor(Item item, TooltipLine nameLine) { - // Apply standard post-ML rarities to the item's color first. - Color? standardRarityColor = CalamityUtils.GetRarityColor(customRarity); - if (!item.expert && standardRarityColor.HasValue) - nameLine.OverrideColor = standardRarityColor.Value; - #region Uniquely Colored Developer Items if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, 100, 255); @@ -237,6 +235,10 @@ namespace CalamityMod.Items // For items such as a Copper Helmet which literally have no tooltips at all, add a custom "Tooltip0" which mimics the vanilla Tooltip0. void AddTooltip(string text) { + // Don't add the tooltip if the item is in a social slot + if (item.social) + return; + int defenseIndex = -1; for (int i = 0; i < tooltips.Count; ++i) if (tooltips[i].Name == "Defense") @@ -255,20 +257,10 @@ namespace CalamityMod.Items if (item.type == ItemID.GelBalloon) EditTooltipByNum(0, (line) => line.Text = ""); - // Teleporters not working while a boss is alive. - if (item.type == ItemID.Teleporter) - EditTooltipByName("Placeable", (line) => line.Text += "\nCannot be used while a boss is alive"); - // Flesh Knuckles giving extra max life. if (item.type == ItemID.FleshKnuckles || item.type == ItemID.HeroShield || item.type == ItemID.BerserkerGlove) EditTooltipByNum(0, (line) => line.Text += "\nMax life increased by 45"); - // Mirrors and Recall Potions cannot be used while a boss is alive. - if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) - ApplyTooltipEdits(tooltips, - (i, l) => l.Mod == "Terraria" && l.Name == (i.type == ItemID.CellPhone ? "Tooltip1" : "Tooltip0"), - (line) => line.Text += "\nCannot be used while you have the Boss Effects buff"); - // Rod of Discord cannot be used multiple times to hurt yourself if (item.type == ItemID.RodofDiscord) EditTooltipByNum(0, (line) => line.Text += "\nTeleportation is disabled while Chaos State is active"); @@ -286,7 +278,7 @@ namespace CalamityMod.Items // If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) - EditTooltipByNum(0, (line) => line.Text += "\nDemon Altars now provide Souls of Night instead of generating ores when destroyed" + + EditTooltipByNum(0, (line) => line.Text += "\nDemon Altars now drop Souls of Night instead of generating ores when destroyed" + "\nHardmode ores now generate after defeating Mechanical Bosses for the first time"); // Bottled Honey gives the Honey buff @@ -319,10 +311,6 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text += extraLine); } - // Invisibility Potion provides various rogue boosts - if (item.type == ItemID.InvisibilityPotion) - EditTooltipByNum(0, (line) => line.Text += "\nBoosts various rogue stats depending on held weapon"); - // Golden Fishing Rod inherently contains High Test Fishing Line if (item.type == ItemID.GoldenFishingRod) EditTooltipByName("NeedsBait", (line) => line.Text += "\nIts fishing line will never break"); @@ -339,6 +327,17 @@ namespace CalamityMod.Items // Due to the higher complexity of the action, the actual logic is delegated to its own method. // I think this fits the miscellaneous category? Not seeing anything like this elsewhere. - Tomat EditTooltipByName("Speed", (line) => RedistributeSpeedTooltips(item, line)); + + if (item.type == ItemID.SpaceGun) + { + int cost = (int)(item.mana * Main.LocalPlayer.manaCost * 0.5f); + EditTooltipByName("UseMana", (line) => line.Text = $"Uses {cost} mana"); + } + if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotBonus != 1f) + { + int healAmt = (int)(item.healLife * Main.LocalPlayer.Calamity().healingPotBonus); + EditTooltipByName("HealLife", (line) => line.Text = $"Restores {healAmt} life"); + } #endregion // For boss summon item clarity @@ -465,6 +464,15 @@ namespace CalamityMod.Items if (item.type == ItemID.DeathSickle) EditTooltipByNum(0, (line) => line.Text += "\nInflicts Whispering Death on hit"); + + if (item.type == ItemID.StarWrath || item.type == ItemID.NorthPole || item.type == ItemID.PsychoKnife) + EditTooltipByNum(0, (line) => line.Text += "\nReceives 33% benefit from melee speed bonuses"); + + if (item.type == ItemID.FetidBaghnakhs) + EditTooltipByName("Knockback", (line) => line.Text += "\nReceives 25% benefit from melee speed bonuses"); + + if (item.type == ItemID.BladedGlove) + EditTooltipByName("Knockback", (line) => line.Text += "\nReceives 50% benefit from melee speed bonuses"); #endregion // Light pets, accessories, and other items which boost the player's Abyss light stat @@ -473,9 +481,10 @@ namespace CalamityMod.Items // +1 to Abyss light level string abyssSmallLightLine = "\nProvides a small amount of light in the abyss"; - if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace || item.type == ItemID.MiningHelmet) + if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace || + item.type == ItemID.MiningHelmet || item.type == ItemID.UltrabrightHelmet) EditTooltipByNum(0, (line) => line.Text += abyssSmallLightLine); - if (item.type == ItemID.JellyfishDivingGear) + if (item.type == ItemID.JellyfishDivingGear || item.type == ItemID.Magiluminescence) EditTooltipByNum(1, (line) => line.Text += abyssSmallLightLine); // +2 to Abyss light level @@ -490,7 +499,7 @@ namespace CalamityMod.Items // +3 to Abyss light level string abyssLargeLightLine = "\nProvides a large amount of light in the abyss"; - if (item.type == ItemID.WispinaBottle) + if (item.type == ItemID.WispinaBottle || item.type == ItemID.PumpkingPetItem || item.type == ItemID.GolemPetItem || item.type == ItemID.FairyQueenPetItem) EditTooltipByNum(0, (line) => line.Text += abyssLargeLightLine); if (item.type == ItemID.SuspiciousLookingTentacle) EditTooltipByNum(1, (line) => line.Text += abyssLargeLightLine); @@ -581,11 +590,12 @@ namespace CalamityMod.Items // Arcane and Magnet Flower buffs. if (item.type == ItemID.ArcaneFlower || item.type == ItemID.MagnetFlower) - EditTooltipByNum(0, (line) => line.Text = "20% reduced mana usage"); + EditTooltipByNum(0, (line) => line.Text = "12% reduced mana usage"); // Magiluminescence nerf and clear explanation of what it actually does. if (item.type == ItemID.Magiluminescence) - EditTooltipByNum(0, (line) => line.Text = "Increases movement acceleration and deceleration by 1.25x"); + EditTooltipByNum(0, (line) => line.Text = "Increases movement acceleration and deceleration by 1.25x\n" + + "Increases movement speed by 1.05x. This bonus applies to running boot accessories"); // Soaring Insignia nerf and clear explanation of what it actually does. if (item.type == ItemID.EmpressFlightBooster) @@ -639,6 +649,9 @@ namespace CalamityMod.Items if (item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaWaders || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose) EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); + if (item.type == ItemID.TerrasparkBoots) + EditTooltipByNum(3, (line) => line.Text += "\nImmunity to the On Fire! debuff"); + // IT'S HELLFIRE!!! if (item.type == ItemID.MagmaStone || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("fire damage", "Hellfire")); @@ -797,11 +810,9 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text = "Increases your max number of sentries by 2\n" + "10% increased melee and minion damage"); if (item.type == ItemID.MonkAltShirt) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee speed\n" + - "5% increased melee critical strike chance"); + EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee speed"); if (item.type == ItemID.MonkAltPants) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee critical strike chance\n" + - "30% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee critical strike chance"); // Red Riding armor if (item.type == ItemID.HuntressAltShirt) @@ -809,8 +820,7 @@ namespace CalamityMod.Items // Dark Artist armor if (item.type == ItemID.ApprenticeAltPants) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and magic critical strike chance\n" + - "20% increased movement speed"); + EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and magic critical strike chance"); #endregion // Non-consumable boss summon items @@ -828,7 +838,8 @@ namespace CalamityMod.Items if (item.type == ItemID.Picksaw) EditTooltipByNum(0, (line) => line.Text += "\nCan mine Scoria Ore located in the Abyss"); - if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe) + if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe + || item.type == ItemID.SolarFlareDrill || item.type == ItemID.VortexDrill || item.type == ItemID.NebulaDrill || item.type == ItemID.StardustDrill) EditTooltipByName("Knockback", (line) => line.Text += "\nCan mine Uelibloom Ore"); #endregion @@ -1107,11 +1118,54 @@ namespace CalamityMod.Items float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; if (stealthGenBoost > 0) { + TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Expert"); + if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); + TooltipLine StealthGen = new TooltipLine(Mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") { IsModifier = true }; - tooltips.Add(StealthGen); + + if (line == null) + tooltips.Add(StealthGen); + else + tooltips.Insert(tooltips.IndexOf(line), StealthGen); + } + } + #endregion + + #region Stealth Strike Damage Prefix Weapon Tooltip + private void StealthWeaponTooltip(Item item, IList tooltips) + { + if (!item.CountsAsClass() || item.accessory || item.prefix <= 0) + return; + + float stealthDmgBonus = item.Calamity().StealthStrikePrefixBonus - 1f; + if (stealthDmgBonus > 0) + { + TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixShootSpeed"); + if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixCritChance"); + else if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixSpeed"); + else if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixDamage"); + TooltipLine line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Expert"); + if (line2 == null) + line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); + + TooltipLine StealthDmg = new TooltipLine(Mod, "PrefixStealthDamageBoost", "+" + Math.Round(stealthDmgBonus * 100f) + "% stealth strike damage") + { + IsModifier = true + }; + + // If price/expert line doesn't exist, just add it to the end + if (line2 == null) + tooltips.Add(StealthDmg); + // Otherwise, insert it right before the sell price (or expert line) + else + tooltips.Insert(tooltips.IndexOf(line2), StealthDmg); } } #endregion diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 493ad9c6f4..382035d30e 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -38,9 +38,11 @@ namespace CalamityMod.Items { ItemID.AdamantiteSword, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(77)) }, { ItemID.AdamantiteWaraxe, Do(AxePower(160), UseTimeExact(10), TileBoostExact(+1)) }, { ItemID.Amarok, autoReuse }, - { ItemID.AmberStaff, Do(DamageExact(19), UseTimeExact(15), UseAnimationExact(40)) }, + { ItemID.AmberStaff, Do(UseTimeExact(15), UseAnimationExact(45), ReuseDelayExact(10)) }, { ItemID.AmethystStaff, Do(ManaExact(2)) }, { ItemID.Anchor, Do(DamageExact(107), UseExact(30)) }, + { ItemID.AncientHallowedGreaves, Do(DefenseDelta(+2)) }, + { ItemID.AncientHallowedPlateMail, Do(DefenseDelta(+3)) }, { ItemID.AnkhShield, Do(DefenseDelta(+8)) }, { ItemID.AntlionClaw, Do(ScaleRatio(1.5f), DamageRatio(1.5f), UseExact(14)) }, { ItemID.AquaScepter, Do(DamageExact(21), ShootSpeedExact(25f)) }, @@ -49,7 +51,7 @@ namespace CalamityMod.Items { ItemID.Bananarang, Do(DamageExact(98), UseExact(14)) }, { ItemID.BatBat, autoReuse }, { ItemID.BatScepter, Do(DamageExact(56)) }, - { ItemID.BeamSword, Do(AutoReuse, DamageExact(360), UseAnimationExact(60), ShootSpeedExact(23f)) }, + { ItemID.BeamSword, Do(AutoReuse, UseMeleeSpeed, DamageExact(360), UseAnimationExact(60), ShootSpeedExact(23f)) }, { ItemID.BeeGun, Do(DamageExact(11)) }, { ItemID.BeeKeeper, Do(UseTurn, ScaleRatio(1.5f), DamageExact(60)) }, { ItemID.BeesKnees, Do(PointBlank, DamageExact(18), UseExact(38)) }, @@ -96,15 +98,16 @@ namespace CalamityMod.Items { ItemID.Chik, autoReuse }, { ItemID.ChlorophyteArrow, Do(DamageRatio(1.1f)) }, { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), TileBoostExact(+0)) }, + { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed) }, { ItemID.ChlorophyteDrill, Do(TrueMeleeNoSpeed, PickPower(200), UseTimeExact(4), TileBoostExact(+2)) }, { ItemID.ChlorophyteGreataxe, Do(AxePower(165), UseTimeExact(7), TileBoostExact(+2)) }, { ItemID.ChlorophyteJackhammer, Do(TrueMeleeNoSpeed, HammerPower(90), UseTimeExact(5), TileBoostExact(+0)) }, - { ItemID.ChlorophytePartisan, Do(AutoReuse, UseRatio(0.8f), DamageExact(100)) }, + { ItemID.ChlorophytePartisan, Do(AutoReuse, UseMeleeSpeed, UseRatio(0.8f), DamageExact(100)) }, { ItemID.ChlorophytePickaxe, Do(PickPower(200), UseTimeExact(7), TileBoostExact(+2)) }, - { ItemID.ChlorophyteSaber, Do(DamageExact(80), UseExact(10)) }, + { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(80), UseExact(10)) }, { ItemID.ChlorophyteShotbow, Do(PointBlank, DamageExact(80), UseExact(50)) }, { ItemID.ChlorophyteWarhammer, Do(HammerPower(90), UseTimeExact(8), TileBoostExact(+2)) }, - { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, DamageExact(114)) }, + { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(114)) }, { ItemID.ClingerStaff, Do(DamageExact(118)) }, { ItemID.ClockworkAssaultRifle, Do(PointBlank, DamageExact(21)) }, { ItemID.CobaltBreastplate, Do(DefenseDelta(+3)) }, @@ -128,14 +131,12 @@ namespace CalamityMod.Items { ItemID.CopperBroadsword, Do(AutoReuse, UseTurn) }, { ItemID.CopperHammer, Do(HammerPower(35), UseTimeExact(12), TileBoostExact(+0)) }, { ItemID.CopperPickaxe, Do(PickPower(35), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.CopperShortsword, autoReuse }, + { ItemID.CopperShortsword, Do(AutoReuse, TrueMelee) }, { ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(27)) }, { ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(30)) }, { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, { ItemID.CrystalStorm, Do(DamageExact(40))}, - // Vanilla 1.4 buffed Crystal Vile Shard pretty hard: base damage 19 -> 25 and ignores 10 defense. This shouldn't be needed anymore. - // { ItemID.CrystalVileShard, Do(DamageRatio(1.33f)) }, { ItemID.CursedArrow, Do(DamageRatio(1.1f)) }, { ItemID.CursedBullet, Do(DamageExact(16)) }, { ItemID.CursedDart, Do(DamageExact(25)) }, @@ -149,24 +150,25 @@ namespace CalamityMod.Items { ItemID.DartRifle, Do(PointBlank, DamageExact(58)) }, // if Daybreak still needs a buff after the 1.4 explosion change, apply it here // { ItemID.DayBreak, Do(DamageRatio(1.0f)) } - { ItemID.DD2BallistraTowerT1Popper, Do(UseExact(30)) }, // Ballista Tier 1 - { ItemID.DD2BallistraTowerT2Popper, Do(UseExact(25)) }, // Ballista Tier 2 - { ItemID.DD2BallistraTowerT3Popper, Do(UseExact(20)) }, // Ballista Tier 3 + { ItemID.DD2BallistraTowerT1Popper, Do(AutoReuse, UseExact(30)) }, // Ballista Tier 1 + { ItemID.DD2BallistraTowerT2Popper, Do(AutoReuse, UseExact(25)) }, // Ballista Tier 2 + { ItemID.DD2BallistraTowerT3Popper, Do(AutoReuse, UseExact(20)) }, // Ballista Tier 3 { ItemID.DD2BetsyBow, Do(DamageRatio(1.1f)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that - { ItemID.DD2ExplosiveTrapT1Popper, Do(UseExact(30)) }, // Explosive Trap Tier 1 - { ItemID.DD2ExplosiveTrapT2Popper, Do(UseExact(25)) }, // Explosive Trap Tier 2 - { ItemID.DD2ExplosiveTrapT3Popper, Do(UseExact(20)) }, // Explosive Trap Tier 3 - { ItemID.DD2FlameburstTowerT1Popper, Do(UseExact(30)) }, // Flameburst Tier 1 - { ItemID.DD2FlameburstTowerT2Popper, Do(UseExact(25)) }, // Flameburst Tier 2 - { ItemID.DD2FlameburstTowerT3Popper, Do(UseExact(20)) }, // Flameburst Tier 3 - { ItemID.DD2LightningAuraT1Popper, Do(UseExact(30)) }, // Lightning Aura Tier 1 - { ItemID.DD2LightningAuraT2Popper, Do(UseExact(25)) }, // Lightning Aura Tier 2 - { ItemID.DD2LightningAuraT3Popper, Do(UseExact(20)) }, // Lightning Aura Tier 3 + { ItemID.DD2ExplosiveTrapT1Popper, Do(AutoReuse, UseExact(30)) }, // Explosive Trap Tier 1 + { ItemID.DD2ExplosiveTrapT2Popper, Do(AutoReuse, UseExact(25)) }, // Explosive Trap Tier 2 + { ItemID.DD2ExplosiveTrapT3Popper, Do(AutoReuse, UseExact(20)) }, // Explosive Trap Tier 3 + { ItemID.DD2FlameburstTowerT1Popper, Do(AutoReuse, UseExact(30)) }, // Flameburst Tier 1 + { ItemID.DD2FlameburstTowerT2Popper, Do(AutoReuse, UseExact(25)) }, // Flameburst Tier 2 + { ItemID.DD2FlameburstTowerT3Popper, Do(AutoReuse, UseExact(20)) }, // Flameburst Tier 3 + { ItemID.DD2LightningAuraT1Popper, Do(AutoReuse, UseExact(30)) }, // Lightning Aura Tier 1 + { ItemID.DD2LightningAuraT2Popper, Do(AutoReuse, UseExact(25)) }, // Lightning Aura Tier 2 + { ItemID.DD2LightningAuraT3Popper, Do(AutoReuse, UseExact(20)) }, // Lightning Aura Tier 3 { ItemID.DD2PhoenixBow, Do(PointBlank, UseExact(18)) }, // Phantom Phoenix + { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed) }, // Flying Dragon { ItemID.DD2SquireDemonSword, Do(DamageExact(110), UseExact(25)) }, // Brand of the Inferno - { ItemID.DeadlySphereStaff, Do(UseExact(20)) }, + { ItemID.DeadlySphereStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.DeathbringerPickaxe, Do(PickPower(70), UseTimeExact(10)) }, - { ItemID.DeathSickle, Do(DamageExact(82), ShootSpeedExact(15f)) }, + { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(82), ShootSpeedExact(15f)) }, { ItemID.DeerThing, nonConsumableBossSummon }, { ItemID.DemonBow, Do(PointBlank, DamageExact(12), AutoReuse) }, { ItemID.DemonScythe, Do(AutoReuse, DamageExact(33), ManaExact(10)) }, @@ -180,13 +182,14 @@ namespace CalamityMod.Items { ItemID.ElectrosphereLauncher, Do(DamageRatio(1.1f)) }, { ItemID.EldMelter, Do(DamageExact(113), ShootSpeedDelta(+3f)) }, // Elf Melter, intentionally not in alphabetical order to correct for typo { ItemID.EmeraldStaff, Do(DamageExact(28)) }, - { ItemID.EmpressBlade, Do(UseExact(20)) }, + { ItemID.EmpressBlade, Do(AutoReuse, DamageExact(60), UseExact(20)) }, // Terraprisma { ItemID.EnchantedBoomerang, Do(DamageRatio(2f), UseExact(28)) }, - { ItemID.EnchantedSword, Do(ScaleRatio(1.5f), DamageExact(42), UseAnimationExact(20), ShootSpeedExact(15f)) }, + { ItemID.EnchantedSword, Do(UseMeleeSpeed, ScaleRatio(1.5f), DamageExact(42), UseAnimationExact(20), ShootSpeedExact(15f)) }, { ItemID.EndlessQuiver, Do(DamageRatio(1.1f)) }, { ItemID.EoCShield, Do(DefenseDelta(+1)) }, { ItemID.FairyQueenRangedItem, pointBlank }, { ItemID.Excalibur, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, + { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, { ItemID.FalconBlade, Do(UseTurn, ScaleRatio(1.5f), DamageExact(35), UseExact(15)) }, { ItemID.FieryGreatsword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(90), UseExact(45)) }, { ItemID.FireWhip, autoReuse }, @@ -204,21 +207,22 @@ namespace CalamityMod.Items { ItemID.FlowerofFrost, Do(AutoReuse, ManaExact(7), UseExact(30), DamageExact(70), ShootSpeedExact(14)) }, { ItemID.FlyingKnife, Do(DamageExact(70)) }, { ItemID.FormatC, autoReuse }, - { ItemID.Frostbrand, Do(DamageExact(140), UseTimeExact(20)) }, + { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(97), UseExact(23)) }, { ItemID.FrostburnArrow, Do(DamageExact(8)) }, { ItemID.FrostStaff, Do(DamageExact(160), UseExact(37), ShootSpeedExact(20f)) }, // has 1 extra update { ItemID.FrozenShield, Do(DefenseDelta(+7)) }, { ItemID.FrozenTurtleShell, Do(DefenseExact(6)) }, { ItemID.FruitcakeChakram, Do(DamageRatio(2f)) }, { ItemID.Gatligator, Do(PointBlank, UseExact(6)) }, + { ItemID.Gladius, Do(AutoReuse, TrueMelee) }, { ItemID.GoblinBattleStandard, nonConsumableBossSummon }, { ItemID.GoldAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, { ItemID.GoldBow, Do(PointBlank, DamageExact(12)) }, { ItemID.GoldBroadsword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(2f)) }, - { ItemID.GoldenShower, Do(DamageExact(44))} , + { ItemID.GoldenShower, Do(DamageExact(44)) }, { ItemID.GoldHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.GoldPickaxe, Do(PickPower(55), UseTimeExact(9)) }, - { ItemID.GoldShortsword, Do(AutoReuse, DamageRatio(2f)) }, + { ItemID.GoldShortsword, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, { ItemID.GolemFist, Do(DamageExact(150)) }, { ItemID.Gradient, autoReuse }, { ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, @@ -232,7 +236,7 @@ namespace CalamityMod.Items { ItemID.HallowedRepeater, Do(PointBlank, UseExact(14), DamageExact(57)) }, { ItemID.HallowJoustingLance, trueMelee }, { ItemID.Hammush, Do(HammerPower(85), UseTimeExact(10), TileBoostExact(+1)) }, - { ItemID.Handgun, Do(PointBlank, UseExact(15), DamageExact(12)) }, + { ItemID.Handgun, Do(PointBlank, UseExact(27), DamageExact(36)) }, { ItemID.Harpoon, pointBlank }, { ItemID.HelFire, autoReuse }, { ItemID.HellfireArrow, Do(DamageRatio(1.1f)) }, @@ -241,21 +245,21 @@ namespace CalamityMod.Items { ItemID.HighVelocityBullet, Do(DamageExact(15)) }, { ItemID.HolyArrow, Do(DamageRatio(1.1f)) }, { ItemID.HornetStaff, Do(AutoReuse, UseExact(30)) }, - { ItemID.IceBlade, Do(DamageExact(26), UseTimeExact(33)) }, + { ItemID.IceBlade, Do(UseMeleeSpeed, DamageExact(26), UseTimeExact(33)) }, { ItemID.IceBoomerang, Do(DamageExact(28), UseExact(25), ShootSpeedExact(10)) }, { ItemID.IceBow, Do(PointBlank, AutoReuse, DamageExact(120), UseExact(35)) }, { ItemID.IceRod, Do(UseExact(6), DamageExact(30), ShootSpeedExact(20)) }, - { ItemID.IceSickle, Do(AutoReuse, DamageExact(95), ShootSpeedExact(20f)) }, + { ItemID.IceSickle, Do(AutoReuse, UseMeleeSpeed, DamageExact(95), ShootSpeedExact(20f)) }, { ItemID.IchorArrow, Do(DamageExact(15)) }, { ItemID.ImpStaff, Do(AutoReuse, UseExact(30)) }, { ItemID.InfernoFork, Do(DamageRatio(1.66f)) }, - { ItemID.InfluxWaver, Do(DamageRatio(0.75f)) }, + { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageRatio(0.75f)) }, { ItemID.IronAxe, Do(AxePower(60), UseTimeExact(15), TileBoostExact(+0)) }, { ItemID.IronBow, Do(PointBlank, DamageRatio(1.1f)) }, { ItemID.IronBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.25f), ScaleRatio(1.2f)) }, { ItemID.IronHammer, Do(HammerPower(45), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.IronPickaxe, Do(PickPower(40), UseTimeExact(8)) }, - { ItemID.IronShortsword, Do(AutoReuse, DamageRatio(1.25f)) }, + { ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageRatio(1.25f)) }, { ItemID.JestersArrow, Do(DamageExact(6)) }, { ItemID.JoustingLance, trueMelee }, { ItemID.JungleYoyo, autoReuse }, @@ -272,7 +276,7 @@ namespace CalamityMod.Items { ItemID.LeadBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.25f), ScaleRatio(1.2f)) }, { ItemID.LeadHammer, Do(HammerPower(45), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.LeadPickaxe, Do(PickPower(40), UseTimeExact(8)) }, - { ItemID.LeadShortsword, Do(AutoReuse, DamageRatio(1.25f)) }, + { ItemID.LeadShortsword, Do(AutoReuse, TrueMelee, DamageRatio(1.25f)) }, { ItemID.BlandWhip, autoReuse }, { ItemID.LifeCrystal, autoReuse }, { ItemID.LifeFruit, autoReuse }, @@ -287,7 +291,7 @@ namespace CalamityMod.Items { ItemID.MaceWhip, autoReuse }, { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, { ItemID.MagicDagger, Do(AutoReuse, DamageExact(77), UseExact(16), ShootSpeedExact(30)) }, - { ItemID.MagicMissile, Do(DamageRatio(1.2f)) }, + { ItemID.MagicMissile, Do(DamageExact(20), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) }, { ItemID.MagnetSphere, Do(DamageRatio(1.1f)) }, { ItemID.ManaCrystal, autoReuse }, { ItemID.Marrow, Do(PointBlank, AutoReuse, DamageExact(69)) }, @@ -296,7 +300,7 @@ namespace CalamityMod.Items { ItemID.MechanicalWorm, nonConsumableBossSummon }, { ItemID.MedusaHead, Do(ManaExact(6), DamageRatio(1.2f)) }, { ItemID.Megashark, pointBlank }, - { ItemID.Meowmere, Do(DamageRatio(1.33f)) }, + { ItemID.Meowmere, Do(UseMeleeSpeed/*, DamageRatio(1.33f) */) }, { ItemID.MeteorHamaxe, Do(HammerPower(70), AxePower(100), UseTimeExact(16), TileBoostExact(+0)) }, { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, { ItemID.Minishark, Do(PointBlank, DamageExact(4)) }, @@ -326,7 +330,7 @@ namespace CalamityMod.Items { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(43)) }, { ItemID.NightmarePickaxe, Do(PickPower(66), UseTimeExact(9)) }, { ItemID.NightsEdge, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(98)) }, - { ItemID.NorthPole, autoReuse }, + { ItemID.NorthPole, Do(AutoReuse, UseMeleeSpeed, AttackSpeedExact(0.33f)) }, { ItemID.ObsidianShield, Do(DefenseDelta(+5)) }, { ItemID.ObsidianSkull, Do(DefenseDelta(+1)) }, { ItemID.ObsidianSkullRose, Do(DefenseExact(4)) }, @@ -370,10 +374,12 @@ namespace CalamityMod.Items { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageRatio(2.31f), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) }, { ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageRatio(4f), TileBoostExact(+0)) }, { ItemID.PearlwoodSword, Do(AutoReuse, UseTurn, DamageRatio(4f)) }, + { ItemID.PewMaticHorn, Do(DamageExact(23)) }, { ItemID.Phantasm, pointBlank }, - { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, DamageRatio(0.75f), UseExact(14)) }, // Phoenix Blaster is nerfed to compensate for autofire + { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, DamageExact(36), UseExact(27)) }, { ItemID.PickaxeAxe, Do(PickPower(200), AxePower(110), UseTimeExact(7), TileBoostExact(+1)) }, { ItemID.Picksaw, Do(PickPower(210), AxePower(125), UseTimeExact(6), TileBoostExact(+1)) }, + { ItemID.PiercingStarlight, Do(TrueMelee) }, { ItemID.PirateMap, nonConsumableBossSummon }, { ItemID.PirateStaff, Do(AutoReuse, UseExact(25)) }, { ItemID.PlatinumAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, @@ -381,7 +387,7 @@ namespace CalamityMod.Items { ItemID.PlatinumBroadsword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(2f)) }, { ItemID.PlatinumHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.PlatinumPickaxe, Do(PickPower(55), UseTimeExact(9)) }, - { ItemID.PlatinumShortsword, Do(AutoReuse, DamageRatio(2f)) }, + { ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, { ItemID.PoisonStaff, Do(DamageExact(57)) }, { ItemID.ProximityMineLauncher, Do(DamageRatio(4f), UseRatio(0.8f)) }, { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), AttackSpeedExact(0.5f), DamageRatio(3f)) }, @@ -392,15 +398,15 @@ namespace CalamityMod.Items { ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, { ItemID.PurpleSolution, Do(Value(Item.buyPrice(silver: 5))) }, { ItemID.Pwnhammer, Do(HammerPower(80), UseTimeExact(11), TileBoostExact(+1)) }, - { ItemID.PygmyStaff, Do(UseExact(20)) }, + { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.QuadBarrelShotgun, pointBlank }, { ItemID.QueenSlimeCrystal, nonConsumableBossSummon }, { ItemID.QueenSpiderStaff, Do(UseExact(25)) }, { ItemID.RainbowCrystalStaff, Do(UseExact(15)) }, - { ItemID.RainbowRod, Do(DamageExact(50), UseExact(35)) }, + { ItemID.RainbowRod, Do(DamageExact(35), ManaExact(15), UseExact(25)) }, { ItemID.RainbowWhip, autoReuse }, { ItemID.Rally, Do(AutoReuse, DamageExact(20)) }, - { ItemID.RavenStaff, Do(UseExact(20)) }, + { ItemID.RavenStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.Razorpine, Do(DamageRatio(0.75f)) }, { ItemID.ReaverShark, Do(PickPower(100), UseTimeExact(16)) }, { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, @@ -417,13 +423,14 @@ namespace CalamityMod.Items { ItemID.RocketLauncher, Do(DamageRatio(1.1f)) }, { ItemID.Rockfish, Do(HammerPower(50), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.RubyStaff, Do(DamageExact(25)) }, + { ItemID.Ruler, Do(TrueMelee) }, { ItemID.Sandgun, pointBlank }, { ItemID.SapphireStaff, Do(AutoReuse, DamageExact(25)) }, { ItemID.SanguineStaff, Do(AutoReuse, UseExact(25)) }, { ItemID.SawtoothShark, Do(TrueMeleeNoSpeed, AxePower(45), UseTimeExact(4), TileBoostExact(-1)) }, { ItemID.ScytheWhip, autoReuse }, { ItemID.SDMG, pointBlank }, - { ItemID.Seedler, Do(DamageRatio(1.5f)) }, + { ItemID.Seedler, Do(UseMeleeSpeed, DamageRatio(1.5f)) }, { ItemID.Shackle, Do(DefenseDelta(+2)) }, { ItemID.ShadewoodBow, Do(PointBlank, DamageRatio(1.1f)) }, { ItemID.ShadewoodHammer, Do(HammerPower(25), UseTimeExact(9), TileBoostExact(+0)) }, @@ -441,7 +448,7 @@ namespace CalamityMod.Items { ItemID.SilverBullet, Do(DamageExact(8)) }, { ItemID.SilverHammer, Do(HammerPower(55), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.SilverPickaxe, Do(PickPower(50), UseTimeExact(11)) }, - { ItemID.SilverShortsword, Do(AutoReuse, DamageRatio(1.5f)) }, + { ItemID.SilverShortsword, Do(AutoReuse, TrueMelee, DamageRatio(1.5f)) }, { ItemID.SkyFracture, Do(DamageExact(54), ShootSpeedExact(30f)) }, { ItemID.SlapHand, Do(UseTurn, ScaleRatio(1.5f), DamageExact(120)) }, { ItemID.SlimeCrown, nonConsumableBossSummon }, @@ -468,28 +475,31 @@ namespace CalamityMod.Items { ItemID.StaffoftheFrostHydra, Do(UseExact(20)) }, { ItemID.StakeLauncher, Do(PointBlank, DamageRatio(2f), UseRatio(1.5f)) }, { ItemID.StarCannon, Do(DamageExact(25)) }, - { ItemID.StardustCellStaff, Do(UseExact(20)) }, + { ItemID.StardustCellStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.StardustChainsaw, trueMeleeNoSpeed }, { ItemID.StardustDragonStaff, Do(AutoReuse, DamageExact(20), UseExact(19)) }, { ItemID.StardustDrill, Do(TrueMeleeNoSpeed, PickPower(225), UseTimeExact(3), TileBoostExact(+4)) }, { ItemID.StardustPickaxe, Do(PickPower(225), UseTimeExact(6), TileBoostExact(+4)) }, { ItemID.Starfury, autoReuse }, - { ItemID.StarWrath, Do(DamageRatio(0.9f)) }, { ItemID.PortableStool, Do(Value(Item.sellPrice(copper: 20))) }, // Step Stool + { ItemID.StarWrath, Do(DamageRatio(0.9f), AttackSpeedExact(0.33f)) }, { ItemID.StickyBomb, maxStack999 }, { ItemID.StickyDynamite, maxStack999 }, - { ItemID.SwordWhip, autoReuse }, - { ItemID.StormTigerStaff, Do(UseExact(20)) }, + { ItemID.StormTigerStaff, Do(AutoReuse, DamageExact(49), UseExact(20)) }, // Desert Tiger Staff { ItemID.StylistKilLaKillScissorsIWish, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(33)) }, { ItemID.SuspiciousLookingEye, nonConsumableBossSummon }, { ItemID.Swordfish, Do(AutoReuse, TrueMelee, DamageExact(38)) }, + { ItemID.SwordWhip, autoReuse }, { ItemID.TacticalShotgun, Do(PointBlank, DamageRatio(1.2f)) }, { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(70)) }, - { ItemID.TempestStaff, Do(UseExact(20)) }, + { ItemID.TempestStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.TendonBow, Do(PointBlank, DamageExact(17), AutoReuse) }, { ItemID.TentacleSpike, autoReuse }, + { ItemID.TerraBlade, Do(UseMeleeSpeed) }, { ItemID.Terragrim, trueMeleeNoSpeed }, - { ItemID.Terrarian, Do(AutoReuse, DamageExact(352)) }, + // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, + // Terrarian is extremely overpowered and requires a heavy nerf. + { ItemID.Terrarian, Do(AutoReuse, DamageExact(106)) }, { ItemID.TheAxe, Do(HammerPower(100), AxePower(175), UseTimeExact(7), TileBoostExact(+1)) }, { ItemID.TheBreaker, Do(HammerPower(70), UseTimeExact(13), TileBoostExact(+0)) }, { ItemID.TheEyeOfCthulhu, autoReuse }, @@ -498,13 +508,13 @@ namespace CalamityMod.Items { ItemID.TheUndertaker, Do(AutoReuse, UseExact(21)) }, { ItemID.ThornChakram, Do(DamageExact(32)) }, { ItemID.ThornWhip, autoReuse }, - { ItemID.ThunderSpear, autoReuse }, + { ItemID.ThunderSpear, Do(AutoReuse, UseMeleeSpeed) }, // Storm Spear { ItemID.TinAxe, Do(AxePower(50), UseTimeExact(16), TileBoostExact(+0)) }, { ItemID.TinBow, Do(PointBlank, DamageRatio(1.1f)) }, { ItemID.TinBroadsword, Do(AutoReuse, UseTurn) }, { ItemID.TinHammer, Do(HammerPower(35), UseTimeExact(12), TileBoostExact(+0)) }, { ItemID.TinPickaxe, Do(PickPower(35), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.TinShortsword, autoReuse }, + { ItemID.TinShortsword, Do(AutoReuse, TrueMelee) }, { ItemID.TitaniumChainsaw, Do(TrueMeleeNoSpeed, AxePower(90), UseTimeExact(4), TileBoostExact(+0)) }, { ItemID.TitaniumDrill, Do(TrueMeleeNoSpeed, PickPower(180), UseTimeExact(4), TileBoostExact(+1)) }, { ItemID.TitaniumPickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, @@ -516,20 +526,21 @@ namespace CalamityMod.Items { ItemID.Toxikarp, Do(UseTimeExact(7), UseAnimationExact(14)) }, { ItemID.TragicUmbrella, autoReuse }, { ItemID.Trident, Do(AutoReuse, TrueMelee, DamageExact(22)) }, - { ItemID.TrueExcalibur, Do(AutoReuse, UseTurn, DamageExact(82)) }, - { ItemID.TrueNightsEdge, Do(AutoReuse, UseTurn, DamageExact(160), ShootSpeedExact(16), ScaleRatio(1.5f)) }, + { ItemID.TrueExcalibur, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(82)) }, + { ItemID.TrueNightsEdge, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(160), ShootSpeedExact(16), ScaleRatio(1.5f)) }, { ItemID.Tsunami, Do(PointBlank, DamageRatio(1.25f)) }, { ItemID.TungstenAxe, Do(AxePower(70), UseTimeExact(14), TileBoostExact(+0)) }, { ItemID.TungstenBow, Do(PointBlank, DamageRatio(1.1f)) }, { ItemID.TungstenBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.5f), ScaleRatio(1.3f)) }, { ItemID.TungstenHammer, Do(HammerPower(55), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.TungstenPickaxe, Do(PickPower(50), UseTimeExact(11)) }, - { ItemID.TungstenShortsword, Do(AutoReuse, DamageRatio(1.5f)) }, + { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageRatio(1.5f)) }, { ItemID.Umbrella, autoReuse }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, { ItemID.UnholyTrident, Do(ManaExact(14), DamageRatio(1.25f)) }, { ItemID.Uzi, pointBlank }, { ItemID.ValkyrieYoyo, autoReuse }, + { ItemID.Valor, Do(DamageExact(32)) }, { ItemID.VampireFrogStaff, Do(AutoReuse, UseExact(30)) }, { ItemID.VampireKnives, Do(DamageRatio(1.33f)) }, { ItemID.VenomArrow, Do(DamageRatio(1.1f)) }, @@ -555,7 +566,7 @@ namespace CalamityMod.Items { ItemID.WoodYoyo, autoReuse }, { ItemID.WormFood, nonConsumableBossSummon }, { ItemID.Xenopopper, Do(DamageRatio(0.75f)) }, - { ItemID.XenoStaff, Do(UseExact(20)) }, + { ItemID.XenoStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.Yelets, autoReuse }, { ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, { ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, @@ -603,12 +614,12 @@ namespace CalamityMod.Items internal static bool HasKnockback(Item it) => !it.accessory & !it.vanity; // how to check if something is wearable armor? internal static bool IsAxe(Item it) => it.axe > 0; internal static bool IsHammer(Item it) => it.hammer > 0; - internal static bool IsMelee(Item it) => it.CountsAsClass(); + internal static bool IsMelee(Item it) => it.CountsAsClass() || it.CountsAsClass(); // true melee is included by extension internal static bool IsPickaxe(Item it) => it.pick > 0; - internal static bool IsScalable(Item it) => it.damage > 0 && it.CountsAsClass(); // sanity check: only melee weapons get scaled - internal static bool IsUsable(Item it) => it.useStyle != 0 && it.useTime > 0 && it.useAnimation > 0; + internal static bool IsScalable(Item it) => it.damage > 0 && IsMelee(it); // sanity check: only melee weapons get scaled + internal static bool IsUsable(Item it) => it.useStyle != ItemUseStyleID.None && it.useTime > 0 && it.useAnimation > 0; internal static bool UsesMana(Item it) => IsUsable(it); // Only usable items cost mana, but items must be able to have their mana cost disabled or enabled at will. - internal static bool UtilizesVelocity(Item it) => IsUsable(it) || it.ammo > 0; // The item must either be usable or be an ammunition for its velocity stat to do anything. + internal static bool UtilizesVelocity(Item it) => IsUsable(it) || it.ammo > AmmoID.None; // The item must either be usable or be an ammunition for its velocity stat to do anything. #endregion #region Item Tweak Definitions @@ -929,6 +940,42 @@ namespace CalamityMod.Items internal static IItemTweak MaxStack(int stk) => new MaxStackRule(stk); #endregion + #region Melee Settings (True Melee & Melee Speed) + internal class MeleeSettingsRule : IItemTweak + { + // If true: Uses melee speed, which WILL apply to projectile fire rate. + // If false: Does not use melee speed in any way. + internal readonly bool speed = true; + + // If true: Counts as true melee, and benefits from True Melee specific bonuses. + // If false: Does not count as true melee. + internal readonly bool trueMelee = false; + + public MeleeSettingsRule(bool s, bool t = false) + { + speed = s; + trueMelee = t; + } + public bool AppliesTo(Item it) => IsMelee(it); + public void ApplyTweak(Item it) + { + // If set to use melee speed, the item's projectile fire rate now scales with melee speed. + if (speed) + it.attackSpeedOnlyAffectsWeaponAnimation = false; + + // Set damage type appropriately. + if (speed) + it.DamageType = trueMelee ? TrueMeleeDamageClass.Instance : DamageClass.Melee; + else + it.DamageType = trueMelee ? TrueMeleeNoSpeedDamageClass.Instance : DamageClass.MeleeNoSpeed; + } + } + internal static IItemTweak UseMeleeSpeed => new MeleeSettingsRule(true, false); + internal static IItemTweak DontUseMeleeSpeed => new MeleeSettingsRule(false, false); + internal static IItemTweak TrueMelee => new MeleeSettingsRule(true, true); + internal static IItemTweak TrueMeleeNoSpeed => new MeleeSettingsRule(false, true); + #endregion + #region Pick Power internal class PickPowerRule : IItemTweak { @@ -1071,22 +1118,6 @@ namespace CalamityMod.Items internal static IItemTweak TileBoostExact(int tb) => new TileBoostExactRule(tb); #endregion - #region True Melee - internal class TrueMeleeRule : IItemTweak - { - public bool AppliesTo(Item it) => true; - public void ApplyTweak(Item it) => it.DamageType = TrueMeleeDamageClass.Instance; - } - internal static IItemTweak TrueMelee => new TrueMeleeRule(); - - internal class TrueMeleeNoSpeedRule : IItemTweak - { - public bool AppliesTo(Item it) => true; - public void ApplyTweak(Item it) => it.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - } - internal static IItemTweak TrueMeleeNoSpeed => new TrueMeleeNoSpeedRule(); - #endregion - #region Use Time and Use Animation internal class UseDeltaRule : IItemTweak { @@ -1231,6 +1262,51 @@ namespace CalamityMod.Items } } internal static IItemTweak UseTimeRatio(float f) => new UseTimeRatioRule(f); + + internal class ReuseDelayDeltaRule : IItemTweak + { + internal readonly int delta = 0; + + public ReuseDelayDeltaRule(int d) => delta = d; + public bool AppliesTo(Item it) => IsUsable(it); + public void ApplyTweak(Item it) + { + it.reuseDelay += delta; + if (it.reuseDelay < 0) + it.reuseDelay = 0; + } + } + internal static IItemTweak ReuseDelayDelta(int d) => new ReuseDelayDeltaRule(d); + + internal class ReuseDelayExactRule : IItemTweak + { + internal readonly int newReuseDelay = 0; + + public ReuseDelayExactRule(int rd) => newReuseDelay = rd; + public bool AppliesTo(Item it) => IsUsable(it); + public void ApplyTweak(Item it) + { + it.reuseDelay = newReuseDelay; + if (it.reuseDelay < 0) + it.reuseDelay = 0; + } + } + internal static IItemTweak ReuseDelayExact(int rd) => new ReuseDelayExactRule(rd); + + internal class ReuseDelayRatioRule : IItemTweak + { + internal readonly float ratio = 1f; + + public ReuseDelayRatioRule(float f) => ratio = f; + public bool AppliesTo(Item it) => IsUsable(it); + public void ApplyTweak(Item it) + { + it.reuseDelay = (int)(it.reuseDelay * ratio); + if (it.reuseDelay < 0) + it.reuseDelay = 0; + } + } + internal static IItemTweak ReuseDelayRatio(float f) => new ReuseDelayRatioRule(f); #endregion #region Use Turn diff --git a/Items/CalamityResearchSorting.cs b/Items/CalamityResearchSorting.cs new file mode 100644 index 0000000000..61d0f24227 --- /dev/null +++ b/Items/CalamityResearchSorting.cs @@ -0,0 +1,11 @@ +namespace CalamityMod.Items +{ + public enum CalamityResearchSorting : int + { + SpawnPrevention = 92, // After Event Items + RogueWeapon = 570, // After Summon Weapons + ClasslessWeapon = 580, // After Rogue Weapons + ToolsOther = 820, // Between Light Pets and Golf + LoreItems = 12000, // After everything else + } +} diff --git a/Items/Critters/BabyGhostBellItem.cs b/Items/Critters/BabyGhostBellItem.cs index 4d4ec92c1b..5fc03afa34 100644 --- a/Items/Critters/BabyGhostBellItem.cs +++ b/Items/Critters/BabyGhostBellItem.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - //item.CloneDefaults(2004); //Lightning Bug item Item.width = 26; Item.height = 24; + Item.bait = 20; Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.Green; } diff --git a/Items/Critters/RepairUnitItem.cs b/Items/Critters/RepairUnitItem.cs new file mode 100644 index 0000000000..02eb419b53 --- /dev/null +++ b/Items/Critters/RepairUnitItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.DraedonLabThings; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class RepairUnitItem : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 5; + DisplayName.SetDefault("Repair Unit"); + } + + public override void SetDefaults() + { + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.width = 38; + Item.height = 24; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ModContent.RarityType(); + } + } +} diff --git a/Items/Critters/RepairUnitItem.png b/Items/Critters/RepairUnitItem.png new file mode 100644 index 0000000000..e91282c777 Binary files /dev/null and b/Items/Critters/RepairUnitItem.png differ diff --git a/Items/Critters/SeaMinnowItem.cs b/Items/Critters/SeaMinnowItem.cs index f3e8b9e63a..bca56b96b5 100644 --- a/Items/Critters/SeaMinnowItem.cs +++ b/Items/Critters/SeaMinnowItem.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Items.Critters Item.consumable = true; Item.noUseGraphic = true; Item.value = Item.buyPrice(0, 0, 30, 0); - //item.CloneDefaults(2004); //Lightning Bug item Item.width = 26; Item.height = 24; Item.bait = 20; diff --git a/Items/DifficultyItems/BallAndChain.cs b/Items/DifficultyItems/BallAndChain.cs index 964765ee31..e9853e39b1 100644 --- a/Items/DifficultyItems/BallAndChain.cs +++ b/Items/DifficultyItems/BallAndChain.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Items.DifficultyItems Item.rare = ItemRarityID.Blue; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override bool CanUseItem(Player player) => false; public override void UpdateInventory(Player player) diff --git a/Items/DifficultyItems/DeathModeItem.cs b/Items/DifficultyItems/DeathModeItem.cs deleted file mode 100644 index 206653ec6f..0000000000 --- a/Items/DifficultyItems/DeathModeItem.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.DifficultyItems -{ - [LegacyName("Death")] - public class DeathModeItem : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Satanic Scepter of Death"); - Tooltip.SetDefault("Enables/disables Death Mode, can only be used in Revengeance Mode.\n" + - - // Rev Mode line - "All effects from Revengeance Mode are enabled, including the following:\n" + - - // Biome effect lines - "Greatly boosts enemy spawn rates during the Blood Moon.\n" + - "Makes the Abyss more treacherous to navigate.\n" + - - // General enemy lines - "Certain non-boss enemies and projectiles deal between 6% and 15% more damage.\n" + - - // Misc lines - "Nerfs the effectiveness of life steal a bit more.\n" + - "The Nurse no longer heals you while a boss is alive.\n" + - "Increases damage done by 50% for several debuffs and all alcohols that reduce life regen.\n" + - - // Boss lines - "Changes all boss AIs and most enemy AIs.\n" + - "Increases the damage of all bosses a bit more."); - } - - public override void SetDefaults() - { - Item.expert = true; - Item.rare = ItemRarityID.Purple; - Item.width = 28; - Item.height = 28; - Item.useAnimation = 45; - Item.useTime = 45; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item119; - Item.consumable = false; - } - - // Can only be used in Revengeance Mode. - public override bool CanUseItem(Player player) => CalamityWorld.revenge || CalamityWorld.death; - - public override bool? UseItem(Player player) - { - // This world syncing code should only be run by one entity- the server, to prevent a race condition - // with the packets. - if (Main.netMode == NetmodeID.MultiplayerClient) - return true; - - if (CalamityPlayer.areThereAnyDamnBosses || BossRushEvent.BossRushActive) - { - string key = "Mods.CalamityMod.ChangingTheRules"; - Color messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - return true; - } - if (!CalamityWorld.death) - { - CalamityWorld.death = true; - string key = "Mods.CalamityMod.DeathText"; - Color messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else - { - CalamityWorld.death = false; - string key = "Mods.CalamityMod.DeathText2"; - Color messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - CalamityNetcode.SyncWorld(); - - return true; - } - - public override void AddRecipes() - { - CreateRecipe() - .AddTile(TileID.DemonAltar) - .Register(); - } - } -} diff --git a/Items/DifficultyItems/DeathModeItem.png b/Items/DifficultyItems/DeathModeItem.png deleted file mode 100644 index c58a8179c6..0000000000 Binary files a/Items/DifficultyItems/DeathModeItem.png and /dev/null differ diff --git a/Items/DifficultyItems/RevengeanceModeItem.cs b/Items/DifficultyItems/RevengeanceModeItem.cs deleted file mode 100644 index 227c14eeb6..0000000000 --- a/Items/DifficultyItems/RevengeanceModeItem.cs +++ /dev/null @@ -1,122 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using System.Linq; - -namespace CalamityMod.Items.DifficultyItems -{ - [LegacyName("Revenge")] - public class RevengeanceModeItem : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Blood Fountain of Revengeance"); - Tooltip.SetDefault("Enables/disables Revengeance Mode, can only be used in Expert Mode.\n" + - - // Rage and Adrenaline lines - "RAGE TOOLTIP LINE HERE\n" + - "You gain Rage when in proximity of enemies or by using special items.\n" + - "ADRENALINE TOOLTIP LINE HERE\n" + - "You gain Adrenaline whenever a boss is alive. Getting hit drops Adrenaline back to 0.\n" + - "Getting hit while Adrenaline is maxed will reduce damage taken by a massive amount.\n" + - - // General enemy lines - "All enemies spawn 17.65% more frequently.\n" + - "Certain non-boss enemies and projectiles deal between 10% and 25% more damage.\n" + - "Makes certain enemies block life steal and nerfs the effectiveness of life steal.\n" + - - // Misc lines - "Nerfs the effectiveness of the Hallowed Armor set bonus.\n" + - - // Boss lines - "All boss minions no longer drop hearts.\n" + - "Changes all boss AIs and some enemy AIs.\n" + - "Increases the health and damage of all bosses."); - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 28; - Item.useAnimation = 45; - Item.useTime = 45; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.expert = true; - Item.rare = ItemRarityID.Purple; - Item.UseSound = SoundID.Item119; - Item.consumable = false; - } - - public override void ModifyTooltips(List list) - { - string rageKey = CalamityKeybinds.RageHotKey.TooltipHotkeyString(); - string adrenKey = CalamityKeybinds.AdrenalineHotKey.TooltipHotkeyString(); - - TooltipLine lineRage = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - if (lineRage != null) - lineRage.Text = "Enables the Rage mechanic. When Rage is maxed press " + rageKey + " to activate Rage Mode."; - - TooltipLine lineAdrenaline = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); - if (lineAdrenaline != null) - lineAdrenaline.Text = "Enables the Adrenaline mechanic. When Adrenaline is maxed press " + adrenKey + " to activate Adrenaline Mode."; - } - - // Can only be used in Expert worlds. The Revengeance check is a failsafe that allows you to disable rev in normal mode worlds if it gets enabled for whatever reason. - public override bool CanUseItem(Player player) => Main.expertMode || CalamityWorld.revenge; - - public override bool? UseItem(Player player) - { - // This world syncing code should only be run by one entity- the server, to prevent a race condition - // with the packets. - if (Main.netMode == NetmodeID.MultiplayerClient) - return true; - - if (CalamityPlayer.areThereAnyDamnBosses || BossRushEvent.BossRushActive) - { - string key = "Mods.CalamityMod.ChangingTheRules"; - Color messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - return true; - } - if (!CalamityWorld.revenge) - { - CalamityWorld.revenge = true; - string key = "Mods.CalamityMod.RevengeText"; - Color messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - CalamityNetcode.SyncWorld(); - } - else - { - CalamityWorld.revenge = false; - string key = "Mods.CalamityMod.RevengeText2"; - Color messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - if (CalamityWorld.death) - { - CalamityWorld.death = false; - key = "Mods.CalamityMod.DeathText2"; - messageColor = Color.Crimson; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - CalamityNetcode.SyncWorld(); - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe() - .AddTile(TileID.DemonAltar) - .Register(); - } - } -} diff --git a/Items/DifficultyItems/RevengeanceModeItem.png b/Items/DifficultyItems/RevengeanceModeItem.png deleted file mode 100644 index ea7bd87649..0000000000 Binary files a/Items/DifficultyItems/RevengeanceModeItem.png and /dev/null differ diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index 33234b163f..69a21b1644 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonSummoner; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; @@ -13,8 +14,10 @@ namespace CalamityMod.Items.DraedonMisc { public class AdvancedDisplay : ModItem { + public static readonly SoundStyle InstallSound = new("CalamityMod/Sounds/Custom/Codebreaker/AdvancedDisplayInstall"); public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Advanced Display"); Tooltip.SetDefault("Can be placed on the Codebreaker\n" + "Allows you to decrypt the Underworld schematic"); @@ -43,6 +46,8 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { + SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsAdvancedDisplay) return false; diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index a541d99dd8..ad9f8398d0 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -1,9 +1,11 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; @@ -15,8 +17,10 @@ namespace CalamityMod.Items.DraedonMisc { public class AuricQuantumCoolingCell : ModItem { + public static readonly SoundStyle InstallSound = new("CalamityMod/Sounds/Custom/Codebreaker/AuricQuantumCoolingCellInstallNew"); public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Auric Quantum Cooling Cell"); Tooltip.SetDefault("Can be placed in the Codebreaker, completing it\n" + "The completion of the Codebreaker allows you to make contact with its original creator\n" + @@ -30,9 +34,8 @@ namespace CalamityMod.Items.DraedonMisc Item.maxStack = 999; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Red; Item.useTime = Item.useAnimation = 15; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List tooltips) @@ -57,6 +60,8 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { + SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsCoolingCell || codebreakerTileEntity.DecryptionCountdown > 0) return false; diff --git a/Items/DraedonMisc/CodebreakerBase.cs b/Items/DraedonMisc/CodebreakerBase.cs index 0fbf45e953..7a834ec93c 100644 --- a/Items/DraedonMisc/CodebreakerBase.cs +++ b/Items/DraedonMisc/CodebreakerBase.cs @@ -8,7 +8,11 @@ namespace CalamityMod.Items.DraedonMisc { public class CodebreakerBase : ModItem { - public override void SetStaticDefaults() => DisplayName.SetDefault("Codebreaker Base"); + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Codebreaker Base"); + } public override void SetDefaults() { diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index b2db9d2981..ad923798e8 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonSummoner; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; @@ -13,8 +14,11 @@ namespace CalamityMod.Items.DraedonMisc { public class DecryptionComputer : ModItem { + public static readonly SoundStyle InstallSound = new("CalamityMod/Sounds/Custom/Codebreaker/DecryptionComputerInstall"); + public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Decryption Computer"); Tooltip.SetDefault("Can be placed on the Codebreaker\n" + "Allows you to decrypt the Planetoid schematic\n" + @@ -44,6 +48,8 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { + SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsDecryptionComputer) return false; diff --git a/Items/DraedonMisc/DraedonPowerCell.cs b/Items/DraedonMisc/DraedonPowerCell.cs index bf177eadb9..d084e1e7f6 100644 --- a/Items/DraedonMisc/DraedonPowerCell.cs +++ b/Items/DraedonMisc/DraedonPowerCell.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +14,7 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { + SacrificeTotal = 100; DisplayName.SetDefault("Draedon Power Cell"); Tooltip.SetDefault("Used to charge Draedon's weaponry at a Charging Station\n" + "Also can be processed by the Extractinator for spare parts"); @@ -23,8 +25,7 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 26; Item.height = 14; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.maxStack = 999; Item.consumable = true; diff --git a/Items/DraedonMisc/DraedonsLogHell.cs b/Items/DraedonMisc/DraedonsLogHell.cs index 65328443b9..a24c2155b9 100644 --- a/Items/DraedonMisc/DraedonsLogHell.cs +++ b/Items/DraedonMisc/DraedonsLogHell.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.UI; using Terraria; using Terraria.ID; @@ -9,6 +10,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Draedon's Log - Hell"); Tooltip.SetDefault("Click to view its contents"); } @@ -17,8 +19,7 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 28; Item.height = 28; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; } diff --git a/Items/DraedonMisc/DraedonsLogJungle.cs b/Items/DraedonMisc/DraedonsLogJungle.cs index e0db93e5f9..c516d8ec11 100644 --- a/Items/DraedonMisc/DraedonsLogJungle.cs +++ b/Items/DraedonMisc/DraedonsLogJungle.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.UI; using Terraria; using Terraria.ID; @@ -9,6 +10,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Draedon's Log - The Jungle and Plague"); Tooltip.SetDefault("Click to view its contents"); } @@ -17,8 +19,7 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 28; Item.height = 28; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; } diff --git a/Items/DraedonMisc/DraedonsLogPlanetoid.cs b/Items/DraedonMisc/DraedonsLogPlanetoid.cs index dbe5cd2403..5f2d05c18c 100644 --- a/Items/DraedonMisc/DraedonsLogPlanetoid.cs +++ b/Items/DraedonMisc/DraedonsLogPlanetoid.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.UI; using Terraria; using Terraria.ID; @@ -9,6 +10,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Draedon's Log - Space"); Tooltip.SetDefault("Click to view its contents"); } @@ -17,8 +19,7 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 28; Item.height = 28; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; } diff --git a/Items/DraedonMisc/DraedonsLogSnowBiome.cs b/Items/DraedonMisc/DraedonsLogSnowBiome.cs index 1fa7ec4b72..360bb47b61 100644 --- a/Items/DraedonMisc/DraedonsLogSnowBiome.cs +++ b/Items/DraedonMisc/DraedonsLogSnowBiome.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.UI; using Terraria; using Terraria.ID; @@ -9,6 +10,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Draedon's Log - The Frozen Wasteland"); Tooltip.SetDefault("Click to view its contents"); } @@ -17,8 +19,7 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 28; Item.height = 28; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; } diff --git a/Items/DraedonMisc/DraedonsLogSunkenSea.cs b/Items/DraedonMisc/DraedonsLogSunkenSea.cs index 63eb1db249..bcc7d5487e 100644 --- a/Items/DraedonMisc/DraedonsLogSunkenSea.cs +++ b/Items/DraedonMisc/DraedonsLogSunkenSea.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.UI; using Terraria; using Terraria.ID; @@ -9,6 +10,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Draedon's Log - Study on Sunken Aquatic Life"); Tooltip.SetDefault("Click to view its contents"); } @@ -17,8 +19,7 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 28; Item.height = 28; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.HoldUp; } diff --git a/Items/DraedonMisc/EncryptedSchematicHell.cs b/Items/DraedonMisc/EncryptedSchematicHell.cs index 8bd15a53cc..44ae788514 100644 --- a/Items/DraedonMisc/EncryptedSchematicHell.cs +++ b/Items/DraedonMisc/EncryptedSchematicHell.cs @@ -1,11 +1,16 @@ -using System; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.UI; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; -using System.Linq; namespace CalamityMod.Items.DraedonMisc { @@ -13,6 +18,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Encrypted Schematic (Underworld)"); Tooltip.SetDefault("Requires a Codebreaker with a sophisticated display to decrypt"); } @@ -21,9 +27,10 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 42; Item.height = 42; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.maxStack = 1; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } public override void UpdateInventory(Player player) @@ -38,9 +45,42 @@ namespace CalamityMod.Items.DraedonMisc public override void ModifyTooltips(List list) { TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes) + { + if (line != null) + line.Text = "Has already been decrypted.\n" + + "Click to view its contents.\n" + + "Unlocked recipes:"; + int insertIndex = list.FindIndex(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{ModContent.ItemType()}] Pulse Dragon"); + meleeDisplay.OverrideColor = new Color(201, 41, 255); + list.Insert(insertIndex + 1, meleeDisplay); + + TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{ModContent.ItemType()}] Heavy Laser Rifle"); + rangedDisplay.OverrideColor = new Color(255, 64, 31); + list.Insert(insertIndex + 2, rangedDisplay); + + TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{ModContent.ItemType()}] Plasma Caster"); + mageDisplay.OverrideColor = new Color(149, 243, 43); + list.Insert(insertIndex + 3, mageDisplay); + + TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{ModContent.ItemType()}] Snake Eyes"); + summonDisplay.OverrideColor = new Color(31, 242, 245); + list.Insert(insertIndex + 4, summonDisplay); + + TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{ModContent.ItemType()}] Wave Pounder"); + rogueDisplay.OverrideColor = new Color(236, 255, 31); + list.Insert(insertIndex + 5, rogueDisplay); + + TooltipLine machineDisplay = new TooltipLine(this.Mod, "CalamityMod:CodeDisplay", $"[i:{ModContent.ItemType()}] Voltage Regulation System"); + machineDisplay.OverrideColor = new Color(165, 118, 104); + list.Insert(insertIndex + 6, machineDisplay); + + } + } - if (line != null && RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes) - line.Text = "Has already been decrypted"; } public override void AddRecipes() @@ -53,5 +93,14 @@ namespace CalamityMod.Items.DraedonMisc AddTile(TileID.Anvils). Register(); } + + public override bool? UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes) + { + PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonSchematicHellGUI)); + } + return true; + } } } diff --git a/Items/DraedonMisc/EncryptedSchematicIce.cs b/Items/DraedonMisc/EncryptedSchematicIce.cs index 5f9e8286e6..3fd140e34b 100644 --- a/Items/DraedonMisc/EncryptedSchematicIce.cs +++ b/Items/DraedonMisc/EncryptedSchematicIce.cs @@ -1,11 +1,16 @@ -using System; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; +using CalamityMod.UI; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; -using System.Linq; namespace CalamityMod.Items.DraedonMisc @@ -14,6 +19,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Encrypted Schematic (Ice)"); Tooltip.SetDefault("Requires a Codebreaker with a complex voltage regulation system to decrypt"); } @@ -22,9 +28,10 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 42; Item.height = 42; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.maxStack = 1; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } public override void UpdateInventory(Player player) @@ -39,9 +46,41 @@ namespace CalamityMod.Items.DraedonMisc public override void ModifyTooltips(List list) { TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes) + { + if (line != null) + line.Text = "Has already been decrypted.\n" + + "Click to view its contents.\n" + + "Unlocked recipes:"; + int insertIndex = list.FindIndex(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{ModContent.ItemType()}] Phaseslayer"); + meleeDisplay.OverrideColor = new Color(255, 64, 31); + list.Insert(insertIndex + 1, meleeDisplay); - if (line != null && RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes) - line.Text = "Has already been decrypted"; + TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{ModContent.ItemType()}] Pulse Rifle"); + rangedDisplay.OverrideColor = new Color(201, 41, 255); + list.Insert(insertIndex + 2, rangedDisplay); + + TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{ModContent.ItemType()}] Tesla Cannon"); + mageDisplay.OverrideColor = new Color(31, 242, 245); + list.Insert(insertIndex + 3, mageDisplay); + + TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{ModContent.ItemType()}] Pole Warper"); + summonDisplay.OverrideColor = new Color(236, 255, 31); + list.Insert(insertIndex + 4, summonDisplay); + + TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{ModContent.ItemType()}] Plasma Grenade"); + rogueDisplay.OverrideColor = new Color(149, 243, 43); + list.Insert(insertIndex + 5, rogueDisplay); + + TooltipLine machineDisplay = new TooltipLine(this.Mod, "CalamityMod:CodeDisplay", $"[i:{ModContent.ItemType()}] Auric Quantum Cooling Cell"); + machineDisplay.OverrideColor = new Color(255, 215, 0); + list.Insert(insertIndex + 6, machineDisplay); + + } + } } public override void AddRecipes() @@ -54,5 +93,14 @@ namespace CalamityMod.Items.DraedonMisc AddTile(TileID.Anvils). Register(); } + + public override bool? UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes) + { + PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonSchematicIceGUI)); + } + return true; + } } } diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs index a4d4616caf..c96fa70fb0 100644 --- a/Items/DraedonMisc/EncryptedSchematicJungle.cs +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -1,11 +1,16 @@ -using System; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; +using CalamityMod.UI; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; -using System.Linq; namespace CalamityMod.Items.DraedonMisc { @@ -13,6 +18,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Encrypted Schematic (Jungle)"); Tooltip.SetDefault("Requires a Codebreaker with a fine tuned, long range sensor to decrypt"); } @@ -21,9 +27,10 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 42; Item.height = 42; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.maxStack = 1; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } public override void UpdateInventory(Player player) @@ -38,9 +45,41 @@ namespace CalamityMod.Items.DraedonMisc public override void ModifyTooltips(List list) { TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes) + { + if (line != null) + line.Text = "Has already been decrypted.\n" + + "Click to view its contents.\n" + + "Unlocked recipes:"; + int insertIndex = list.FindIndex(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{ModContent.ItemType()}] Galvanizing Glaive"); + meleeDisplay.OverrideColor = new Color(149, 243, 43); + list.Insert(insertIndex + 1, meleeDisplay); - if (line != null && RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes) - line.Text = "Has already been decrypted"; + TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{ModContent.ItemType()}] Gauss Rifle"); + rangedDisplay.OverrideColor = new Color(236, 255, 31); + list.Insert(insertIndex + 2, rangedDisplay); + + TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{ModContent.ItemType()}] Gatling Laser"); + mageDisplay.OverrideColor = new Color(255, 64, 31); + list.Insert(insertIndex + 3, mageDisplay); + + TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{ModContent.ItemType()}] Pulse Turret Remote"); + summonDisplay.OverrideColor = new Color(201, 41, 255); + list.Insert(insertIndex + 4, summonDisplay); + + TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{ModContent.ItemType()}] System Bane"); + rogueDisplay.OverrideColor = new Color(31, 242, 245); + list.Insert(insertIndex + 5, rogueDisplay); + + TooltipLine machineDisplay = new TooltipLine(this.Mod, "CalamityMod:CodeDisplay", $"[i:{ModContent.ItemType()}] Advanced Display"); + machineDisplay.OverrideColor = new Color(165, 118, 104); + list.Insert(insertIndex + 6, machineDisplay); + + } + } } public override void AddRecipes() @@ -53,5 +92,14 @@ namespace CalamityMod.Items.DraedonMisc AddTile(TileID.Anvils). Register(); } + + public override bool? UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes) + { + PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonSchematicJungleGUI)); + } + return true; + } } } diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index ec5ce5797f..fa33d77b11 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -1,11 +1,16 @@ -using System; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; +using CalamityMod.UI; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Collections.Generic; -using System.Linq; namespace CalamityMod.Items.DraedonMisc { @@ -13,6 +18,7 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Encrypted Schematic (Planetoid)"); Tooltip.SetDefault("Requires a Codebreaker with a basic decryption computer to decrypt"); } @@ -21,9 +27,10 @@ namespace CalamityMod.Items.DraedonMisc { Item.width = 42; Item.height = 42; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.maxStack = 1; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } public override void UpdateInventory(Player player) @@ -38,9 +45,41 @@ namespace CalamityMod.Items.DraedonMisc public override void ModifyTooltips(List list) { TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes) + { + if (line != null) + line.Text = "Has already been decrypted.\n" + + "Click to view its contents.\n" + + "Unlocked recipes:"; + int insertIndex = list.FindIndex(x => x.Name == "Tooltip0" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{ModContent.ItemType()}] Hydraulic Volt Crasher"); + meleeDisplay.OverrideColor = new Color(31, 242, 245); + list.Insert(insertIndex + 1, meleeDisplay); - if (line != null && RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes) - line.Text = "Has already been decrypted"; + TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{ModContent.ItemType()}] Matter Modulator"); + rangedDisplay.OverrideColor = new Color(149, 243, 43); + list.Insert(insertIndex + 2, rangedDisplay); + + TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{ModContent.ItemType()}] Gauss Pistol"); + mageDisplay.OverrideColor = new Color(236, 255, 31); + list.Insert(insertIndex + 3, mageDisplay); + + TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{ModContent.ItemType()}] Mounted Scanner"); + summonDisplay.OverrideColor = new Color(255, 64, 31); + list.Insert(insertIndex + 4, summonDisplay); + + TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{ModContent.ItemType()}] Frequency Manipulator"); + rogueDisplay.OverrideColor = new Color(201, 41, 255); + list.Insert(insertIndex + 5, rogueDisplay); + + TooltipLine machineDisplay = new TooltipLine(this.Mod, "CalamityMod:CodeDisplay", $"[i:{ModContent.ItemType()}] Long Ranged Sensor Array"); + machineDisplay.OverrideColor = new Color(165, 118, 104); + list.Insert(insertIndex + 6, machineDisplay); + + } + } } public override void AddRecipes() { @@ -52,5 +91,14 @@ namespace CalamityMod.Items.DraedonMisc AddTile(TileID.Anvils). Register(); } + + public override bool? UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes) + { + PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonSchematicPlanetoidGUI)); + } + return true; + } } } diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index cde0b15796..2818df932b 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -1,6 +1,13 @@ -using System; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.UI; +using CalamityMod.Rarities; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,22 +18,21 @@ namespace CalamityMod.Items.DraedonMisc { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Schematic (Sunken Sea)"); Tooltip.SetDefault("Finely detailed diagrams of numerous devices and weaponry dance across the holographic screen.\n" + - "The weaponry I supply to the workers of the laboratories is weak. Hardly suited for battle.\n" + - "However, they suffice for self defense against any lab mechanisms or creations which may have gone rogue.\n" + - "Addendum: For those who think themselves powerful, search the upper bounds of this planet’s atmosphere for a structure similar to that of the Sunken Seas.\n" + - "I will know by the end if you are worthy of battling my creations.\n" + - "Picking up this item or holding it in your inventory permanently unlocks new recipes"); + "Picking up this item or holding it in your inventory permanently unlocks new recipes.\n" + + "Click to view its contents."); } public override void SetDefaults() { Item.width = 42; Item.height = 42; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.maxStack = 1; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; } public override void UpdateInventory(Player player) @@ -52,5 +58,51 @@ namespace CalamityMod.Items.DraedonMisc AddTile(TileID.Anvils). Register(); } + + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes) + { + int insertIndex = list.FindIndex(x => x.Name == "Tooltip2" && x.Mod == "Terraria"); + if (insertIndex != -1) + { + TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{ModContent.ItemType()}] Gauss Dagger"); + meleeDisplay.OverrideColor = new Color(236, 255, 31); + list.Insert(insertIndex + 1, meleeDisplay); + + TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{ModContent.ItemType()}] Taser"); + rangedDisplay.OverrideColor = new Color(31, 242, 245); + list.Insert(insertIndex + 2, rangedDisplay); + + TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{ModContent.ItemType()}] Pulse Pistol"); + mageDisplay.OverrideColor = new Color(201, 41, 255); + list.Insert(insertIndex + 3, mageDisplay); + + TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{ModContent.ItemType()}] Star Swallower Containment Unit"); + summonDisplay.OverrideColor = new Color(149, 243, 43); + list.Insert(insertIndex + 4, summonDisplay); + + TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{ModContent.ItemType()}] Tracking Disk"); + rogueDisplay.OverrideColor = new Color(255, 64, 31); + list.Insert(insertIndex + 5, rogueDisplay); + + TooltipLine machineDisplay = new TooltipLine(this.Mod, "CalamityMod:CodeDisplay", $"[i:{ModContent.ItemType()}] Decryption Computer"); + machineDisplay.OverrideColor = new Color(165, 118, 104); + list.Insert(insertIndex + 6, machineDisplay); + + } + } + + } + + public override bool? UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes) + { + PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonSchematicSunkenSeaGUI)); + } + return true; + } } } diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index 427a1975f2..82d5abe0eb 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonSummoner; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; @@ -13,8 +14,10 @@ namespace CalamityMod.Items.DraedonMisc { public class LongRangedSensorArray : ModItem { + public static readonly SoundStyle InstallSound = new("CalamityMod/Sounds/Custom/Codebreaker/LongRangeSensorArrayInstall"); public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Long Ranged Sensor Array"); Tooltip.SetDefault("Can be placed on the Codebreaker\n" + "Allows you to decrypt the Jungle schematic"); @@ -43,6 +46,8 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { + SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsSensorArray) return false; diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 3f74d5917a..6c03011aeb 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -1,20 +1,24 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.TileEntities; using CalamityMod.Tiles.DraedonSummoner; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.TileEntities; -using CalamityMod.CustomRecipes; -using System.Collections.Generic; -using System; namespace CalamityMod.Items.DraedonMisc { public class VoltageRegulationSystem : ModItem { + public static readonly SoundStyle InstallSound = new("CalamityMod/Sounds/Custom/Codebreaker/VoltageRegulationSystemInstall"); public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Voltage Regulation System"); Tooltip.SetDefault("Can be placed on the Codebreaker\n" + "Allows you to decrypt the Ice biome schematic"); @@ -27,8 +31,7 @@ namespace CalamityMod.Items.DraedonMisc Item.maxStack = 999; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.useTime = Item.useAnimation = 15; } @@ -44,6 +47,8 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { + SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsVoltageRegulationSystem) return false; diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index d713c04294..3350406048 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 9, 0, 0); } diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs index 2fca9ea149..3da1c20844 100644 --- a/Items/Dyes/BloodflareDye.cs +++ b/Items/Dyes/BloodflareDye.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 4, 0, 0); } diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index bdf7b3abc6..c03daf9ff3 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs index 05501ad551..bbe95866b6 100644 --- a/Items/Dyes/CalamitousDye.cs +++ b/Items/Dyes/CalamitousDye.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 10, 0, 0); } diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index 6a70ba8b24..c05b5ec04c 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -1,10 +1,11 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -19,8 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 4, 0, 0); } diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index b4032df071..9193190811 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 3896572671..c03b06e19a 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -19,8 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 8, 0, 0); } diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index a65cb589d4..921ef87638 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index 005a541acd..85d0eb73ea 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 10, 0, 0); } diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 7c2a358682..a4dea3fc0e 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index af00a3d3d8..1beb474c35 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs index 8338dda857..60d048767d 100644 --- a/Items/Dyes/ProfanedMoonlightDye.cs +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -1,8 +1,10 @@ -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Dyes { @@ -17,8 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 10, 0, 0); } } diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index 7b3f8abf66..780c79161d 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 10, 0, 0); } diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index 22ecc07d9f..a9fa1d0db8 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -1,12 +1,13 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using CalamityMod.Items.Placeables.Ores; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 4, 50, 0); } diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs index bef086a047..23bb2e48aa 100644 --- a/Items/Dyes/SwirlingCosmicFlameDye.cs +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework; -using ReLogic.Content; namespace CalamityMod.Items.Dyes { @@ -20,8 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(0, 7, 50, 0); } diff --git a/Items/Fishing/AstralCatches/AldebaranAlewife.cs b/Items/Fishing/AstralCatches/AldebaranAlewife.cs index 437f418c50..8d434f8a6c 100644 --- a/Items/Fishing/AstralCatches/AldebaranAlewife.cs +++ b/Items/Fishing/AstralCatches/AldebaranAlewife.cs @@ -8,9 +8,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches { public override void SetStaticDefaults() { - SacrificeTotal = 3; + SacrificeTotal = 3; DisplayName.SetDefault("Aldebaran Alewife"); Tooltip.SetDefault("A star-struck entity in the form of a fish"); + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.value = Item.sellPrice(silver: 8); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs index 56af04b8da..f49f869d37 100644 --- a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs +++ b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches SacrificeTotal = 5; DisplayName.SetDefault("Arcturus Astroidean"); Tooltip.SetDefault("Increases fishing power if used in the Astral Infection or Sulphurous Sea"); + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index db3db03d97..709325a559 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; using CalamityMod.Items.Critters; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Potions; @@ -11,6 +11,7 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Astral; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -21,6 +22,8 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetStaticDefaults() { SacrificeTotal = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; DisplayName.SetDefault("Astral Crate"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); } @@ -41,75 +44,56 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.useStyle = ItemUseStyleID.Swing; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + public override bool CanRightClick() => true; - - public override void RightClick(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + var postAstrumAureus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumAureus); + var postAstrumDeus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); - //Modded materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - DropHelper.DropItem(s, player, ItemID.FallenStar, 5, 10); - DropHelper.DropItemChance(s, player, ItemID.Meteorite, 0.2f, 10, 20); - DropHelper.DropItemChance(s, player, ItemID.MeteoriteBar, 0.1f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAstrumAureus, 0.2f, 2, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAstrumDeus, 0.2f, 10, 20); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAstrumDeus, 0.1f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAstrumDeus, 0.25f, 5, 10); + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ItemID.FallenStar, 1, 5, 10); + itemLoot.Add(ItemID.Meteorite, 5, 10, 20); + itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); - // Weapons - DropHelper.DropItemFromSetCondition(s, player, DownedBossSystem.downedAstrumAureus, 0.1f, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), + postAstrumAureus.Add(ModContent.ItemType(), 5, 2, 5); + postAstrumDeus.Add(ModContent.ItemType(), 5, 10, 20); + postAstrumDeus.Add(ModContent.ItemType(), 10, 1, 3); + postAstrumDeus.Add(ModContent.ItemType(), 4, 5, 10); + + // Weapons (and Starburster Core) + postAstrumAureus.Add(new OneFromOptionsDropRule(10, 1, ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType()); + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); - //Pet - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10); + // Pet + itemLoot.Add(ModContent.ItemType(), 10); - //Bait - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 5, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.EnchantedNightcrawler, 5, 1, 3); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 5, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.Firefly, 3, 1, 3); + // Bait + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.Firefly, 3, 1, 3); - //Potions - DropHelper.DropItemChance(s, player, ItemID.ObsidianSkinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.SwiftnessPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.IronskinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.NightOwlPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ShinePotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.MiningPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.HeartreachPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAstrumAureus, 0.1f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAstrumAureus, 0.1f, 1, 3); - int healingPotID = ItemID.HealingPotion; - int manaPotID = ItemID.ManaPotion; - if (DownedBossSystem.downedDoG) - { - healingPotID = ModContent.ItemType(); - manaPotID = ModContent.ItemType(); - } - else if (DownedBossSystem.downedProvidence) - { - healingPotID = ItemID.SuperHealingPotion; - manaPotID = ItemID.SuperManaPotion; - } - else if (NPC.downedMechBossAny) - { - healingPotID = ItemID.GreaterHealingPotion; - manaPotID = ItemID.GreaterManaPotion; - } - DropHelper.DropItemChance(s, player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); + // Potions + postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); + postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); + itemLoot.AddCratePotionRules(); - //Money - DropHelper.DropItem(s, player, ItemID.SilverCoin, 10, 90); - DropHelper.DropItemChance(s, player, ItemID.GoldCoin, 0.5f, 1, 5); + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); } } } diff --git a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs index b61b339e7f..c4493cdb3b 100644 --- a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs +++ b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches { DisplayName.SetDefault("Procyonid Prawn"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -20,5 +21,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/AstralCatches/TwinklingPollox.cs b/Items/Fishing/AstralCatches/TwinklingPollox.cs index 4aec210565..973b339037 100644 --- a/Items/Fishing/AstralCatches/TwinklingPollox.cs +++ b/Items/Fishing/AstralCatches/TwinklingPollox.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches DisplayName.SetDefault("Twinkling Pollox"); //Bass substitute Tooltip.SetDefault("The scales gleam like crystals"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index 92d9207cf6..bf3217eb3f 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Potions; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +19,7 @@ Grants a buff that boosts life regen for 10 seconds The life regen boost is stronger if below 75% health 10 second duration"); SacrificeTotal = 30; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -27,8 +29,7 @@ The life regen boost is stronger if below 75% health Item.maxStack = 30; Item.useTurn = true; Item.value = Item.sellPrice(gold: 5); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.useAnimation = 17; Item.useTime = 17; Item.useStyle = ItemUseStyleID.EatFood; diff --git a/Items/Fishing/BrimstoneCragCatches/Brimlish.cs b/Items/Fishing/BrimstoneCragCatches/Brimlish.cs index 6d496fa657..b00900a876 100644 --- a/Items/Fishing/BrimstoneCragCatches/Brimlish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Brimlish.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { DisplayName.SetDefault("Brimlish"); SacrificeTotal = 2; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 0aa91b4a07..4aff7809a6 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetStaticDefaults() { SacrificeTotal = 5; + ItemID.Sets.IsFishingCrate[Type] = true; DisplayName.SetDefault("Brimstone Crate"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); } @@ -32,67 +33,36 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.useStyle = ItemUseStyleID.Swing; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + public override bool CanRightClick() => true; - - public override void RightClick(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - //Vanilla materials - DropHelper.DropItem(s, player, ItemID.Obsidian, 2, 5); - DropHelper.DropItemChance(s, player, ItemID.Hellstone, 0.25f, 2, 5); - DropHelper.DropItemChance(s, player, ItemID.HellstoneBar, 0.1f, 1, 3); - - //Modded materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 1, 4); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedBrimstoneElemental, 0.1f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence && DownedBossSystem.downedPolterghast, 0.1f, 1, 3); + // Materials + itemLoot.Add(ItemID.Obsidian, 1, 2, 5); + itemLoot.Add(ItemID.Hellstone, 4, 2, 5); + itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); + itemLoot.Add(ModContent.ItemType(), 1, 1, 4); + itemLoot.AddIf(() => DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), 10, 1, 3); + itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2, 1, 3); // Weapons (none) - //Bait - DropHelper.DropItemChance(s, player, ItemID.MasterBait, 10, 1, 2); - DropHelper.DropItemChance(s, player, ItemID.JourneymanBait, 5, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ApprenticeBait, 3, 2, 3); + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - //Potions - DropHelper.DropItemChance(s, player, ItemID.ObsidianSkinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.SwiftnessPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.IronskinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.NightOwlPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ShinePotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.MiningPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.HeartreachPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - DropHelper.DropItemChance(s, player, ItemID.InfernoPotion, 10, 1, 3); - int healingPotID = ItemID.LesserHealingPotion; - int manaPotID = ItemID.LesserManaPotion; - if (DownedBossSystem.downedDoG) - { - healingPotID = ModContent.ItemType(); - manaPotID = ModContent.ItemType(); - } - else if (DownedBossSystem.downedProvidence) - { - healingPotID = ItemID.SuperHealingPotion; - manaPotID = ItemID.SuperManaPotion; - } - else if (NPC.downedMechBossAny) - { - healingPotID = ItemID.GreaterHealingPotion; - manaPotID = ItemID.GreaterManaPotion; - } - else if (NPC.downedBoss3) - { - healingPotID = ItemID.HealingPotion; - manaPotID = ItemID.ManaPotion; - } - DropHelper.DropItemChance(s, player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); + // Potions + itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); + itemLoot.AddCratePotionRules(); - //Money - DropHelper.DropItem(s, player, ItemID.SilverCoin, 10, 90); - DropHelper.DropItemChance(s, player, ItemID.GoldCoin, 0.5f, 1, 5); + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs index 9d88368fb6..915127a78e 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DisplayName.SetDefault("Brimstone Fish"); //Future potion ingredient Tooltip.SetDefault("Fire is a living being"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.value = Item.sellPrice(silver: 8); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs b/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs index 7edd168957..ee7fa8f668 100644 --- a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Tooltip.SetDefault("The horns lay a curse on those who touch it\n" + "Right click to extract essence"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -20,20 +21,17 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.width = 30; Item.height = 28; Item.maxStack = 999; + Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); } } diff --git a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs index 39f6840ae8..fc03a8c21f 100644 --- a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs +++ b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DisplayName.SetDefault("Charred Lasher"); Tooltip.SetDefault("This elusive fish is a prized commodity"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.Orange; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs index 0c2630e822..9d282c6594 100644 --- a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DisplayName.SetDefault("Coastal Demonfish"); //Hadal Stew ingredient Tooltip.SetDefault("The horns lay a curse on those who touch it"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.value = Item.sellPrice(silver: 8); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs index 8b28563f42..7a65d83f53 100644 --- a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs +++ b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DisplayName.SetDefault("Crag Bullhead"); //Bass substitute Tooltip.SetDefault("Its scales are scorching hot"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index 8bf4761aff..c3cf12b2de 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DisplayName.SetDefault("Shadowfish"); Tooltip.SetDefault("Darkness spreads"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.value = Item.sellPrice(silver: 8); Item.rare = ItemRarityID.Blue; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs b/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs index ee2f1feaa1..6c5be07d41 100644 --- a/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Slurpfish.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { DisplayName.SetDefault("Slurpfish"); SacrificeTotal = 2; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/EnchantedStarfish.cs b/Items/Fishing/EnchantedStarfish.cs index a2bec690fc..401b6c9840 100644 --- a/Items/Fishing/EnchantedStarfish.cs +++ b/Items/Fishing/EnchantedStarfish.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Enchanted Starfish"); Tooltip.SetDefault("Permanently increases maximum mana by 20"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -23,10 +24,10 @@ namespace CalamityMod.Items.Fishing Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item29; - Item.consumable = true; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 50); Item.autoReuse = true; + Item.consumable = true; } public override bool? UseItem(Player player) @@ -40,6 +41,7 @@ namespace CalamityMod.Items.Fishing if (Main.myPlayer == player.whoAmI) player.ManaEffect(20); AchievementsHelper.HandleSpecialEvent(player, 1); + player.ConsumeItem(ModContent.ItemType(), true); } return false; } diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index a4b527f826..61884f5a17 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -1,10 +1,11 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using Terraria.DataStructures; namespace CalamityMod.Items.Fishing.FishingRods { @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); Item.value = Item.buyPrice(1, 20, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index a60b73eeba..640ec71221 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; @@ -37,6 +38,7 @@ namespace CalamityMod.Items.Fishing.FishingRods CreateRecipe(). AddIngredient(5). AddIngredient(8). + AddIngredient(1). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index c49b71b61c..94d5063fbf 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -1,10 +1,11 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.DataStructures; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index ed4c1d1979..159dc4111b 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Fishing.FishingRods { SacrificeTotal = 1; DisplayName.SetDefault("Wulfrum Fishing Pole"); - Tooltip.SetDefault("This barely works, but it's better than nothing."); + Tooltip.SetDefault("This barely works, but it's better than nothing"); } public override void SetDefaults() @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(9). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/FishofEleum.cs b/Items/Fishing/FishofEleum.cs index b5aa4157dd..f51d41b08c 100644 --- a/Items/Fishing/FishofEleum.cs +++ b/Items/Fishing/FishofEleum.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing { @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Fish of Eleum"); Tooltip.SetDefault("Right click to extract essence"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -19,20 +20,17 @@ namespace CalamityMod.Items.Fishing Item.width = 30; Item.height = 28; Item.maxStack = 999; + Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); } } diff --git a/Items/Fishing/FishofFlight.cs b/Items/Fishing/FishofFlight.cs index 960d457859..eece4c143c 100644 --- a/Items/Fishing/FishofFlight.cs +++ b/Items/Fishing/FishofFlight.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Fish of Flight"); Tooltip.SetDefault("Right click to extract souls"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -23,16 +24,12 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(gold: 1); } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ItemID.SoulofFlight, 2, 5); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ItemID.SoulofFlight, 1, 5, 8); } } diff --git a/Items/Fishing/FishofLight.cs b/Items/Fishing/FishofLight.cs index 755cbc6b2f..ac995457f2 100644 --- a/Items/Fishing/FishofLight.cs +++ b/Items/Fishing/FishofLight.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Fish of Light"); Tooltip.SetDefault("Right click to extract souls"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -23,16 +24,12 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(gold: 1); } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ItemID.SoulofLight, 2, 5); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ItemID.SoulofLight, 1, 2, 5); } } diff --git a/Items/Fishing/FishofNight.cs b/Items/Fishing/FishofNight.cs index 734bc71b80..c634c11d56 100644 --- a/Items/Fishing/FishofNight.cs +++ b/Items/Fishing/FishofNight.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Fish of Night"); Tooltip.SetDefault("Right click to extract souls"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -23,16 +24,12 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(gold: 1); } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ItemID.SoulofNight, 2, 5); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ItemID.SoulofNight, 1, 2, 5); } } diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index e7f99fd4a6..ca30a54b77 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Glimmering Gemfish"); Tooltip.SetDefault("Right click to extract gems"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -23,31 +24,37 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(silver: 50); } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - int gemMin = 1; int gemMax = 3; - DropHelper.DropItemChance(s, player, ItemID.Amethyst, 0.5f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, ItemID.Topaz, 0.4f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, ItemID.Sapphire, 0.3f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, ItemID.Emerald, 0.2f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, ItemID.Ruby, 0.15f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, ItemID.Diamond, 0.1f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, ItemID.Amber, 0.25f, gemMin, gemMax); + itemLoot.Add(ItemID.Amethyst, 2, gemMin, gemMax); + itemLoot.Add(ItemID.Topaz, 2, gemMin, gemMax); + itemLoot.Add(ItemID.Sapphire, 4, gemMin, gemMax); + itemLoot.Add(ItemID.Emerald, 4, gemMin, gemMax); + itemLoot.Add(ItemID.Ruby, 8, gemMin, gemMax); + itemLoot.Add(ItemID.Diamond, 10, gemMin, gemMax); + itemLoot.Add(ItemID.Amber, 8, gemMin, gemMax); + Mod thorium = CalamityMod.Instance.thorium; - if (thorium != null) + if (thorium is not null) { - DropHelper.DropItemChance(s, player, thorium.Find("Pearl").Type, 0.25f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, thorium.Find("Opal").Type, 0.25f, gemMin, gemMax); - DropHelper.DropItemChance(s, player, thorium.Find("Onyx").Type, 0.25f, gemMin, gemMax); + try + { + itemLoot.Add(thorium.Find("Pearl").Type, 4, gemMin, gemMax); + itemLoot.Add(thorium.Find("Opal").Type, 4, gemMin, gemMax); + itemLoot.Add(thorium.Find("Onyx").Type, 4, gemMin, gemMax); + } + catch + { + CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); + } } } } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 3df9c809cc..776485d826 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Stuffed Fish"); Tooltip.SetDefault("Right click to extract herbs and seeds"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -23,59 +24,82 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(silver: 50); } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - int herbMin = 1; int herbMax = 3; int seedMin = 2; int seedMax = 5; - DropHelper.DropItemChance(s, player, ItemID.Daybloom, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.Moonglow, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.Waterleaf, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.Deathweed, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.Shiverthorn, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.Fireblossom, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.Blinkroot, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, ItemID.DaybloomSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.MoonglowSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.WaterleafSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.DeathweedSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.ShiverthornSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.FireblossomSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.BlinkrootSeeds, 0.2f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.GrassSeeds, 0.1f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.JungleGrassSeeds, 0.1f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.MushroomGrassSeeds, 0.1f, seedMin, seedMax); - DropHelper.DropItemChance(s, player, ItemID.PumpkinSeed, 0.05f, seedMin, seedMax); - DropHelper.DropItemCondition(s, player, ItemID.CorruptSeeds, !WorldGen.crimson, 0.05f, seedMin, seedMax); - DropHelper.DropItemCondition(s, player, ItemID.CrimsonSeeds, WorldGen.crimson, 0.05f, seedMin, seedMax); - DropHelper.DropItemCondition(s, player, ItemID.HallowedSeeds, Main.hardMode, 0.05f, seedMin, seedMax); - Mod thorium = CalamityMod.Instance.thorium; - if (thorium != null) - { - DropHelper.DropItemChance(s, player, thorium.Find("MarineKelp").Type, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, thorium.Find("MarineKelpSeeds").Type, 0.1f, seedMin, seedMax); - } - Mod soa = CalamityMod.Instance.soa; - if (soa != null) - { - DropHelper.DropItemChance(s, player, soa.Find("Welkinbell").Type, 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(s, player, soa.Find("WelkinbellSeeds").Type, 0.1f, seedMin, seedMax); - DropHelper.DropItemCondition(s, player, soa.Find("Illumifern").Type, Main.hardMode, 0.25f, herbMin, herbMax); - DropHelper.DropItemCondition(s, player, soa.Find("IllumifernSeeds").Type, Main.hardMode, 0.1f, seedMin, seedMax); - // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. - // Dan Yami has confirmed that downed calls will be added to SoA eventually. - //DropHelper.DropItemCondition(s, player, shadowsOfAbaddon.ItemType("Enduflora"), SacredTools.ModdedWorld.downedAbaddon, 0.25f, herbMin, herbMax); - //DropHelper.DropItemCondition(s, player, shadowsOfAbaddon.ItemType("EndufloraSeeds"), SacredTools.ModdedWorld.downedAbaddon, 0.1f, seedMin, seedMax); + // Herbs + itemLoot.Add(ItemID.Daybloom, 4, herbMin, herbMax); + itemLoot.Add(ItemID.Blinkroot, 4, herbMin, herbMax); + itemLoot.Add(ItemID.Waterleaf, 4, herbMin, herbMax); + itemLoot.Add(ItemID.Shiverthorn, 4, herbMin, herbMax); + itemLoot.Add(ItemID.Moonglow, 4, herbMin, herbMax); + itemLoot.Add(ItemID.Deathweed, 4, herbMin, herbMax); + itemLoot.Add(ItemID.Fireblossom, 4, herbMin, herbMax); + + // Herb seeds + itemLoot.Add(ItemID.DaybloomSeeds, 5, seedMin, seedMax); + itemLoot.Add(ItemID.BlinkrootSeeds, 5, seedMin, seedMax); + itemLoot.Add(ItemID.WaterleafSeeds, 5, seedMin, seedMax); + itemLoot.Add(ItemID.ShiverthornSeeds, 5, seedMin, seedMax); + itemLoot.Add(ItemID.MoonglowSeeds, 5, seedMin, seedMax); + itemLoot.Add(ItemID.DeathweedSeeds, 5, herbMin, herbMax); + itemLoot.Add(ItemID.FireblossomSeeds, 5, seedMin, seedMax); + + // Miscellaneous seeds + itemLoot.Add(ItemID.GrassSeeds, 10, seedMin, seedMax); + itemLoot.Add(ItemID.JungleGrassSeeds, 10, seedMin, seedMax); + itemLoot.Add(ItemID.MushroomGrassSeeds, 10, seedMin, seedMax); + itemLoot.Add(ItemID.PumpkinSeed, 20, seedMin, seedMax); + + // Biome grass seeds + itemLoot.AddIf(() => !WorldGen.crimson , ItemID.CorruptSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => WorldGen.crimson , ItemID.CrimsonSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => Main.hardMode , ItemID.HallowedSeeds, 20, seedMin, seedMax); + + Mod thorium = CalamityMod.Instance.thorium; + if (thorium is not null) + { + try + { + itemLoot.Add(thorium.Find("MarineKelp").Type, 4, herbMin, herbMax); + itemLoot.Add(thorium.Find("MarineKelpSeeds").Type, 10, seedMin, seedMax); + } + catch + { + CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); + } + } + + Mod soa = CalamityMod.Instance.soa; + if (soa is not null) + { + try + { + itemLoot.Add(soa.Find("Welkinbell").Type, 4, herbMin, herbMax); + itemLoot.Add(soa.Find("WelkinbellSeeds").Type, 10, seedMin, seedMax); + + itemLoot.AddIf(() => Main.hardMode, soa.Find("Illumifern").Type, 4, herbMin, herbMax); + itemLoot.AddIf(() => Main.hardMode, soa.Find("IllumifernSeeds").Type, 10, seedMin, seedMax); + + // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. + // Dan Yami has confirmed that downed calls will be added to SoA eventually. + //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("Enduflora").Type, 4, herbMin, herbMax); + //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("EndufloraSeeds").Type, 10, seedMin, seedMax); + } + catch + { + CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); + } } } } diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index 41a1285b34..54e50b9841 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent.ItemDropRules; using CrateTile = CalamityMod.Tiles.Abyss.AbyssalCrateTile; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetStaticDefaults() { SacrificeTotal = 5; + ItemID.Sets.IsFishingCrate[Type] = true; DisplayName.SetDefault("Abyssal Crate"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); } @@ -43,95 +45,79 @@ namespace CalamityMod.Items.Fishing.SulphurCatches Item.useStyle = ItemUseStyleID.Swing; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + public override bool CanRightClick() => true; - - public override void RightClick(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. + var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); + var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); + var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); + var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); + var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); - //Modded materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedEoCAcidRain, 0.1f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedAquaticScourgeAcidRain, 0.1f, 1, 3); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 16, 28); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedGolemBoss, 0.15f, 4, 7); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke, 0.1f, 1, 5); + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - // Weapons - DropHelper.DropItemFromSetCondition(s, player, DownedBossSystem.downedSlimeGod || Main.hardMode, 0.1f, - ModContent.ItemType(), + tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); + tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); + scoriaAvailable.Add(ModContent.ItemType(), 5, 16, 28); + scoriaAvailable.Add(ModContent.ItemType(), new Fraction(15, 100), 4, 7); + tier3AcidRain.Add(ModContent.ItemType(), 10, 1, 5); + + // Pre-HM Abyss Weapons + tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType()); + ModContent.ItemType() + )); - DropHelper.DropItemFromSetCondition(s, player, DownedBossSystem.downedAquaticScourgeAcidRain, 0.1f, - ModContent.ItemType(), - ModContent.ItemType(), + // Post-AS Acid Rain Weapons (and Nuclear Rod) + tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType()); + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); - // Equipment - DropHelper.DropItemFromSetCondition(s, player, DownedBossSystem.downedSlimeGod || Main.hardMode, 0.25f, - ModContent.ItemType(), + // Pre-HM Abyss Equipment (and Torrential Tear) + tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType()); + ModContent.ItemType(), + ModContent.ItemType() + )); - //Bait - DropHelper.DropItemChance(s, player, ItemID.MasterBait, 10, 1, 2); - DropHelper.DropItemChance(s, player, ItemID.JourneymanBait, 5, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ApprenticeBait, 3, 2, 3); + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - //Potions - DropHelper.DropItemChance(s, player, ItemID.ObsidianSkinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.SwiftnessPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.IronskinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.NightOwlPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ShinePotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.MiningPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.HeartreachPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10, 1, 3); - int healingPotID = ItemID.LesserHealingPotion; - int manaPotID = ItemID.LesserManaPotion; - if (DownedBossSystem.downedDoG) - { - healingPotID = ModContent.ItemType(); - manaPotID = ModContent.ItemType(); - } - else if (DownedBossSystem.downedProvidence) - { - healingPotID = ItemID.SuperHealingPotion; - manaPotID = ItemID.SuperManaPotion; - } - else if (NPC.downedMechBossAny) - { - healingPotID = ItemID.GreaterHealingPotion; - manaPotID = ItemID.GreaterManaPotion; - } - else if (NPC.downedBoss3) - { - healingPotID = ItemID.HealingPotion; - manaPotID = ItemID.ManaPotion; - } - DropHelper.DropItemChance(s, player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); + // Potions + itemLoot.Add(ModContent.ItemType(), 10, 1, 3); + itemLoot.AddCratePotionRules(); - //Money - DropHelper.DropItem(s, player, ItemID.SilverCoin, 10, 90); - DropHelper.DropItemChance(s, player, ItemID.GoldCoin, 0.5f, 1, 5); + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); } } } diff --git a/Items/Fishing/SunbeamFish.cs b/Items/Fishing/SunbeamFish.cs index da87d78f4f..372bca3546 100644 --- a/Items/Fishing/SunbeamFish.cs +++ b/Items/Fishing/SunbeamFish.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing { @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Sunbeam Fish"); Tooltip.SetDefault("Right click to extract essence"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -19,20 +20,17 @@ namespace CalamityMod.Items.Fishing Item.width = 30; Item.height = 28; Item.maxStack = 999; + Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 10); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); } } diff --git a/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs b/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs index e085517176..7c8c3892a0 100644 --- a/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs +++ b/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DisplayName.SetDefault("Coralskin Foolfish"); //Potion material Tooltip.SetDefault("Camouflage is one of nature's best defenses"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.value = Item.sellPrice(silver: 7); Item.rare = ItemRarityID.Green; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs index e5895751b7..971093c99e 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { DisplayName.SetDefault("Eutrophic Sandfish"); SacrificeTotal = 2; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs index bcbab9201e..2c430fa15e 100644 --- a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs +++ b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DisplayName.SetDefault("Greenwave Loach"); Tooltip.SetDefault("An endangered fish that is highly prized in the market"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.Orange; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs index 413d96de69..d6d5621ab7 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DisplayName.SetDefault("Prismatic Guppy"); //Bass substitute Tooltip.SetDefault("Throwing these in an aquarium would be insanity"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Green; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs b/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs deleted file mode 100644 index 8361bf84b9..0000000000 --- a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Fishing.SunkenSeaCatches -{ - public class ScarredAngelfish : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scarred Angelfish"); - Tooltip.SetDefault("The mark of a fallen angel"); - SacrificeTotal = 3; - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 26; - Item.maxStack = 999; - Item.value = Item.sellPrice(silver: 7); - Item.rare = ItemRarityID.Blue; - } - } -} diff --git a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.png b/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.png deleted file mode 100644 index b535397ff2..0000000000 Binary files a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.png and /dev/null differ diff --git a/Items/Fishing/SunkenSeaCatches/Serpentuna.cs b/Items/Fishing/SunkenSeaCatches/Serpentuna.cs index 3f16e0b2fe..be385094bc 100644 --- a/Items/Fishing/SunkenSeaCatches/Serpentuna.cs +++ b/Items/Fishing/SunkenSeaCatches/Serpentuna.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { DisplayName.SetDefault("Serpentuna"); SacrificeTotal = 2; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index f5157d8d21..e3373ccc10 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -1,13 +1,12 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Critters; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Tiles.SunkenSea; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +17,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetStaticDefaults() { SacrificeTotal = 5; + ItemID.Sets.IsFishingCrate[Type] = true; DisplayName.SetDefault("Sunken Crate"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); } @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.height = 32; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useTurn = true; Item.autoReuse = true; Item.useAnimation = 15; @@ -38,69 +38,44 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.useStyle = ItemUseStyleID.Swing; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + public override bool CanRightClick() => true; - - public override void RightClick(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + var postHardmodeClam = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCLAMHardMode); - //Modded materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 10, 30); - DropHelper.DropItem(s, player, ModContent.ItemType(), 10, 30); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 5, 10); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 0.2f, 2, 5); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedCLAMHardMode, 0.12f, 2, 5); + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); + postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); + postHardmodeClam.Add(ModContent.ItemType(), new Fraction(12, 100), 2, 5); // Weapons - DropHelper.DropItemFromSetCondition(s, player, DownedBossSystem.downedCLAMHardMode, 0.07f, - ModContent.ItemType(), + postHardmodeClam.Add(new OneFromOptionsNotScaledWithLuckDropRule(7, 100, ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType()); + ModContent.ItemType() + )); - //Bait - DropHelper.DropItemChance(s, player, ItemID.MasterBait, 10, 1, 2); - DropHelper.DropItemChance(s, player, ItemID.JourneymanBait, 5, 1, 3); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 5, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ApprenticeBait, 3, 2, 3); + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - //Potions - DropHelper.DropItemChance(s, player, ItemID.ObsidianSkinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.SwiftnessPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.IronskinPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.NightOwlPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.ShinePotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.MiningPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.HeartreachPotion, 10, 1, 3); - DropHelper.DropItemChance(s, player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - int healingPotID = ItemID.LesserHealingPotion; - int manaPotID = ItemID.LesserManaPotion; - if (DownedBossSystem.downedDoG) - { - healingPotID = ModContent.ItemType(); - manaPotID = ModContent.ItemType(); - } - else if (DownedBossSystem.downedProvidence) - { - healingPotID = ItemID.SuperHealingPotion; - manaPotID = ItemID.SuperManaPotion; - } - else if (NPC.downedMechBossAny) - { - healingPotID = ItemID.GreaterHealingPotion; - manaPotID = ItemID.GreaterManaPotion; - } - else if (NPC.downedBoss3) - { - healingPotID = ItemID.HealingPotion; - manaPotID = ItemID.ManaPotion; - } - DropHelper.DropItemChance(s, player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); + // Potions + itemLoot.AddCratePotionRules(); - //Money - DropHelper.DropItem(s, player, ItemID.SilverCoin, 10, 90); - DropHelper.DropItemChance(s, player, ItemID.GoldCoin, 0.5f, 1, 5); + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); } } } diff --git a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs index 803911225a..3eb346b641 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DisplayName.SetDefault("Sunken Sailfish"); //Potion material Tooltip.SetDefault("Zooming at 60 miles per hour"); SacrificeTotal = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -21,5 +22,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.value = Item.sellPrice(silver: 7); Item.rare = ItemRarityID.Green; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } } } diff --git a/Items/Fishing/SunkenSeaCatches/SurfClam.cs b/Items/Fishing/SunkenSeaCatches/SurfClam.cs index d14fcaa3d0..5eb7de7e34 100644 --- a/Items/Fishing/SunkenSeaCatches/SurfClam.cs +++ b/Items/Fishing/SunkenSeaCatches/SurfClam.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { DisplayName.SetDefault("Surf Clam"); SacrificeTotal = 2; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Fishing/Xerocodile.cs b/Items/Fishing/Xerocodile.cs index f8a5af9953..19c62f83bb 100644 --- a/Items/Fishing/Xerocodile.cs +++ b/Items/Fishing/Xerocodile.cs @@ -1,7 +1,7 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Fishing { @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Fishing DisplayName.SetDefault("Xerocodile"); Tooltip.SetDefault("Right click to extract blood orbs"); SacrificeTotal = 10; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -19,20 +20,17 @@ namespace CalamityMod.Items.Fishing Item.width = 30; Item.height = 28; Item.maxStack = 999; + Item.consumable = true; Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; } - public override bool CanRightClick() - { - return true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 15); - } + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 15); } } diff --git a/Items/LabFinders/CyanSeekingMechanism.cs b/Items/LabFinders/CyanSeekingMechanism.cs index 62a2d3af95..f8bdafb1b1 100644 --- a/Items/LabFinders/CyanSeekingMechanism.cs +++ b/Items/LabFinders/CyanSeekingMechanism.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.LabFinders { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Cyan Seeking Mechanism"); Tooltip.SetDefault("Moves swiftly towards a lab deep below the desert"); } @@ -26,7 +28,7 @@ namespace CalamityMod.Items.LabFinders Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 15; Item.Calamity().UsesCharge = true; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.SunkenSeaLabCenter != Vector2.Zero; diff --git a/Items/LabFinders/GreenSeekingMechanism.cs b/Items/LabFinders/GreenSeekingMechanism.cs index 91f5f4a1df..1f6bbff7c7 100644 --- a/Items/LabFinders/GreenSeekingMechanism.cs +++ b/Items/LabFinders/GreenSeekingMechanism.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.LabFinders { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Green Seeking Mechanism"); Tooltip.SetDefault("Moves swiftly towards a lab within the jungle"); } @@ -26,7 +28,7 @@ namespace CalamityMod.Items.LabFinders Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 15; Item.Calamity().UsesCharge = true; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.JungleLabCenter != Vector2.Zero; diff --git a/Items/LabFinders/LabSeekingMechanism.cs b/Items/LabFinders/LabSeekingMechanism.cs index 13014f163b..26da0fa75c 100644 --- a/Items/LabFinders/LabSeekingMechanism.cs +++ b/Items/LabFinders/LabSeekingMechanism.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,7 @@ namespace CalamityMod.Items.LabFinders { public override void SetStaticDefaults() { + SacrificeTotal = 5; DisplayName.SetDefault("Lab Seeking Mechanism"); Tooltip.SetDefault("A receptacle for technology which pinpoints the power cores of Draedon's Labs"); } @@ -17,7 +19,7 @@ namespace CalamityMod.Items.LabFinders { Item.width = 24; Item.height = 26; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LabFinders/PurpleSeekingMechanism.cs b/Items/LabFinders/PurpleSeekingMechanism.cs index 5c8c743ea4..56c5736d4b 100644 --- a/Items/LabFinders/PurpleSeekingMechanism.cs +++ b/Items/LabFinders/PurpleSeekingMechanism.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.LabFinders { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Purple Seeking Mechanism"); Tooltip.SetDefault("Moves swiftly towards a lab within the sky"); } @@ -26,7 +28,7 @@ namespace CalamityMod.Items.LabFinders Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 15; Item.Calamity().UsesCharge = true; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.PlanetoidLabCenter != Vector2.Zero; diff --git a/Items/LabFinders/RedSeekingMechanism.cs b/Items/LabFinders/RedSeekingMechanism.cs index 454f83bbe1..dcca0a6bee 100644 --- a/Items/LabFinders/RedSeekingMechanism.cs +++ b/Items/LabFinders/RedSeekingMechanism.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.LabFinders { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Red Seeking Mechanism"); Tooltip.SetDefault("Moves swiftly towards a lab within the underworld"); } @@ -26,7 +28,7 @@ namespace CalamityMod.Items.LabFinders Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 15; Item.Calamity().UsesCharge = true; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.HellLabCenter != Vector2.Zero; diff --git a/Items/LabFinders/YellowSeekingMechanism.cs b/Items/LabFinders/YellowSeekingMechanism.cs index ef64f7e0c2..36b045645e 100644 --- a/Items/LabFinders/YellowSeekingMechanism.cs +++ b/Items/LabFinders/YellowSeekingMechanism.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.LabFinders { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Yellow Seeking Mechanism"); Tooltip.SetDefault("Moves swiftly towards a lab within the frozen caverns"); } @@ -26,7 +28,7 @@ namespace CalamityMod.Items.LabFinders Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 15; Item.Calamity().UsesCharge = true; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.IceLabCenter != Vector2.Zero; diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index f0acb783b3..057573607b 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAstralInfection.cs b/Items/LoreItems/KnowledgeAstralInfection.cs index 58392ff8d7..8f365e0d9a 100644 --- a/Items/LoreItems/KnowledgeAstralInfection.cs +++ b/Items/LoreItems/KnowledgeAstralInfection.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 0a18015e67..22fe7b8a87 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index 1f92340013..b87e2f1c91 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBloodMoon.cs b/Items/LoreItems/KnowledgeBloodMoon.cs index 2581c748b8..1dfdf9e90e 100644 --- a/Items/LoreItems/KnowledgeBloodMoon.cs +++ b/Items/LoreItems/KnowledgeBloodMoon.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index c7e3ab327a..c32caab1f9 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.cs b/Items/LoreItems/KnowledgeBrimstoneCrag.cs index 4179ee79bf..632d88b8fd 100644 --- a/Items/LoreItems/KnowledgeBrimstoneCrag.cs +++ b/Items/LoreItems/KnowledgeBrimstoneCrag.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index a3b0bcbcca..69bdfa1dff 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index 1e396f2b3b..056c8b57ba 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -34,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index cb61ebc0d8..1e3663d788 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs index 3da487f82d..86234f98e4 100644 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ b/Items/LoreItems/KnowledgeCorruption.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 3c2b230a52..92f00c3516 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs index 609ce20e61..4f2f6b8260 100644 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ b/Items/LoreItems/KnowledgeCrimson.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 92c32936af..c4511382f7 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index 22df3d9738..7d7826d45a 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index fd3af2f635..569b24d62d 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index 0b0b070171..1e61229979 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDragonfolly.cs b/Items/LoreItems/KnowledgeDragonfolly.cs index 1f2440c7fc..dd44f3dd41 100644 --- a/Items/LoreItems/KnowledgeDragonfolly.cs +++ b/Items/LoreItems/KnowledgeDragonfolly.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index 1788777652..0230c84827 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DukeFishronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DukeFishronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index dd07853189..f3363c2c9d 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeExoMechs.cs b/Items/LoreItems/KnowledgeExoMechs.cs index 5643a83498..37332d507d 100644 --- a/Items/LoreItems/KnowledgeExoMechs.cs +++ b/Items/LoreItems/KnowledgeExoMechs.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => false; @@ -31,10 +31,10 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index ce7255eb92..6d1dfd796d 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EyeofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EyeofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index ff92743849..cccab2f7ef 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.GolemTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.GolemTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 135b4ed413..1ed2c5d8ec 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index 0005ad7239..15b4773dbc 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.KingSlimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.KingSlimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeLeviathanAnahita.cs b/Items/LoreItems/KnowledgeLeviathanAnahita.cs index a45f3ae590..ea2f3ad28d 100644 --- a/Items/LoreItems/KnowledgeLeviathanAnahita.cs +++ b/Items/LoreItems/KnowledgeLeviathanAnahita.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 7f78c3e167..a0eeed9cc1 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeMechs.cs b/Items/LoreItems/KnowledgeMechs.cs index 93ea4300ff..097c49ad4f 100644 --- a/Items/LoreItems/KnowledgeMechs.cs +++ b/Items/LoreItems/KnowledgeMechs.cs @@ -31,10 +31,10 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index 93ce48f272..0f4cd1ca4d 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.MoonLordTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.MoonLordTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs index d69a37420d..02c3c07812 100644 --- a/Items/LoreItems/KnowledgeOcean.cs +++ b/Items/LoreItems/KnowledgeOcean.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 7c35c6244d..cab1a2821d 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.consumable = false; } @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index 5f244100a0..a85538bc2e 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index eb0acf7fb5..9910acea88 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index e37a50ff94..0b322f8f19 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.PlanteraTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.PlanteraTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index b7d214a6aa..ef2714fa56 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.cs b/Items/LoreItems/KnowledgeProfanedGuardians.cs index 76f21f2971..b917bb3431 100644 --- a/Items/LoreItems/KnowledgeProfanedGuardians.cs +++ b/Items/LoreItems/KnowledgeProfanedGuardians.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 0ca8bac9dd..bbad13b0e8 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index 2eedd92c3a..62af6853a4 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.QueenBeeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.QueenBeeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index ec6bbdce88..801c120ad5 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSentinels.cs b/Items/LoreItems/KnowledgeSentinels.cs index 4a06773945..6056a32d0c 100644 --- a/Items/LoreItems/KnowledgeSentinels.cs +++ b/Items/LoreItems/KnowledgeSentinels.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,9 +23,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -34,9 +34,9 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index 19a543e18d..30d9729757 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index 2d9cb716f5..c2e625d395 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index 3905f3a6d9..99853650eb 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeSulphurSea.cs b/Items/LoreItems/KnowledgeSulphurSea.cs index d0de5d2975..2ccf0260bd 100644 --- a/Items/LoreItems/KnowledgeSulphurSea.cs +++ b/Items/LoreItems/KnowledgeSulphurSea.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index 72f34effaa..4fbdeae703 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index 32666d13b8..7f6d7378bb 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index f06264907a..15fe0542eb 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 33bdda9fe4..e3eab00918 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,8 @@ namespace CalamityMod.Items.LoreItems { Item.width = 20; Item.height = 20; - Item.rare = ItemRarityID.Red; Item.consumable = false; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void AddRecipes() { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); + CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); } } } diff --git a/Items/LoreItems/LoreItem.cs b/Items/LoreItems/LoreItem.cs index b4e35ac7e6..e22f352921 100644 --- a/Items/LoreItems/LoreItem.cs +++ b/Items/LoreItems/LoreItem.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems @@ -6,5 +7,10 @@ namespace CalamityMod.Items.LoreItems public abstract class LoreItem : ModItem { public override Color? GetAlpha(Color lightColor) => Color.White; + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.LoreItems; + } } } diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index 37b0725d47..7bf7f7710c 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Aerialite Bar"); + ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone } public override void SetDefaults() diff --git a/Items/Materials/ArmoredShell.cs b/Items/Materials/ArmoredShell.cs index ed44c4f4e9..9ac8219573 100644 --- a/Items/Materials/ArmoredShell.cs +++ b/Items/Materials/ArmoredShell.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,8 +9,9 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - SacrificeTotal = 25; + SacrificeTotal = 5; DisplayName.SetDefault("Armored Shell"); + ItemID.Sets.SortingPriorityMaterials[Type] = 107; } public override void SetDefaults() @@ -18,7 +20,6 @@ namespace CalamityMod.Items.Materials Item.height = 34; Item.maxStack = 999; Item.value = Item.buyPrice(0, 7, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index 4a04aa9540..9d0d402d4a 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 118; } public override void SetDefaults() @@ -27,8 +29,7 @@ namespace CalamityMod.Items.Materials Item.width = 32; Item.height = 54; Item.maxStack = 999; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 40); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/AshesofAnnihilation.cs b/Items/Materials/AshesofAnnihilation.cs index 7bd7fbf51f..7ac4f66962 100644 --- a/Items/Materials/AshesofAnnihilation.cs +++ b/Items/Materials/AshesofAnnihilation.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -19,6 +20,7 @@ namespace CalamityMod.Items.Materials Tooltip.SetDefault("The smoldering essence of the Witch's wrath"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 123; } public override void SetDefaults() @@ -26,9 +28,8 @@ namespace CalamityMod.Items.Materials Item.width = 54; Item.height = 56; Item.maxStack = 999; - Item.rare = ItemRarityID.Purple; Item.value = Item.sellPrice(gold: 66, silver: 66, copper: 66); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index 8b16e6b7dc..80ebef063a 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -20,16 +21,17 @@ namespace CalamityMod.Items.Materials DisplayName.SetDefault("Auric Bar"); Tooltip.SetDefault("Godlike power emanates from the metal"); + ItemID.Sets.SortingPriorityMaterials[Type] = 120; } public override void SetDefaults() { Item.createTile = ModContent.TileType(); - Item.width = 50; - Item.height = 30; + Item.width = 62; + Item.height = 44; Item.maxStack = 999; Item.value = Item.sellPrice(gold: 60); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; @@ -39,27 +41,27 @@ namespace CalamityMod.Items.Materials } public override void UseStyle(Player player, Rectangle heldItemFrame) { - player.itemLocation += new Vector2(-10f * player.direction, 10f * player.gravDir).RotatedBy(player.itemRotation); + player.itemLocation += new Vector2(-20f * player.direction, 15f * player.gravDir).RotatedBy(player.itemRotation); } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBar_Animated").Value; - spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBar_Animated").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBarGlow").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 15, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/AuricBar.png b/Items/Materials/AuricBar.png index 2d3c447a88..b25eab570d 100644 Binary files a/Items/Materials/AuricBar.png and b/Items/Materials/AuricBar.png differ diff --git a/Items/Materials/AuricBarGlow.png b/Items/Materials/AuricBarGlow.png index 837248c74e..d80546d13a 100644 Binary files a/Items/Materials/AuricBarGlow.png and b/Items/Materials/AuricBarGlow.png differ diff --git a/Items/Materials/AuricBar_Animated.png b/Items/Materials/AuricBar_Animated.png index 38a8c159a1..3f6b3f271a 100644 Binary files a/Items/Materials/AuricBar_Animated.png and b/Items/Materials/AuricBar_Animated.png differ diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 55630f66bb..d11dba26c1 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -27,5 +27,12 @@ namespace CalamityMod.Items.Materials num *= Main.essScale; Lighting.AddLight((int)((Item.position.X + (Item.width / 2)) / 16f), (int)((Item.position.Y + (Item.height / 2)) / 16f), 0.75f * num, 0f, 0f); } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(ItemID.BloodMoonStarter). + Register(); + } } } diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs index 6429304fbb..236ad97913 100644 --- a/Items/Materials/BloodSample.cs +++ b/Items/Materials/BloodSample.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Blood Sample"); + ItemID.Sets.SortingPriorityMaterials[Type] = 68; // Sturdy Fossil } public override void SetDefaults() diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index 3de7e0c4e3..168b43fa26 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 100; DisplayName.SetDefault("Bloodstone"); + ItemID.Sets.SortingPriorityMaterials[Type] = 112; } public override void SetDefaults() @@ -18,8 +20,7 @@ namespace CalamityMod.Items.Materials Item.height = 10; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 60); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 58ea042f2b..5095506abd 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Bloodstone Core"); + ItemID.Sets.SortingPriorityMaterials[Type] = 113; } public override void SetDefaults() @@ -18,9 +20,9 @@ namespace CalamityMod.Items.Materials Item.height = 12; Item.maxStack = 999; Item.value = Item.sellPrice(gold: 4); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } + public override void AddRecipes() { CreateRecipe(2). diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index bf9cea1a89..aa9ac1e41d 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Core of Calamity"); + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CoreofChaos.cs b/Items/Materials/CoreofChaos.cs index 9ed0a4cc3a..829a8b76b1 100644 --- a/Items/Materials/CoreofChaos.cs +++ b/Items/Materials/CoreofChaos.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Core of Chaos"); + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CoreofEleum.cs b/Items/Materials/CoreofEleum.cs index 961e3280ac..8dc754dab2 100644 --- a/Items/Materials/CoreofEleum.cs +++ b/Items/Materials/CoreofEleum.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Core of Eleum"); + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CoreofSunlight.cs b/Items/Materials/CoreofSunlight.cs index ea63c27faa..2da39cd3d4 100644 --- a/Items/Materials/CoreofSunlight.cs +++ b/Items/Materials/CoreofSunlight.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Core of Sunlight"); + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index 19fb6ef780..3cf0d46f16 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles; +using CalamityMod.Rarities; +using CalamityMod.Tiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -17,6 +18,7 @@ namespace CalamityMod.Items.Materials SacrificeTotal = 25; DisplayName.SetDefault("Cosmilite Bar"); Tooltip.SetDefault("A chunk of durable and highly resilient cosmic steel"); + ItemID.Sets.SortingPriorityMaterials[Type] = 114; } public override void SetDefaults() @@ -26,8 +28,7 @@ namespace CalamityMod.Items.Materials Item.height = 24; Item.maxStack = 999; Item.value = Item.sellPrice(gold: 20); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; diff --git a/Items/Materials/CryonicBar.cs b/Items/Materials/CryonicBar.cs index 2a6fb3ce4a..e8fbd23811 100644 --- a/Items/Materials/CryonicBar.cs +++ b/Items/Materials/CryonicBar.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Cryonic Bar"); + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() diff --git a/Items/Materials/DarkPlasma.cs b/Items/Materials/DarkPlasma.cs index c23c69a822..c9b0d4a68b 100644 --- a/Items/Materials/DarkPlasma.cs +++ b/Items/Materials/DarkPlasma.cs @@ -1,6 +1,7 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.Rarities; +using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -9,11 +10,12 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - SacrificeTotal = 25; + SacrificeTotal = 5; DisplayName.SetDefault("Dark Plasma"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 108; } public override void SetDefaults() @@ -22,8 +24,7 @@ namespace CalamityMod.Items.Materials Item.height = 12; Item.maxStack = 999; Item.value = Item.buyPrice(0, 7, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index 17d7556767..eb55960517 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 117; } public override void SetDefaults() @@ -27,9 +29,8 @@ namespace CalamityMod.Items.Materials Item.width = 28; Item.height = 32; Item.maxStack = 999; - Item.rare = ItemRarityID.Purple; Item.value = Item.sellPrice(gold: 12); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/DivineGeode.cs b/Items/Materials/DivineGeode.cs index 48a850ef64..c3b49fca02 100644 --- a/Items/Materials/DivineGeode.cs +++ b/Items/Materials/DivineGeode.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Materials SacrificeTotal = 25; DisplayName.SetDefault("Divine Geode"); Tooltip.SetDefault("A chunk of crystallized holy energy"); + ItemID.Sets.SortingPriorityMaterials[Type] = 104; } public override void SetDefaults() @@ -18,9 +20,8 @@ namespace CalamityMod.Items.Materials Item.width = 15; Item.height = 12; Item.maxStack = 999; - Item.rare = ItemRarityID.Purple; Item.value = Item.buyPrice(0, 6, 50, 0); - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/DubiousPlating.cs b/Items/Materials/DubiousPlating.cs index 424f63e8a3..8f213e8706 100644 --- a/Items/Materials/DubiousPlating.cs +++ b/Items/Materials/DubiousPlating.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,8 +18,7 @@ namespace CalamityMod.Items.Materials Item.width = 30; Item.height = 24; Item.maxStack = 999; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(silver: 6); } } } diff --git a/Items/Materials/EffulgentFeather.cs b/Items/Materials/EffulgentFeather.cs index a6e101b2bb..4f6205749a 100644 --- a/Items/Materials/EffulgentFeather.cs +++ b/Items/Materials/EffulgentFeather.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Materials Tooltip.SetDefault("It vibrates with fluffy golden energy"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(3, 11)); ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 102; } public override void SetDefaults() diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 1bfdfe973b..a6be15323c 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.DataStructures; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 116; } public override void SetDefaults() @@ -27,9 +29,8 @@ namespace CalamityMod.Items.Materials Item.width = 36; Item.height = 38; Item.maxStack = 999; - Item.rare = ItemRarityID.Red; Item.value = Item.sellPrice(gold: 2); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/EssenceofChaos.cs b/Items/Materials/EssenceofChaos.cs index 85e1845a76..923cfe613f 100644 --- a/Items/Materials/EssenceofChaos.cs +++ b/Items/Materials/EssenceofChaos.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Materials DisplayName.SetDefault("Essence of Chaos"); Tooltip.SetDefault("The essence of chaotic creatures"); + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/EssenceofEleum.cs b/Items/Materials/EssenceofEleum.cs index 20d98de6b0..3cd1b111a3 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Materials DisplayName.SetDefault("Essence of Eleum"); Tooltip.SetDefault("The essence of cold creatures"); + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/EssenceofSunlight.cs b/Items/Materials/EssenceofSunlight.cs index 90ceef9e6f..de1c29d200 100644 --- a/Items/Materials/EssenceofSunlight.cs +++ b/Items/Materials/EssenceofSunlight.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Materials DisplayName.SetDefault("Essence of Sunlight"); Tooltip.SetDefault("The essence of sky, light, and storm creatures"); + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index 8187d26130..738fe4ea95 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Materials SacrificeTotal = 25; DisplayName.SetDefault("Exo Prism"); Tooltip.SetDefault("Fractal energies shimmer across its surface"); + ItemID.Sets.SortingPriorityMaterials[Type] = 121; } public override void SetDefaults() @@ -21,9 +23,8 @@ namespace CalamityMod.Items.Materials Item.width = 32; Item.height = 52; Item.maxStack = 999; - Item.rare = ItemRarityID.Purple; Item.value = Item.sellPrice(gold: 60); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index 1db9201030..94a57bb699 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 24)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite } public override void SetDefaults() diff --git a/Items/Materials/LifeAlloy.cs b/Items/Materials/LifeAlloy.cs index 3a5b2a5672..b57e1e9087 100644 --- a/Items/Materials/LifeAlloy.cs +++ b/Items/Materials/LifeAlloy.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Life Alloy"); + ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment } public override void SetDefaults() diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 144c6d9eba..1a12655d28 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Materials SacrificeTotal = 5; DisplayName.SetDefault("Miracle Matter"); Tooltip.SetDefault("Its amorphous form contains untold potential\n" + "One is required for every Exo Weapon"); + ItemID.Sets.SortingPriorityMaterials[Type] = 122; } public override void SetDefaults() @@ -23,9 +25,8 @@ namespace CalamityMod.Items.Materials Item.width = 46; Item.height = 64; Item.maxStack = 999; - Item.rare = ItemRarityID.Purple; Item.value = Item.sellPrice(platinum: 6, gold: 50); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) diff --git a/Items/Materials/MysteriousCircuitry.cs b/Items/Materials/MysteriousCircuitry.cs index 94cd36509b..33ab218335 100644 --- a/Items/Materials/MysteriousCircuitry.cs +++ b/Items/Materials/MysteriousCircuitry.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,8 +18,7 @@ namespace CalamityMod.Items.Materials Item.width = 30; Item.height = 24; Item.maxStack = 999; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(silver: 6); } } } diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 61fce0a01f..7a246ad080 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; using Terraria.DataStructures; -using Terraria.ID; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 115; } public override void SetDefaults() @@ -27,9 +29,8 @@ namespace CalamityMod.Items.Materials Item.width = 38; Item.height = 36; Item.maxStack = 999; - Item.rare = ItemRarityID.Red; Item.value = Item.sellPrice(gold: 2); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/VictoryShard.cs b/Items/Materials/PearlShard.cs similarity index 71% rename from Items/Materials/VictoryShard.cs rename to Items/Materials/PearlShard.cs index 0c4af84316..9f21ef24a8 100644 --- a/Items/Materials/VictoryShard.cs +++ b/Items/Materials/PearlShard.cs @@ -4,12 +4,14 @@ using Terraria.ID; namespace CalamityMod.Items.Materials { - public class VictoryShard : ModItem + [LegacyName("VictoryShard")] + public class PearlShard : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 25; - DisplayName.SetDefault("Victory Shard"); + DisplayName.SetDefault("Pearl Shard"); + ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite } public override void SetDefaults() diff --git a/Items/Materials/VictoryShard.png b/Items/Materials/PearlShard.png similarity index 100% rename from Items/Materials/VictoryShard.png rename to Items/Materials/PearlShard.png diff --git a/Items/Materials/PerennialBar.cs b/Items/Materials/PerennialBar.cs index 03de4ccfec..c3a2ad5a0c 100644 --- a/Items/Materials/PerennialBar.cs +++ b/Items/Materials/PerennialBar.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Perennial Bar"); + ItemID.Sets.SortingPriorityMaterials[Type] = 92; // Shroomite Bar } public override void SetDefaults() diff --git a/Items/Materials/Phantoplasm.cs b/Items/Materials/Phantoplasm.cs index d1031bdfb9..d0d6b88a2e 100644 --- a/Items/Materials/Phantoplasm.cs +++ b/Items/Materials/Phantoplasm.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Materials Tooltip.SetDefault("It churns and seethes with ghastly malice"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 110; } public override void SetDefaults() diff --git a/Items/Materials/PlasmaDriveCore.cs b/Items/Materials/PlasmaDriveCore.cs index cc1db25aba..2deaf42af6 100644 --- a/Items/Materials/PlasmaDriveCore.cs +++ b/Items/Materials/PlasmaDriveCore.cs @@ -1,11 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using System; -using Terraria.GameContent; namespace CalamityMod.Items.Materials { @@ -24,8 +25,7 @@ namespace CalamityMod.Items.Materials Item.height = 30; Item.maxStack = 999; Item.value = Item.buyPrice(0, 0, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Materials/PurifiedGel.cs b/Items/Materials/PurifiedGel.cs index f6b69460b2..9e5ee106ac 100644 --- a/Items/Materials/PurifiedGel.cs +++ b/Items/Materials/PurifiedGel.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Purified Gel"); + ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() diff --git a/Items/Materials/ReaperTooth.cs b/Items/Materials/ReaperTooth.cs index 5d1bb1e781..33b3f4fe69 100644 --- a/Items/Materials/ReaperTooth.cs +++ b/Items/Materials/ReaperTooth.cs @@ -1,6 +1,7 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Materials { @@ -19,8 +20,7 @@ namespace CalamityMod.Items.Materials Item.height = 26; Item.maxStack = 999; Item.value = Item.buyPrice(0, 7, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Materials/RottenMatter.cs b/Items/Materials/RottenMatter.cs index d112c4a485..f5498a74d3 100644 --- a/Items/Materials/RottenMatter.cs +++ b/Items/Materials/RottenMatter.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Rotten Matter"); + ItemID.Sets.SortingPriorityMaterials[Type] = 65; // Crimtane Ore } public override void SetDefaults() diff --git a/Items/Materials/RuinousSoul.cs b/Items/Materials/RuinousSoul.cs index ae3a712f41..69a869a75a 100644 --- a/Items/Materials/RuinousSoul.cs +++ b/Items/Materials/RuinousSoul.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Materials Tooltip.SetDefault("A shard of the distant past"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 111; } public override void SetDefaults() @@ -22,7 +24,7 @@ namespace CalamityMod.Items.Materials Item.height = 42; Item.maxStack = 999; Item.value = Item.buyPrice(0, 7, 0, 0); - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Materials/ScoriaBar.cs b/Items/Materials/ScoriaBar.cs index ba13df58d3..3b3f71c834 100644 --- a/Items/Materials/ScoriaBar.cs +++ b/Items/Materials/ScoriaBar.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Materials SacrificeTotal = 25; DisplayName.SetDefault("Scoria Bar"); Tooltip.SetDefault("The smoke feels warm"); + ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment } public override void SetDefaults() diff --git a/Items/Materials/SeaRemains.cs b/Items/Materials/SeaRemains.cs index 33d0c1d557..d20f294431 100644 --- a/Items/Materials/SeaRemains.cs +++ b/Items/Materials/SeaRemains.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Sea Remains"); + ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite } public override void SetDefaults() @@ -24,10 +25,10 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.Coral). - AddIngredient(ItemID.Starfish). - AddIngredient(ItemID.Seashell). + AddIngredient(2). + AddIngredient(ItemID.Coral, 2). + AddIngredient(ItemID.Starfish, 2). + AddIngredient(ItemID.Seashell, 2). AddTile(TileID.Furnaces). Register(); } diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 15916be59c..11531a20a4 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles; +using CalamityMod.Rarities; +using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Materials SacrificeTotal = 25; DisplayName.SetDefault("Shadowspec Bar"); Tooltip.SetDefault("A vile, black metal, so horrendous and powerful as to defy explanation"); + ItemID.Sets.SortingPriorityMaterials[Type] = 124; } public override void SetDefaults() @@ -34,7 +36,7 @@ namespace CalamityMod.Items.Materials Item.consumable = true; Item.value = Item.sellPrice(platinum: 1, gold: 92); - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Materials/SuspiciousScrap.cs b/Items/Materials/SuspiciousScrap.cs index 0bafe069c3..19f206a1d9 100644 --- a/Items/Materials/SuspiciousScrap.cs +++ b/Items/Materials/SuspiciousScrap.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Rarities; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.World; -using Terraria.GameContent; namespace CalamityMod.Items.Materials { @@ -23,8 +24,7 @@ namespace CalamityMod.Items.Materials Item.height = 30; Item.maxStack = 999; Item.value = Item.buyPrice(0, 0, 0, 20); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs index 113bbbe2f5..3b965c9e1a 100644 --- a/Items/Materials/TitanHeart.cs +++ b/Items/Materials/TitanHeart.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - SacrificeTotal = 25; + SacrificeTotal = 3; DisplayName.SetDefault("Titan Heart"); Tooltip.SetDefault("Also used at the Astral Beacon"); } diff --git a/Items/Materials/TwistingNether.cs b/Items/Materials/TwistingNether.cs index 82fa73e6c7..85ed09f48a 100644 --- a/Items/Materials/TwistingNether.cs +++ b/Items/Materials/TwistingNether.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,10 +9,11 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - SacrificeTotal = 25; + SacrificeTotal = 5; ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Twisting Nether"); + ItemID.Sets.SortingPriorityMaterials[Type] = 109; } public override void SetDefaults() @@ -20,8 +22,7 @@ namespace CalamityMod.Items.Materials Item.height = 12; Item.maxStack = 999; Item.value = Item.buyPrice(0, 7, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/UelibloomBar.cs b/Items/Materials/UelibloomBar.cs index c50ccf7323..e16bad297c 100644 --- a/Items/Materials/UelibloomBar.cs +++ b/Items/Materials/UelibloomBar.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using CalamityMod.Tiles; using Terraria; using Terraria.ID; @@ -13,6 +14,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Uelibloom Bar"); // Yoo-luh Bloom + ItemID.Sets.SortingPriorityMaterials[Type] = 106; } public override void SetDefaults() @@ -21,9 +23,8 @@ namespace CalamityMod.Items.Materials Item.width = 15; Item.height = 12; Item.maxStack = 999; - Item.rare = ItemRarityID.Red; - Item.value = Item.sellPrice(gold: 3); - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.value = Item.sellPrice(gold: 5); + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index 280e0ee449..e338956835 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Unholy Core"); + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() diff --git a/Items/Materials/UnholyEssence.cs b/Items/Materials/UnholyEssence.cs index 7948cd0912..a204926ec0 100644 --- a/Items/Materials/UnholyEssence.cs +++ b/Items/Materials/UnholyEssence.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Item.type] = true; + ItemID.Sets.SortingPriorityMaterials[Type] = 103; } public override void SetDefaults() diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index 7567c3dd3d..ccc5ff865c 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -1,11 +1,36 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Terraria.DataStructures; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Wulfrum; +using Terraria.Audio; +using CalamityMod.Cooldowns; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Materials { - public class WulfrumShard : ModItem + [LegacyName("WulfrumShard")] + public class WulfrumMetalScrap : ModItem { + public override void Load() + { + On.Terraria.Item.CanFillEmptyAmmoSlot += AvoidDefaultingToAmmoSlot; + } + + public override void Unload() + { + On.Terraria.Item.CanFillEmptyAmmoSlot -= AvoidDefaultingToAmmoSlot; + } + + private bool AvoidDefaultingToAmmoSlot(On.Terraria.Item.orig_CanFillEmptyAmmoSlot orig, Item self) + { + if (self.type == Type) + return false; + + return orig(self); + } + public override void SetStaticDefaults() { SacrificeTotal = 25; @@ -19,6 +44,39 @@ namespace CalamityMod.Items.Materials Item.maxStack = 999; Item.value = Item.sellPrice(copper: 80); Item.rare = ItemRarityID.Blue; + Item.ammo = Item.type; + } + + public override void OnSpawn(IEntitySource source) + { + if (source is EntitySource_Loot) + { + if (Main.rand.NextBool()) + return; + + bool closePlayer = false; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if ((Main.player[i].Center - Item.Center).Length() < 1200 && Main.player[i].GetModPlayer().battery) + { + closePlayer = true; + break; + } + } + + if (closePlayer) + { + Item.stack++; + SoundEngine.PlaySound(WulfrumBattery.ExtraDropSound, Item.Center); + + int numDust = Main.rand.Next(3, 7); + for (int i = 0; i < numDust; i++) + { + Dust.NewDustDirect(Item.position, Item.width, Item.height, Main.rand.NextBool() ? 246 : 247, 0, -3f, Scale: Main.rand.NextFloat(0.9f, 1f)); + } + } + } } } } diff --git a/Items/Materials/WulfrumShard.png b/Items/Materials/WulfrumMetalScrap.png similarity index 100% rename from Items/Materials/WulfrumShard.png rename to Items/Materials/WulfrumMetalScrap.png diff --git a/Items/Materials/YharonSoulFragment.cs b/Items/Materials/YharonSoulFragment.cs index 5dd1b03b0e..8f57f064b5 100644 --- a/Items/Materials/YharonSoulFragment.cs +++ b/Items/Materials/YharonSoulFragment.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Materials Item.height = 14; Item.maxStack = 999; Item.value = Item.sellPrice(gold: 45); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/MomentumCapacitor.cs b/Items/MomentumCapacitor.cs index 913428a2e0..0bba490815 100644 --- a/Items/MomentumCapacitor.cs +++ b/Items/MomentumCapacitor.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items { SacrificeTotal = 1; DisplayName.SetDefault("Momentum Capacitor"); - Tooltip.SetDefault("Hold down the button to charge the Momentum Capacitor,\n" + "continuously and uncontrollably increasing your top speed"); + Tooltip.SetDefault("While using the Momentum Capacitor,\n" + "your top speed will continuously and uncontrollably increase"); } public override void SetDefaults() @@ -34,6 +34,11 @@ namespace CalamityMod.Items Item.useTurn = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override bool? UseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index 4c6c5bb4f3..d1e2833c03 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,8 +27,17 @@ namespace CalamityMod.Items.Mounts Item.mountType = ModContent.MountType(); Item.value = Item.buyPrice(platinum: 1, gold: 50); - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(20). + AddTile(TileID.LunarCraftingStation). + Register(); + } } } diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs index 3d0fd6b102..6815d7a0d0 100644 --- a/Items/Mounts/ExoThrone.cs +++ b/Items/Mounts/ExoThrone.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using CalamityMod.Rarities; +using System.Collections.Generic; using System.Linq; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Mounts Item.mountType = ModContent.MountType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List list) diff --git a/Items/Mounts/Fabsol.cs b/Items/Mounts/Fabsol.cs index aa2847f91c..9d6b2b7d31 100644 --- a/Items/Mounts/Fabsol.cs +++ b/Items/Mounts/Fabsol.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Mounts Item.mountType = ModContent.MountType(); Item.value = Item.buyPrice(platinum: 3); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } } diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index 4e724482d1..8ccda72dee 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Mounts Item.useStyle = ItemUseStyleID.HoldUp; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.NPCHit56; diff --git a/Items/Mounts/Minecarts/TheCartofGods.cs b/Items/Mounts/Minecarts/TheCartofGods.cs index ed7b6c9c2b..cce1061c75 100644 --- a/Items/Mounts/Minecarts/TheCartofGods.cs +++ b/Items/Mounts/Minecarts/TheCartofGods.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -20,8 +21,7 @@ namespace CalamityMod.Items.Mounts.Minecarts Item.useStyle = ItemUseStyleID.Swing; Item.value = Item.sellPrice(gold: 30); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item68; diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 3f03518b0a..df833d2c9b 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.Mounts; +using CalamityMod.Buffs.Mounts; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using System; @@ -97,16 +97,7 @@ namespace CalamityMod.Items.Mounts { if (Main.myPlayer == player.whoAmI) { - int highestPickPower = 35; //35% if you have no pickaxes. - for (int item = 0; item < Main.InventorySlotsTotal; item++) - { - if (player.inventory[item].pick <= 0) - continue; - if (player.inventory[item].pick > highestPickPower) - { - highestPickPower = player.inventory[item].pick; - } - } + int highestPickPower = player.GetBestPickPower(); float direction = Math.Sign(player.velocity.X); if (Math.Abs(direction) < 0.1f) @@ -145,60 +136,7 @@ namespace CalamityMod.Items.Mounts float tileDist = tileVec.Length(); Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - int pickReq = 0; - ModTile moddedTile = TileLoader.GetTile(tile.TileType); - if (moddedTile != null) - { - pickReq = moddedTile.MinPick; - } - else - { - switch (tile.TileType) - { - case TileID.Chlorophyte: - pickReq = 200; - break; - case TileID.Ebonstone: - case TileID.Crimstone: - case TileID.Pearlstone: - case TileID.DesertFossil: - case TileID.Obsidian: - case TileID.Hellstone: - pickReq = 65; - break; - case TileID.Meteorite: - pickReq = 50; - break; - case TileID.Demonite: - case TileID.Crimtane: - if (y > Main.worldSurface) - pickReq = 55; - break; - case TileID.LihzahrdBrick: - case TileID.LihzahrdAltar: - pickReq = 210; - break; - case TileID.Cobalt: - case TileID.Palladium: - pickReq = 100; - break; - case TileID.Mythril: - case TileID.Orichalcum: - pickReq = 110; - break; - case TileID.Adamantite: - case TileID.Titanium: - pickReq = 150; - break; - default: - break; - } - } - if (Main.tileDungeon[tile.TileType]) - { - if (x < Main.maxTilesX * 0.35 || x > Main.maxTilesX * 0.65) - pickReq = 65; - } + int pickReq = tile.GetRequiredPickPower(x, y); if (tileDist < mineHeight) { diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index 2f47f28cfe..9ce6f441b3 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.Mounts; +using CalamityMod.Buffs.Mounts; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Mounts MountData.dashSpeed = 8f; MountData.jumpHeight = 20; MountData.acceleration = 0.1f; - MountData.jumpSpeed = 20f; + MountData.jumpSpeed = 15f; MountData.totalFrames = 4; MountData.blockExtraJumps = true; int[] array = new int[MountData.totalFrames]; @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Mounts if (player.velocity.Y > 0f || player.controlDown) { player.gravity = 1f; - player.maxFallSpeed = 20f; + player.maxFallSpeed = 15f; } player.noFallDmg = true; } diff --git a/Items/Mounts/SuspiciousLookingJellyBean.cs b/Items/Mounts/SuspiciousLookingJellyBean.cs index c22d4debf7..7f86cab4ea 100644 --- a/Items/Mounts/SuspiciousLookingJellyBean.cs +++ b/Items/Mounts/SuspiciousLookingJellyBean.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Mounts Item.noMelee = true; Item.mountType = ModContent.MountType(); - Item.value = Item.buyPrice(platinum: 1); - Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; Item.Calamity().devItem = true; } } diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index baa2a02192..4309a754fe 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -43,6 +43,11 @@ namespace CalamityMod.Items line.Text = "Press " + hotkey + " to teleport to the position of the mouse"; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 43fc5e2888..50a4e30324 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -1,38 +1,53 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; +using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { public class BloodOrange : ModItem { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/BloodOrangeConsume"); public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Orange"); Tooltip.SetDefault("It has a distinctly sweet flavor and a strong aroma\n" + "Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); + "Can only be used if the max amount of life fruit has been consumed\n" + + ""); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit } public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 38; + Item.height = 40; Item.useAnimation = 30; Item.rare = ItemRarityID.LightPurple; Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item4; + Item.UseSound = UseSound; Item.consumable = true; } public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.bOrange || player.statLifeMax < 500) + if (modPlayer.bOrange) + { + string key = "Mods.CalamityMod.BloodOrangeText"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return false; + } + else if (player.statLifeMax < 500) { return false; } @@ -54,6 +69,14 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().bOrange) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/PermanentBoosters/BloodOrange.png b/Items/PermanentBoosters/BloodOrange.png index 399874ec4c..ca4e3941f4 100644 Binary files a/Items/PermanentBoosters/BloodOrange.png and b/Items/PermanentBoosters/BloodOrange.png differ diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 404767b6ee..bb3e535373 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -1,8 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; +using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -13,6 +16,8 @@ namespace CalamityMod.Items.PermanentBoosters DisplayName.SetDefault("Comet Shard"); Tooltip.SetDefault("Permanently increases maximum mana by 50"); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Mana Crystal } public override void SetDefaults() @@ -32,6 +37,11 @@ namespace CalamityMod.Items.PermanentBoosters CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.cShard) { + string key = "Mods.CalamityMod.CometShardText"; + Color messageColor = Color.DarkOrchid; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + return false; } return true; @@ -52,6 +62,14 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().cShard) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index c9846e31ec..9c41bb4f7e 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -1,14 +1,20 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; +using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { public class Dragonfruit : ModItem { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/DragonfruitConsume"); public override void SetStaticDefaults() { DisplayName.SetDefault("Dragonfruit"); @@ -16,25 +22,34 @@ namespace CalamityMod.Items.PermanentBoosters "Permanently increases maximum life by 25\n" + "Can only be used if the max amount of life fruit has been consumed"); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit } public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 32; + Item.height = 32; Item.useAnimation = 30; Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item4; + Item.UseSound = UseSound; Item.consumable = true; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.dFruit || player.statLifeMax < 500) + if (modPlayer.dFruit) + { + string key = "Mods.CalamityMod.DragonfruitText"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + return false; + } + else if (player.statLifeMax < 500) { return false; } @@ -56,13 +71,21 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().dFruit) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). AddIngredient(ItemID.SkyBlueFlower). AddIngredient(ItemID.FragmentSolar, 15). - AddIngredient(2). + AddIngredient(5). AddIngredient(). AddTile(). Register(); diff --git a/Items/PermanentBoosters/Dragonfruit.png b/Items/PermanentBoosters/Dragonfruit.png index 0040545e75..2293b6c4f6 100644 Binary files a/Items/PermanentBoosters/Dragonfruit.png and b/Items/PermanentBoosters/Dragonfruit.png differ diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index c3a74fee90..73bb6a8a07 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.PermanentBoosters Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item122; Item.consumable = true; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; // Not researchable, only drops one time. + Item.rare = ModContent.RarityType(); // Not researchable, only drops one time. } public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostThree; diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index 7914443307..4e58b85b92 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -1,6 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using System.Linq; +using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +13,7 @@ namespace CalamityMod.Items.PermanentBoosters { public class Elderberry : ModItem { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/ElderberryConsume"); public override void SetStaticDefaults() { DisplayName.SetDefault("Elderberry"); @@ -15,25 +21,34 @@ namespace CalamityMod.Items.PermanentBoosters "Permanently increases maximum life by 25\n" + "Can only be used if the max amount of life fruit has been consumed"); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit } public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 38; + Item.height = 34; Item.useAnimation = 30; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item4; + Item.UseSound = UseSound; Item.consumable = true; } public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.eBerry || player.statLifeMax < 500) + if (modPlayer.eBerry) + { + string key = "Mods.CalamityMod.ElderberryText"; + Color messageColor = Color.RoyalBlue; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + return false; + } + else if (player.statLifeMax < 500) { return false; } @@ -55,6 +70,14 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().eBerry) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/PermanentBoosters/Elderberry.png b/Items/PermanentBoosters/Elderberry.png index 4014076ac5..1259611398 100644 Binary files a/Items/PermanentBoosters/Elderberry.png and b/Items/PermanentBoosters/Elderberry.png differ diff --git a/Items/PermanentBoosters/ElectrolyteGelPack.cs b/Items/PermanentBoosters/ElectrolyteGelPack.cs index 65590763a0..74254848fc 100644 --- a/Items/PermanentBoosters/ElectrolyteGelPack.cs +++ b/Items/PermanentBoosters/ElectrolyteGelPack.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.PermanentBoosters Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item122; - Item.consumable = true; // Not researchable, only drops one time. + Item.consumable = true; } public override bool CanUseItem(Player player) diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 5c3bb46bc0..16e59df693 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -1,8 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; +using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { @@ -13,6 +16,8 @@ namespace CalamityMod.Items.PermanentBoosters DisplayName.SetDefault("Ethereal Core"); Tooltip.SetDefault("Permanently increases maximum mana by 50"); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Mana Crystal } public override void SetDefaults() @@ -32,6 +37,11 @@ namespace CalamityMod.Items.PermanentBoosters CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.eCore) { + string key = "Mods.CalamityMod.EtherealCoreText"; + Color messageColor = Color.Purple; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + return false; } return true; @@ -52,6 +62,14 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().eCore) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 0c4fbd6832..381ac019b6 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -1,13 +1,18 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; +using System.Collections.Generic; namespace CalamityMod.Items.PermanentBoosters { public class MiracleFruit : ModItem { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/MiracleFruitConsume"); public override void SetStaticDefaults() { DisplayName.SetDefault("Miracle Fruit"); @@ -15,24 +20,34 @@ namespace CalamityMod.Items.PermanentBoosters "Permanently increases maximum life by 25\n" + "Can only be used if the max amount of life fruit has been consumed"); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit } public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 32; + Item.height = 36; Item.useAnimation = 30; Item.rare = ItemRarityID.Yellow; Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item4; + Item.UseSound = UseSound; Item.consumable = true; } public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.mFruit || player.statLifeMax < 500) + if (modPlayer.mFruit) + { + string key = "Mods.CalamityMod.MiracleFruitText"; + Color messageColor = Color.GreenYellow; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + return false; + } + else if (player.statLifeMax < 500) { return false; } @@ -54,6 +69,14 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().mFruit) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/PermanentBoosters/MiracleFruit.png b/Items/PermanentBoosters/MiracleFruit.png index 483f4a425c..195f910b14 100644 Binary files a/Items/PermanentBoosters/MiracleFruit.png and b/Items/PermanentBoosters/MiracleFruit.png differ diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index d4ad854805..07b6dfa1ca 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -1,5 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using System.Linq; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +17,8 @@ namespace CalamityMod.Items.PermanentBoosters DisplayName.SetDefault("Phantom Heart"); Tooltip.SetDefault("Permanently increases maximum mana by 50"); SacrificeTotal = 1; + // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) + ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Mana Crystal } public override void SetDefaults() @@ -24,8 +30,7 @@ namespace CalamityMod.Items.PermanentBoosters Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item29; Item.consumable = true; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -33,6 +38,10 @@ namespace CalamityMod.Items.PermanentBoosters CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.pHeart) { + string key = "Mods.CalamityMod.PhantomHeartText"; + Color messageColor = Color.Magenta; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return false; } return true; @@ -53,6 +62,14 @@ namespace CalamityMod.Items.PermanentBoosters return true; } + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (line != null && Main.LocalPlayer.Calamity().pHeart) + line.Text = "[c/8a8a8a:You have already consumed this item]"; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Pets/BrimstoneJewel.cs b/Items/Pets/BrimstoneJewel.cs index cc32264382..d1a9f7e642 100644 --- a/Items/Pets/BrimstoneJewel.cs +++ b/Items/Pets/BrimstoneJewel.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Pets Item.buffType = ModContent.BuffType(); Item.value = Item.sellPrice(gold: 40); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 9e9b1ccc51..3fe7593be2 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Pets Item.UseSound = SoundID.Meowmere; Item.value = Item.sellPrice(gold: 7); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/EnchantedButterfly.cs b/Items/Pets/EnchantedButterfly.cs index 037b9cd41c..f2721874dc 100644 --- a/Items/Pets/EnchantedButterfly.cs +++ b/Items/Pets/EnchantedButterfly.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Pets AddIngredient(ItemID.TreeNymphButterfly). AddIngredient(ItemID.ZebraSwallowtailButterfly). AddIngredient(ItemID.JuliaButterfly). + AddIngredient(ItemID.HellButterfly). AddTile(TileID.CrystalBall). Register(); } diff --git a/Items/Pets/ForgottenDragonEgg.cs b/Items/Pets/ForgottenDragonEgg.cs index f4c5ce5ed3..cc253d9014 100644 --- a/Items/Pets/ForgottenDragonEgg.cs +++ b/Items/Pets/ForgottenDragonEgg.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Pets Item.buffType = ModContent.BuffType(); Item.value = Item.sellPrice(gold: 30); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index 89f2257967..e25a138db9 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Pets Item.expert = true; Item.value = Item.sellPrice(gold: 30); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index 2ec54075a7..db05a825b1 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Pets Item.buffType = ModContent.BuffType(); Item.value = Item.sellPrice(gold: 40); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/LittleLight.cs b/Items/Pets/LittleLight.cs index f8ed2d127e..278e9ccfd6 100644 --- a/Items/Pets/LittleLight.cs +++ b/Items/Pets/LittleLight.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -26,8 +27,7 @@ namespace CalamityMod.Items.Pets Item.buffType = ModContent.BuffType(); Item.value = Item.sellPrice(gold: 15); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/McNuggets.cs b/Items/Pets/McNuggets.cs index 0661024552..4a11496017 100644 --- a/Items/Pets/McNuggets.cs +++ b/Items/Pets/McNuggets.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Pets; using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Pets Item.buffType = ModContent.BuffType(); Item.value = Item.sellPrice(gold: 30); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/AbyssGravel.cs index e5cf8a3f79..82087cef44 100644 --- a/Items/Placeables/AbyssGravel.cs +++ b/Items/Placeables/AbyssGravel.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 13; - Item.height = 10; + Item.width = 16; + Item.height = 16; Item.maxStack = 999; } } diff --git a/Items/Placeables/AbyssGravel.png b/Items/Placeables/AbyssGravel.png index 79c48af545..b6f0e0ed2f 100644 Binary files a/Items/Placeables/AbyssGravel.png and b/Items/Placeables/AbyssGravel.png differ diff --git a/Items/Placeables/Acidwood.cs b/Items/Placeables/Acidwood.cs index e8600b2391..eb78237af0 100644 --- a/Items/Placeables/Acidwood.cs +++ b/Items/Placeables/Acidwood.cs @@ -2,6 +2,7 @@ using CalamityMod.Tiles.Abyss; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Walls; namespace CalamityMod.Items.Placeables { @@ -27,11 +28,20 @@ namespace CalamityMod.Items.Placeables Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + } + public override void AddRecipes() { CreateRecipe(). AddIngredient(2). Register(); + + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 4). + AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index 6b261a876c..84c3802272 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Placeables { SacrificeTotal = 25; DisplayName.SetDefault("Astral Bar"); + ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite } public override void SetDefaults() diff --git a/Items/Placeables/AstralMonolith.cs b/Items/Placeables/AstralMonolith.cs index 02419346e9..2a5480e7ae 100644 --- a/Items/Placeables/AstralMonolith.cs +++ b/Items/Placeables/AstralMonolith.cs @@ -27,6 +27,12 @@ namespace CalamityMod.Items.Placeables Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // It's not really wood... but it comes from trees! + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Placeables/AstralStone.png b/Items/Placeables/AstralStone.png index e169904f6e..081b62b170 100644 Binary files a/Items/Placeables/AstralStone.png and b/Items/Placeables/AstralStone.png differ diff --git a/Items/Placeables/Banners/GiantClamBanner.png b/Items/Placeables/Banners/GiantClamBanner.png deleted file mode 100644 index 74b65932d9..0000000000 Binary files a/Items/Placeables/Banners/GiantClamBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/GreatSandSharkBanner.png b/Items/Placeables/Banners/GreatSandSharkBanner.png deleted file mode 100644 index e5cf0ba0a0..0000000000 Binary files a/Items/Placeables/Banners/GreatSandSharkBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/MaulerBanner.png b/Items/Placeables/Banners/MaulerBanner.png deleted file mode 100644 index 09871a1440..0000000000 Binary files a/Items/Placeables/Banners/MaulerBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/WulfrumPylonBanner.cs b/Items/Placeables/Banners/WulfrumAmplifierBanner.cs similarity index 88% rename from Items/Placeables/Banners/WulfrumPylonBanner.cs rename to Items/Placeables/Banners/WulfrumAmplifierBanner.cs index 93a31975e9..75e8bc424d 100644 --- a/Items/Placeables/Banners/WulfrumPylonBanner.cs +++ b/Items/Placeables/Banners/WulfrumAmplifierBanner.cs @@ -4,12 +4,13 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Banners { - public class WulfrumPylonBanner : ModItem + [LegacyName("WulfrumPylonBanner")] + public class WulfrumAmplifierBanner : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Wulfrum Pylon"); + Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Wulfrum Amplifier"); } public override void SetDefaults() diff --git a/Items/Placeables/Banners/WulfrumPylonBanner.png b/Items/Placeables/Banners/WulfrumAmplifierBanner.png similarity index 100% rename from Items/Placeables/Banners/WulfrumPylonBanner.png rename to Items/Placeables/Banners/WulfrumAmplifierBanner.png diff --git a/Items/Placeables/CelestialRemains.cs b/Items/Placeables/CelestialRemains.cs index a5901531a6..8c5029fe2b 100644 --- a/Items/Placeables/CelestialRemains.cs +++ b/Items/Placeables/CelestialRemains.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Placeables { DisplayName.SetDefault("Celestial Remains"); SacrificeTotal = 200; + ItemID.Sets.SortingPriorityExtractibles[Type] = 3; // Desert Fossil } public override void SetDefaults() diff --git a/Items/Placeables/ChaoticBrick.png b/Items/Placeables/ChaoticBrick.png deleted file mode 100644 index 9067fa1f57..0000000000 Binary files a/Items/Placeables/ChaoticBrick.png and /dev/null differ diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs index 97f55ef5cd..ea59cc3042 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.useAnimation = 15; Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.consumable = true; Item.createTile = ModContent.TileType(); } diff --git a/Items/Placeables/DraedonStructures/AgedSecurityChest.cs b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs index 1f1b384525..085b50921d 100644 --- a/Items/Placeables/DraedonStructures/AgedSecurityChest.cs +++ b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.autoReuse = true; Item.useAnimation = 15; Item.useTime = 14; - Item.rare = ItemRarityID.Green; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = 500; diff --git a/Items/Placeables/DraedonStructures/ChargingStationItem.cs b/Items/Placeables/DraedonStructures/ChargingStationItem.cs index 6d30809e2d..b66477d841 100644 --- a/Items/Placeables/DraedonStructures/ChargingStationItem.cs +++ b/Items/Placeables/DraedonStructures/ChargingStationItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.value = Item.buyPrice(gold: 50); } } diff --git a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs index fee2adafb2..99211770fb 100644 --- a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs +++ b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = Item.buyPrice(gold: 5); - Item.rare = ItemRarityID.Orange; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.createTile = ModContent.TileType(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs index 7b07470423..787153b230 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.useAnimation = 15; Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.consumable = true; Item.createTile = ModContent.TileType(); } diff --git a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs index 4559888e65..3844b6b0a0 100644 --- a/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs +++ b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; @@ -26,8 +27,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.value = Item.buyPrice(gold: 50); } } diff --git a/Items/Placeables/DraedonStructures/SecurityChest.cs b/Items/Placeables/DraedonStructures/SecurityChest.cs index b41b1e861c..42cb9e63f6 100644 --- a/Items/Placeables/DraedonStructures/SecurityChest.cs +++ b/Items/Placeables/DraedonStructures/SecurityChest.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,8 +23,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures Item.autoReuse = true; Item.useAnimation = 15; Item.useTime = 14; - Item.rare = ItemRarityID.Orange; - Item.Calamity().customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.value = 500; diff --git a/Items/Placeables/Furniture/AltarOfTheAccursedItem.png b/Items/Placeables/Furniture/AltarOfTheAccursedItem.png deleted file mode 100644 index c4bb03cb8b..0000000000 Binary files a/Items/Placeables/Furniture/AltarOfTheAccursedItem.png and /dev/null differ diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/Furniture/AuricToilet.cs index 92acab9a4a..3d56aa97d5 100644 --- a/Items/Placeables/Furniture/AuricToilet.cs +++ b/Items/Placeables/Furniture/AuricToilet.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Placeables.FurnitureSilva; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs index 765dc45a7c..1455c25974 100644 --- a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Scourge Relic"); - + Tooltip.SetDefault("A glimpse into what will be..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs index e851e65aaa..9c6fd55a10 100644 --- a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Desert Scourge Relic"); - + Tooltip.SetDefault("A glimpse into what will be..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs similarity index 60% rename from Items/Placeables/Furniture/AltarOfTheAccursedItem.cs rename to Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index 3505cecbc1..234703f2dd 100644 --- a/Items/Placeables/Furniture/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -1,10 +1,10 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture +namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { [LegacyName("SCalAltarItem")] public class AltarOfTheAccursedItem : ModItem @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Placeables.Furniture Tooltip.SetDefault("Offer Ashes of Calamity at this altar to summon the Witch\n" + "Doing so will create a square arena of blocks, with the altar at its center\n" + "During the battle, heart pickups only heal for half as much\n" + - "The Witch enrages while you are outside of the arena"); + "The Witch enrages while you are outside of the arena\n" + + "Used for special crafting"); } public override void SetDefaults() @@ -27,16 +28,26 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 60; - Item.height = 48; - Item.maxStack = 999; + Item.width = 38; + Item.height = 32; + Item.maxStack = 9999; Item.useStyle = ItemUseStyleID.Swing; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 30).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 30). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 1). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.png b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.png new file mode 100644 index 0000000000..1948408b29 Binary files /dev/null and b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs index 83970d7e91..729c1679a3 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -27,6 +27,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index d7c77fba4c..b10e136ad9 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -28,6 +28,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs index 8d50b0bf8b..f0d22ed2f3 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs @@ -25,6 +25,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.JungleSpores, 5).AddTile(TileID.LunarCraftingStation).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index f4aefe4dd6..154d1a8ae1 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -30,11 +31,15 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(platinum: 2, gold: 50); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddRecipeGroup("HardmodeAnvil").AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.LunarBar, 10).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index dcb528048c..21ceba638a 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,11 +29,15 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(platinum: 27, gold: 50); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("HardmodeForge").AddIngredient(ItemID.TinkerersWorkshop).AddIngredient(ItemID.LunarCraftingStation).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 25).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs index 6b6bcca0bf..e7042db9ab 100644 --- a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs @@ -1,5 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Materials; + namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { [LegacyName("EutrophicCrafting")] @@ -26,9 +28,20 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(). + AddIngredient(10). + AddIngredient(5). + AddIngredient(5). + AddIngredient(3). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs index 3f4e2b99be..76c1e28a99 100644 --- a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs @@ -26,6 +26,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.WorkBenches).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs index c5588e0cee..bcb1c790a6 100644 --- a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs @@ -25,6 +25,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1). diff --git a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs index 2ccb4806ce..7553ad3858 100644 --- a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs @@ -28,6 +28,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs index 461a40b38d..1ccf0ae407 100644 --- a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs +++ b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs @@ -27,6 +27,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyGoldBar", 5).AddTile(TileID.LunarCraftingStation).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs index ee6128313a..f2a5481d56 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs @@ -25,6 +25,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Solidifier).AddTile(TileID.Anvils).Register(); diff --git a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs index e3ea478527..219a9591f2 100644 --- a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs +++ b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs @@ -25,6 +25,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations Item.createTile = ModContent.TileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.Anvils).Register(); diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index 26beea17ff..48bccbb2a3 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -11,6 +11,7 @@ using CalamityMod.Items.Placeables.FurnitureSilva; using CalamityMod.Items.Placeables.FurnitureStatigel; using CalamityMod.Items.Placeables.FurnitureStratus; using CalamityMod.Items.Placeables.FurnitureVoid; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs index 70fe94ae76..cd82a71714 100644 --- a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 27; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs index b06575ac21..f71c064760 100644 --- a/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ApolloTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 28; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs index a0750f4dcd..885cece8dc 100644 --- a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 23; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AresTrophy.cs b/Items/Placeables/Furniture/Trophies/AresTrophy.cs index f3d02c20f1..95541c0466 100644 --- a/Items/Placeables/Furniture/Trophies/AresTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AresTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 30; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs index b7c8602228..bce13f8b2a 100644 --- a/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ArtemisTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 29; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs index 7b7b6965a6..73ef6e2bf0 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumAureusTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -26,8 +26,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 19; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs index 73a8035b04..eab4996a03 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 20; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs index 8bc8dc168e..ddd3dbabc8 100644 --- a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 21; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs index 305d0ede52..8c498e46a5 100644 --- a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 7; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs index ca5d840c4b..9546d1476f 100644 --- a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 16; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs index 175cd1dc51..d1ed744917 100644 --- a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 15; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs index 2d449a7577..f60ce14b9f 100644 --- a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 13; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs index fe2ce1b03b..579f1f88e6 100644 --- a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 9; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Banners/MaulerBanner.cs b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs similarity index 55% rename from Items/Placeables/Banners/MaulerBanner.cs rename to Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs index a42f2e9433..5b30e22f1a 100644 --- a/Items/Placeables/Banners/MaulerBanner.cs +++ b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.cs @@ -1,21 +1,20 @@ -using CalamityMod.Tiles; -using Terraria; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Banners +namespace CalamityMod.Items.Placeables.Furniture.Trophies { - public class MaulerBanner : ModItem + public class CragmawMireTrophy : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Mauler"); + DisplayName.SetDefault("Cragmaw Mire Trophy"); } public override void SetDefaults() { - Item.width = 10; - Item.height = 24; + Item.width = 30; + Item.height = 30; Item.maxStack = 99; Item.useTurn = true; Item.autoReuse = true; @@ -23,10 +22,9 @@ namespace CalamityMod.Items.Placeables.Banners Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; + Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 5; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.png b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.png new file mode 100644 index 0000000000..5786292364 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/CragmawMireTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs index 401704626b..65a43bde3c 100644 --- a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 3; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs index 1fce24b023..18b1a020a3 100644 --- a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 0; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs index 1a469067b8..740ce3c6fe 100644 --- a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 14; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs b/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs index c50ac2d2fb..d3ea61f641 100644 --- a/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DragonfollyTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; @@ -26,8 +26,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 18; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Banners/GiantClamBanner.cs b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs similarity index 55% rename from Items/Placeables/Banners/GiantClamBanner.cs rename to Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs index b56af347e8..884e130083 100644 --- a/Items/Placeables/Banners/GiantClamBanner.cs +++ b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.cs @@ -1,22 +1,21 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; - -namespace CalamityMod.Items.Placeables.Banners +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Trophies { - public class GiantClamBanner : ModItem + [LegacyName("GiantClamBanner")] + public class GiantClamTrophy : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Giant Clam"); + DisplayName.SetDefault("Giant Clam Trophy"); } public override void SetDefaults() { - Item.width = 10; - Item.height = 24; + Item.width = 30; + Item.height = 30; Item.maxStack = 99; Item.useTurn = true; Item.autoReuse = true; @@ -24,10 +23,9 @@ namespace CalamityMod.Items.Placeables.Banners Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; + Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 107; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/GiantClamTrophy.png b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.png new file mode 100644 index 0000000000..07cc02ab3e Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/GiantClamTrophy.png differ diff --git a/Items/Placeables/Banners/GreatSandSharkBanner.cs b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs similarity index 54% rename from Items/Placeables/Banners/GreatSandSharkBanner.cs rename to Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs index 4c56047b8d..bb79427c8b 100644 --- a/Items/Placeables/Banners/GreatSandSharkBanner.cs +++ b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.cs @@ -1,22 +1,21 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; - -namespace CalamityMod.Items.Placeables.Banners +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Trophies { - public class GreatSandSharkBanner : ModItem + [LegacyName("GreatSandSharkBanner")] + public class GreatSandSharkTrophy : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Great Sand Shark"); + DisplayName.SetDefault("Great Sand Shark Trophy"); } public override void SetDefaults() { - Item.width = 10; - Item.height = 24; + Item.width = 30; + Item.height = 30; Item.maxStack = 99; Item.useTurn = true; Item.autoReuse = true; @@ -24,10 +23,9 @@ namespace CalamityMod.Items.Placeables.Banners Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; + Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 65; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.png b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.png new file mode 100644 index 0000000000..ec551dc644 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/GreatSandSharkTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs index 70efed37ef..d83830d22f 100644 --- a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 8; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs index 9fdd7fdb3f..b12c6c1871 100644 --- a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 5; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs b/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs new file mode 100644 index 0000000000..dafe1916fb --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/MaulerTrophy.cs @@ -0,0 +1,31 @@ +using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + [LegacyName("MaulerBanner")] + public class MaulerTrophy : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Mauler Trophy"); + } + + public override void SetDefaults() + { + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/MaulerTrophy.png b/Items/Placeables/Furniture/Trophies/MaulerTrophy.png new file mode 100644 index 0000000000..3033f2dc2d Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/MaulerTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs new file mode 100644 index 0000000000..602995b096 --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture.BossTrophies; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class NuclearTerrorTrophy : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Nuclear Terror Trophy"); + } + + public override void SetDefaults() + { + Item.width = 30; + Item.height = 30; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 50000; + Item.rare = ItemRarityID.Blue; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.png b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.png new file mode 100644 index 0000000000..005055d317 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/NuclearTerrorTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs index 50ed769448..5ebacd7dc9 100644 --- a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 24; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs index 4e5461c06c..f68d9afb95 100644 --- a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 1; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs index 9dd5af5a1e..7dbe3da93b 100644 --- a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 4; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs index 1e9235223d..b797b11c47 100644 --- a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 17; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs index f0ee58ec8c..a3ec9361f4 100644 --- a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 25; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs index b463af19e4..2ac7dc6283 100644 --- a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 6; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs index 54d69c44e4..d442593cd4 100644 --- a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 22; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs index d42d22520a..dc9180cb4e 100644 --- a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 11; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs index 75fe5f18e8..4cb5ec9246 100644 --- a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 2; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs index 8a91288304..64444473ac 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 26; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs index e5bb38089f..7705e3cf8e 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCataclysmTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 33; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs index 1df64ae35a..74a038bccc 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCatastropheTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 32; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs index 656c801676..7511a56da7 100644 --- a/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ThanatosTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 31; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs index 6cb389dc59..6adb8be4a3 100644 --- a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 12; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs index 30c71f3647..06e5df3c3c 100644 --- a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); - Item.placeStyle = 10; + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/WulfrumLureItem.cs b/Items/Placeables/Furniture/WulfrumLureItem.cs new file mode 100644 index 0000000000..676a697c96 --- /dev/null +++ b/Items/Placeables/Furniture/WulfrumLureItem.cs @@ -0,0 +1,47 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Accessories; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class WulfrumLureItem : ModItem + { + public static int SignalTime = 30 * 60; + public static int SpawnIntervals = 4 * 60; + public static int MaxEnemiesPerWave = 3; + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Wulfrum Lure"); + Tooltip.SetDefault($"Consumes [i:{ModContent.ItemType()}] Energy Cores to emit a wulfrum signal that lures Wulfrum automatons out\n" + + $"The signal lasts for {SignalTime / 60f} seconds"); + } + + public override void SetDefaults() + { + Item.width = 22; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 14; + Item.rare = ItemRarityID.Blue; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 1). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/WulfrumLureItem.png b/Items/Placeables/Furniture/WulfrumLureItem.png new file mode 100644 index 0000000000..22dd7c1c4d Binary files /dev/null and b/Items/Placeables/Furniture/WulfrumLureItem.png differ diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index 4099117e07..909ff476a4 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -12,6 +12,9 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss { SacrificeTotal = 100; Tooltip.SetDefault("Can be placed in water"); + ItemID.Sets.Torches[Item.type] = true; + // Right now this causes some Cursed Inferno dust until tmod fixes AutoLightSelect, it's a small sacrifice + ItemID.Sets.WaterTorches[Item.type] = true; } public override void SetDefaults() @@ -32,6 +35,12 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss Item.value = 500; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + public override void HoldItem(Player player) { if (Main.rand.Next(player.itemAnimation > 0 ? 10 : 20) == 0) @@ -39,14 +48,15 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 180); } Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); - Lighting.AddLight(position, 1f, 1f, 1f); + Lighting.AddLight(position, 0.5f, 0.5f, 2f); } public override void PostUpdate() { - Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 1f, 1f); + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.5f, 0.5f, 2f); } + // This function doesn't even work.... public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) { wetTorch = true; diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.png b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.png index 65a175e242..e1f2cd166e 100644 Binary files a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.png and b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.png differ diff --git a/Items/Placeables/FurnitureExo/ExoBathtub.cs b/Items/Placeables/FurnitureExo/ExoBathtub.cs index 47e348f6d1..a533d0eacd 100644 --- a/Items/Placeables/FurnitureExo/ExoBathtub.cs +++ b/Items/Placeables/FurnitureExo/ExoBathtub.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoBed.cs b/Items/Placeables/FurnitureExo/ExoBed.cs index ff187454df..ab26c1be01 100644 --- a/Items/Placeables/FurnitureExo/ExoBed.cs +++ b/Items/Placeables/FurnitureExo/ExoBed.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoBed.png b/Items/Placeables/FurnitureExo/ExoBed.png index 92c8b28d4c..ab8bfa06d0 100644 Binary files a/Items/Placeables/FurnitureExo/ExoBed.png and b/Items/Placeables/FurnitureExo/ExoBed.png differ diff --git a/Items/Placeables/FurnitureExo/ExoBookcase.cs b/Items/Placeables/FurnitureExo/ExoBookcase.cs index 438627f431..ddd61d72d2 100644 --- a/Items/Placeables/FurnitureExo/ExoBookcase.cs +++ b/Items/Placeables/FurnitureExo/ExoBookcase.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoCandelabra.cs b/Items/Placeables/FurnitureExo/ExoCandelabra.cs index 88b7f9e119..4ac4b4a130 100644 --- a/Items/Placeables/FurnitureExo/ExoCandelabra.cs +++ b/Items/Placeables/FurnitureExo/ExoCandelabra.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoCandle.cs b/Items/Placeables/FurnitureExo/ExoCandle.cs index 085a0e9fa6..746c479792 100644 --- a/Items/Placeables/FurnitureExo/ExoCandle.cs +++ b/Items/Placeables/FurnitureExo/ExoCandle.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoChair.cs b/Items/Placeables/FurnitureExo/ExoChair.cs index 1aae27065f..f968d009ad 100644 --- a/Items/Placeables/FurnitureExo/ExoChair.cs +++ b/Items/Placeables/FurnitureExo/ExoChair.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoChandelier.cs b/Items/Placeables/FurnitureExo/ExoChandelier.cs index c38391a20f..59a129ab75 100644 --- a/Items/Placeables/FurnitureExo/ExoChandelier.cs +++ b/Items/Placeables/FurnitureExo/ExoChandelier.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoChest.cs b/Items/Placeables/FurnitureExo/ExoChest.cs index cf44f37d75..5412a0139d 100644 --- a/Items/Placeables/FurnitureExo/ExoChest.cs +++ b/Items/Placeables/FurnitureExo/ExoChest.cs @@ -1,7 +1,8 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureExo { public class ExoChest : ModItem @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoClock.cs b/Items/Placeables/FurnitureExo/ExoClock.cs index 4777b5f2a8..a0ed61f3f9 100644 --- a/Items/Placeables/FurnitureExo/ExoClock.cs +++ b/Items/Placeables/FurnitureExo/ExoClock.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoConsole.cs b/Items/Placeables/FurnitureExo/ExoConsole.cs index fa7a97ae9e..29a5fe3f09 100644 --- a/Items/Placeables/FurnitureExo/ExoConsole.cs +++ b/Items/Placeables/FurnitureExo/ExoConsole.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoDisplay.cs b/Items/Placeables/FurnitureExo/ExoDisplay.cs index 631a6782a7..8bfc1c54c8 100644 --- a/Items/Placeables/FurnitureExo/ExoDisplay.cs +++ b/Items/Placeables/FurnitureExo/ExoDisplay.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoDoor.cs b/Items/Placeables/FurnitureExo/ExoDoor.cs index 0d52c3a447..4527d1188d 100644 --- a/Items/Placeables/FurnitureExo/ExoDoor.cs +++ b/Items/Placeables/FurnitureExo/ExoDoor.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoDresser.cs b/Items/Placeables/FurnitureExo/ExoDresser.cs index 84c0a8def3..d8a06e8cbb 100644 --- a/Items/Placeables/FurnitureExo/ExoDresser.cs +++ b/Items/Placeables/FurnitureExo/ExoDresser.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoKeyboard.cs b/Items/Placeables/FurnitureExo/ExoKeyboard.cs index c1e035ada7..6ad06e401f 100644 --- a/Items/Placeables/FurnitureExo/ExoKeyboard.cs +++ b/Items/Placeables/FurnitureExo/ExoKeyboard.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoLamp.cs b/Items/Placeables/FurnitureExo/ExoLamp.cs index 3e1604046f..9844fb5ef8 100644 --- a/Items/Placeables/FurnitureExo/ExoLamp.cs +++ b/Items/Placeables/FurnitureExo/ExoLamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoLantern.cs b/Items/Placeables/FurnitureExo/ExoLantern.cs index 199a22acbb..d5bd1e6647 100644 --- a/Items/Placeables/FurnitureExo/ExoLantern.cs +++ b/Items/Placeables/FurnitureExo/ExoLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoPlatform.cs b/Items/Placeables/FurnitureExo/ExoPlatform.cs index 5ce29d2629..48826ccfda 100644 --- a/Items/Placeables/FurnitureExo/ExoPlatform.cs +++ b/Items/Placeables/FurnitureExo/ExoPlatform.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Rarities; +using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index c9d87be990..5f19777591 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; -using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs index ff608adca4..86ebbf5e69 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; -using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs b/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs index 9128c580ad..9286b10f15 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPlatform.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Rarities; +using CalamityMod.Tiles.FurnitureExo; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Placeables/FurnitureExo/ExoScreen.cs b/Items/Placeables/FurnitureExo/ExoScreen.cs index 127f9076c8..a0deefeac7 100644 --- a/Items/Placeables/FurnitureExo/ExoScreen.cs +++ b/Items/Placeables/FurnitureExo/ExoScreen.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoServer.cs b/Items/Placeables/FurnitureExo/ExoServer.cs index c4c82e1a1d..59d3fd06ac 100644 --- a/Items/Placeables/FurnitureExo/ExoServer.cs +++ b/Items/Placeables/FurnitureExo/ExoServer.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoSink.cs b/Items/Placeables/FurnitureExo/ExoSink.cs index c3e89cfe2c..b50f0ce9ed 100644 --- a/Items/Placeables/FurnitureExo/ExoSink.cs +++ b/Items/Placeables/FurnitureExo/ExoSink.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoSofa.cs b/Items/Placeables/FurnitureExo/ExoSofa.cs index 1b529956d1..36b45ce273 100644 --- a/Items/Placeables/FurnitureExo/ExoSofa.cs +++ b/Items/Placeables/FurnitureExo/ExoSofa.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoTable.cs b/Items/Placeables/FurnitureExo/ExoTable.cs index 3d5f60f929..3dee022850 100644 --- a/Items/Placeables/FurnitureExo/ExoTable.cs +++ b/Items/Placeables/FurnitureExo/ExoTable.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoTerminal.cs b/Items/Placeables/FurnitureExo/ExoTerminal.cs index 5cbc24e433..fe803c52c8 100644 --- a/Items/Placeables/FurnitureExo/ExoTerminal.cs +++ b/Items/Placeables/FurnitureExo/ExoTerminal.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.DraedonMisc; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoToilet.cs b/Items/Placeables/FurnitureExo/ExoToilet.cs index f66b810661..3d9334d052 100644 --- a/Items/Placeables/FurnitureExo/ExoToilet.cs +++ b/Items/Placeables/FurnitureExo/ExoToilet.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureExo/ExoWorkbench.cs b/Items/Placeables/FurnitureExo/ExoWorkbench.cs index 698976fdd4..05ffa261a6 100644 --- a/Items/Placeables/FurnitureExo/ExoWorkbench.cs +++ b/Items/Placeables/FurnitureExo/ExoWorkbench.cs @@ -1,3 +1,4 @@ +using CalamityMod.Rarities; using CalamityMod.Tiles.FurnitureExo; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureExo Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; Item.createTile = ModContent.TileType(); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs new file mode 100644 index 0000000000..3032495ebe --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.cs @@ -0,0 +1,43 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class EyeOfTheAccursedBanner : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of the Accursed Banner"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 36; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 3). + AddIngredient(ItemID.Silk, 5). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.png b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.png new file mode 100644 index 0000000000..12c80f260d Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/EyeOfTheAccursedBanner.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs new file mode 100644 index 0000000000..2fc4de6aee --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class LargeRitualCandle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Large Ritual Candle"); + Tooltip.SetDefault("Right click to place in a different style"); + SacrificeTotal = 1; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 24; + Item.height = 50; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed) + { + Item.placeStyle = 1; + } + else + { + Item.placeStyle = 0; + } + return base.CanUseItem(player); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 6). + AddIngredient(ModContent.ItemType()). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.png b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.png new file mode 100644 index 0000000000..8dd248c204 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/LargeRitualCandle.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs new file mode 100644 index 0000000000..a8701618bd --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs @@ -0,0 +1,41 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class MonolithOfTheAccursed : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Monolith of the Accursed"); + Tooltip.SetDefault("Let the sky burn a blazing red\n" + + "The monolith has two different modes"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 24; + Item.height = 28; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 15). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.png b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.png new file mode 100644 index 0000000000..df000f64de Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs new file mode 100644 index 0000000000..4723c0ab11 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs @@ -0,0 +1,51 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class OccultBrickItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Occult Brick"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 16; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(200). + AddRecipeGroup("AnyStoneBlock", 200). + AddIngredient(ModContent.ItemType()). + AddTile(ModContent.TileType()). + Register(); + + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 2). + Register(); + + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.png b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.png new file mode 100644 index 0000000000..504d8fdbe2 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs new file mode 100644 index 0000000000..fed2da07ec --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.cs @@ -0,0 +1,43 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class OccultLegionnaireBanner : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Occult Legionnaire Banner"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 36; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 3). + AddIngredient(ItemID.Silk, 5). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.png b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.png new file mode 100644 index 0000000000..bfba3998ef Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/OccultLegionnaireBanner.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs b/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs new file mode 100644 index 0000000000..9484dffd1b --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.cs @@ -0,0 +1,36 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class OccultPlatformItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Occult Platform"); + SacrificeTotal = 200; + } + + public override void SetDefaults() + { + Item.width = 22; + Item.height = 18; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(2).AddIngredient(ModContent.ItemType()).Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.png b/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.png new file mode 100644 index 0000000000..b1cc3cd2aa Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/OccultPlatformItem.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs b/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs new file mode 100644 index 0000000000..f87066e165 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/RitualCandle.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class RitualCandle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ritual Candle"); + Tooltip.SetDefault("Right click to place in a different style"); + SacrificeTotal = 1; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 22; + Item.height = 28; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed) + { + Item.placeStyle = 1; + } + else + { + Item.placeStyle = 0; + } + return base.CanUseItem(player); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType()). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/RitualCandle.png b/Items/Placeables/FurnitureSacrilegious/RitualCandle.png new file mode 100644 index 0000000000..9abbb5ace5 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/RitualCandle.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs new file mode 100644 index 0000000000..7e319beea1 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.cs @@ -0,0 +1,39 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousBathtub : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Bathtub"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 22; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 14). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.png new file mode 100644 index 0000000000..efad1bb149 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBathtub.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs new file mode 100644 index 0000000000..0190b2464c --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.cs @@ -0,0 +1,40 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousBed : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Bed"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 18; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ItemID.Silk, 5). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.png new file mode 100644 index 0000000000..41597cef8c Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBed.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs new file mode 100644 index 0000000000..e00b7b3b72 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.cs @@ -0,0 +1,40 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousBench : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Bench"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 42; + Item.height = 26; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ItemID.Silk, 2). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.png new file mode 100644 index 0000000000..ae9ab31f52 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBench.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs new file mode 100644 index 0000000000..1504f3c73a --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.cs @@ -0,0 +1,40 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousBookcase : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Bookcase"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 36; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 20). + AddIngredient(ItemID.Book, 10). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.png new file mode 100644 index 0000000000..9c876b60bd Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousBookcase.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs new file mode 100644 index 0000000000..d2802b61d0 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousCandelabra : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Candelabra"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 28; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 3). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.png new file mode 100644 index 0000000000..2fc69692f1 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandelabra.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs new file mode 100644 index 0000000000..8f2b813e39 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousCandle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Candle"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 16; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType()). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.png new file mode 100644 index 0000000000..5ba4801307 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousCandle.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs new file mode 100644 index 0000000000..b829e0f039 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.cs @@ -0,0 +1,39 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousChair : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Chair"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 20; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 4). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.png new file mode 100644 index 0000000000..83328a4124 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChair.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs new file mode 100644 index 0000000000..a16d406872 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousChandelier : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Chandelier"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 40; + Item.height = 32; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ItemID.Chain). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.png new file mode 100644 index 0000000000..58414098e5 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChandelier.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs new file mode 100644 index 0000000000..74b410833e --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.cs @@ -0,0 +1,40 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousChest : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Chest"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 8). + AddRecipeGroup("IronBar", 2). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.png new file mode 100644 index 0000000000..baae2fcf2e Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousChest.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs new file mode 100644 index 0000000000..d0faa0e54d --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.cs @@ -0,0 +1,41 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousClock : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Clock"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 34; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddRecipeGroup("IronBar", 3). + AddIngredient(ItemID.Glass, 6). + AddIngredient(ModContent.ItemType(), 10). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.png new file mode 100644 index 0000000000..43807523e0 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousClock.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs new file mode 100644 index 0000000000..c77294848a --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.cs @@ -0,0 +1,39 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousDoor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Door"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 22; + Item.height = 32; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 8). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.png new file mode 100644 index 0000000000..79b3abff27 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDoor.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs new file mode 100644 index 0000000000..70b917a7a8 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.cs @@ -0,0 +1,39 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousDresser : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Dresser"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 24; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 16). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.png new file mode 100644 index 0000000000..c892ea613e Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousDresser.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs new file mode 100644 index 0000000000..92818c4a4d --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousLamp : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Lamp"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 38; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 3). + AddIngredient(ModContent.ItemType()). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.png new file mode 100644 index 0000000000..7876628ef0 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLamp.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs new file mode 100644 index 0000000000..245b63fdae --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousLantern : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Lantern"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 16; + Item.height = 30; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 6). + AddIngredient(ModContent.ItemType()). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.png new file mode 100644 index 0000000000..59ee6bea36 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousLantern.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs new file mode 100644 index 0000000000..f341d2ab3d --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.cs @@ -0,0 +1,41 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousOrgan : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Organ"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 24; + Item.height = 34; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ItemID.Bone, 4). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ItemID.Book). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.png new file mode 100644 index 0000000000..2e1c5371da Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousOrgan.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs new file mode 100644 index 0000000000..f0f22083d3 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.cs @@ -0,0 +1,43 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousSink : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Sink"); + SacrificeTotal = 1; + Tooltip.SetDefault("Counts as a water, honey, and lava source"); + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 6). + AddIngredient(ItemID.WaterBucket). + AddIngredient(ItemID.HoneyBucket). + AddIngredient(ItemID.LavaBucket). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.png new file mode 100644 index 0000000000..620a0b3071 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousSink.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs new file mode 100644 index 0000000000..29f89efbcc --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.cs @@ -0,0 +1,39 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousTable : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Table"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 26; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 8). + AddTile(ModContent.TileType()). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.png new file mode 100644 index 0000000000..c1544b286b Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousTable.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs new file mode 100644 index 0000000000..17130c5d63 --- /dev/null +++ b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.cs @@ -0,0 +1,35 @@ +using CalamityMod.Rarities; +using CalamityMod.Tiles.FurnitureSacrilegious; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureSacrilegious +{ + public class SacrilegiousWorkBench : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrilegious Work Bench"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 16; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).Register(); + } + } +} diff --git a/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.png b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.png new file mode 100644 index 0000000000..f504652ac0 Binary files /dev/null and b/Items/Placeables/FurnitureSacrilegious/SacrilegiousWorkBench.png differ diff --git a/Items/Placeables/NovaeSlag.cs b/Items/Placeables/NovaeSlag.cs index bf3a0eae7e..104fa8a7d9 100644 --- a/Items/Placeables/NovaeSlag.cs +++ b/Items/Placeables/NovaeSlag.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Placeables { DisplayName.SetDefault("Novae Slag"); SacrificeTotal = 200; + ItemID.Sets.SortingPriorityExtractibles[Type] = 1; // Silt Block } public override void SetDefaults() diff --git a/Items/Placeables/Ores/AerialiteOre.cs b/Items/Placeables/Ores/AerialiteOre.cs index 9f0c020500..a65f387701 100644 --- a/Items/Placeables/Ores/AerialiteOre.cs +++ b/Items/Placeables/Ores/AerialiteOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Aerialite Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone } public override void SetDefaults() diff --git a/Items/Placeables/Ores/AstralOre.cs b/Items/Placeables/Ores/AstralOre.cs index fee9059163..b275f533e8 100644 --- a/Items/Placeables/Ores/AstralOre.cs +++ b/Items/Placeables/Ores/AstralOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Astral Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite } public override void SetDefaults() diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index 5dc6fc326b..feeae0abce 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -1,6 +1,7 @@ +using CalamityMod.Rarities; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Placeables.Ores SacrificeTotal = 100; DisplayName.SetDefault("Auric Ore"); Tooltip.SetDefault("Laced with the dormant power of a deity"); + ItemID.Sets.SortingPriorityMaterials[Type] = 119; } public override void SetDefaults() @@ -26,7 +28,7 @@ namespace CalamityMod.Items.Placeables.Ores Item.height = 10; Item.maxStack = 999; Item.value = Item.sellPrice(gold: 4); - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Placeables/Ores/CharredOre.cs b/Items/Placeables/Ores/CharredOre.cs index dc787e0b56..3f137708b7 100644 --- a/Items/Placeables/Ores/CharredOre.cs +++ b/Items/Placeables/Ores/CharredOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Charred Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() diff --git a/Items/Placeables/Ores/CryonicOre.cs b/Items/Placeables/Ores/CryonicOre.cs index 1e8b5cb25b..399684e0e1 100644 --- a/Items/Placeables/Ores/CryonicOre.cs +++ b/Items/Placeables/Ores/CryonicOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Cryonic Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() diff --git a/Items/Placeables/Ores/ExodiumCluster.cs b/Items/Placeables/Ores/ExodiumCluster.cs index 06f5dbb6ea..f74e568803 100644 --- a/Items/Placeables/Ores/ExodiumCluster.cs +++ b/Items/Placeables/Ores/ExodiumCluster.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Placeables.Ores SacrificeTotal = 100; DisplayName.SetDefault("Exodium Cluster"); Tooltip.SetDefault("A cold cluster from the great unknown."); + ItemID.Sets.SortingPriorityMaterials[Type] = 101; } public override void SetDefaults() diff --git a/Items/Placeables/Ores/HallowedOre.cs b/Items/Placeables/Ores/HallowedOre.cs index ec0f2c2d0c..6ebfcbf192 100644 --- a/Items/Placeables/Ores/HallowedOre.cs +++ b/Items/Placeables/Ores/HallowedOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Hallowed Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 89; // Hallowed Bar } public override void SetDefaults() diff --git a/Items/Placeables/Ores/PerennialOre.cs b/Items/Placeables/Ores/PerennialOre.cs index 13192626e3..8020ee18ac 100644 --- a/Items/Placeables/Ores/PerennialOre.cs +++ b/Items/Placeables/Ores/PerennialOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Perennial Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 92; // Shroomite Bar } public override void SetDefaults() diff --git a/Items/Placeables/Ores/ScoriaOre.cs b/Items/Placeables/Ores/ScoriaOre.cs index bbdcb7858f..cfb27ea9d5 100644 --- a/Items/Placeables/Ores/ScoriaOre.cs +++ b/Items/Placeables/Ores/ScoriaOre.cs @@ -1,6 +1,6 @@ using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Scoria Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment } public override void SetDefaults() diff --git a/Items/Placeables/Ores/UelibloomOre.cs b/Items/Placeables/Ores/UelibloomOre.cs index 5a8c5c6fb2..b2dfa7d522 100644 --- a/Items/Placeables/Ores/UelibloomOre.cs +++ b/Items/Placeables/Ores/UelibloomOre.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Uelibloom Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 105; } public override void SetDefaults() @@ -24,8 +26,8 @@ namespace CalamityMod.Items.Placeables.Ores Item.width = 10; Item.height = 10; Item.maxStack = 999; - Item.Calamity().customRarity = CalamityRarity.Turquoise; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 1); } } } diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index 249d9ee09f..6b2146a491 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -37,6 +37,11 @@ namespace CalamityMod.Items.Placeables AddIngredient(4). AddTile(TileID.WorkBenches). Register(); + + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Pylons/AstralPylon.cs b/Items/Placeables/Pylons/AstralPylon.cs new file mode 100644 index 0000000000..3856796a24 --- /dev/null +++ b/Items/Placeables/Pylons/AstralPylon.cs @@ -0,0 +1,23 @@ +using CalamityMod.Tiles.Pylons; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Pylons +{ + public class AstralPylon : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + + Item.value = Item.buyPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/Pylons/AstralPylon.png b/Items/Placeables/Pylons/AstralPylon.png new file mode 100644 index 0000000000..aa33e4c65e Binary files /dev/null and b/Items/Placeables/Pylons/AstralPylon.png differ diff --git a/Items/Placeables/Pylons/CragsPylon.cs b/Items/Placeables/Pylons/CragsPylon.cs new file mode 100644 index 0000000000..a86bcf9a61 --- /dev/null +++ b/Items/Placeables/Pylons/CragsPylon.cs @@ -0,0 +1,23 @@ +using CalamityMod.Tiles.Pylons; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Pylons +{ + public class CragsPylon : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + + Item.value = Item.buyPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/Pylons/CragsPylon.png b/Items/Placeables/Pylons/CragsPylon.png new file mode 100644 index 0000000000..2c3948a083 Binary files /dev/null and b/Items/Placeables/Pylons/CragsPylon.png differ diff --git a/Items/Placeables/Pylons/SulphurPylon.cs b/Items/Placeables/Pylons/SulphurPylon.cs new file mode 100644 index 0000000000..0dc24b43cb --- /dev/null +++ b/Items/Placeables/Pylons/SulphurPylon.cs @@ -0,0 +1,23 @@ +using CalamityMod.Tiles.Pylons; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Pylons +{ + public class SulphurPylon : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + + Item.value = Item.buyPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/Pylons/SulphurPylon.png b/Items/Placeables/Pylons/SulphurPylon.png new file mode 100644 index 0000000000..324dde9aa3 Binary files /dev/null and b/Items/Placeables/Pylons/SulphurPylon.png differ diff --git a/Items/Placeables/Pylons/SunkenPylon.cs b/Items/Placeables/Pylons/SunkenPylon.cs new file mode 100644 index 0000000000..81dba6c617 --- /dev/null +++ b/Items/Placeables/Pylons/SunkenPylon.cs @@ -0,0 +1,23 @@ +using CalamityMod.Tiles.Pylons; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Pylons +{ + public class SunkenPylon : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + + Item.value = Item.buyPrice(0, 10, 0, 0); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Placeables/Pylons/SunkenPylon.png b/Items/Placeables/Pylons/SunkenPylon.png new file mode 100644 index 0000000000..240a444d52 Binary files /dev/null and b/Items/Placeables/Pylons/SunkenPylon.png differ diff --git a/Items/Placeables/ChaoticBrick.cs b/Items/Placeables/ScoriaBrick.cs similarity index 84% rename from Items/Placeables/ChaoticBrick.cs rename to Items/Placeables/ScoriaBrick.cs index 0bd9b0408d..8e0a87fb51 100644 --- a/Items/Placeables/ChaoticBrick.cs +++ b/Items/Placeables/ScoriaBrick.cs @@ -4,7 +4,8 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class ChaoticBrick : ModItem + [LegacyName("ChaoticBrick")] + public class ScoriaBrick : ModItem { public override void SetStaticDefaults() => SacrificeTotal = 100; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); } public override void AddRecipes() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Placeables Register(); CreateRecipe(). - AddIngredient(4). + AddIngredient(4). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/ScoriaBrick.png b/Items/Placeables/ScoriaBrick.png new file mode 100644 index 0000000000..456d85d88c Binary files /dev/null and b/Items/Placeables/ScoriaBrick.png differ diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.cs b/Items/Placeables/Walls/AbyssGravelWallItem.cs index 21d486530b..22dde7ef79 100644 --- a/Items/Placeables/Walls/AbyssGravelWallItem.cs +++ b/Items/Placeables/Walls/AbyssGravelWallItem.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - Item.width = 32; - Item.height = 32; + Item.width = 24; + Item.height = 24; Item.maxStack = 999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.png b/Items/Placeables/Walls/AbyssGravelWallItem.png index 8adf7a052e..37de1361ee 100644 Binary files a/Items/Placeables/Walls/AbyssGravelWallItem.png and b/Items/Placeables/Walls/AbyssGravelWallItem.png differ diff --git a/Items/Placeables/Walls/AcidwoodWallItem.cs b/Items/Placeables/Walls/AcidwoodWallItem.cs new file mode 100644 index 0000000000..0fca80c89b --- /dev/null +++ b/Items/Placeables/Walls/AcidwoodWallItem.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class AcidwoodWallItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acidwood Wall"); + SacrificeTotal = 400; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(ModContent.ItemType()). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/AcidwoodWallItem.png b/Items/Placeables/Walls/AcidwoodWallItem.png new file mode 100644 index 0000000000..b737bcc19e Binary files /dev/null and b/Items/Placeables/Walls/AcidwoodWallItem.png differ diff --git a/Items/Placeables/Walls/AstralStoneWall.png b/Items/Placeables/Walls/AstralStoneWall.png index af919f2e91..4fb96202c6 100644 Binary files a/Items/Placeables/Walls/AstralStoneWall.png and b/Items/Placeables/Walls/AstralStoneWall.png differ diff --git a/Items/Placeables/Walls/CosmiliteBrickWall.cs b/Items/Placeables/Walls/CosmiliteBrickWall.cs index cfff7ecaac..68a556ecd4 100644 --- a/Items/Placeables/Walls/CosmiliteBrickWall.cs +++ b/Items/Placeables/Walls/CosmiliteBrickWall.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetDefaults() { - Item.width = 12; - Item.height = 12; + Item.width = 32; + Item.height = 32; Item.maxStack = 999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/Walls/CosmiliteBrickWall.png b/Items/Placeables/Walls/CosmiliteBrickWall.png index 37ea4bf2f7..387338878f 100644 Binary files a/Items/Placeables/Walls/CosmiliteBrickWall.png and b/Items/Placeables/Walls/CosmiliteBrickWall.png differ diff --git a/Items/Placeables/Walls/FloralWall.cs b/Items/Placeables/Walls/FloralWall.cs new file mode 100644 index 0000000000..11d4b690b4 --- /dev/null +++ b/Items/Placeables/Walls/FloralWall.cs @@ -0,0 +1,33 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; +namespace CalamityMod.Items.Placeables.Walls +{ + public class FloralWall : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 400; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + //CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + } + } +} diff --git a/Items/Placeables/Walls/FloralWall.png b/Items/Placeables/Walls/FloralWall.png new file mode 100644 index 0000000000..fd0caef445 Binary files /dev/null and b/Items/Placeables/Walls/FloralWall.png differ diff --git a/Items/Placeables/Walls/OccultBrickWallItem.cs b/Items/Placeables/Walls/OccultBrickWallItem.cs new file mode 100644 index 0000000000..81e61702ca --- /dev/null +++ b/Items/Placeables/Walls/OccultBrickWallItem.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using CalamityMod.Rarities; +using CalamityMod.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class OccultBrickWallItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Occult Brick Wall"); + SacrificeTotal = 400; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(ModContent.ItemType()). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/OccultBrickWallItem.png b/Items/Placeables/Walls/OccultBrickWallItem.png new file mode 100644 index 0000000000..fdc1340a06 Binary files /dev/null and b/Items/Placeables/Walls/OccultBrickWallItem.png differ diff --git a/Items/Placeables/Walls/ChaoticBrickWall.cs b/Items/Placeables/Walls/ScoriaBrickWall.cs similarity index 67% rename from Items/Placeables/Walls/ChaoticBrickWall.cs rename to Items/Placeables/Walls/ScoriaBrickWall.cs index 3410d503b2..c45a29dc77 100644 --- a/Items/Placeables/Walls/ChaoticBrickWall.cs +++ b/Items/Placeables/Walls/ScoriaBrickWall.cs @@ -4,12 +4,13 @@ using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { - public class ChaoticBrickWall : ModItem + [LegacyName("ChaoticBrickWall")] + public class ScoriaBrickWall : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 400; - DisplayName.SetDefault("Chaotic Brick Wall"); + DisplayName.SetDefault("Scoria Brick Wall"); } public override void SetDefaults() { @@ -22,12 +23,12 @@ namespace CalamityMod.Items.Placeables.Walls Item.useTime = 7; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.createWall = ModContent.WallType(); + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - CreateRecipe(4).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(4).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ChaoticBrickWall.png b/Items/Placeables/Walls/ScoriaBrickWall.png similarity index 100% rename from Items/Placeables/Walls/ChaoticBrickWall.png rename to Items/Placeables/Walls/ScoriaBrickWall.png diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index bd3c865099..158eb77ac4 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Potions AddIngredient(4). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(8). diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index 743200e43c..4394be8a13 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,8 +22,7 @@ namespace CalamityMod.Items.Potions Item.height = 18; Item.useTurn = true; Item.maxStack = 30; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.useAnimation = 17; Item.useTime = 17; Item.useStyle = ItemUseStyleID.DrinkLiquid; @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(4). diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/CrumblingPotion.cs index 0f72ad7240..3a2c56f0d6 100644 --- a/Items/Potions/CrumblingPotion.cs +++ b/Items/Potions/CrumblingPotion.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index 2240593167..6facfe39ed 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Potions Item.height = 44; Item.useTurn = true; Item.maxStack = 30; - Item.Calamity().customRarity = CalamityRarity.Violet; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.useAnimation = 17; Item.useTime = 17; Item.useStyle = ItemUseStyleID.DrinkLiquid; @@ -64,6 +64,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.Moonglow). AddIngredient(ItemID.Fireblossom). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index d53caf0cb5..3b652e5a45 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/HolyWrathPotion.cs index f411a6f372..c40691fc4e 100644 --- a/Items/Potions/HolyWrathPotion.cs +++ b/Items/Potions/HolyWrathPotion.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index a02c938662..0edeefbea6 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Potions Item.consumable = true; Item.potion = true; Item.value = Item.buyPrice(0, 7, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs index 1c65079c96..a8fb73be1b 100644 --- a/Items/Potions/PenumbraPotion.cs +++ b/Items/Potions/PenumbraPotion.cs @@ -12,9 +12,7 @@ namespace CalamityMod.Items.Potions { SacrificeTotal = 20; DisplayName.SetDefault("Penumbra Potion"); - Tooltip.SetDefault("Rogue stealth generates 15% faster while moving\n" - + "At night, stealth also generates 15% faster while standing still\n" - + "During an eclipse both boosts increase to 20%"); + Tooltip.SetDefault("Rogue stealth generates 10% faster while moving and 15% faster while standing still"); } public override void SetDefaults() @@ -41,6 +39,7 @@ namespace CalamityMod.Items.Potions AddIngredient(3). AddIngredient(ItemID.LunarTabletFragment). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index c4d5bc8e5e..ef5b44b081 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs index 78504ffdda..1ab1d1546b 100644 --- a/Items/Potions/ProfanedRagePotion.cs +++ b/Items/Potions/ProfanedRagePotion.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index ab846e3733..a4783b208e 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -13,10 +13,10 @@ namespace CalamityMod.Items.Potions { SacrificeTotal = 20; DisplayName.SetDefault("Shadow Potion"); - Tooltip.SetDefault("Causes the player to disappear while not attacking\n" + - "Holding different types of rogue weapons give the player boosts\n" + - "Different types of rogue weapons spawn different projectiles on hit\n" + - "Stealth generation is increased by 10%"); + Tooltip.SetDefault("Turns the player into a shadow with glowing eyes\n" + + "Rogue weapons spawn projectiles on hit\n" + + "Stealth generation is increased by 8%\n" + + "Visual effects can be disabled with the Stealth Invisibility config"); } public override void SetDefaults() @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(2). AddIngredient(ItemID.InvisibilityPotion). AddIngredient(). - AddTile(TileID.AlchemyTable). + AddTile(TileID.Bottles). Register(); CreateRecipe(). diff --git a/Items/Potions/ShatteringPotion.cs b/Items/Potions/ShatteringPotion.cs index bbcf8c4aef..6a8d3ad532 100644 --- a/Items/Potions/ShatteringPotion.cs +++ b/Items/Potions/ShatteringPotion.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(2). AddIngredient(ItemID.BeetleHusk). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index 0a50c371b5..e32d66dfc9 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.SoulofFlight). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs index 5ad94f8d7b..40ab6b0637 100644 --- a/Items/Potions/TeslaPotion.cs +++ b/Items/Potions/TeslaPotion.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.BottledWater). AddIngredient(2). AddIngredient(5). + AddIngredient(). AddIngredient(). AddTile(TileID.Bottles). Register(); @@ -49,6 +50,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). AddIngredient(10). + AddIngredient(). AddTile(TileID.AlchemyTable). Register(); } diff --git a/Items/Potions/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs index 0a56b85222..1414cd13ce 100644 --- a/Items/Potions/TitanScalePotion.cs +++ b/Items/Potions/TitanScalePotion.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.BeetleHusk). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(4). diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs index 7979c60bf2..d77ef7f465 100644 --- a/Items/Potions/TriumphPotion.cs +++ b/Items/Potions/TriumphPotion.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Potions { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.Bottles). Register(); diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index 9a93fe576c..61905e7ba1 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.PinkGel). AddIngredient(ItemID.Daybloom). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index cb914a1c36..a181ddba50 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Potions AddIngredient(4). AddIngredient(). AddTile(TileID.AlchemyTable). + AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 02456ec6ca..95b412fa5f 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items "Holding out the crystal slows the player down\n" + "At the end of its life, the crystal heals the player for 70 HP"); SacrificeTotal = 1; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -32,6 +33,11 @@ namespace CalamityMod.Items Item.shoot = ModContent.ProjectileType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } } diff --git a/Items/SirenproofEarMuffs.cs b/Items/SirenproofEarMuffs.cs index 95224af9b2..de302528a7 100644 --- a/Items/SirenproofEarMuffs.cs +++ b/Items/SirenproofEarMuffs.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Blue; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + public override void UpdateInventory(Player player) { if (Item.favorited) diff --git a/Items/SummonItems/Abombination.cs b/Items/SummonItems/Abombination.cs index 15d6d33671..7791f10f42 100644 --- a/Items/SummonItems/Abombination.cs +++ b/Items/SummonItems/Abombination.cs @@ -11,14 +11,16 @@ namespace CalamityMod.Items.SummonItems [LegacyName("Abomination")] public class Abombination : ModItem { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PBGSummon"); public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Abombination"); Tooltip.SetDefault("Calls in the airborne abomination\n" + "Summons the Plaguebringer Goliath when used in the Jungle\n" + - "Enrages outside the Underground Jungle\n" + + "Enrages outside the Jungle\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear } public override void SetDefaults() @@ -32,6 +34,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; @@ -39,7 +46,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(UseSound, player.position); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index a331bafdd8..628ac72639 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons Astrum Aureus when used in the Astral Infection during nighttime\n" + "Enrages during the day\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 14; // Frost Moon } public override void SetDefaults() @@ -31,6 +32,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index fe55f31f4b..8bf6c43348 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -1,6 +1,7 @@ -using Terraria.ModLoader; -using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.Rarities; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { @@ -12,15 +13,15 @@ namespace CalamityMod.Items.SummonItems DisplayName.SetDefault("Bloodworm"); Tooltip.SetDefault("Summons The Old Duke if used as bait in the Sulphurous Sea\n" + "Enrages outside the Sulphurous Sea"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() { Item.width = 28; Item.height = 28; - Item.maxStack = 20; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.maxStack = 9999; + Item.rare = ModContent.RarityType(); Item.bait = 4444; Item.useStyle = ItemUseStyleID.Swing; Item.autoReuse = true; @@ -32,5 +33,10 @@ namespace CalamityMod.Items.SummonItems Item.makeNPC = (short)ModContent.NPCType(); SacrificeTotal = 3; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } } } diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index 8ca8a7e20c..0e4dd99738 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons the Perforator Hive when used in the Crimson\n" + "Enrages outside the Underground Crimson\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing } public override void SetDefaults() @@ -30,6 +31,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneCrimson && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/CeremonialUrn.cs b/Items/SummonItems/CeremonialUrn.cs index d281431f42..346c80f17c 100644 --- a/Items/SummonItems/CeremonialUrn.cs +++ b/Items/SummonItems/CeremonialUrn.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems @@ -12,21 +14,27 @@ namespace CalamityMod.Items.SummonItems SacrificeTotal = 1; DisplayName.SetDefault("Ceremonial Urn"); Tooltip.SetDefault("Use at the Altar of the Accursed to summon Supreme Calamitas\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() { Item.width = 34; Item.height = 54; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override void AddRecipes() { CreateRecipe(). AddIngredient(5). AddIngredient(15). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 7f8e79d83e..e4045a64d5 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.SummonItems "Summons the Brimstone Elemental when used in the Brimstone Crags\n" + "Enrages outside the Brimstone Crags\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 9; // Mechanical Skull } public override void SetDefaults() @@ -32,6 +33,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 46b69e78eb..a8a28fd954 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -1,11 +1,12 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -17,6 +18,7 @@ namespace CalamityMod.Items.SummonItems DisplayName.SetDefault("Cosmic Worm"); Tooltip.SetDefault("Summons the Devourer of Gods\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -27,10 +29,14 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; @@ -54,7 +60,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). + AddIngredient(). AddIngredient(). AddIngredient(). AddTile(TileID.LunarCraftingStation). diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index 5a3773586a..ccdd787153 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons Cryogen when used in the tundra\n" + "Enrages outside the tundra\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 7; // Mechanical Eye } public override void SetDefaults() @@ -29,6 +30,11 @@ namespace CalamityMod.Items.SummonItems Item.useStyle = ItemUseStyleID.HoldUp; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneSnow && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 2ada9293d9..1629eecae4 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("A very old temple whistle\n" + "Summons the Ravager\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear } public override void SetDefaults() @@ -31,6 +32,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && player.ZoneOverworldHeight && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index b1db1025d4..185945a200 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons Crabulon when used in the Mushroom biome\n" + "Enrages outside the Underground Mushroom biome\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 3; // Worm Food / Bloody Spine } public override void SetDefaults() @@ -30,6 +31,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneGlowshroom && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/DesertMedallion.cs b/Items/SummonItems/DesertMedallion.cs index 9dcb6f9a35..6dbe19f88b 100644 --- a/Items/SummonItems/DesertMedallion.cs +++ b/Items/SummonItems/DesertMedallion.cs @@ -3,9 +3,9 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.DesertScourge; using CalamityMod.World; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,6 +19,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons the Desert Scourge when used in the Desert\n" + "Enrages outside the Desert\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 1; // Suspicious Looking Eye } public override void SetDefaults() @@ -32,6 +33,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index 11d2257a20..bbaf2a65be 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.SummonItems DisplayName.SetDefault("Eidolon Tablet"); Tooltip.SetDefault("Summons the Lunatic Cultist\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear } public override void SetDefaults() @@ -28,6 +29,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/ExoticPheromones.cs b/Items/SummonItems/ExoticPheromones.cs index 07a66cc976..11bbddf0d0 100644 --- a/Items/SummonItems/ExoticPheromones.cs +++ b/Items/SummonItems/ExoticPheromones.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.SummonItems "Summons The Dragonfolly when used in the Jungle\n" + "Enrages outside the Jungle\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -32,6 +33,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index 490d0b9d8e..3704ad307b 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.SummonItems "Summons Calamitas when used during nighttime\n" + "Enrages during the day\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 10; // Pirate Map } public override void SetDefaults() @@ -32,6 +33,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !Main.dayTime && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index cd686f9c41..95990f3ee1 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.SummonItems.Invasion DisplayName.SetDefault("Caustic Tear"); Tooltip.SetDefault("Causes an acidic downpour in the Sulphurous Sea\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 1; // Suspicious Looking Eye } @@ -29,6 +30,11 @@ namespace CalamityMod.Items.SummonItems.Invasion Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + public override bool CanUseItem(Player player) { return !AcidRainEvent.AcidRainEventIsOngoing; diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.cs b/Items/SummonItems/Invasion/MartianDistressBeacon.cs index f8b39f79ce..896dea699e 100644 --- a/Items/SummonItems/Invasion/MartianDistressBeacon.cs +++ b/Items/SummonItems/Invasion/MartianDistressBeacon.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.SummonItems.Invasion DisplayName.SetDefault("Martian Distress Beacon"); Tooltip.SetDefault("Summons the Martian Madness\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear } public override void SetDefaults() @@ -26,6 +27,11 @@ namespace CalamityMod.Items.SummonItems.Invasion Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; public override bool? UseItem(Player player) diff --git a/Items/SummonItems/JungleDragonEgg.cs b/Items/SummonItems/JungleDragonEgg.cs index 17523fc9d7..a228a3f624 100644 --- a/Items/SummonItems/JungleDragonEgg.cs +++ b/Items/SummonItems/JungleDragonEgg.cs @@ -1,10 +1,11 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Yharon; +using CalamityMod.Rarities; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -19,6 +20,7 @@ namespace CalamityMod.Items.SummonItems "Summons Jungle Dragon, Yharon when used in the Jungle\n" + "Enrages outside the fire walls\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -29,10 +31,14 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; @@ -40,7 +46,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(Yharon.FireSound, player.position); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index d418a2c7cc..99c4bfffbb 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -1,12 +1,13 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Polterghast; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -20,6 +21,7 @@ namespace CalamityMod.Items.SummonItems "Summons Polterghast when used in the Dungeon\n" + "Enrages in large spaces\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -30,10 +32,14 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value); @@ -46,7 +52,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(Polterghast.SpawnSound, player.position); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs index 444a5d531a..516577e96e 100644 --- a/Items/SummonItems/OldPowerCell.cs +++ b/Items/SummonItems/OldPowerCell.cs @@ -1,9 +1,9 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -16,6 +16,8 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons the Golem when used in the Jungle Temple\n" + "Enrages outside the Jungle Temple\n" + "Not consumable"); + NPCID.Sets.MPAllowedEnemies[NPCID.Golem] = true; + ItemID.Sets.SortingPriorityBossSpawns[Type] = 15; // Lihzahrd Power Cell } public override void SetDefaults() @@ -29,6 +31,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { bool canSummon = false; diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index 08c2baa9b4..41c70af15c 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("It looks corrupted\n" + "Summons the Slime God\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing } public override void SetDefaults() @@ -30,10 +31,14 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) diff --git a/Items/SummonItems/Portabulb.cs b/Items/SummonItems/Portabulb.cs index c55da445d4..f0d15dc612 100644 --- a/Items/SummonItems/Portabulb.cs +++ b/Items/SummonItems/Portabulb.cs @@ -1,9 +1,9 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -17,6 +17,8 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons Plantera when used in the Jungle\n" + "Enrages outside the Underground Jungle\n" + "Not consumable"); + NPCID.Sets.MPAllowedEnemies[NPCID.Plantera] = true; + ItemID.Sets.SortingPriorityBossSpawns[Type] = 11; // Truffle Worm } public override void SetDefaults() @@ -30,6 +32,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index f0592a246f..8767f039a9 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -17,9 +17,10 @@ namespace CalamityMod.Items.SummonItems DisplayName.SetDefault("Profaned Core"); Tooltip.SetDefault("The core of the unholy flame\n" + "Summons Providence when used in the Hallow or Underworld\n" + - "Should be used during daytime\n" + - "Enrages during the nighttime or when outside the Hallow or Underworld\n" + + "Unique drop changes depending on the biome fought in\n" + + "Enrages when fought during nighttime or when outside the Hallow or Underworld\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -33,6 +34,11 @@ namespace CalamityMod.Items.SummonItems Item.rare = ItemRarityID.Purple; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 26ea3bfe44..3dd5abfa42 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.SummonItems "Summons the Profaned Guardians when used in the Hallow or Underworld during daytime\n" + "Enrage when not in the Hallow or Underworld\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -31,6 +32,11 @@ namespace CalamityMod.Items.SummonItems Item.rare = ItemRarityID.Purple; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && Main.dayTime && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/RuneofKos.cs b/Items/SummonItems/RuneofKos.cs index 223c4ca96d..586961a830 100644 --- a/Items/SummonItems/RuneofKos.cs +++ b/Items/SummonItems/RuneofKos.cs @@ -3,18 +3,22 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.StormWeaver; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; +using CalamityMod.Rarities; using System.Linq; using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { [LegacyName("RuneofCos")] public class RuneofKos : ModItem { + public static readonly SoundStyle CVSound = new("CalamityMod/Sounds/Item/CeaselessVoidSpawn"); + public static readonly SoundStyle SignutSound = new("CalamityMod/Sounds/Item/SignusSpawn"); + public static readonly SoundStyle StormSound = new("CalamityMod/Sounds/Item/StormWeaverSpawn"); public override void SetStaticDefaults() { SacrificeTotal = 1; @@ -23,6 +27,7 @@ namespace CalamityMod.Items.SummonItems "Contains the power hunted relentlessly by the sentinels of the cosmic devourer\n" + "When used in certain areas of the world, it will unleash them\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -32,12 +37,16 @@ namespace CalamityMod.Items.SummonItems Item.useAnimation = 10; Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item44; + Item.UseSound = null; Item.consumable = false; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) && @@ -46,9 +55,9 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); if (player.ZoneDungeon) { + SoundEngine.PlaySound(CVSound, player.position); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -56,6 +65,7 @@ namespace CalamityMod.Items.SummonItems } else if (player.ZoneUnderworldHeight) { + SoundEngine.PlaySound(SignutSound, player.position); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -63,6 +73,7 @@ namespace CalamityMod.Items.SummonItems } else if (player.ZoneSkyHeight) { + SoundEngine.PlaySound(StormSound, player.position); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 3885017cf4..cd8ab0f804 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.SummonItems DisplayName.SetDefault("Sandstorm's Core"); Tooltip.SetDefault("Summons the Great Sand Shark when used in the desert\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 12; // Frost Legion } public override void SetDefaults() @@ -27,6 +28,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()); diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index 21459704c5..7be26c0ca7 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons the Aquatic Scourge when used in the Sulphurous Sea\n" + "Enrages outside the Sulphurous Sea\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 8; // Mechanical Worm } public override void SetDefaults() @@ -31,6 +32,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index b8f630e926..b2146d409e 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("May the stars guide your way\n" + "Summons Astrum Deus at the Astral Beacon, but is not consumed\n" + "Enrages during the day"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear } public override void SetDefaults() @@ -24,6 +25,11 @@ namespace CalamityMod.Items.SummonItems Item.rare = ItemRarityID.Cyan; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 677d511b0c..21859a039b 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.SummonItems Tooltip.SetDefault("Summons the Hive Mind when used in the Corruption\n" + "Enrages outside the Underground Corruption\n" + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 5; // Abeemination / Deer Thing } public override void SetDefaults() @@ -30,6 +31,11 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } + public override bool CanUseItem(Player player) { return player.ZoneCorrupt && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; diff --git a/Items/SummonItems/Terminus.cs b/Items/SummonItems/Terminus.cs index 80d44c3156..d2babf5322 100644 --- a/Items/SummonItems/Terminus.cs +++ b/Items/SummonItems/Terminus.cs @@ -30,5 +30,11 @@ namespace CalamityMod.Items.SummonItems Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // The wiki classifies Boss Rush as an event + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } } } diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 11803b55dc..cfef478b93 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,10 +31,9 @@ namespace CalamityMod.Items.Tools Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index 38eb189c49..646068e015 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -1,7 +1,8 @@ -using Terraria; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Typeless; using static Terraria.ModLoader.ModContent; @@ -27,8 +28,7 @@ Pull Velocity: {BobbitHead.PullSpeed}"); Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. Item.shoot = ProjectileType(); Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = (CalamityRarity)13; + Item.rare = ModContent.RarityType(); Item.width = 30; Item.height = 32; } diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 1d37c79094..aff98734d2 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -25,6 +25,11 @@ namespace CalamityMod.Items.Tools.ClimateChange Item.UseSound = SoundID.Item66; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + public override bool CanUseItem(Player player) { return DownedBossSystem.downedDesertScourge; diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 7777ed7b74..d9e261a6f6 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -28,6 +28,11 @@ namespace CalamityMod.Items.Tools.ClimateChange Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override bool CanUseItem(Player player) { return !CalamityPlayer.areThereAnyDamnBosses; diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index 1a3d18854b..37fe5d505b 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -27,6 +27,11 @@ namespace CalamityMod.Items.Tools.ClimateChange Item.consumable = false; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + public override bool CanUseItem(Player player) { return !Main.slimeRain; diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index df1b1826eb..acb2361f13 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -1,13 +1,14 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System.Collections.Generic; +using System.Linq; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; -using Terraria.Audio; namespace CalamityMod.Items.Tools { @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Tools Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 5ffc54d7f6..7ad528da60 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,8 +40,7 @@ namespace CalamityMod.Items.Tools Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Tools/MarniteDeconstructor.cs b/Items/Tools/MarniteDeconstructor.cs new file mode 100644 index 0000000000..901b2ffa32 --- /dev/null +++ b/Items/Tools/MarniteDeconstructor.cs @@ -0,0 +1,62 @@ +using CalamityMod.Projectiles.Melee; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; +using Terraria.Audio; + +namespace CalamityMod.Items.Tools +{ + //Its not like its a renamed version of the spear, but i put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. + [LegacyName("MarniteSpear")] + public class MarniteDeconstructor : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Marnite Deconstructor"); + Tooltip.SetDefault("Its engine generates hardlight rays capable of excavating walls from a long distance\n" + "Ignores 10 points of enemy Defense"); + } + + public override void SetDefaults() + { + Item.damage = 6; + Item.ArmorPenetration = 10; + Item.knockBack = 0f; + Item.useTime = 7; + Item.useAnimation = 25; + Item.hammer = 40; + + Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Item.width = 36; + Item.height = 18; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = SoundID.Item23; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 40f; + Item.tileBoost = 7; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Sapphire). + AddRecipeGroup("AnyGoldBar", 3). + AddIngredient(ItemID.Granite, 5). + AddIngredient(ItemID.Marble, 5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Tools/MarniteDeconstructor.png b/Items/Tools/MarniteDeconstructor.png new file mode 100644 index 0000000000..ffeec7360b Binary files /dev/null and b/Items/Tools/MarniteDeconstructor.png differ diff --git a/Items/Tools/MarniteDeconstructorBloom.png b/Items/Tools/MarniteDeconstructorBloom.png new file mode 100644 index 0000000000..784253f3be Binary files /dev/null and b/Items/Tools/MarniteDeconstructorBloom.png differ diff --git a/Items/Tools/MarniteDeconstructorSelection.png b/Items/Tools/MarniteDeconstructorSelection.png new file mode 100644 index 0000000000..189912fbdd Binary files /dev/null and b/Items/Tools/MarniteDeconstructorSelection.png differ diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 8b57815481..bdeb8e7aa6 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -1,25 +1,30 @@ using CalamityMod.Projectiles.Melee; using Terraria.ID; using Terraria.ModLoader; +using Terraria; +using Terraria.Audio; namespace CalamityMod.Items.Tools { public class MarniteObliterator : ModItem { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/MarniteObliteratorUse") { PitchVariance = 0.3f }; + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Marnite Obliterator"); + Tooltip.SetDefault("Uses a diamond focus to project a long-range digging beam of light\n" + "Ignores 5 points of enemy Defense"); } public override void SetDefaults() { - Item.damage = 13; - Item.knockBack = 1f; + Item.damage = 7; + Item.ArmorPenetration = 5; + Item.knockBack = 0f; Item.useTime = 6; Item.useAnimation = 25; Item.pick = 50; - Item.axe = 30 / 5; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.width = 36; @@ -34,11 +39,19 @@ namespace CalamityMod.Items.Tools Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 40f; + Item.tileBoost = 7; } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.Diamond). AddRecipeGroup("AnyGoldBar", 3). AddIngredient(ItemID.Granite, 5). AddIngredient(ItemID.Marble, 5). diff --git a/Items/Tools/MarniteObliteratorBloom.png b/Items/Tools/MarniteObliteratorBloom.png new file mode 100644 index 0000000000..b367100b2b Binary files /dev/null and b/Items/Tools/MarniteObliteratorBloom.png differ diff --git a/Items/Tools/SeismicHampick.cs b/Items/Tools/SeismicHampick.cs index c01b8528e8..3cf87c773a 100644 --- a/Items/Tools/SeismicHampick.cs +++ b/Items/Tools/SeismicHampick.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Items.Tools Tooltip.SetDefault(@"Capable of mining Lihzahrd Bricks Left click to use as a pickaxe Right click to use as a hammer"); + + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs deleted file mode 100644 index 3cb9edc5f9..0000000000 --- a/Items/Tools/WulfrumAxe.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class WulfrumAxe : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Axe"); - } - - public override void SetDefaults() - { - Item.damage = 5; - Item.knockBack = 4.5f; - Item.useTime = 15; - Item.useAnimation = 26; - Item.axe = 60 / 5; - Item.tileBoost += 1; - - Item.DamageType = DamageClass.Melee; - Item.width = 30; - Item.height = 38; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 1, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(14). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Tools/WulfrumAxe.png b/Items/Tools/WulfrumAxe.png deleted file mode 100644 index 7bd72fbc30..0000000000 Binary files a/Items/Tools/WulfrumAxe.png and /dev/null differ diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs new file mode 100644 index 0000000000..950d861bb3 --- /dev/null +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -0,0 +1,89 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Tools +{ + public class WulfrumDiggingTurtle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Digging Turtle"); + Tooltip.SetDefault("Throws a rickety mining contraption to dig out a small tunnel\n" + + "In case of an emergency, right click to instantly detonate all your digging turtles"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.useTime = Item.useAnimation = 8; + Item.maxStack = 999; + Item.consumable = true; + Item.shootSpeed = 20f; + Item.shoot = ModContent.ProjectileType(); + Item.width = 30; + Item.height = 38; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.UseSound = SoundID.Item1; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.rare = ItemRarityID.Blue; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool ConsumeItem(Player player) + { + return player.altFunctionUse != 2; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + // Play a sound and detonate all owned turtles. + if (player.altFunctionUse == 2) + { + bool explodedAny = false; + + for (int i = 0; i < Main.maxProjectiles; ++i) + { + Projectile p = Main.projectile[i]; + if (!p.active || p.owner != player.whoAmI || p.type != Item.shoot) + continue; + + p.ai[1] = 1f; + p.timeLeft = 1; + p.netUpdate = true; + p.netSpam = 0; + + explodedAny = true; + } + + if (explodedAny) + SoundEngine.PlaySound(SoundID.Item73, position); + + return false; + } + + return true; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Gel, 5). //Gel is a default combustible item to fuel the motors of the lil guys + AddIngredient(3). + Register(); + } + } +} diff --git a/Items/Tools/WulfrumDiggingTurtle.png b/Items/Tools/WulfrumDiggingTurtle.png new file mode 100644 index 0000000000..7b9d5641ca Binary files /dev/null and b/Items/Tools/WulfrumDiggingTurtle.png differ diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumDrill.cs similarity index 53% rename from Items/Tools/WulfrumPickaxe.cs rename to Items/Tools/WulfrumDrill.cs index 529aa57d42..c9a662177b 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -2,41 +2,52 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles.Typeless; namespace CalamityMod.Items.Tools { - public class WulfrumPickaxe : ModItem + [LegacyName("WulfrumPickaxe")] + public class WulfrumDrill : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Pickaxe"); + DisplayName.SetDefault("Wulfrum Drill"); } public override void SetDefaults() { Item.damage = 5; - Item.knockBack = 2f; - Item.useTime = 8; + Item.knockBack = 0f; + Item.useTime = 5; Item.useAnimation = 16; - Item.pick = 40; + Item.pick = 35; Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; Item.width = 46; Item.height = 38; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; Item.value = Item.buyPrice(0, 1, 0, 0); Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.Item23; Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Shoot; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(8). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/WulfrumDrill.png b/Items/Tools/WulfrumDrill.png new file mode 100644 index 0000000000..d1ec38a2df Binary files /dev/null and b/Items/Tools/WulfrumDrill.png differ diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs deleted file mode 100644 index 6323e7996a..0000000000 --- a/Items/Tools/WulfrumHammer.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class WulfrumHammer : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Hammer"); - } - - public override void SetDefaults() - { - Item.damage = 7; - Item.knockBack = 5.5f; - Item.useTime = 11; - Item.useAnimation = 29; - Item.hammer = 45; - Item.tileBoost += 1; - - Item.DamageType = DamageClass.Melee; - Item.width = 28; - Item.height = 38; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 1, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(16). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Tools/WulfrumHammer.png b/Items/Tools/WulfrumHammer.png deleted file mode 100644 index 05741786eb..0000000000 Binary files a/Items/Tools/WulfrumHammer.png and /dev/null differ diff --git a/Items/Tools/WulfrumPickaxe.png b/Items/Tools/WulfrumPickaxe.png deleted file mode 100644 index 2dc3379335..0000000000 Binary files a/Items/Tools/WulfrumPickaxe.png and /dev/null differ diff --git a/Items/Tools/WulfrumScaffoldKit.cs b/Items/Tools/WulfrumScaffoldKit.cs new file mode 100644 index 0000000000..70ebab6a42 --- /dev/null +++ b/Items/Tools/WulfrumScaffoldKit.cs @@ -0,0 +1,125 @@ +using System.IO; +using System.Linq; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Items.Tools +{ + public class WulfrumScaffoldKit : ModItem + { + public int storedScrap = 0; + public static int TilesPerScrap = 40; + public static int TileTime = 6 * 60; + public static int TileReach = 40; + public static int PlacedTileType => ModContent.TileType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Scaffold Kit"); + Tooltip.SetDefault("\"For when you need something built fast and don't need it to last.\"\n" + + "Places down temporary metal scaffolding. Uses up one wulfrum metal scrap for " + TilesPerScrap.ToString() + " tiles built\n" + + "Scaffold needs to be adjacent to a solid tile to be placed down" + ); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 52; + Item.height = 42; + Item.useTime = Item.useAnimation = 25; + Item.autoReuse = false; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.HiddenAnimation; + Item.UseSound = null; + Item.noMelee = true; + Item.channel = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(silver: 50); + storedScrap = 0; + Item.shoot = ModContent.ProjectileType(); + TileTime = 6 * 60; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override bool CanUseItem(Player player) + { + return (storedScrap > 0 || player.HasItem(ModContent.ItemType())) && !player.noBuilding + && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == Item.shoot); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + float barScale = 1f; + + var barBG = ModContent.Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/ExtraTextures/GenericBarFront").Value; + + Vector2 drawPos = position + Vector2.UnitY * (frame.Height - 2) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f; + Rectangle frameCrop = new Rectangle(0, 0, (int)(storedScrap / (float)TilesPerScrap * barFG.Width), barFG.Height); + Color colorBG = Color.RoyalBlue; + Color colorFG = Color.Lerp(Color.Teal, Color.YellowGreen, storedScrap / (float)TilesPerScrap); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, origin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG * 0.8f, 0f, origin, scale * barScale, 0f, 0f); + } + + + #region saving the durability + public override ModItem Clone(Item item) + { + ModItem clone = base.Clone(item); + if (clone is WulfrumScaffoldKit a && item.ModItem is WulfrumScaffoldKit a2) + { + a.storedScrap = a2.storedScrap; + } + return clone; + } + + public override void SaveData(TagCompound tag) + { + tag["storedScrap"] = storedScrap; + } + + public override void LoadData(TagCompound tag) + { + storedScrap = tag.GetInt("storedScrap"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(storedScrap); + } + + public override void NetReceive(BinaryReader reader) + { + storedScrap = reader.ReadInt32(); + } + #endregion + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(1). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Tools/WulfrumScaffoldKit.png b/Items/Tools/WulfrumScaffoldKit.png new file mode 100644 index 0000000000..4d977d3937 Binary files /dev/null and b/Items/Tools/WulfrumScaffoldKit.png differ diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs new file mode 100644 index 0000000000..95334063ff --- /dev/null +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -0,0 +1,298 @@ +using System; +using System.IO; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Items.Tools +{ + public class WulfrumTreasurePinger : ModItem + { + public static readonly SoundStyle ScanBeepSound = new("CalamityMod/Sounds/Item/WulfrumPing") { PitchVariance = 0.1f }; + public static readonly SoundStyle ScanBeepBreakSound = new("CalamityMod/Sounds/Item/WulfrumPingBreak"); + public static readonly SoundStyle RechargeBeepSound = new("CalamityMod/Sounds/Item/WulfrumPingReady") { PitchVariance = 0.1f }; + + public int usesLeft = maxUses; + public const int maxUses = 20; + public static int breakTime = 90; + public int timeBeforeBlast = 90; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Treasure Pinger"); + Tooltip.SetDefault("Helps you find metal that's hopefully more valuable than wulfrum\n" + + "This contraption seems incredibly shoddy. [c/fc4903:It'll break sooner than later for sure]" + ); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 52; + Item.height = 42; + Item.useTime = Item.useAnimation = 25; + Item.autoReuse = false; + Item.holdStyle = 16; //Custom hold style + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; + Item.noMelee = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(silver: 50); + usesLeft = maxUses; + timeBeforeBlast = breakTime; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + + //If the explosion sequence has been initiated. + if (usesLeft <= 0 && timeBeforeBlast < breakTime) + { + timeBeforeBlast--; + player.itemTime = 2; + player.itemAnimation = 2; + + float breakProgress = 1 - timeBeforeBlast / (float)breakTime; + + int smokeLikelyhood = (int)Math.Floor(1 + timeBeforeBlast / (float)breakTime * 4); + if (Main.rand.NextBool(smokeLikelyhood)) + { + Vector2 smokePos = player.GetBackHandPosition(player.compositeBackArm.stretch, player.compositeBackArm.rotation).Floor(); + Vector2 velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 0.7f) * Main.rand.NextFloat(6f, 9f + 6f * breakProgress); + + Color smokeStart = Main.rand.NextBool() ? Color.GreenYellow : Color.DeepSkyBlue; + Color smokeEnd = Color.Lerp(new Color(110, 110, 110), new Color(60, 60, 60), breakProgress); + + float smokeSize = Main.rand.NextFloat(1.4f, 2.2f) * (0.6f + 0.4f * breakProgress); + + Particle smoke = new SmallSmokeParticle(smokePos, velocity, smokeStart, smokeEnd, smokeSize, 115 - Main.rand.Next(30)); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + if (timeBeforeBlast <= 0) + { + int scrapRefund = Main.rand.Next(0, 4); + if (scrapRefund > 0) + player.QuickSpawnItem(Item.GetSource_ItemUse(Item), ModContent.ItemType(), scrapRefund); + + Item.TurnToAir(); + + int smokeCount = Main.rand.Next(5, 10); + int shrapnelCount = Main.rand.Next(3, 5); + int sparkCount = Main.rand.Next(4, 8); + + Vector2 centerPosition = player.GetBackHandPosition(player.compositeBackArm.stretch, player.compositeBackArm.rotation).Floor(); + + for (int i = 0; i < smokeCount; i++) + { + Vector2 velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(12f, 16f); + + Color smokeStart = Main.rand.NextBool() ? Color.GreenYellow : Color.Aqua; + Color smokeEnd = new Color(60, 60, 60); + + float smokeSize = Main.rand.NextFloat(1.4f, 2.2f); + + Particle smoke = new SmallSmokeParticle(centerPosition, velocity, smokeStart, smokeEnd, smokeSize, 135 - Main.rand.Next(30)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < shrapnelCount; i++) + { + Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(9f, 9f); + float shrapnelScale = Main.rand.NextFloat(0.8f, 1f); + + Gore.NewGore(Item.GetSource_ItemUse(Item), centerPosition, shrapnelVelocity, Mod.Find("WulfrumPinger" + Main.rand.Next(1, 5).ToString()).Type, shrapnelScale); + } + } + + for (int i = 0; i < sparkCount; i++) + { + Dust.NewDustPerfect(centerPosition, 226, Main.rand.NextVector2Circular(18f, 18f), Scale: Main.rand.NextFloat(0.4f, 1f)); + } + } + } + + public override bool CanUseItem(Player player) + { + return !(TilePingerSystem.tileEffects["WulfrumPing"].Active); + } + + public override bool? UseItem(Player player) + { + if (TilePingerSystem.AddPing("WulfrumPing", player.Center, player)) + { + if (player.name != "John Wulfrum") + usesLeft--; + + if (usesLeft <= 0) + { + if (player.whoAmI == Main.myPlayer) + SoundEngine.PlaySound(ScanBeepBreakSound); + + //Start the breaking anim. + timeBeforeBlast--; + } + + else if (player.whoAmI == Main.myPlayer) + SoundEngine.PlaySound(ScanBeepSound); + + return true; + } + + return false; + } + + #region drawing stuff + public void SetItemInHand(Player player, Rectangle heldItemFrame) + { + //Make the player face where they're aiming. + if (player.Calamity().mouseWorld.X > player.Center.X) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + + float itemRotation = player.compositeBackArm.rotation + MathHelper.PiOver2 * player.gravDir; + Vector2 itemPosition = player.GetBackHandPositionImproved(player.compositeBackArm).Floor(); + Vector2 itemSize = new Vector2(52, 42); + Vector2 itemOrigin = new Vector2(-20, -13); + + if (usesLeft == 0) + { + itemPosition += Main.rand.NextVector2CircularEdge(4f, 4f) * (1 - timeBeforeBlast / (float)breakTime); + //We have to lower the timebeforeblast here as well because the item that gets processed here is not actually the same item as the item held in the players hands. + //Basically we are dealing with a clone of the item that the drawn player uses. + //So no, don't worry, the item isn't breaking twice as fast. + timeBeforeBlast--; + } + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + } + + public void SetPlayerArms(Player player) + { + //Calculate the dirction in which the players arms should be pointing at. + Vector2 playerToCursor = (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX); + float armPointingDirection = (playerToCursor.ToRotation() + MathHelper.PiOver2).Modulo(MathHelper.TwoPi); + + //"crop" the rotation so the player only tilts the fishing rod slightly up and slightly down. + if (armPointingDirection < MathHelper.Pi) + { + armPointingDirection = armPointingDirection / MathHelper.Pi * MathHelper.PiOver4 * 0.5f - MathHelper.PiOver4 * 0.3f; + } + + //It gets a bit harder if its pointing left; ouch + else + { + armPointingDirection -= MathHelper.Pi; + + armPointingDirection = armPointingDirection / MathHelper.Pi * MathHelper.PiOver4 * 0.5f - MathHelper.PiOver4 * 0.3f + MathHelper.Pi; + } + + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection * player.gravDir - MathHelper.PiOver2); + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection * player.gravDir - MathHelper.PiOver2); + } + + public override void HoldStyle(Player player, Rectangle heldItemFrame) => SetItemInHand(player, heldItemFrame); + public override void UseStyle(Player player, Rectangle heldItemFrame) => SetItemInHand(player, heldItemFrame); + public override void HoldItemFrame(Player player) => SetPlayerArms(player); + public override void UseItemFrame(Player player) => SetPlayerArms(player); + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (usesLeft == maxUses || usesLeft == 0) + return; + + float barScale = 1.3f; + + var barBG = ModContent.Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/ExtraTextures/GenericBarFront").Value; + + Vector2 drawPos = position + Vector2.UnitY * (frame.Height - 2) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f; + Rectangle frameCrop = new Rectangle(0, 0, (int)(usesLeft / (float)maxUses * barFG.Width), barFG.Height); + Color colorBG = Color.RoyalBlue; + Color colorFG = Color.Lerp(Color.Teal, Color.YellowGreen, usesLeft / (float)maxUses); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, origin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG * 0.8f, 0f, origin, scale * barScale, 0f, 0f); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (usesLeft > 0) + return true; + + var tex = ModContent.Request(Texture).Value; + + float blastProgress = (1 - timeBeforeBlast / (float)breakTime); + position += Main.rand.NextVector2CircularEdge(4f, 4f) * blastProgress; + drawColor = Color.Lerp(drawColor, Color.OrangeRed, blastProgress); + + spriteBatch.Draw(tex, position, frame, drawColor, 0f, origin, scale, 0f, 0f); + return false; + } + #endregion + + #region saving the durability + public override ModItem Clone(Item item) + { + ModItem clone = base.Clone(item); + if (clone is WulfrumTreasurePinger a && item.ModItem is WulfrumTreasurePinger a2) + { + a.usesLeft = a2.usesLeft; + a.timeBeforeBlast = a2.timeBeforeBlast; + } + return clone; + } + + public override void SaveData(TagCompound tag) + { + tag["usesLeft"] = usesLeft; + } + + public override void LoadData(TagCompound tag) + { + usesLeft = tag.GetInt("usesLeft"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(usesLeft); + } + + public override void NetReceive(BinaryReader reader) + { + usesLeft = reader.ReadInt32(); + } + #endregion + + public override void AddRecipes() + { + //Intentionally craftable anywhere. + CreateRecipe(). + AddIngredient(6). + Register(); + } + } + + +} diff --git a/Items/Tools/WulfrumTreasurePinger.png b/Items/Tools/WulfrumTreasurePinger.png new file mode 100644 index 0000000000..9a3dec7cbb Binary files /dev/null and b/Items/Tools/WulfrumTreasurePinger.png differ diff --git a/Items/TreasureBags/AbyssalTreasure.cs b/Items/TreasureBags/AbyssalTreasure.cs deleted file mode 100644 index d20f2a5219..0000000000 --- a/Items/TreasureBags/AbyssalTreasure.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Items.Potions; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags -{ - public class AbyssalTreasure : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Treasure"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - SacrificeTotal = 10; - } - - public override void SetDefaults() - { - Item.maxStack = 999; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.rare = ItemRarityID.Blue; //Blue for thematics - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // Loops 4 times to compensate for dropping only one treasure now - for (int i = 0; i < 4; i++) - { - if (Main.rand.NextBool(10)) - { - int potionType = Utils.SelectRandom(WorldGen.genRand, new int[] - { - ItemID.SpelunkerPotion, - ItemID.MagicPowerPotion, - ItemID.ShinePotion, - ItemID.WaterWalkingPotion, - ItemID.ObsidianSkinPotion, - ItemID.WaterWalkingPotion, - ItemID.GravitationPotion, - ItemID.RegenerationPotion, - ModContent.ItemType(), - ModContent.ItemType(), - ItemID.GillsPotion, - ItemID.EndurancePotion, - ItemID.HeartreachPotion, - ItemID.FlipperPotion, - ItemID.LifeforcePotion, - ItemID.InfernoPotion - }); - DropHelper.DropItem(s, player, potionType); - } - else - { - switch (Main.rand.Next(10)) - { - case 0: - int sglowstickAmt = Main.rand.Next(2, 6); - if (Main.expertMode) - { - sglowstickAmt += Main.rand.Next(1, 7); - } - DropHelper.DropItem(s, player, ItemID.SpelunkerGlowstick, sglowstickAmt); - break; - case 1: - DropHelper.DropItem(s, player, ItemID.HellfireArrow, 10, 20); - break; - case 2: - DropHelper.DropItem(s, player, ModContent.ItemType()); - break; - case 3: - DropHelper.DropItem(s, player, ItemID.StickyDynamite); - break; - default: - int coinCount = 5000 + Main.rand.Next(-100, 101); - while (coinCount > 0) - { - if (coinCount > 1000000) - { - int ptCoinAmt = coinCount / 1000000; - if (ptCoinAmt > 50 && Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 1000000 * ptCoinAmt; - DropHelper.DropItem(s, player, ItemID.PlatinumCoin, ptCoinAmt); - } - else if (coinCount > 10000) - { - int auCoinAmt = coinCount / 10000; - if (auCoinAmt > 50 && Main.rand.NextBool(2)) - { - auCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - auCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 10000 * auCoinAmt; - DropHelper.DropItem(s, player, ItemID.GoldCoin, auCoinAmt); - } - else if (coinCount > 100) - { - int agCoinAmt = coinCount / 100; - if (agCoinAmt > 50 && Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 100 * agCoinAmt; - DropHelper.DropItem(s, player, ItemID.SilverCoin, agCoinAmt); - } - else - { - int cuCoinAmt = coinCount; - if (cuCoinAmt > 50 && Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(4) + 1; - } - if (cuCoinAmt < 1) - { - cuCoinAmt = 1; - } - coinCount -= cuCoinAmt; - DropHelper.DropItem(s, player, ItemID.CopperCoin, cuCoinAmt); - } - } - break; - } - } - } - } - } -} diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index 2573da620c..a9a1b865a4 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -1,28 +1,29 @@ using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.TreasureBags.MiscGrabBags; 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.AquaticScourge; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Armor.Vanity; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.TreasureBags { public class AquaticScourgeBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Aquatic Scourge)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -35,45 +36,53 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // AS is available PHM, so this check is necessary to keep vanilla consistency - if (Main.hardMode) - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); // Fishing - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/AstrumAureusBag.cs b/Items/TreasureBags/AstrumAureusBag.cs index d0c861eba3..76c5018610 100644 --- a/Items/TreasureBags/AstrumAureusBag.cs +++ b/Items/TreasureBags/AstrumAureusBag.cs @@ -4,31 +4,31 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Potions; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.TreasureBags { [LegacyName("AstrageldonBag")] public class AstrumAureusBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Astrum Aureus)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -41,45 +41,53 @@ namespace CalamityMod.Items.TreasureBags Item.rare = ItemRarityID.Cyan; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 12, 16); - DropHelper.DropItem(s, player, ModContent.ItemType(), 30, 40); - DropHelper.DropItem(s, player, ItemID.FallenStar, 20, 30); + itemLoot.Add(ModContent.ItemType(), 1, 12, 16); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ItemID.FallenStar, 1, 20, 30); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), NPC.downedMoonlord); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); // Other - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().adrenalineBoostTwo); + itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().adrenalineBoostTwo, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 65d53b2f4c..72c63dc061 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -2,29 +2,29 @@ using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AstrumDeus; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.TreasureBags { public class AstrumDeusBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Astrum Deus)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -37,42 +37,52 @@ namespace CalamityMod.Items.TreasureBags Item.rare = ItemRarityID.Cyan; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 60, 90); - DropHelper.DropItem(s, player, ItemID.FallenStar, 30, 50); + itemLoot.Add(ModContent.ItemType(), 1, 60, 90); + itemLoot.Add(ItemID.FallenStar, 1, 30, 50); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 5); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); + itemLoot.Add(ModContent.ItemType(), 5); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); } } } diff --git a/Items/TreasureBags/BleachedAnglingKit.cs b/Items/TreasureBags/BleachedAnglingKit.cs deleted file mode 100644 index 55a4349764..0000000000 --- a/Items/TreasureBags/BleachedAnglingKit.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags -{ - public class BleachedAnglingKit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bleached Angling Kit"); - Tooltip.SetDefault("Has a chance to contain various fishing gear\n" + - "{$CommonItemTooltip.RightClickToOpen}"); - SacrificeTotal = 10; - } - - public override void SetDefaults() - { - Item.maxStack = 999; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.rare = ItemRarityID.Pink; - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - int anglerTackleBagChance = !Main.expertMode ? 18 : 15; - int fishingAccChance = !Main.expertMode ? 12 : 10; - int fishFindAccChance = !Main.expertMode ? 9 : 8; - int anglerArmorChance = !Main.expertMode ? 4 : 2; - int potionChance = !Main.expertMode ? 4 : 2; - int bugNetChance = !Main.expertMode ? 15 : 12; - // Fishing - DropHelper.DropItemChance(s, player, ItemID.AnglerTackleBag, anglerTackleBagChance, 1, 1); - DropHelper.DropItemChance(s, player, ItemID.HighTestFishingLine, fishingAccChance); - DropHelper.DropItemChance(s, player, ItemID.TackleBox, fishingAccChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerEarring, fishingAccChance); - DropHelper.DropItemChance(s, player, ItemID.FishermansGuide, fishFindAccChance); - DropHelper.DropItemChance(s, player, ItemID.WeatherRadio, fishFindAccChance); - DropHelper.DropItemChance(s, player, ItemID.Sextant, fishFindAccChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerHat, anglerArmorChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerVest, anglerArmorChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerPants, anglerArmorChance); - DropHelper.DropItemChance(s, player, ItemID.FishingPotion, potionChance, 2, 3); - DropHelper.DropItemChance(s, player, ItemID.SonarPotion, potionChance, 2, 3); - DropHelper.DropItemChance(s, player, ItemID.CratePotion, potionChance, 2, 3); - DropHelper.DropItemChance(s, player, ItemID.GoldenBugNet, bugNetChance, 1, 1); - } - } -} diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index 255bacb4b4..8f21cbe370 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -9,23 +9,23 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.World; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class BrimstoneWaifuBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Brimstone Elemental)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -38,43 +38,52 @@ namespace CalamityMod.Items.TreasureBags Item.rare = ItemRarityID.Cyan; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 9); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 25, 35); + itemLoot.Add(ModContent.ItemType(), 1, 5, 9); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.AddIf(() => CalamityWorld.revenge, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/CalamitasBag.cs b/Items/TreasureBags/CalamitasBag.cs index f7de3bafbf..f1d90583fa 100644 --- a/Items/TreasureBags/CalamitasBag.cs +++ b/Items/TreasureBags/CalamitasBag.cs @@ -6,23 +6,23 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Calamitas; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class CalamitasBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Calamitas)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -35,46 +35,51 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 14, 18); - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 9); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 35, 45); + itemLoot.Add(ModContent.ItemType(), 1, 30, 35); + itemLoot.Add(ModContent.ItemType(), 1, 10, 15); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - if (Main.rand.NextBool(10)) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } + itemLoot.Add(ModContent.ItemType(), 7); + var calamityRobes = ItemDropRule.Common(ModContent.ItemType(), 10); + calamityRobes.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + itemLoot.Add(calamityRobes); } } } diff --git a/Items/TreasureBags/CeaselessVoidBag.cs b/Items/TreasureBags/CeaselessVoidBag.cs index ef475d6325..c6eb4e064d 100644 --- a/Items/TreasureBags/CeaselessVoidBag.cs +++ b/Items/TreasureBags/CeaselessVoidBag.cs @@ -7,6 +7,7 @@ using CalamityMod.NPCs.CeaselessVoid; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -14,13 +15,12 @@ namespace CalamityMod.Items.TreasureBags { public class CeaselessVoidBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Ceaseless Void)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -33,38 +33,47 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 4, 6); + itemLoot.Add(ModContent.ItemType(), 1, 6, 9); // Weapons - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } + itemLoot.Add(ModContent.ItemType(), 7); + var ancientGodSlayer = ItemDropRule.Common(ModContent.ItemType(), 20); + ancientGodSlayer.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + ancientGodSlayer.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + itemLoot.Add(ancientGodSlayer); } } } diff --git a/Items/TreasureBags/CrabulonBag.cs b/Items/TreasureBags/CrabulonBag.cs index f28ea43db3..6ce0438ca0 100644 --- a/Items/TreasureBags/CrabulonBag.cs +++ b/Items/TreasureBags/CrabulonBag.cs @@ -10,6 +10,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -17,13 +18,13 @@ namespace CalamityMod.Items.TreasureBags { public class CrabulonBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Crabulon)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() @@ -36,38 +37,50 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ItemID.GlowingMushroom, 25, 35); - DropHelper.DropItem(s, player, ItemID.MushroomGrassSeeds, 5, 10); + itemLoot.Add(ItemID.GlowingMushroom, 1, 25, 35); + itemLoot.Add(ItemID.MushroomGrassSeeds, 1, 5, 10); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().rageBoostOne); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); + + // Other + itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().rageBoostOne, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/CryogenBag.cs b/Items/TreasureBags/CryogenBag.cs index b7800fa990..4f3ca71230 100644 --- a/Items/TreasureBags/CryogenBag.cs +++ b/Items/TreasureBags/CryogenBag.cs @@ -11,6 +11,7 @@ using CalamityMod.NPCs.Cryogen; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -18,13 +19,12 @@ namespace CalamityMod.Items.TreasureBags { public class CryogenBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Cryogen)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -37,40 +37,48 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 5, 9); + itemLoot.Add(ModContent.ItemType(), 1, 5, 9); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); } } } diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index ddc52a659b..69d27571e7 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -10,6 +11,7 @@ using CalamityMod.NPCs.DesertScourge; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -17,13 +19,13 @@ namespace CalamityMod.Items.TreasureBags { public class DesertScourgeBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Desert Scourge)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() @@ -36,45 +38,54 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 10, 16); - DropHelper.DropItem(s, player, ItemID.Coral, 7, 11); - DropHelper.DropItem(s, player, ItemID.Seashell, 7, 11); - DropHelper.DropItem(s, player, ItemID.Starfish, 7, 11); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ItemID.Coral, 1, 30, 40); + itemLoot.Add(ItemID.Seashell, 1, 30, 40); + itemLoot.Add(ItemID.Starfish, 1, 30, 40); // Weapons - // Set up the base drop set, which includes Scourge of the Desert at its normal drop chance. - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); // Fishing - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index 82c4a48b25..ca082dbb66 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -13,20 +13,20 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class DevourerofGodsBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Devourer of Gods)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -39,6 +39,11 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); @@ -51,39 +56,43 @@ namespace CalamityMod.Items.TreasureBags public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); - public override void OpenBossBag(Player player) + public override void PostUpdate() + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } + + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 30, 39); - DropHelper.DropItem(s, player, ModContent.ItemType(), 200, 320); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ModContent.ItemType(), 1, 200, 320); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.death && player.difficulty == 2); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.AddIf((info) => CalamityWorld.death && info.player.difficulty == 2, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/DraedonBag.cs b/Items/TreasureBags/DraedonBag.cs index a643ce9d1a..3c986ed815 100644 --- a/Items/TreasureBags/DraedonBag.cs +++ b/Items/TreasureBags/DraedonBag.cs @@ -5,10 +5,12 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.ExoMechs.Apollo; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -17,13 +19,12 @@ namespace CalamityMod.Items.TreasureBags [LegacyName("DraedonTreasureBag")] public class DraedonBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Box (Exo Mechs)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -36,62 +37,62 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); - player.TryGettingDevArmor(s); + // Originally, masks were 1/3.5, for whatever reason. Keeping it that way. + Fraction maskFraction = new Fraction(2, 7); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 30, 40); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); - // Weapons - if (DownedBossSystem.downedAres) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } - if (DownedBossSystem.downedThanatos) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } - if (DownedBossSystem.downedArtemisAndApollo) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } + // Boss-specific items + var ares = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAres); + ares.Add(ModContent.ItemType()); + ares.Add(ModContent.ItemType()); + ares.Add(ModContent.ItemType()); + ares.Add(ModContent.ItemType(), maskFraction); + + var thanatos = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedThanatos); + thanatos.Add(ModContent.ItemType()); + thanatos.Add(ModContent.ItemType()); + thanatos.Add(ModContent.ItemType(), maskFraction); + + var artemisAndApollo = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedArtemisAndApollo); + artemisAndApollo.Add(ModContent.ItemType()); + artemisAndApollo.Add(ModContent.ItemType()); + artemisAndApollo.Add(ModContent.ItemType(), maskFraction); + artemisAndApollo.Add(ModContent.ItemType(), maskFraction); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); - // Vanity - // Higher chance due to how the drops work - float maskDropRate = 1f / 3.5f; - if (DownedBossSystem.downedThanatos) - DropHelper.DropItemChance(s, player, ModContent.ItemType(), maskDropRate); - - if (DownedBossSystem.downedArtemisAndApollo) - { - DropHelper.DropItemChance(s, player, ModContent.ItemType(), maskDropRate); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), maskDropRate); - } - - if (DownedBossSystem.downedAres) - DropHelper.DropItemChance(s, player, ModContent.ItemType(), maskDropRate); - - DropHelper.DropItemChance(s, player, ModContent.ItemType(), maskDropRate); + // Vanity (Draedon Mask) + itemLoot.Add(ModContent.ItemType(), maskFraction); } } } diff --git a/Items/TreasureBags/DragonfollyBag.cs b/Items/TreasureBags/DragonfollyBag.cs index 5add24dd11..d140c417c7 100644 --- a/Items/TreasureBags/DragonfollyBag.cs +++ b/Items/TreasureBags/DragonfollyBag.cs @@ -1,31 +1,31 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Accessories; using CalamityMod.NPCs.Bumblebirb; using CalamityMod.World; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items.Armor.Vanity; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { [LegacyName("BumblebirbBag")] public class DragonfollyBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Dragonfolly)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -38,39 +38,49 @@ namespace CalamityMod.Items.TreasureBags Item.rare = ItemRarityID.Cyan; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 15, 21); + itemLoot.Add(ModContent.ItemType(), 1, 30, 35); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().rageBoostThree); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); + + // Other + itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().rageBoostThree, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/FleshyGeode.cs b/Items/TreasureBags/FleshyGeode.cs deleted file mode 100644 index c8ae2df58e..0000000000 --- a/Items/TreasureBags/FleshyGeode.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.TreasureBags -{ - [LegacyName("FleshyGeodeT1")] - public class FleshyGeode : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fleshy Geode"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - SacrificeTotal = 10; - } - - public override void SetDefaults() - { - Item.maxStack = 999; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.rare = ItemRarityID.Yellow; - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // Materials - int barMin = !Main.expertMode ? 1 : 2; - int barMax = 3; - int coreMin = 1; - int coreMax = !Main.expertMode ? 2 : 3; - DropHelper.DropItem(s, player, ModContent.ItemType(), barMin, barMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), barMin, barMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), barMin, barMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), coreMin, coreMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), coreMin, coreMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), coreMin, coreMax); - } - } -} diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 851e42beea..69ea121467 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -11,6 +11,7 @@ using CalamityMod.NPCs.HiveMind; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -18,13 +19,13 @@ namespace CalamityMod.Items.TreasureBags { public class HiveMindBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Hive Mind)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() @@ -37,42 +38,52 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 30, 40); - DropHelper.DropItem(s, player, ItemID.DemoniteBar, 9, 14); - DropHelper.DropItem(s, player, ItemID.RottenChunk, 10, 20); - DropHelper.DropItemCondition(s, player, ItemID.CursedFlame, Main.hardMode, 15, 30); - DropHelper.DropItem(s, player, ItemID.CorruptSeeds, 10, 15); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ItemID.DemoniteBar, 1, 15, 20); + itemLoot.Add(ItemID.RottenChunk, 1, 15, 20); + itemLoot.AddIf(() => Main.hardMode, ItemID.CursedFlame, 1, 25, 30); + itemLoot.Add(ItemID.CorruptSeeds, 1, 10, 15); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w, 50, 75), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new WeightedItemStack[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 10); } } } diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index fa17688a1f..41a10d57d5 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -9,6 +9,7 @@ using CalamityMod.NPCs.Leviathan; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -16,13 +17,12 @@ namespace CalamityMod.Items.TreasureBags { public class LeviathanBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Leviathan and Anahita)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -35,52 +35,60 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // siren & levi are available PHM, so this check is necessary to keep vanilla consistency - if (Main.hardMode) - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); // Fishing - DropHelper.DropItemChance(s, player, ItemID.HotlineFishingHook, 10); - DropHelper.DropItemChance(s, player, ItemID.BottomlessBucket, 10); - DropHelper.DropItemChance(s, player, ItemID.SuperAbsorbantSponge, 10); - DropHelper.DropItemChance(s, player, ItemID.FishingPotion, 5, 5, 8); - DropHelper.DropItemChance(s, player, ItemID.SonarPotion, 5, 5, 8); - DropHelper.DropItemChance(s, player, ItemID.CratePotion, 5, 5, 8); + itemLoot.Add(ItemID.HotlineFishingHook, 10); + itemLoot.Add(ItemID.BottomlessBucket, 10); + itemLoot.Add(ItemID.SuperAbsorbantSponge, 10); + itemLoot.Add(ItemID.FishingPotion, 5, 5, 8); + itemLoot.Add(ItemID.SonarPotion, 5, 5, 8); + itemLoot.Add(ItemID.CratePotion, 5, 5, 8); } } } diff --git a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs new file mode 100644 index 0000000000..f774495c49 --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs @@ -0,0 +1,89 @@ +using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + public class AbyssalTreasure : ModItem + { + internal static readonly int[] AbyssalTreasurePotions = new int[] + { + ItemID.SpelunkerPotion, + ItemID.MagicPowerPotion, + ItemID.ShinePotion, + ItemID.WaterWalkingPotion, + ItemID.ObsidianSkinPotion, + ItemID.WaterWalkingPotion, + ItemID.GravitationPotion, + ItemID.RegenerationPotion, + ModContent.ItemType(), + ModContent.ItemType(), + ItemID.GillsPotion, + ItemID.EndurancePotion, + ItemID.HeartreachPotion, + ItemID.FlipperPotion, + ItemID.LifeforcePotion, + ItemID.InfernoPotion + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Treasure"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Blue; //Blue for thematics + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } + + public override bool CanRightClick() => true; + + // TML 1.4 August Stable Grab Bag hook + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // 10% chance for potions + var tenPercentPotions = itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(10, 1, AbyssalTreasurePotions)); + + // 1/30 chance for a Wormhole Potion in multiplayer only + IItemDropRule wormholePotion = ItemDropRule.ByCondition(DropHelper.If(() => Main.netMode == NetmodeID.MultiplayerClient), ItemID.WormholePotion, 30); + LeadingConditionRule singlePlayer = new LeadingConditionRule(DropHelper.If(() => Main.netMode != NetmodeID.MultiplayerClient)); + + // IF YOU DONT GET POTIONS + // 10% chance for 4-8 Abyss Torches + // 10% chance 10-20 Hellfire Arrows + // 10% chance for 1 Hadal Stew + // 10% chance for 1 Sticky Dynamite + // 60% chance for 40-60 Silver Coins + + // 4-8 Abyss Torches + CommonDrop torches = new CommonDrop(ModContent.ItemType(), 1, 4, 8); + // 10-20 Hellfire Arrows + CommonDrop hellfireArrows = new CommonDrop(ItemID.HellfireArrow, 1, 10, 20); + // 1 Hadal Stew + CommonDrop hadalStew = new CommonDrop(ModContent.ItemType(), 1); + // 1 Sticky Dynamite + CommonDrop stickyDynamite = new CommonDrop(ItemID.StickyDynamite, 1); + // 40-60 Silver Coin + CommonDrop silver = new CommonDrop(ItemID.SilverCoin, 1, 40, 60); + + OneFromRulesRule otherDrops = new OneFromRulesRule(1, new IItemDropRule[] { torches, hellfireArrows, hadalStew, stickyDynamite, silver, silver, silver, silver, silver, silver }); + + tenPercentPotions.OnFailedRoll(wormholePotion).OnFailedRoll(otherDrops); + tenPercentPotions.OnFailedRoll(singlePlayer).OnSuccess(otherDrops); + } + } +} diff --git a/Items/TreasureBags/AbyssalTreasure.png b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.png similarity index 100% rename from Items/TreasureBags/AbyssalTreasure.png rename to Items/TreasureBags/MiscGrabBags/AbyssalTreasure.png diff --git a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs new file mode 100644 index 0000000000..53e0d86e5b --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs @@ -0,0 +1,70 @@ +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + public class BleachedAnglingKit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bleached Angling Kit"); + Tooltip.SetDefault("Has a chance to contain various fishing gear\n" + + "{$CommonItemTooltip.RightClickToOpen}"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Pink; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } + + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Different drop rates on Normal and Expert, so define normal first, then expert + var normalOnly = itemLoot.DefineNormalOnlyDropSet(); + normalOnly.Add(ItemID.AnglerTackleBag, 18); + normalOnly.Add(ItemID.HighTestFishingLine, 12); + normalOnly.Add(ItemID.TackleBox, 12); + normalOnly.Add(ItemID.AnglerEarring, 12); + normalOnly.Add(ItemID.FishermansGuide, 9); + normalOnly.Add(ItemID.WeatherRadio, 9); + normalOnly.Add(ItemID.Sextant, 9); + normalOnly.Add(ItemID.AnglerHat, 4); + normalOnly.Add(ItemID.AnglerVest, 4); + normalOnly.Add(ItemID.AnglerPants, 4); + normalOnly.Add(ItemID.FishingPotion, 4, 2, 3); + normalOnly.Add(ItemID.SonarPotion, 4, 2, 3); + normalOnly.Add(ItemID.CratePotion, 4, 2, 3); + normalOnly.Add(ItemID.GoldenBugNet, 15); + + var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); + expertPlus.Add(ItemID.AnglerTackleBag, 15); + expertPlus.Add(ItemID.HighTestFishingLine, 10); + expertPlus.Add(ItemID.TackleBox, 10); + expertPlus.Add(ItemID.AnglerEarring, 10); + expertPlus.Add(ItemID.FishermansGuide, 8); + expertPlus.Add(ItemID.WeatherRadio, 8); + expertPlus.Add(ItemID.Sextant, 8); + expertPlus.Add(ItemID.AnglerHat, 2); + expertPlus.Add(ItemID.AnglerVest, 2); + expertPlus.Add(ItemID.AnglerPants, 2); + expertPlus.Add(ItemID.FishingPotion, 2, 2, 3); + expertPlus.Add(ItemID.SonarPotion, 2, 2, 3); + expertPlus.Add(ItemID.CratePotion, 2, 2, 3); + expertPlus.Add(ItemID.GoldenBugNet, 12); + } + } +} diff --git a/Items/TreasureBags/BleachedAnglingKit.png b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.png similarity index 100% rename from Items/TreasureBags/BleachedAnglingKit.png rename to Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.png diff --git a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs new file mode 100644 index 0000000000..25ee21cd45 --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs @@ -0,0 +1,57 @@ +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + [LegacyName("FleshyGeodeT1")] + public class FleshyGeode : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fleshy Geode"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Yellow; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } + + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Different drop rates on Normal and Expert, so define normal first, then expert + // 1-3 bars on Normal, 2-3 bars on Expert + // 1-2 cores on Normal, 1-3 cores on Expert + var normalOnly = itemLoot.DefineNormalOnlyDropSet(); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + + var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); + expertPlus.Add(ModContent.ItemType(), 1, 2, 3); + expertPlus.Add(ModContent.ItemType(), 1, 2, 3); + expertPlus.Add(ModContent.ItemType(), 1, 2, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + } + } +} diff --git a/Items/TreasureBags/FleshyGeode.png b/Items/TreasureBags/MiscGrabBags/FleshyGeode.png similarity index 100% rename from Items/TreasureBags/FleshyGeode.png rename to Items/TreasureBags/MiscGrabBags/FleshyGeode.png diff --git a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs new file mode 100644 index 0000000000..528913fc18 --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs @@ -0,0 +1,67 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + [LegacyName("FleshyGeodeT2")] + public class NecromanticGeode : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Necromantic Geode"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ModContent.RarityType(); + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } + + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Different drop rates on Normal and Expert, so define normal first, then expert + // 5-10 bars on Normal, 7-12 bars on Expert + // 1-3 cores on Normal, 2-4 cores on Expert + // 50% chance of life alloy on Normal, 100% on Expert + // 33% chance of core of calamity on Normal, 50% on Expert + // 100-120 bloodstone on Normal, 120-140 bloodstone on Expert + var normalOnly = itemLoot.DefineNormalOnlyDropSet(); + normalOnly.Add(ModContent.ItemType(), 1, 5, 10); + normalOnly.Add(ModContent.ItemType(), 1, 5, 10); + normalOnly.Add(ModContent.ItemType(), 1, 5, 10); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 2); + normalOnly.Add(ModContent.ItemType(), 3); + normalOnly.Add(ModContent.ItemType(), 1, 100, 120); + + var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); + expertPlus.Add(ModContent.ItemType(), 1, 7, 12); + expertPlus.Add(ModContent.ItemType(), 1, 7, 12); + expertPlus.Add(ModContent.ItemType(), 1, 7, 12); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType()); + expertPlus.Add(ModContent.ItemType(), 2); + expertPlus.Add(ModContent.ItemType(), 1, 120, 140); + } + } +} diff --git a/Items/TreasureBags/NecromanticGeode.png b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.png similarity index 100% rename from Items/TreasureBags/NecromanticGeode.png rename to Items/TreasureBags/MiscGrabBags/NecromanticGeode.png diff --git a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs new file mode 100644 index 0000000000..80dbd4e322 --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs @@ -0,0 +1,68 @@ +using Terraria; +using Terraria.ID; +using Terraria.GameContent.ItemDropRules; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + public class SandyAnglingKit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandy Angling Kit"); + Tooltip.SetDefault("Has a chance to contain various fishing gear\n" + + "{$CommonItemTooltip.RightClickToOpen}"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Blue; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } + + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Different drop rates on Normal and Expert, so define normal first, then expert + var normalOnly = itemLoot.DefineNormalOnlyDropSet(); + normalOnly.Add(ItemID.HighTestFishingLine, 15); + normalOnly.Add(ItemID.TackleBox, 15); + normalOnly.Add(ItemID.AnglerEarring, 15); + normalOnly.Add(ItemID.FishermansGuide, 10); + normalOnly.Add(ItemID.WeatherRadio, 10); + normalOnly.Add(ItemID.Sextant, 10); + normalOnly.Add(ItemID.AnglerHat, 5); + normalOnly.Add(ItemID.AnglerVest, 5); + normalOnly.Add(ItemID.AnglerPants, 5); + normalOnly.Add(ItemID.FishingPotion, 5, 2, 3); + normalOnly.Add(ItemID.SonarPotion, 5, 2, 3); + normalOnly.Add(ItemID.CratePotion, 5, 2, 3); + normalOnly.AddIf(() => NPC.downedBoss3, ItemID.GoldenBugNet, 20); + + var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); + expertPlus.Add(ItemID.HighTestFishingLine, 12); + expertPlus.Add(ItemID.TackleBox, 12); + expertPlus.Add(ItemID.AnglerEarring, 12); + expertPlus.Add(ItemID.FishermansGuide, 9); + expertPlus.Add(ItemID.WeatherRadio, 9); + expertPlus.Add(ItemID.Sextant, 9); + expertPlus.Add(ItemID.AnglerHat, 4); + expertPlus.Add(ItemID.AnglerVest, 4); + expertPlus.Add(ItemID.AnglerPants, 4); + expertPlus.Add(ItemID.FishingPotion, 4, 2, 3); + expertPlus.Add(ItemID.SonarPotion, 4, 2, 3); + expertPlus.Add(ItemID.CratePotion, 4, 2, 3); + expertPlus.AddIf(() => NPC.downedBoss3, ItemID.GoldenBugNet, 18); + } + } +} diff --git a/Items/TreasureBags/SandyAnglingKit.png b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.png similarity index 100% rename from Items/TreasureBags/SandyAnglingKit.png rename to Items/TreasureBags/MiscGrabBags/SandyAnglingKit.png diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs new file mode 100644 index 0000000000..c88cb14537 --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -0,0 +1,80 @@ +using CalamityMod.Items.Pets; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + public class StarterBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starter Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Blue; + } + + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Weapons + // Tin and copper content is explicitly separated + LeadingConditionRule tin = itemLoot.DefineConditionalDropSet(() => WorldGen.SavedOreTiers.Copper == TileID.Tin); + tin.Add(ItemID.TinBroadsword); + tin.Add(ItemID.TinBow); + tin.Add(ItemID.TopazStaff); + tin.OnFailedConditions(new CommonDrop(ItemID.CopperBroadsword, 1)); + tin.OnFailedConditions(new CommonDrop(ItemID.CopperBow, 1)); + tin.OnFailedConditions(new CommonDrop(ItemID.AmethystStaff, 1)); + itemLoot.Add(ItemID.WoodenArrow, 1, 100, 100); // You must specify 100 to 100. + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), 1, 150, 150); + + // 1 Mana Crystal + itemLoot.Add(ItemID.ManaCrystal); + + // Tools and Utility Items + tin.Add(ItemID.TinHammer); + tin.OnFailedConditions(new CommonDrop(ItemID.CopperHammer, 1)); + itemLoot.Add(ItemID.Bomb, 1, 10, 10); + itemLoot.Add(ItemID.Rope, 1, 50, 50); + + // Potions + itemLoot.Add(ItemID.MiningPotion); + itemLoot.Add(ItemID.SpelunkerPotion, 1, 2, 2); + itemLoot.Add(ItemID.SwiftnessPotion, 1, 3, 3); + itemLoot.Add(ItemID.GillsPotion, 1, 2, 2); + itemLoot.Add(ItemID.ShinePotion); + itemLoot.Add(ItemID.RecallPotion, 1, 3, 3); + + // Tiles + itemLoot.Add(ItemID.Torch, 1, 25, 25); + itemLoot.Add(ItemID.Chest, 1, 3, 3); + + // Calamity title theme music box (if music mod is enabled) + Mod musicMod = CalamityMod.Instance.musicMod; + if (musicMod is not null) + itemLoot.Add(musicMod.Find("CalamityMusicbox").Type); + + // Aleksh donator item + // Name specific: "Aleksh" or "Shark Lad" + static bool getsLadPet(DropAttemptInfo info) + { + string playerName = info.player.name; + return playerName == "Aleksh" || playerName == "Shark Lad"; + }; + itemLoot.AddIf(getsLadPet, ModContent.ItemType()); + } + } +} diff --git a/Items/TreasureBags/StarterBag.png b/Items/TreasureBags/MiscGrabBags/StarterBag.png similarity index 100% rename from Items/TreasureBags/StarterBag.png rename to Items/TreasureBags/MiscGrabBags/StarterBag.png diff --git a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs new file mode 100644 index 0000000000..3fd13d87f9 --- /dev/null +++ b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs @@ -0,0 +1,88 @@ +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags.MiscGrabBags +{ + public class SulphuricTreasure : ModItem + { + internal static readonly int[] SulphuricTreasurePotions = new int[] + { + ItemID.SpelunkerPotion, + ItemID.MagicPowerPotion, + ItemID.ShinePotion, + ItemID.WaterWalkingPotion, + ItemID.ObsidianSkinPotion, + ItemID.WaterWalkingPotion, + ItemID.GravitationPotion, + ItemID.RegenerationPotion, + ModContent.ItemType(), + ModContent.ItemType(), + ItemID.GillsPotion, + ItemID.EndurancePotion, + ItemID.HeartreachPotion, + ItemID.FlipperPotion, + ItemID.LifeforcePotion, + ItemID.InfernoPotion + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphuric Treasure"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.maxStack = 999; + Item.consumable = true; + Item.width = 24; + Item.height = 24; + Item.rare = ItemRarityID.Green; //Green for thematics + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } + + public override bool CanRightClick() => true; + + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // 1/15 chance for potions + var oneInFifteenPotions = itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(15, 1, SulphuricTreasurePotions)); + + // 1/30 chance for a Wormhole Potion in multiplayer only + IItemDropRule wormholePotion = ItemDropRule.ByCondition(DropHelper.If(() => Main.netMode == NetmodeID.MultiplayerClient), ItemID.WormholePotion, 30); + LeadingConditionRule singlePlayer = new LeadingConditionRule(DropHelper.If(() => Main.netMode != NetmodeID.MultiplayerClient)); + + // IF YOU DONT GET POTIONS + // 10% chance for 4-8 Sticky Glowsticks + // 10% chance for 10-20 Jester Arrows + // 10% chance for 1 Hadal Stew + // 10% chance for 5-7 BOMBS?! + // 0% chance for Lamp Oil (no item in game) + // 60% chance for 40-60 Silver Coins + + // 4-8 Glowsticks + CommonDrop stickyGlowsticks = new CommonDrop(ItemID.StickyGlowstick, 1, 4, 8); + // 10-20 Jester Arrows + CommonDrop jesterArrows = new CommonDrop(ItemID.JestersArrow, 1, 10, 20); + // 1 Hadal Stew + CommonDrop hadalStew = new CommonDrop(ModContent.ItemType(), 1); + // 5-7 Sticky Bombs + CommonDrop stickyBombs = new CommonDrop(ItemID.StickyBomb, 1, 5, 7); + // 40-60 Silver Coin + CommonDrop silver = new CommonDrop(ItemID.SilverCoin, 1, 40, 60); + + OneFromRulesRule otherDrops = new OneFromRulesRule(1, new IItemDropRule[] { stickyGlowsticks, jesterArrows, hadalStew, stickyBombs, silver, silver, silver, silver, silver, silver }); + + oneInFifteenPotions.OnFailedRoll(wormholePotion).OnFailedRoll(otherDrops); + oneInFifteenPotions.OnFailedRoll(singlePlayer).OnSuccess(otherDrops); + } + } +} diff --git a/Items/TreasureBags/SulphuricTreasure.png b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.png similarity index 100% rename from Items/TreasureBags/SulphuricTreasure.png rename to Items/TreasureBags/MiscGrabBags/SulphuricTreasure.png diff --git a/Items/TreasureBags/NecromanticGeode.cs b/Items/TreasureBags/NecromanticGeode.cs deleted file mode 100644 index c13fa072cd..0000000000 --- a/Items/TreasureBags/NecromanticGeode.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags -{ - [LegacyName("FleshyGeodeT2")] - public class NecromanticGeode : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Necromantic Geode"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - SacrificeTotal = 10; - } - - public override void SetDefaults() - { - Item.maxStack = 999; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.Calamity().customRarity = CalamityRarity.Turquoise; - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // Materials - int barMin = !Main.expertMode ? 5 : 7; - int barMax = !Main.expertMode ? 10 : 12; - int coreMin = !Main.expertMode ? 1 : 2; - int coreMax = !Main.expertMode ? 3 : 4; - int bloodstoneMin = !Main.expertMode ? 50 : 60; - int bloodstoneMax = !Main.expertMode ? 60 : 70; - int lifeAlloyChance = !Main.expertMode ? 2 : 1; - int coreofCalChance = !Main.expertMode ? 3 : 2; - DropHelper.DropItem(s, player, ModContent.ItemType(), barMin, barMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), barMin, barMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), barMin, barMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), coreMin, coreMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), coreMin, coreMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), coreMin, coreMax); - DropHelper.DropItem(s, player, ModContent.ItemType(), bloodstoneMin, bloodstoneMax); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), lifeAlloyChance, 1, 1); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), coreofCalChance, 1, 1); - } - } -} diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 56c4290a5a..37e73160b0 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -1,28 +1,28 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.OldDuke; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class OldDukeBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Old Duke)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -35,40 +35,50 @@ namespace CalamityMod.Items.TreasureBags Item.rare = ItemRarityID.Red; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; - public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(Item); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() + { + CalamityUtils.ForceItemIntoWorld(Item); + Item.TreasureBagLightAndDust(); + } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); } } } diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index 1c5d4b6025..1c0ba8898f 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -11,6 +11,7 @@ using CalamityMod.NPCs.Perforator; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -18,13 +19,13 @@ namespace CalamityMod.Items.TreasureBags { public class PerforatorBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Perforators)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() @@ -37,44 +38,54 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 45, 60); - DropHelper.DropItem(s, player, ItemID.CrimtaneBar, 15, 20); - DropHelper.DropItem(s, player, ItemID.Vertebrae, 15, 20); - DropHelper.DropItemCondition(s, player, ItemID.Ichor, Main.hardMode, 15, 30); - DropHelper.DropItem(s, player, ItemID.CrimsonSeeds, 10, 15); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ItemID.CrimtaneBar, 1, 15, 20); + itemLoot.Add(ItemID.Vertebrae, 1, 15, 20); + itemLoot.AddIf(() => Main.hardMode, ItemID.Ichor, 1, 25, 30); + itemLoot.Add(ItemID.CrimsonSeeds, 1, 10, 15); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w, 50, 75), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new WeightedItemStack[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 10);; } } } diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 0298796953..4609d9e264 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -11,6 +11,7 @@ using CalamityMod.NPCs.PlaguebringerGoliath; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -18,13 +19,12 @@ namespace CalamityMod.Items.TreasureBags { public class PlaguebringerGoliathBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Plaguebringer Goliath)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -37,48 +37,56 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 13, 17); - DropHelper.DropItem(s, player, ModContent.ItemType(), 16, 20); - DropHelper.DropItem(s, player, ItemID.Stinger, 4, 8); + itemLoot.Add(ModContent.ItemType(), 1, 25, 30); + itemLoot.Add(ModContent.ItemType(), 1, 30, 35); + itemLoot.Add(ItemID.Stinger, 1, 4, 8); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), // Virulence - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), // Pandemic - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), // Blight Spewer - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 10); } } } diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index 88ed51ae99..06a74a4d8f 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -12,20 +12,20 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class PolterghastBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Polterghast)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -38,6 +38,17 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + + public override bool CanRightClick() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); @@ -48,37 +59,34 @@ namespace CalamityMod.Items.TreasureBags Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/TreasureBags/PolterghastBagGlow").Value); } - public override bool CanRightClick() => true; - - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 10, 20); - DropHelper.DropItem(s, player, ModContent.ItemType(), 40, 50); + itemLoot.Add(ModContent.ItemType(), 1, 10, 20); + itemLoot.Add(ModContent.ItemType(), 1, 40, 50); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().adrenalineBoostThree); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().adrenalineBoostThree, ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); } } } diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index c341fa0943..3499918044 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -7,23 +7,23 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Providence; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class ProvidenceBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Providence, the Profaned Goddess)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -36,42 +36,50 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 25, 35); - DropHelper.DropItem(s, player, ModContent.ItemType(), 20, 30); + itemLoot.Add(ModContent.ItemType(), 1, 25, 35); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); } } } diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 1a7acdabfb..0a69e96dcb 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -8,23 +9,23 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Ravager; using CalamityMod.World; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class RavagerBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Ravager)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -37,44 +38,54 @@ namespace CalamityMod.Items.TreasureBags Item.rare = ItemRarityID.Cyan; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); - player.TryGettingDevArmor(s); - - // Materials - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), !DownedBossSystem.downedProvidence); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence); + // Materials (contained in Geodes to prevent overwhelming item floods) + itemLoot.AddIf(() => !DownedBossSystem.downedProvidence, ModContent.ItemType()); + itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType()); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.05f); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + })); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 20); // Equipment - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.5f); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.5f); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), DownedBossSystem.downedProvidence); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().rageBoostTwo); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(ItemDropRule.OneFromOptionsNotScalingWithLuck(1, + ModContent.ItemType(), + ModContent.ItemType() + )); + itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); + itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().rageBoostTwo, ModContent.ItemType()); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); } } } diff --git a/Items/TreasureBags/SandyAnglingKit.cs b/Items/TreasureBags/SandyAnglingKit.cs deleted file mode 100644 index 48025ced94..0000000000 --- a/Items/TreasureBags/SandyAnglingKit.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags -{ - public class SandyAnglingKit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandy Angling Kit"); - Tooltip.SetDefault("Has a chance to contain various fishing gear\n" + - "{$CommonItemTooltip.RightClickToOpen}"); - SacrificeTotal = 10; - } - - public override void SetDefaults() - { - Item.maxStack = 999; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.rare = ItemRarityID.Blue; - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - int fishingAccChance = !Main.expertMode ? 15 : 12; - int fishFindAccChance = !Main.expertMode ? 10 : 9; - int anglerArmorChance = !Main.expertMode ? 5 : 4; - int potionChance = !Main.expertMode ? 5 : 4; - int bugNetChance = !Main.expertMode ? 20 : 18; - // Fishing - DropHelper.DropItemChance(s, player, ItemID.HighTestFishingLine, fishingAccChance); - DropHelper.DropItemChance(s, player, ItemID.TackleBox, fishingAccChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerEarring, fishingAccChance); - DropHelper.DropItemChance(s, player, ItemID.FishermansGuide, fishFindAccChance); - DropHelper.DropItemChance(s, player, ItemID.WeatherRadio, fishFindAccChance); - DropHelper.DropItemChance(s, player, ItemID.Sextant, fishFindAccChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerHat, anglerArmorChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerVest, anglerArmorChance); - DropHelper.DropItemChance(s, player, ItemID.AnglerPants, anglerArmorChance); - DropHelper.DropItemChance(s, player, ItemID.FishingPotion, potionChance, 2, 3); - DropHelper.DropItemChance(s, player, ItemID.SonarPotion, potionChance, 2, 3); - DropHelper.DropItemChance(s, player, ItemID.CratePotion, potionChance, 2, 3); - DropHelper.DropItemCondition(s, player, ItemID.GoldenBugNet, NPC.downedBoss3, bugNetChance, 1, 1); - } - } -} diff --git a/Items/TreasureBags/SignusBag.cs b/Items/TreasureBags/SignusBag.cs index fd304b9733..736719bb28 100644 --- a/Items/TreasureBags/SignusBag.cs +++ b/Items/TreasureBags/SignusBag.cs @@ -7,6 +7,7 @@ using CalamityMod.NPCs.Signus; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -14,13 +15,12 @@ namespace CalamityMod.Items.TreasureBags { public class SignusBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Signus, Envoy of the Devourer)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -33,38 +33,47 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 3, 4); + itemLoot.Add(ModContent.ItemType(), 1, 6, 9); // Weapons - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } + itemLoot.Add(ModContent.ItemType(), 7); + var ancientGodSlayer = ItemDropRule.Common(ModContent.ItemType(), 20); + ancientGodSlayer.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + ancientGodSlayer.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + itemLoot.Add(ancientGodSlayer); } } } diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index 601e64971e..b397d3ce5d 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -10,6 +10,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -17,13 +18,13 @@ namespace CalamityMod.Items.TreasureBags { public class SlimeGodBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (The Slime God)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.PreHardmodeLikeBossBag[Item.type] = true; } public override void SetDefaults() @@ -36,39 +37,51 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials // No Gel is dropped here because the boss drops Gel directly - DropHelper.DropItem(s, player, ModContent.ItemType(), 40, 52); + itemLoot.Add(ModContent.ItemType(), 1, 40, 52); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().adrenalineBoostOne); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemFromSetChance(s, player, 0.142857f, ModContent.ItemType(), ModContent.ItemType()); + itemLoot.Add(ItemDropRule.OneFromOptions(7, ModContent.ItemType(), ModContent.ItemType())); + + // Other + itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().adrenalineBoostOne, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/StarterBag.cs b/Items/TreasureBags/StarterBag.cs deleted file mode 100644 index 2332bd4fb4..0000000000 --- a/Items/TreasureBags/StarterBag.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.Items.Pets; -using CalamityMod.Items.DifficultyItems; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags -{ - public class StarterBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starter Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.rare = ItemRarityID.Blue; - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // Weapons - DropHelper.DropItem(s, player, WorldGen.SavedOreTiers.Copper == TileID.Copper ? ItemID.CopperBroadsword : ItemID.TinBroadsword); - DropHelper.DropItem(s, player, WorldGen.SavedOreTiers.Copper == TileID.Copper ? ItemID.CopperBow : ItemID.TinBow); - DropHelper.DropItem(s, player, ItemID.WoodenArrow, 100); - DropHelper.DropItem(s, player, WorldGen.SavedOreTiers.Copper == TileID.Copper ? ItemID.AmethystStaff : ItemID.TopazStaff); - DropHelper.DropItem(s, player, ItemID.ManaCrystal); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType(), 150); - - // Tools / Utility - DropHelper.DropItem(s, player, WorldGen.SavedOreTiers.Copper == TileID.Copper ? ItemID.CopperHammer : ItemID.TinHammer); - DropHelper.DropItem(s, player, ItemID.Bomb, 10); - DropHelper.DropItem(s, player, ItemID.MiningPotion); - DropHelper.DropItem(s, player, ItemID.SpelunkerPotion, 2); - DropHelper.DropItem(s, player, ItemID.SwiftnessPotion, 3); - DropHelper.DropItem(s, player, ItemID.GillsPotion, 2); - DropHelper.DropItem(s, player, ItemID.ShinePotion); - DropHelper.DropItem(s, player, ItemID.RecallPotion, 3); - - // Tiles / Placeables - DropHelper.DropItem(s, player, ItemID.Torch, 25); - DropHelper.DropItem(s, player, ItemID.Chest, 3); - - // Difficulty items (Revengeance and Death don't drop in Normal) - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), Main.expertMode); - - // The Lad - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), player.name == "Aleksh" || player.name == "Shark Lad"); - - // Music box (if music mod installed) - Mod musicMod = CalamityMod.Instance.musicMod; - if (musicMod != null) - DropHelper.DropItem(s, player, musicMod.Find("CalamityMusicbox").Type); - } - } -} diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index e1d280d134..46f4af0a2d 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -7,6 +7,7 @@ using CalamityMod.NPCs.StormWeaver; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -14,13 +15,12 @@ namespace CalamityMod.Items.TreasureBags { public class StormWeaverBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Storm Weaver)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -33,42 +33,49 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 7, 10); + itemLoot.Add(ModContent.ItemType(), 1, 6, 9); // Weapons - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment + itemLoot.AddRevBagAccessories(); // Stay tuned for Definitely Not Charged Perforator Runald's Band As A Single Item // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } - - // Light Pet - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 8); + itemLoot.Add(ModContent.ItemType(), 7); + var ancientGodSlayer = ItemDropRule.Common(ModContent.ItemType(), 20); + ancientGodSlayer.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + ancientGodSlayer.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + itemLoot.Add(ancientGodSlayer); + itemLoot.Add(ModContent.ItemType(), 8); } } } diff --git a/Items/TreasureBags/SulphuricTreasure.cs b/Items/TreasureBags/SulphuricTreasure.cs deleted file mode 100644 index 98bd5c5027..0000000000 --- a/Items/TreasureBags/SulphuricTreasure.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Items.Potions; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags -{ - public class SulphuricTreasure : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sulphuric Treasure"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - SacrificeTotal = 10; - } - - public override void SetDefaults() - { - Item.maxStack = 999; - Item.consumable = true; - Item.width = 24; - Item.height = 24; - Item.rare = ItemRarityID.Green; //Green for thematics - } - - public override bool CanRightClick() => true; - - public override void RightClick(Player player) - { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - // Loops 4 times to compensate for dropping only one treasure now - for (int i = 0; i < 4; i++) - { - if (Main.rand.NextBool(15)) - { - int potionType = Utils.SelectRandom(WorldGen.genRand, new int[] - { - ItemID.SpelunkerPotion, - ItemID.MagicPowerPotion, - ItemID.ShinePotion, - ItemID.WaterWalkingPotion, - ItemID.ObsidianSkinPotion, - ItemID.WaterWalkingPotion, - ItemID.GravitationPotion, - ItemID.RegenerationPotion, - ModContent.ItemType(), - ModContent.ItemType(), - ItemID.GillsPotion, - ItemID.EndurancePotion, - ItemID.HeartreachPotion, - ItemID.FlipperPotion, - ItemID.LifeforcePotion, - ItemID.InfernoPotion - }); - DropHelper.DropItem(s, player, potionType); - } - else - { - switch (Main.rand.Next(10)) - { - case 0: - int glowstickAmt = Main.rand.Next(2, 6); - if (Main.expertMode) - { - glowstickAmt += Main.rand.Next(1, 7); - } - DropHelper.DropItem(s, player, ItemID.Glowstick, glowstickAmt); - break; - case 1: - DropHelper.DropItem(s, player, ItemID.JestersArrow, 10, 20); - break; - case 2: - DropHelper.DropItem(s, player, ItemID.HealingPotion); - break; - case 3: - DropHelper.DropItem(s, player, ItemID.Bomb, 5, 8); - break; - default: - int coinCount = 5000 + Main.rand.Next(-100, 101); - while (coinCount > 0) - { - if (coinCount > 1000000) - { - int ptCoinAmt = coinCount / 1000000; - if (ptCoinAmt > 50 && Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 1000000 * ptCoinAmt; - DropHelper.DropItem(s, player, ItemID.PlatinumCoin, ptCoinAmt); - } - else if (coinCount > 10000) - { - int auCoinAmt = coinCount / 10000; - if (auCoinAmt > 50 && Main.rand.NextBool(2)) - { - auCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - auCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 10000 * auCoinAmt; - DropHelper.DropItem(s, player, ItemID.GoldCoin, auCoinAmt); - } - else if (coinCount > 100) - { - int agCoinAmt = coinCount / 100; - if (agCoinAmt > 50 && Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 100 * agCoinAmt; - DropHelper.DropItem(s, player, ItemID.SilverCoin, agCoinAmt); - } - else - { - int cuCoinAmt = coinCount; - if (cuCoinAmt > 50 && Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(4) + 1; - } - if (cuCoinAmt < 1) - { - cuCoinAmt = 1; - } - coinCount -= cuCoinAmt; - DropHelper.DropItem(s, player, ItemID.CopperCoin, cuCoinAmt); - } - } - break; - } - } - } - } - } -} diff --git a/Items/TreasureBags/SupremeCalamitasCoffer.cs b/Items/TreasureBags/SupremeCalamitasCoffer.cs index ae9ca3bef5..484b095bc1 100644 --- a/Items/TreasureBags/SupremeCalamitasCoffer.cs +++ b/Items/TreasureBags/SupremeCalamitasCoffer.cs @@ -7,26 +7,25 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; - namespace CalamityMod.Items.TreasureBags { [LegacyName("SCalBag")] public class SupremeCalamitasCoffer : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Coffer (Supreme Calamitas)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -39,51 +38,53 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); - - player.TryGettingDevArmor(s); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - DropHelper.DropItem(s, player, ModContent.ItemType(), 25, 35); + itemLoot.Add(ModContent.ItemType(), 1, 30, 40); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + })); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - - // SCal vanity set (This drops all at once, or not at all) - if (Main.rand.NextBool(7)) - { - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - } - - // The Brimstone Jewel is an expert-only vanity - DropHelper.DropItem(s, player, ModContent.ItemType()); + var scalVanitySet = ItemDropRule.Common(ModContent.ItemType(), 7); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + itemLoot.Add(scalVanitySet); + itemLoot.Add(ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 50ab9ab450..d3f20dd766 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -8,25 +10,23 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Yharon; using CalamityMod.World; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items.Accessories.Wings; -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { public class YharonBag : ModItem { - public override int BossBagNPC => ModContent.NPCType(); - public override void SetStaticDefaults() { SacrificeTotal = 3; DisplayName.SetDefault("Treasure Bag (Jungle Dragon, Yharon)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -39,47 +39,54 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } + public override bool CanRightClick() => true; + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + + public override void PostUpdate() => Item.TreasureBagLightAndDust(); + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { return CalamityUtils.DrawTreasureBagInWorld(Item, spriteBatch, ref rotation, ref scale, whoAmI); } - public override void OpenBossBag(Player player) + public override void ModifyItemLoot(ItemLoot itemLoot) { - // IEntitySource my beloathed - var s = player.GetSource_OpenItem(Item.type); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); - player.TryGettingDevArmor(s); + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 30, 35); // Weapons - float w = DropHelper.BagWeaponDropRateFloat; - DropHelper.DropEntireWeightedSet(s, player, - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), - DropHelper.WeightStack(w), // Yharon Kindle Staff - DropHelper.WeightStack(w), // Infernal Spear - DropHelper.WeightStack(w) - ); + itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + })); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItem(s, player, ModContent.ItemType()); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 0.1f); - - int soulFragMin = 22; - int soulFragMax = 28; - DropHelper.DropItem(s, player, ModContent.ItemType(), soulFragMin, soulFragMax); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); + itemLoot.AddRevBagAccessories(); // Vanity - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 7); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10); - DropHelper.DropItemChance(s, player, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(s, player, ModContent.ItemType(), CalamityWorld.revenge); + itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.AddIf(() => CalamityWorld.revenge, ModContent.ItemType()); } } } diff --git a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs index 46e693d914..d33dc4fc12 100644 --- a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.VanillaArmorChanges public const int AmountToHealPerPulse = 10; - public const int PulseReleaseRate = 180; + public const int PulseReleaseRate = 300; - public const int DelayBetweenHeals = 150; + public const int DelayBetweenHeals = 270; public const int BaseDamageToEnemies = 300; diff --git a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs index b7aa059bbf..d4117a6918 100644 --- a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs +++ b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText = "Multiplies all cold-based debuff damage by 1.25\n" + + // Not sure why it doesn't say Set bonus automatically + setBonusText = "Set bonus: Multiplies all cold-based debuff damage by 1.25\n" + "Cold enemies will deal reduced contact damage to the player\n" + "Provides immunity to the Frostburn and Glacial State debuffs"; } diff --git a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs index 493a4fa005..25ce3a0b2f 100644 --- a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs @@ -14,20 +14,15 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Gladiator"; - public override bool NeedsToCreateSetBonusTextManually => true; - public const int HelmetRogueDamageBoostPercent = 3; public const int ChestplateRogueCritBoostPercent = 3; public const int LeggingRogueVelocityBoostPercent = 3; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText = "+3 defense\n" + - "5% increased rogue damage and 10% increased velocity\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 70\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + setBonusText += "\n+3 defense\n" + + "+70 maximum stealth\n" + + "5% increased rogue damage and 10% increased velocity"; } public override void ApplyHeadPieceEffect(Player player) diff --git a/Items/VanillaArmorChanges/MiningArmorSetChange.cs b/Items/VanillaArmorChanges/MiningArmorSetChange.cs new file mode 100644 index 0000000000..4d1cb47a71 --- /dev/null +++ b/Items/VanillaArmorChanges/MiningArmorSetChange.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.VanillaArmorChanges +{ + public class MiningArmorSetChange : VanillaArmorChange + { + public override int? HeadPieceID => ItemID.MiningHelmet; + public override int[] AlternativeHeadPieceIDs => new int[] { ItemID.UltrabrightHelmet }; + + public override int? BodyPieceID => ItemID.MiningShirt; + + public override int? LegPieceID => ItemID.MiningPants; + + public override string ArmorSetName => "Mining"; + + public const float MiningSpeed = 0.4f; + public const int BonusOreChance = 4; + public const int CooldownMin = 180; + public const int CooldownMax = 360; + + public override void UpdateSetBonusText(ref string setBonusText) + { + setBonusText = setBonusText.Replace("30%", "40%"); + setBonusText += "\nMining ore will sometimes have additional yield"; + } + + public override void ApplyArmorSetBonus(Player player) + { + // Remove the vanilla +30% pick speed and add (subtract?) the new pick speed value at the same time + player.pickSpeed -= MiningSpeed + 0.3f; + player.Calamity().miningSet = true; + } + } +} diff --git a/Items/VoodooDemonVoodooDoll.cs b/Items/VoodooDemonVoodooDoll.cs index 2d5d53ea78..ea3848d15b 100644 --- a/Items/VoodooDemonVoodooDoll.cs +++ b/Items/VoodooDemonVoodooDoll.cs @@ -20,6 +20,11 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Blue; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.SpawnPrevention; + } + public override void UpdateInventory(Player player) { if (Item.favorited) diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index 0a216bdbb3..4d4f266105 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,10 +13,11 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class FrequencyManipulator : ModItem + public class FrequencyManipulator : RogueWeapon { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Frequency Manipulator"); Tooltip.SetDefault("A long device, used in the tuning of some rather... original machines\n" + "Swings a spear around and then throws it\n" + @@ -39,8 +42,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.shootSpeed = 16f; diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index cc422ce759..d2c70c925b 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -15,11 +16,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Galvanizing Glaive"); Tooltip.SetDefault("Its use as a tool is to quickly separate a single object into two\n" + "That is also its use as a weapon\n" + "Swings a spear which envelops struck foes in an energy field\n" + "When done swinging, the spear discharges an extra pulse of energy"); + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -40,8 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.shoot = ModContent.ProjectileType(); @@ -68,8 +70,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(12). AddIngredient(18). + AddIngredient(10). AddIngredient(5). - AddIngredient(5). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 69a84d6e87..4aefa9a03f 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -24,6 +25,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Gatling Laser"); Tooltip.SetDefault("Large laser cannon used primarily by Yharim's fleet and base defense force"); } @@ -49,8 +51,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; @@ -77,8 +78,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(15). AddIngredient(15). + AddIngredient(10). AddIngredient(5). - AddIngredient(5). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 7e2907e596..0d2ef0e25d 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public const int HitsRequiredForFlux = 2; public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Gauss Dagger"); Tooltip.SetDefault("Slicing foes, it causes a flux of energy to form on the area tearing at them with turbulent forces\n" + "Repeat strikes envelop foes in magnetic flux"); @@ -34,8 +36,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 7f; Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index d79a110618..a665a73bdd 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using System; using System.Collections.Generic; using Terraria; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Gauss Pistol"); Tooltip.SetDefault("A simple pistol that utilizes magic power; a weapon for the more magically adept\n" + "Fires a devastating high velocity blast with extreme knockback"); @@ -37,8 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index f07d2cbb9b..d53031d4b9 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -1,15 +1,16 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -19,6 +20,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Gauss Rifle"); Tooltip.SetDefault("A large and slow weapon, the concussive force of its projectiles do well in clearing large groups\n" + "Fires a devastating high velocity blast with absurd knockback"); @@ -41,8 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 27f; @@ -65,8 +66,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(18). AddIngredient(12). + AddIngredient(10). AddIngredient(5). - AddIngredient(5). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs index 6b0cc34335..d0277a0c70 100644 --- a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs @@ -1,14 +1,15 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using System; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -19,6 +20,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Heavy Laser Rifle"); Tooltip.SetDefault("Laser weapon used by heavy infantry units in Yharim's army"); } @@ -41,8 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index ca63211b48..fbb235d2ce 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using System; using System.Collections.Generic; using Terraria; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Hydraulic Volt Crasher"); Tooltip.SetDefault("Good for both stamping metal plates and instantly fusing them, as well as crushing enemies\n" + "An electrically charged jackhammer which shocks all nearby foes on hit"); @@ -39,8 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index 7023cf13c7..4391a4c42e 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -1,6 +1,8 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -8,7 +10,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Matter Modulator"); Tooltip.SetDefault("Using extra mass gained from collision with solid materials, it causes extra damage\n" + "Fires a burst of unstable matter that does significant damage after striking a tile\n" + @@ -39,8 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 7f; diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index cbc600ef84..9cfda6dce7 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Mounted Scanner"); Tooltip.SetDefault("Laser technology used in this case for both targeting and defense\n" + "Summons a powerful weapon above your head that fires lasers at nearby enemies"); @@ -38,8 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index af94cd3594..4045a21f49 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -26,6 +27,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Phaseslayer"); Tooltip.SetDefault("A rough prototype of the Murasama blade, it is formed entirely from laser energy\n" + "Wield a colossal laser blade which is controlled by the cursor\n" + @@ -37,7 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CalamityGlobalItem modItem = Item.Calamity(); Item.damage = Damage; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 26; Item.height = 26; Item.useTime = 24; @@ -49,8 +51,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noUseGraphic = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index f8305ff72e..acac4ecd0c 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -1,14 +1,15 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public const int BaseDamage = 705; public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Plasma Caster"); Tooltip.SetDefault("Industrial tool used to fuse metal together with super-heated plasma\n" + "Right click for turbo mode"); @@ -46,8 +48,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 5289403d83..bd485e11da 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -1,24 +1,27 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class PlasmaGrenade : ModItem + public class PlasmaGrenade : RogueWeapon { public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/PlasmaGrenadeExplosion"); public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Plasma Grenade"); Tooltip.SetDefault("Each grenade contains a heavily condensed and heated unit of plasma. Use with care\n" + "Throws a grenade that explodes into plasma on collision\n" + @@ -42,8 +45,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 3a350918c8..1905dfc0fb 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Pole Warper"); Tooltip.SetDefault("Magnetic devices which tear at foes by propelling themselves off their opposite counterparts\n" + "Incredibly dangerous\n" + @@ -37,8 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 8f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item15; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index a37a852efe..352588292d 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Pulse Dragon"); Tooltip.SetDefault("Heavy duty flails, each containing a powerful generator which is activated upon launch\n" + "Throws two dragon heads that emit electrical fields"); @@ -25,7 +27,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CalamityGlobalItem modItem = Item.Calamity(); Item.damage = 300; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 30; Item.height = 10; Item.useTime = 20; @@ -35,8 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noUseGraphic = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.channel = true; diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 1969c6e9fc..76e8a235d0 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Pulse Pistol"); Tooltip.SetDefault("Fires a pulse that arcs to a new target on enemy hits"); } @@ -38,8 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 63139314c2..c30a07627e 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -1,15 +1,16 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -21,6 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Pulse Rifle"); Tooltip.SetDefault("Draedon's former pulse rifle, used in emergencies for creations which turned against him\n" + "When the pulse hits a target it will arc to another nearby target"); @@ -44,8 +46,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index fda4549a9d..250bd4543a 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Pulse Turret Remote"); Tooltip.SetDefault("A device used to defend against the weaker, less cognizant rogue creations of Draedon\n" + "Summons a pulse turret which eradicates nearby foes with focused energy blasts\n" + @@ -40,8 +42,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; @@ -70,8 +71,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(12). AddIngredient(18). + AddIngredient(10). AddIngredient(5). - AddIngredient(5). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 6cdf260238..bfaaf9a316 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -1,6 +1,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Snake Eyes"); Tooltip.SetDefault("Surveillance drones equipped with a strong electric field which can be directed at enemies\n" + "Summons a mechanical watcher that zaps and flies around enemies"); @@ -35,8 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item15; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index ed36f31e7c..c4654065a4 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Star Swallower Containment Unit"); Tooltip.SetDefault("Small novelties created to easily transport and fire plasma, strangely popular with humans\n" + "Summons a biomechanical frog that vomits plasma onto enemies"); @@ -35,8 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.knockBack = 2.25f; Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item15; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index d861061759..ac4955559c 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,12 +13,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class SystemBane : ModItem + public class SystemBane : RogueWeapon { public const int MaxDeployedProjectiles = 5; public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("System Bane"); Tooltip.SetDefault("Can be used to quickly send out an electromagnetic blast\n" + "Hurls an unstable device which sticks to the ground and shocks nearby enemies with lightning\n" + @@ -39,8 +42,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; Item.value = CalamityGlobalItem.Rarity8BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.shootSpeed = 16f; @@ -68,8 +70,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CreateRecipe(). AddIngredient(20). AddIngredient(10). + AddIngredient(10). AddIngredient(5). - AddIngredient(5). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 0e639ee84e..5eebd9abaf 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -2,12 +2,13 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using System; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Taser"); Tooltip.SetDefault("A slow, simple electric weapon, meant only for low ranking guards\n" + "Shoots a hook that attaches to enemies and electrocutes them before returning"); @@ -37,8 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 244027c889..481107a939 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -1,26 +1,28 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class TeslaCannon : ModItem { - private int BaseDamage = 1050; + private int BaseDamage = 1360; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/TeslaCannonFire"); public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Tesla Cannon"); Tooltip.SetDefault("Lightweight energy cannon that blasts an intense electrical beam that explodes\n" + "Beams can arc to nearby targets"); @@ -45,8 +47,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs new file mode 100644 index 0000000000..309c214b2a --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -0,0 +1,119 @@ +using Terraria.DataStructures; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Projectiles.DraedonsArsenal; +using System.Collections.Generic; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.CustomRecipes; +using System; +using CalamityMod.Rarities; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class TheAnomalysNanogun : ModItem + { + public static readonly SoundStyle PlasmaChargeSFX = new("CalamityMod/Sounds/Item/AnomalysNanogunPlasmaCharge"); + public static readonly SoundStyle MPFBShotSFX = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBShot"); + public static readonly SoundStyle PlasmaShotSFX = new("CalamityMod/Sounds/Item/AnomalysNanogunPlasmaShot"); + public bool PlasmaChargeSelected = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Anomaly's Nanogun"); + Tooltip.SetDefault("'Welcome to the party, pal'\n" + + "Left click to charge up 5 rapid-fire plasma beams\n" + + "Right click to launch 3 fission bombs"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + + Item.damage = 3000; + Item.knockBack = 4.5f; + Item.useTime = Item.useAnimation = AnomalysNanogunHoldout.PlasmaFireTimer; + Item.shootSpeed = 5f; + Item.width = 102; + Item.height = 44; + Item.DamageType = DamageClass.Ranged; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); + Item.UseSound = null; + + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); + modItem.donorItem = true; + + modItem.UsesCharge = true; + modItem.MaxCharge = 250f; + modItem.ChargePerUse = 0.2f; + modItem.ChargePerAltUse = 0.125f; + } + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + public override Vector2? HoldoutOffset() => new(-30f, 0f); + public override bool AltFunctionUse(Player player) => true; + public override void UseItemFrame(Player player) + { + // Thank you Mr. IbanPlay (CoralSprout.cs) + // Calculate the dirction in which the players arms should be pointing at. + float armPointingDirection = player.itemRotation; + if (player.direction < 0) + armPointingDirection += MathHelper.Pi; + + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); + } + + // Adjust based on right or left click + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + Vector2 rotationVector = velocity.SafeNormalize(Vector2.UnitX); + position = player.MountedCenter + rotationVector * AnomalysNanogunHoldout.GunLength; + velocity = rotationVector * 5f; + + // Right click is the MPBF Devastator + if (player.altFunctionUse == 2) + { + damage = (int)(damage * 0.1f); + knockback *= 0.8f; + velocity = rotationVector * 13f; + } + } + + // The clicks have different use times + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return (float)AnomalysNanogunHoldout.PlasmaFireTimer / AnomalysNanogunHoldout.MPFBFireTimer; + + return 1f; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + // The shooting mode is stored inside the holdout projectile + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, player.altFunctionUse, 0f); + return false; + } + + public override void AddRecipes() + { + CreateRecipe() + .AddIngredient() + .AddIngredient(8) + .AddIngredient(16) + .AddIngredient(16) + .AddIngredient(2) + .AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition) + .AddTile() + .Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.png b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.png new file mode 100644 index 0000000000..b874d63a36 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.png differ diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index 677cc6a8a4..66156dd7fc 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -1,10 +1,12 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -12,10 +14,11 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class TrackingDisk : ModItem + public class TrackingDisk : RogueWeapon { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Tracking Disk"); Tooltip.SetDefault("A weapon that, as it flies, processes calculations and fires lasers\n" + "Releases a flying disk that fires lasers at nearby enemies\n" + @@ -25,20 +28,19 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 25; + Item.damage = 16; Item.DamageType = RogueDamageClass.Instance; Item.width = 30; Item.height = 34; - Item.useTime = 42; - Item.useAnimation = 42; + Item.useTime = 45; + Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.knockBack = 3f; Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.noUseGraphic = true; diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 487a03b50f..91414f9c1a 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,10 +13,11 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class WavePounder : ModItem + public class WavePounder : RogueWeapon { public override void SetStaticDefaults() { + SacrificeTotal = 1; DisplayName.SetDefault("Wave Pounder"); Tooltip.SetDefault("It utilizes its power to send heavy shockwaves throughout the area, causing agonizing internal damage\n" + "Throws a bomb which explodes into a forceful shockwave\n" + @@ -38,9 +41,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 0f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ItemRarityID.Red; - modItem.customRarity = CalamityRarity.DraedonRust; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.shootSpeed = 16f; diff --git a/Items/Weapons/Magic/AbyssalTome.cs b/Items/Weapons/Magic/AbyssalTome.cs index c740ca38e3..386e745d0d 100644 --- a/Items/Weapons/Magic/AbyssalTome.cs +++ b/Items/Weapons/Magic/AbyssalTome.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,9 +27,9 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item8; + Item.UseSound = SlimeGodCore.ShotSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 237a8468ae..7e843765bf 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -38,8 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; } diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index 7b36173d13..1cda8ab7eb 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -1,10 +1,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = CommonCalamitySounds.LaserCannonSound; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index 4ba3772822..becac56589 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -33,12 +34,11 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 1.5f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item33; Item.autoReuse = true; Item.shootSpeed = 6f; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index e86da4070c..82442cb3d2 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -28,14 +28,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item9; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; } - - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); } } diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index 7c443ff0b6..9023df999c 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 3caebdc8d0..7a18b1022b 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 77; + Item.damage = 230; Item.DamageType = DamageClass.Magic; Item.mana = 42; Item.width = 30; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 6.9f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.UseSound = SoundID.Item92; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index f4aedc5d27..a37799946e 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item43; Item.autoReuse = true; @@ -38,8 +39,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 14f; } - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int index = 0; index < 2; ++index) @@ -55,13 +54,15 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RubyStaff). + AddIngredient(ItemID.AmethystStaff). + AddIngredient(3). AddIngredient(5). AddIngredient(25). AddTile(TileID.Anvils). Register(); CreateRecipe(). - AddIngredient(ItemID.DiamondStaff). + AddIngredient(ItemID.TopazStaff). + AddIngredient(3). AddIngredient(5). AddIngredient(25). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 57d4bb7a40..4480ad2115 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -36,8 +36,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 20f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index a87651d95b..d022b5f7b0 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -27,7 +27,7 @@ Fires spiritual claws that ignore walls and confuse enemies"); Item.useTurn = false; Item.noMelee = true; Item.knockBack = 10f; - Item.value = Item.buyPrice(0, 48, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index 7da4a9c827..b42a31274d 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 52; + Item.damage = 470; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.width = 70; diff --git a/Items/Weapons/Magic/AsteroidStaff.cs b/Items/Weapons/Magic/AsteroidStaff.cs index 7438eed80a..61252bac03 100644 --- a/Items/Weapons/Magic/AsteroidStaff.cs +++ b/Items/Weapons/Magic/AsteroidStaff.cs @@ -39,8 +39,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Red; } - public override Vector2? HoldoutOrigin() => new Vector2(2, 2); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index 3b54d5bd8a..c556b4b949 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item105; Item.autoReuse = true; @@ -41,8 +41,6 @@ namespace CalamityMod.Items.Weapons.Magic // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 15; - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index 84da30f358..8b0ef7dfa8 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -30,16 +30,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item46; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; } - - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index c9223baeba..78566748c9 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -28,14 +28,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item34; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 32f; - } - - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); + } } } diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index f2037aefb5..9481aecf0d 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Biofusillade.cs b/Items/Weapons/Magic/Biofusillade.cs index 4ed97a7d3c..1a129ffb3b 100644 --- a/Items/Weapons/Magic/Biofusillade.cs +++ b/Items/Weapons/Magic/Biofusillade.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -28,12 +29,11 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item33; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Weapons/Magic/BlackAnurian.cs b/Items/Weapons/Magic/BlackAnurian.cs index 91d1162cfd..1c8ee8dfc9 100644 --- a/Items/Weapons/Magic/BlackAnurian.cs +++ b/Items/Weapons/Magic/BlackAnurian.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item111; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 4c1992f2d9..5edc645fc6 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -31,15 +31,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.75f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item21; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } - - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); + 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/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 855468c6c8..071bea7217 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -29,15 +29,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } - - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); + public override void AddRecipes() { diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 345941da55..9817be5dba 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/CarnageRay.cs b/Items/Weapons/Magic/CarnageRay.cs index cabe1f42a3..2621cd3935 100644 --- a/Items/Weapons/Magic/CarnageRay.cs +++ b/Items/Weapons/Magic/CarnageRay.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item72; Item.autoReuse = true; @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 6f; } - public override Vector2? HoldoutOrigin() => new Vector2(12, 12); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 097bcd33cd..64e898c3b4 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.Magic; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; @@ -33,17 +34,15 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.2f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item105; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index 663d81b415..63d3ceb286 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -13,13 +13,19 @@ namespace CalamityMod.Items.Weapons.Magic { public static readonly SoundStyle ChargeSound = SoundID.LiquidsHoneyWater with { Type = SoundType.Sound }; + public static int FullChargeExtraDamage = 6; //Extra damage dealt by each coral chunkits b when fully charging a shot + public static float ChargeDamageBoostSteepness = 2; // Steepness of the extra damage rampup + public static int SymbiosisDamageBuff = 2; //Extra damage from the symbiosis buff + public static int SymbiosisTime = 8 * 60; + public override void SetStaticDefaults() { DisplayName.SetDefault("Coral Spout"); Tooltip.SetDefault("Casts a shotgun-like blast of coral shards\n" + "Keep the attack button held down to narrow the spread\n" + "Fully charging the attack releases a single, bigger chunk of coral that sticks to enemies\n" + - "Grabbing the chunk of coral after it falls from the enemy replenishes 100 mana\n" + + "Grabbing the chunk of coral after it falls from the enemy replenishes 150 mana\n" + + "The mana-charged coral also provides a buff that increases the coral's damage and the convergence speed\n" + //Lore tooltip time. Sekiro. "[c/5C95A1:Knowledge is important, and the Old Sea Kingdom’s many scribes knew it had to be preserved at any cost.]\n" + "[c/5C95A1:Their libraries were much larger than most, because of the water-proof stone tablets occupying them.]" @@ -29,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 7; + Item.damage = 8; Item.DamageType = DamageClass.Magic; Item.mana = 7; Item.width = 28; @@ -40,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.channel = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item17; Item.autoReuse = true; @@ -91,4 +97,11 @@ namespace CalamityMod.Items.Weapons.Magic Register(); } } + + public class CoralSpoutPlayer : ModPlayer + { + public bool Symbiosis = false; + public override void ResetEffects() => Symbiosis = false; + public override void UpdateDead() => Symbiosis = false; + } } diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index 3068e45ec6..64dfe24294 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item67; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index b8b84093aa..696fd2640f 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -37,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.knockBack = 0f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index f8027d1f1c..805eaf2635 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index 4348b0b0c0..26901b8212 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -33,16 +34,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item12; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; } - // public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow").Value); diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 506204b1aa..5e1f41bf5b 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item73; @@ -42,8 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 14e2c445d1..519d4f9b56 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item13; Item.autoReuse = true; @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 14f; } - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); 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/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index ed36c5c747..5ec40d9260 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -1,9 +1,10 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -30,13 +31,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.UseSound = CommonCalamitySounds.WyrmScreamSound; Item.autoReuse = true; Item.shootSpeed = 8f; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Magic/EidolonStaff.cs b/Items/Weapons/Magic/EidolonStaff.cs index c457aea027..2db6595b2f 100644 --- a/Items/Weapons/Magic/EidolonStaff.cs +++ b/Items/Weapons/Magic/EidolonStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; @@ -32,17 +33,15 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index eb1463b4ba..b1a9228113 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item103; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ElementalRay.cs b/Items/Weapons/Magic/ElementalRay.cs index d644f9471e..e1efd6b9d1 100644 --- a/Items/Weapons/Magic/ElementalRay.cs +++ b/Items/Weapons/Magic/ElementalRay.cs @@ -43,8 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 6f; } - public override Vector2? HoldoutOrigin() => new Vector2(15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float offsetAngle = MathHelper.TwoPi * player.itemAnimation / player.itemAnimationMax; diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 522c67bb29..5e26fed61f 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System.Collections.Generic; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 0f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 3700e6e0eb..3254cb4b99 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item84; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index c6544a5c5b..fc3f6d0ec6 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 7247a7cf7f..26eef49f31 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -1,10 +1,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.UseSound = SoundID.Item60; @@ -41,8 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 13.5f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 8fa3e78725..c382960e4b 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); @@ -92,8 +93,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.TheAxe). - AddIngredient(ItemID.MagicalHarp). - AddIngredient(). + AddIngredient(ItemID.SparkleGuitar). // Stellar Tune from Empress of Light AddIngredient(8). AddIngredient(20). AddTile(). diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 865dfe05a0..2db08cf466 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 1f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 1adcf67989..590421cfe5 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 3fa9709b1c..bbac47b400 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 1ed44175c1..325543e753 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index fea75dda32..a48652f61c 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } // This weapon uses a holdout projectile. diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index ed3675b909..d3d18c45f6 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item109; Item.autoReuse = true; @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 14f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index a5fa2f8c61..b007364ef3 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } // This weapon uses a holdout projectile. diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs new file mode 100644 index 0000000000..f28e821887 --- /dev/null +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -0,0 +1,66 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureVoid; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class HadalUrn : ModItem + { + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HadalUrnOpen"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hadal Urn"); + Tooltip.SetDefault("Fires a random assortment of ocean creatures\n"+ "'There's no telling how long it was down there... or what lurks inside'"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.damage = 32; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.width = 58; + Item.height = 38; + Item.useTime = 14; + Item.useAnimation = 14; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.75f; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.Calamity().donorItem = true; + Item.UseSound = ShootSound; + Item.autoReuse = true; + Item.shootSpeed = 8f; + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + SoundEngine.PlaySound(SoundID.Item103 with { Volume = SoundID.Item103.Volume }, player.position); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 12); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(20). + AddIngredient(5). + AddIngredient(15). + AddIngredient(ItemID.Bone, 10). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/HadalUrn.png b/Items/Weapons/Magic/HadalUrn.png new file mode 100644 index 0000000000..83695c732f Binary files /dev/null and b/Items/Weapons/Magic/HadalUrn.png differ diff --git a/Items/Weapons/Magic/HarvestStaff.cs b/Items/Weapons/Magic/HarvestStaff.cs index b1cc71f2cb..af419bc951 100644 --- a/Items/Weapons/Magic/HarvestStaff.cs +++ b/Items/Weapons/Magic/HarvestStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -37,8 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.scale = 0.9f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 16bb717861..719e4451c0 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -37,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item73; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 1f2a54baf5..32968ebf0a 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item43; Item.autoReuse = true; @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 9f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = velocity.Length(); diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 307126cda8..d62ecb73e5 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -30,15 +30,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.UseSound = SoundID.Item21; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { position = Main.MouseWorld; diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index 2c7fbf807b..0d3d28b93d 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 0f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 1c554d25e8..53e6cd13de 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 20; + Item.damage = 22; Item.DamageType = DamageClass.Magic; Item.mana = 7; Item.width = 34; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item8; Item.autoReuse = true; @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 1f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float speed = Item.shootSpeed; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index ae65e0c0fe..c212f84561 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Ammo; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = CastSound; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.damage = 2250; diff --git a/Items/Weapons/Magic/IcicleStaff.cs b/Items/Weapons/Magic/IcicleStaff.cs index adbefb928a..2123a4a050 100644 --- a/Items/Weapons/Magic/IcicleStaff.cs +++ b/Items/Weapons/Magic/IcicleStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item8; Item.autoReuse = true; @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 11f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int i = Main.myPlayer; diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index b4a913b545..6b2326d441 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 55d7db77e3..fac765f344 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 36, 0, 0); - Item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item9; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -42,8 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index b221c89245..d6f6ee8ea4 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index 4a5e2758ca..6006d44b79 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(1). - AddRecipeGroup("AnyZapinator"). + AddIngredient(ItemID.SpaceGun). AddIngredient(ItemID.HeatRay). AddIngredient(ItemID.FragmentSolar, 10). AddIngredient(ItemID.ChlorophyteBar, 6). diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index b860ce3474..1786fe8724 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -28,9 +29,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/MagnaCannon.cs b/Items/Weapons/Magic/MagnaCannon.cs index 067cf143f8..56a8b816d6 100644 --- a/Items/Weapons/Magic/MagnaCannon.cs +++ b/Items/Weapons/Magic/MagnaCannon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item117; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 96fb0726df..cfa98066fd 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -36,11 +37,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 12f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 v = velocity; diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 6eda74f37a..41dc9bd437 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item109; Item.autoReuse = true; @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 10f; } - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 9063dfb62e..f0e54d67dc 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index 054f5afbf5..f09e1673d7 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,16 +31,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item39; Item.autoReuse = true; Item.shoot = ProjectileID.PineNeedleFriendly; Item.shootSpeed = 24f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int num106 = 2 + Main.rand.Next(3); diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 8b08e1c71f..22f758a3f4 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item72; Item.autoReuse = true; @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 6f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index 8c3019c739..24a03b41b2 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.Rarity2BuyPrice; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float speed = Item.shootSpeed; diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 75450d9616..3dac4d9dc0 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,17 +30,15 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index a6ca6f1d3a..90272176e4 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; @@ -13,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Phoenix Flame Barrage"); - Tooltip.SetDefault("Baptism by holy fire\n" + + Tooltip.SetDefault("Baptism by draconic fire\n" + "Casts a barrage of fire from the sky"); Item.staff[Item.type] = true; SacrificeTotal = 1; @@ -32,16 +33,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index d71bc8e392..748406fe74 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item43; Item.autoReuse = true; @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 16f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 816f4d53ec..affec9151e 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -1,11 +1,12 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; Item.autoReuse = true; Item.shootSpeed = 12f; diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 919dc48de5..2378ee1770 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -30,14 +30,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; } - - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); } } diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index b0a1a455f9..7a42900988 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.UseSound = SoundID.Item84; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index ebcf4d738e..6c61266fc9 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,13 +29,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index b7a825199e..6cfa37c1ea 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 870314c270..086d67ca5e 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -1,10 +1,11 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 6f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } 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/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 86d3bb1393..6851117e53 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System.Collections.Generic; @@ -42,8 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.rare = 10; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.noUseGraphic = true; @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.ConfettiCannon). AddIngredient(). - AddIngredient(ItemID.FireworksLauncher). + AddIngredient(ItemID.Celeb2). AddIngredient(ItemID.FlaskofParty, 5). AddIngredient(ItemID.SoulofLight, 25). AddIngredient(ItemID.Confetti, 50). diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index 084ed2d437..303b7e4235 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,15 +24,15 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 444; + Item.damage = 250; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; Item.mana = 10; Item.width = 66; Item.height = 82; - Item.useTime = 27; - Item.useAnimation = 27; + Item.useTime = 25; + Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } // This weapon uses a holdout projectile. diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 0a71d0ae97..dfe4e44228 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -1,5 +1,6 @@ -using CalamityMod.Projectiles.Magic; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; @@ -33,12 +34,11 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 8.5f; Item.UseSound = SoundID.Item8; Item.autoReuse = true; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Magic; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index 6f2d3c24c6..f072cc4b3a 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.25f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item84; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index f778ca977d..9a50518c93 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -31,16 +32,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int orbAmt = Main.rand.Next(6, 9); diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index d639db0633..92c66b8e97 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 6.75f; Item.UseSound = CommonCalamitySounds.FlareSound; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShadecrystalTome.cs b/Items/Weapons/Magic/ShadecrystalTome.cs index 3e3b0ddddf..9c0f228396 100644 --- a/Items/Weapons/Magic/ShadecrystalTome.cs +++ b/Items/Weapons/Magic/ShadecrystalTome.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 745c75f899..5b58f19479 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item66; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 6c623b8f53..93eb407558 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,17 +30,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 131ab4225a..d5aba9f974 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item20; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index cd54288c2c..0bf0396960 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item102; Item.autoReuse = true; @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 15f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index 51b522a379..290e901a9e 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.NPCHit13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index fb7cd9f721..9c2037df0d 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index 74eafd5667..5fb19d167b 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -30,17 +31,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = SoundID.Item73; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } - // public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value); diff --git a/Items/Weapons/Magic/StaffofBlushie.cs b/Items/Weapons/Magic/StaffofBlushie.cs index 8b9c4183bd..703e302f76 100644 --- a/Items/Weapons/Magic/StaffofBlushie.cs +++ b/Items/Weapons/Magic/StaffofBlushie.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Magic/Starfall.cs b/Items/Weapons/Magic/Starfall.cs index 94c67162ad..19d4a3db03 100644 --- a/Items/Weapons/Magic/Starfall.cs +++ b/Items/Weapons/Magic/Starfall.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 50; + Item.damage = 57; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.rare = ItemRarityID.Cyan; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.UseSound = SoundID.Item105; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/StormSpray.cs b/Items/Weapons/Magic/StormSpray.cs index 5bd745663d..27d56033eb 100644 --- a/Items/Weapons/Magic/StormSpray.cs +++ b/Items/Weapons/Magic/StormSpray.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item13; Item.autoReuse = true; @@ -37,8 +37,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 10f; } - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 3cec98d763..4a0c167445 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,20 +13,27 @@ namespace CalamityMod.Items.Weapons.Magic { public class SubsumingVortex : ModItem { + public const int VortexReleaseRate = 32; + + public const int VortexShootDelay = 56; + + public const float SmallVortexTargetRange = 1300f; + + public const float GiantVortexMouseDriftFactor = 0.35f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); - Tooltip.SetDefault("Releases a gigantic, slow-moving vortex\n" + - "The vortex releases exo tentacles that thrash at nearby enemies\n" + - "After a few seconds the vortex slows down, becomes unstable, and explodes"); + Tooltip.SetDefault("Casts a gigantic vortex above your head with a bias towards the mouse\n" + + "When enemies are near the vortex, it sends multiple fast-moving smaller vortices towards them"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 242; + Item.damage = 533; Item.DamageType = DamageClass.Magic; - Item.mana = 78; + Item.mana = 12; Item.width = 38; Item.height = 48; Item.UseSound = SoundID.Item84; @@ -33,14 +41,16 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.autoReuse = true; + Item.channel = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 7f; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow").Value); diff --git a/Items/Weapons/Magic/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index b0cc2408e4..e85d6dba52 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 102bfe9771..7d898b8a98 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index de5bcf2698..bca657b2a4 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item60; Item.autoReuse = true; @@ -39,8 +39,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 6f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 shootVelocity = velocity; @@ -54,13 +52,13 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index bcde5d2041..a9edd0cdbe 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -54,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index 68bcc31563..465d282b52 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -37,13 +38,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.DD2_FlameburstTowerShot; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ItemRarityID.Purple; Item.Calamity().donorItem = true; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } - public override Vector2? HoldoutOrigin() => new Vector2(20f, 20f); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 flameSpawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 8e990025d3..3454b49463 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic { public class TheWand : ModItem { + // The actual base damage of The Wand. The damage reported on the item is just the spark, which is irrelevant. public static int BaseDamage = 599; public override void SetStaticDefaults() @@ -23,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { Item.width = 40; - Item.damage = 1; + Item.damage = 14; // same as 1.4 Wand of Sparking Item.mana = 150; Item.DamageType = DamageClass.Magic; Item.noMelee = true; @@ -35,11 +37,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item102; Item.autoReuse = true; Item.height = 36; - Item.value = Item.buyPrice(2, 50, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) @@ -50,8 +51,6 @@ namespace CalamityMod.Items.Weapons.Magic return numWandBolts + numTornadoStarters + numTornadoPieces < 1; } - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); - public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) @@ -62,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.WandofSparking). - AddIngredient(5). + AddIngredient(8). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 22fea09fa2..c8d63ddc95 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -1,10 +1,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { @@ -31,16 +32,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { player.statLife -= 3; diff --git a/Items/Weapons/Magic/Thunderstorm.cs b/Items/Weapons/Magic/Thunderstorm.cs index 48c1525648..2eb5a92a2b 100644 --- a/Items/Weapons/Magic/Thunderstorm.cs +++ b/Items/Weapons/Magic/Thunderstorm.cs @@ -1,8 +1,9 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Magic { @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; Item.autoReuse = true; Item.shootSpeed = 6f; diff --git a/Items/Weapons/Magic/TomeofFates.cs b/Items/Weapons/Magic/TomeofFates.cs index f54aa67b7d..5d82bf8f10 100644 --- a/Items/Weapons/Magic/TomeofFates.cs +++ b/Items/Weapons/Magic/TomeofFates.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item103; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 1794bfbb33..e28966b968 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item7; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 86601619f9..8d4c11d40f 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 16f; Item.shoot = ModContent.ProjectileType(); - Item.width = Item.height = 16; + Item.width = Item.height = 70; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item9; @@ -43,8 +43,6 @@ namespace CalamityMod.Items.Weapons.Magic // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 30; - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/UltraLiquidator.png b/Items/Weapons/Magic/UltraLiquidator.png index ed2a8485cf..c7b0f9b411 100644 Binary files a/Items/Weapons/Magic/UltraLiquidator.png and b/Items/Weapons/Magic/UltraLiquidator.png differ diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index a8fcde2390..48b83e3d08 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item66; Item.autoReuse = true; @@ -40,8 +40,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 5df7483887..30aa22b0b5 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.noMelee = true; Item.noUseGraphic = true; - Item.value = Item.buyPrice(gold: 36); + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index 6d790bd7d0..0a817182e6 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -40,13 +41,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; } - public override Vector2? HoldoutOrigin() => new Vector2(25, 25); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Item v = player.ActiveItem(); diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index d37a461d39..1c9b0e2e37 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.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,13 +32,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 19f; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOrigin() => new Vector2(15, 15); diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 8fdd7f3dbc..355ceb8e1f 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -1,9 +1,10 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { @@ -31,16 +32,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 6f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 955f7f960d..9f69f2dbd0 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 20f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index ab5a42ba3b..f36ece57b9 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -37,16 +38,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 7.5f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } - public override Vector2? HoldoutOrigin() => new Vector2(20, 20); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 9472fb9168..13a6e947b3 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -34,16 +35,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 0f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } - public override Vector2? HoldoutOrigin() => new Vector2(30, 30); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int numOrbs = 12; diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index d1de652a3b..4c0171f5c6 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -35,16 +36,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int numOrbs = 8; diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index 2fb897e423..6b3b039e74 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index 310c42f3dd..b789daef6b 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item33; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 75f9eadb38..f6b46ccf5f 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item9; Item.scale = 0.9f; diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index 63e3122055..ad964033eb 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs new file mode 100644 index 0000000000..ee7d3ddb2b --- /dev/null +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -0,0 +1,186 @@ +using System; +using System.Linq; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Weapons.Magic +{ + [LegacyName("WulfrumStaff")] + public class WulfrumProsthesis : ModItem, IHideFrontArm + { + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisShoot") { PitchVariance = 0.1f, Volume = 0.55f }; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisHit") { PitchVariance = 0.1f, Volume = 0.75f , MaxInstances = 3}; + public static readonly SoundStyle SuckSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisSucc") { Volume = 0.5f }; + public static readonly SoundStyle SuckStopSound = new("CalamityMod/Sounds/Item/WulfrumProsthesisSuccStop") { Volume = 0.5f }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Prosthesis"); + Tooltip.SetDefault("Casts a wulfrum bolt\n" + + "Right click to drain mana from creatures in front of you\n" + + "[c/83B87E:Technology and magic have been forever locked in an arms race of imitation and retaliation]\n" + + "[c/83B87E:At times they work in tandem, as seen in certain prosthetic limbs]"); + //Lore about how magic is not always a given for everyone, and how some unlucky people sometimes resort to voluntarily cutting their limbs to use magic augmented prosthesis + //1 : Informs about magic as a narrative thing, 2 : Informs about wulfrum energy being partly magical. + SacrificeTotal = 1; + } + + internal static Asset RealSprite; + + public override string Texture => "CalamityMod/Items/Weapons/Magic/WulfrumProsthesis_Arm"; + + public override void SetDefaults() + { + Item.damage = 13; + Item.DamageType = DamageClass.Magic; + Item.mana = 2; + Item.width = 34; + Item.height = 42; + Item.useTime = 24; + Item.useAnimation = 24; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = ShootSound; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 18f; + Item.holdStyle = 16; //Custom hold style + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + player.Calamity().rightClickListener = true; + } + + public override bool CanUseItem(Player player) => !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()); + + public override bool AltFunctionUse(Player player) => true; + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + if (player.altFunctionUse == 2) + type = ModContent.ProjectileType(); + } + + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult = 0f; + } + + public override void UseAnimation(Player player) + { + Item.UseSound = ShootSound; + if (player.altFunctionUse == 2) + Item.UseSound = null; + } + + public void SetItemInHand(Player player, Rectangle heldItemFrame) + { + //Make the player face where they're aiming. + if (player.Calamity().mouseWorld.X > player.Center.X) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + + //Default + Vector2 itemPosition = player.MountedCenter + new Vector2(-2f * player.direction, -1f * player.gravDir); + float itemRotation = (player.Calamity().mouseWorld - itemPosition).ToRotation(); + + //Adjust for animation + + if (animProgress < 0.7f) + itemPosition -= itemRotation.ToRotationVector2() * (1 - (float)Math.Pow(1 - (0.7f - animProgress) / 0.7f, 4)) * 4f; + + if (animProgress < 0.4f) + itemRotation += -0.45f * (float)Math.Pow((0.4f - animProgress) / 0.4f, 2) * player.direction * player.gravDir; + + //Shakezzz + if (player.itemTime == 1 && Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType())) + { + itemPosition += Main.rand.NextVector2Circular(2f, 2f); + } + + + Vector2 itemSize = new Vector2(28, 14); + Vector2 itemOrigin = new Vector2(-8, 0); + CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin, true); + } + + public override void HoldStyle(Player player, Rectangle heldItemFrame) => SetItemInHand(player, heldItemFrame); + public override void UseStyle(Player player, Rectangle heldItemFrame) => SetItemInHand(player, heldItemFrame); + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (RealSprite == null) + RealSprite = ModContent.Request("CalamityMod/Items/Weapons/Magic/WulfrumProsthesis"); + + Texture2D properSprite = RealSprite.Value; + + spriteBatch.DrawNewInventorySprite(properSprite, new Vector2(28f, 14f), position, drawColor, origin, scale, new Vector2(0, -6f)); + + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + if (RealSprite == null) + RealSprite = ModContent.Request("CalamityMod/Items/Weapons/Magic/WulfrumProsthesis"); + + Texture2D properSprite = RealSprite.Value; + + spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); + + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } + + public class WulfrumProsthesisPlayer : ModPlayer + { + public bool ManaDrainActive = false; + + public override void UpdateDead() + { + ManaDrainActive = false; + } + + public override void PostUpdateMiscEffects() + { + if (ManaDrainActive) + { + Player.manaRegenBonus = 35; + Player.manaRegenDelay = 0; + Player.manaRegenBuff = true; + } + + ManaDrainActive = false; + } + } +} diff --git a/Items/Weapons/Magic/WulfrumProsthesis.png b/Items/Weapons/Magic/WulfrumProsthesis.png new file mode 100644 index 0000000000..440925c1b6 Binary files /dev/null and b/Items/Weapons/Magic/WulfrumProsthesis.png differ diff --git a/Items/Weapons/Magic/WulfrumProsthesis_Arm.png b/Items/Weapons/Magic/WulfrumProsthesis_Arm.png new file mode 100644 index 0000000000..600ac1c3c9 Binary files /dev/null and b/Items/Weapons/Magic/WulfrumProsthesis_Arm.png differ diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs deleted file mode 100644 index d88993e314..0000000000 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class WulfrumStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Staff"); - Tooltip.SetDefault("Casts a wulfrum bolt"); - //Item.staff[item.type] = true; - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 13; - Item.DamageType = DamageClass.Magic; - Item.mana = 2; - Item.width = 44; - Item.height = 46; - Item.useTime = 20; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3; - Item.value = Item.buyPrice(0, 1, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item43; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; - } - - //public override Vector2? HoldoutOrigin() => new Vector2(8, 15); - - public override Vector2? HoldoutOffset() => new Vector2(-3, 0); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/WulfrumStaff.png b/Items/Weapons/Magic/WulfrumStaff.png deleted file mode 100644 index bd38ecf2cd..0000000000 Binary files a/Items/Weapons/Magic/WulfrumStaff.png and /dev/null differ diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index fcd38bfaaa..eb3fa6053d 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -31,7 +31,7 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.75f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item102; Item.autoReuse = true; @@ -39,8 +39,6 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles Item.shootSpeed = 18f; } - public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index 366a6c2721..81bc417ec8 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,9 +34,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index ccf523ba80..37ba654575 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 262bfc5e22..c4ef4fb816 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Melee/Aftershock.cs b/Items/Weapons/Melee/Aftershock.cs index 4a650fd46d..cdd473121c 100644 --- a/Items/Weapons/Melee/Aftershock.cs +++ b/Items/Weapons/Melee/Aftershock.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 7cf3267231..0b6d941c3f 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 28; Item.height = 28; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 26; Item.knockBack = 4f; Item.useTime = 22; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(gold: 4); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index e9a5509c74..6c9152278b 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Amidias' Trident"); Tooltip.SetDefault("Shoots homing whirlpools"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 2471fd59fa..94648c6cbd 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 100; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 893e33f1ef..83e4387a93 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 26; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 29; Item.knockBack = 4.25f; Item.useTime = 22; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 8f; Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(gold: 4); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/AquaticDischarge.cs b/Items/Weapons/Melee/AquaticDischarge.cs index d32af11b10..9d0dd2dfb6 100644 --- a/Items/Weapons/Melee/AquaticDischarge.cs +++ b/Items/Weapons/Melee/AquaticDischarge.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles.Melee.Shortswords; namespace CalamityMod.Items.Weapons.Melee { @@ -17,40 +18,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.useStyle = ItemUseStyleID.Thrust; + Item.useStyle = ItemUseStyleID.Rapier; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTurn = false; - Item.useAnimation = 12; - Item.useTime = 12; + Item.useAnimation = 18; + Item.useTime = 18; Item.width = 32; Item.height = 32; Item.damage = 23; - Item.DamageType = DamageClass.Melee; Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; - Item.useTurn = true; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.noUseGraphic = true; + Item.noMelee = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); - } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - var source = player.GetSource_ItemUse(Item); - int sparkDamage = player.CalcIntDamage(0.5f * Item.damage); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sparkDamage, knockback, Main.myPlayer); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - var source = player.GetSource_ItemUse(Item); - int sparkDamage = player.CalcIntDamage(0.5f * Item.damage); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sparkDamage, Item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index ec3253ccd8..ee69aa556b 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -1,6 +1,6 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -95,8 +96,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 136; - Item.damage = 2000; - Item.DamageType = DamageClass.Melee; + Item.damage = 1670; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 15; @@ -107,10 +108,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = null; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 70759ab2aa..e2480cb74e 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 112; Item.height = 172; Item.damage = 600; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; Item.useAnimation = 20; diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index 2ca14d2d70..0b25259124 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 8430599204..d013981407 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Astral Pike"); Tooltip.SetDefault("Summons astral star swarms on critical hits"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 50; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index a39af656fe..5a141ca35d 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index f4c106fa8d..7a18f48154 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 94; Item.height = 92; Item.DamageType = DamageClass.Melee; - Item.damage = 710; + Item.damage = 455; Item.knockBack = 2.5f; Item.useAnimation = 19; Item.useTime = 19; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index acf5e5c71e..6cf865c7d6 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index de869d81e4..baf36ddeda 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -25,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 40; Item.height = 54; - Item.DamageType = DamageClass.Melee; - Item.damage = 50; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.damage = 80; Item.knockBack = 6f; Item.useTime = 20; Item.useAnimation = 20; @@ -41,11 +42,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.rare = ItemRarityID.Red; Item.autoReuse = true; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - Item.value = Item.buyPrice(platinum: 5); + Item.value = CalamityGlobalItem.Rarity16BuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/BallOFugu.cs b/Items/Weapons/Melee/BallOFugu.cs index bafa2310d7..270bb57025 100644 --- a/Items/Weapons/Melee/BallOFugu.cs +++ b/Items/Weapons/Melee/BallOFugu.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.damage = 40; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 30; Item.height = 10; Item.useTime = 20; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/BansheeHook.cs b/Items/Weapons/Melee/BansheeHook.cs index 951a118f25..a7139769c4 100644 --- a/Items/Weapons/Melee/BansheeHook.cs +++ b/Items/Weapons/Melee/BansheeHook.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Banshee Hook"); Tooltip.SetDefault("Swings a banshee hook that fires blades and explodes on hit"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -37,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 42f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index bf0fe40235..bb9897519f 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.useTurn = true; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; } diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index a01fb90c44..f0ffcebe49 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.useTurn = true; Item.channel = true; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shootSpeed = 6f; } diff --git a/Items/Weapons/Melee/BloodyEdge.cs b/Items/Weapons/Melee/BloodyEdge.cs index fd5e1ccdc4..f09e27bee3 100644 --- a/Items/Weapons/Melee/BloodyEdge.cs +++ b/Items/Weapons/Melee/BloodyEdge.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.height = 60; Item.scale = 1.25f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; } diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index a09271f314..ddd0245fb5 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 32; Item.height = 32; Item.damage = BaseDamage; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.useTurn = true; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index ab6fad4467..5c64aa424d 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Brimlance"); Tooltip.SetDefault("Creates brimstone explosions on enemy hits"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 56; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 8cb7d47585..b783b63166 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(4). AddIngredient(3). - AddIngredient(5). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index 416534d077..e40541c5fd 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -17,9 +17,11 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Brimstone Sword"); Tooltip.SetDefault("Summons brimstone geysers on hit\n" + - "Right click to throw like a javelin that explodes on hit"); + "Right click to throw like a javelin that explodes on hit\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() @@ -33,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index 57e677716b..f51a27795e 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ProjectileID.PurificationPowder; Item.knockBack = 5f; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs index 93e2d951b3..5ec3fdce36 100644 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ b/Items/Weapons/Melee/CatastropheClaymore.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 56; - Item.value = Item.buyPrice(0, 48, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Melee/CausticEdge.cs b/Items/Weapons/Melee/CausticEdge.cs index e52a8545c6..7c5cdf25f9 100644 --- a/Items/Weapons/Melee/CausticEdge.cs +++ b/Items/Weapons/Melee/CausticEdge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 48; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } diff --git a/Items/Weapons/Melee/ClamCrusher.cs b/Items/Weapons/Melee/ClamCrusher.cs index 3c109d515b..a344c3121a 100644 --- a/Items/Weapons/Melee/ClamCrusher.cs +++ b/Items/Weapons/Melee/ClamCrusher.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.damage = 150; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 40; Item.height = 60; Item.useTime = 50; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 10f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index f535ed5d80..b802be9f9e 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shootSpeed = 9f; } diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 3eee79133a..baa5b906fd 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.channel = true; Item.autoReuse = true; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = 15; Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; @@ -35,9 +36,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } 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/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index 0d44135e1e..8dde48b2c1 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -1,12 +1,10 @@ -using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Tiles.Furniture.CraftingStations; namespace CalamityMod.Items.Weapons.Melee { @@ -15,75 +13,33 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Shiv"); - Tooltip.SetDefault("Definitely don't underestimate the power of shivs\n" + - "Fires a cosmic beam that homes in on enemies\n" + - "Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars"); + Tooltip.SetDefault("Fires a cosmic beam that homes in on enemies\n" + + "Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() { - Item.useStyle = ItemUseStyleID.Thrust; - Item.useTurn = false; + Item.useStyle = ItemUseStyleID.Rapier; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 18; Item.useTime = 18; Item.width = 44; Item.height = 44; - Item.damage = 218; - - Item.DamageType = DamageClass.Melee; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; - Item.useTurn = true; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2.4f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; - Item.Calamity().donorItem = true; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockback, player.whoAmI); - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - for (int k = 0; k < 36; k++) - { - int dustID = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 173, 0f, 0f, 0, default, 1f); - Main.dust[dustID].velocity *= 3f; - Main.dust[dustID].scale *= 2f; - } - - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - for (int k = 0; k < 36; k++) - { - int dustID = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 173, 0f, 0f, 0, default, 1f); - Main.dust[dustID].velocity *= 3f; - Main.dust[dustID].scale *= 2f; - } - - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; //Yatagarasu#0001 } public override void AddRecipes() diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 2121003d44..65119623f4 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -28,15 +29,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.channel = true; Item.autoReuse = true; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = 18; Item.useTime = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 4f; Item.UseSound = SoundID.Item82; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ModContent.RarityType(); Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 779ff13ec3..14c74c7473 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 58; + Item.width = 92; Item.damage = 123; Item.DamageType = DamageClass.Melee; Item.useAnimation = 36; @@ -29,9 +29,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 60; + Item.height = 100; Item.scale = 1.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; diff --git a/Items/Weapons/Melee/DarklightGreatsword.png b/Items/Weapons/Melee/DarklightGreatsword.png index e8cbb61103..00c1204d21 100644 Binary files a/Items/Weapons/Melee/DarklightGreatsword.png and b/Items/Weapons/Melee/DarklightGreatsword.png differ diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs new file mode 100644 index 0000000000..6d85ec7240 --- /dev/null +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -0,0 +1,117 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class DeathsAscension : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Death's Ascension"); + Tooltip.SetDefault("You can feel the hands of Death himself onto yours\n"+"Right click to launch a barrage of homing scythes"); + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.damage = 1350; + Item.knockBack = 9f; + Item.useTime = 30; + Item.useAnimation = 30; + Item.DamageType = DamageClass.Melee; + Item.noMelee = true; + Item.channel = true; + Item.width = 70; + Item.height = 70; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shootSpeed = 12f; + Item.shoot = ModContent.ProjectileType(); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool? UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + Item.shoot = ModContent.ProjectileType(); + } + else + { + Item.shoot = ModContent.ProjectileType(); + } + return base.UseItem(player); + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2f) + { + Item.damage = 290; + Item.shootSpeed = 18f; + Item.useTime = Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item71; + Item.useTurn = true; + Item.autoReuse = true; + Item.noMelee = false; + Item.noUseGraphic = false; + Item.channel = false; + } + else + { + Item.damage = 1350; + Item.shootSpeed = 24f; + Item.useTime = Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; + Item.useTurn = false; + Item.autoReuse = false; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + } + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + int spreadfactor = 9; + if (player.altFunctionUse == 2f) + { + for (int index = 0; index < 5; ++index) + { + float SpeedX = velocity.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); + float SpeedY = velocity.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + } + } + else + { + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.DeathSickle). + AddIngredient(4). + AddIngredient(1). + AddIngredient(ItemID.SoulofNight, 15). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/DeathsAscension.png b/Items/Weapons/Melee/DeathsAscension.png new file mode 100644 index 0000000000..7d2b3a81f7 Binary files /dev/null and b/Items/Weapons/Melee/DeathsAscension.png differ diff --git a/Items/Weapons/Melee/DepthCrusher.cs b/Items/Weapons/Melee/DepthCrusher.cs index bd34911e84..e73aac8b38 100644 --- a/Items/Weapons/Melee/DepthCrusher.cs +++ b/Items/Weapons/Melee/DepthCrusher.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 50; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } diff --git a/Items/Weapons/Melee/Devastation.cs b/Items/Weapons/Melee/Devastation.cs index 62ceef765c..2cf8ea5282 100644 --- a/Items/Weapons/Melee/Devastation.cs +++ b/Items/Weapons/Melee/Devastation.cs @@ -14,8 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Devastation"); - Tooltip.SetDefault("Fires galaxy blasts that explode"); + Tooltip.SetDefault("Fires galaxy blasts that explode\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 7bfdb6035e..1f10e02927 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -17,9 +18,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Devil's Devastation"); - Tooltip.SetDefault("Fires a spread of demonic scythes\n" + "Pitchforks rise from the underworld to skewer your foes\n" + - "Critical hits cause shadowflame explosions"); + Tooltip.SetDefault("Fires a spread of demonic scythes\n" + + "Pitchforks rise from the underworld to skewer your foes\n" + + "Critical hits cause shadowflame explosions\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() @@ -35,11 +39,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source2, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index 49d9dfefec..c209d94b20 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index d6cabe9ff7..c292fdd675 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Diseased Pike"); Tooltip.SetDefault("Fires plague seekers on hit"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 58; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index b31d77e318..ca3a715aff 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 90; - Item.damage = 80; + Item.damage = 250; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index eccc0fd83a..81634f622e 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +30,7 @@ Summons a barrage of petals and waterfalls on enemy hits"); { Item.width = 76; Item.height = 82; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 660; Item.knockBack = 9f; Item.useAnimation = 20; @@ -43,7 +44,7 @@ Summons a barrage of petals and waterfalls on enemy hits"); Item.channel = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 9028ba7755..0a585125af 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 1275; + Item.damage = 1075; Item.knockBack = 7.5f; Item.useAnimation = Item.useTime = 25; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 6e8e23f7b4..b6b0c38d16 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Melee/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index 451140f754..0196a033c3 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Crushes enemy defenses\n" + "Sprays fossil shards on use"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 60; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 86d36cb7da..47f08e6bbd 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -40,11 +41,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.width = 112; Item.height = 112; - Item.value = Item.buyPrice(5, 0, 0, 0); - Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.Rarity16BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.Calamity().customRarity = CalamityRarity.Rainbow; + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/ElementalLance.cs b/Items/Weapons/Melee/ElementalLance.cs index ac65df10a3..d1d1d36713 100644 --- a/Items/Weapons/Melee/ElementalLance.cs +++ b/Items/Weapons/Melee/ElementalLance.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Rend the cosmos asunder!\n" + "Fires a lance beam that splits multiple times as it travels"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/ElementalShiv.cs b/Items/Weapons/Melee/ElementalShiv.cs index b683790c62..158a1981db 100644 --- a/Items/Weapons/Melee/ElementalShiv.cs +++ b/Items/Weapons/Melee/ElementalShiv.cs @@ -1,7 +1,7 @@ using Terraria.DataStructures; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,61 +15,32 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Shiv"); - Tooltip.SetDefault("Don't underestimate the power of shivs\n" + - "Shoots a rainbow shiv that spawns additional shivs on hit"); + Tooltip.SetDefault("Shoots a rainbow shiv that spawns additional shivs on hit\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() { - Item.useStyle = ItemUseStyleID.Thrust; - Item.useTurn = false; + Item.useStyle = ItemUseStyleID.Rapier; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 10; Item.useTime = 10; Item.width = 44; Item.height = 44; - Item.damage = 168; - Item.DamageType = DamageClass.Melee; + Item.damage = 190; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; - Item.useTurn = true; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2.4f; Item.value = CalamityGlobalItem.Rarity11BuyPrice; Item.rare = ItemRarityID.Purple; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 0aa1d73bf0..f475985fc3 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 18; Item.damage = 230; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 15; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 20; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index 1f8dc42e60..574c896f43 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index f2ff4830d2..de6b8a9875 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,11 +33,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item71; Item.autoReuse = true; Item.height = 78; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 21f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 4ab12d185e..2a1f17c094 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 94; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 08ff0641f2..18b9d9f628 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -1,126 +1,140 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System.Linq; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("DraedonsExoblade")] public class Exoblade : ModItem { + public static readonly SoundStyle SwingSound = new("CalamityMod/Sounds/Item/ExobladeSwing") { MaxInstances = 3, PitchVariance = 0.6f, Volume = 0.8f }; + public static readonly SoundStyle BigSwingSound = new("CalamityMod/Sounds/Item/ExobladeBigSwing") { MaxInstances = 3, PitchVariance = 0.2f }; + public static readonly SoundStyle BigHitSound = new("CalamityMod/Sounds/Item/ExobladeBigHit") { PitchVariance = 0.2f }; + public static readonly SoundStyle BeamHitSound = new("CalamityMod/Sounds/Item/ExobladeBeamSlash") { Volume = 0.4f, PitchVariance = 0.2f }; + public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Item/ExobladeDash") { Volume = 0.6f }; + public static readonly SoundStyle DashHitSound = new("CalamityMod/Sounds/Item/ExobladeDashImpact") { Volume = 0.85f }; + + + public static int BeamNoHomeTime = 24; + + public static float NotTrueMeleeDamagePenalty = 0.46f; + + public static float ExplosionDamageFactor = 1.8f; + + public static float LungeDamageFactor = 1.75f; + + public static int LungeCooldown = 60 * 3; //Projectile has 3 updates : aka 1 second + + public static float LungeMaxCorrection = MathHelper.PiOver4 * 0.05f; + + public static float LungeSpeed = 60f; + + public static float ReboundSpeed = 6f; + + public static float PercentageOfAnimationSpentLunging = 0.6f; + + public static int OpportunityForBigSlash = 37 * 3; + + public static float BigSlashUpscaleFactor = 1.5f; + + public static int DashTime = 49; + + public static int BaseUseTime = 49; + public static int BeamsPerSwing = 3; + public override void SetStaticDefaults() { DisplayName.SetDefault("Exoblade"); Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + - "Fires an exo beam that homes in on the player and explodes\n" + - "Striking an enemy with the blade causes several comets to fire\n" + - "All attacks briefly freeze enemies hit\n" + - "Enemies hit at very low HP explode into frost energy and freeze nearby enemies"); + "Left clicks release multiple energy beams that home in on enemies and slice them on hit\n" + + "Right clicks make you dash in the direction of the cursor with the blade\n" + + "Enemy hits from the blade during the dash result in massive damage and a rebound\n" + + "Left clicks briefly after a rebound are far stronger and create explosions on enemy hits"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 80; - Item.damage = 900; - Item.useAnimation = 14; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 14; - Item.useTurn = true; - Item.DamageType = DamageClass.Melee; - Item.knockBack = 9f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; Item.height = 114; + Item.damage = 640; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = BaseUseTime; + Item.useAnimation = BaseUseTime; + Item.useTurn = true; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.knockBack = 9f; + Item.autoReuse = true; + Item.noUseGraphic = true; + Item.channel = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Red; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 19f; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.shoot = ProjectileType(); + Item.shootSpeed = 9f; + Item.rare = ModContent.RarityType(); } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override bool CanShoot(Player player) { - if (Main.rand.NextBool(4)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); + //Lunge can't be used if ANY exoblade is there (even the ones in stasis) + if (player.altFunctionUse == 2) + return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType()); + + + return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType() && + !(n.ai[0] == 1 && n.ai[1] == 1)); //Ignores exoblades in post bonk stasis. } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + public override void HoldItem(Player player) { - var source = player.GetSource_ItemUse(Item); - if (crit) - damage /= 2; + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } - if (target.life <= (target.lifeMax * 0.05f)) - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); + public override bool AltFunctionUse(Player player) => true; - target.ExoDebuffs(); - SoundEngine.PlaySound(SoundID.Item88, player.Center); - float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - float yPos = player.position.Y + Main.rand.Next(-800, 801); - Vector2 startPos = new Vector2(xPos, yPos); - Vector2 velocity = target.position - startPos; - float dir = 10 / startPos.X; - velocity.X *= dir * 150; - velocity.Y *= dir * 150; - velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); - velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) + public override bool? CanHitNPC(Player player, NPC target) => false; + + public override bool CanHitPvp(Player player, Player target) => false; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float state = 0; + + //If there are any exoblades in "stasis" after a bonk, the attack should be an empowered slash instead + if (Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType() && n.ai[0] == 1 && n.ai[1] == 1 && n.timeLeft > LungeCooldown)) { - for (int comet = 0; comet < 2; comet++) + state = 2; + + //Put all the "post bonk" stasised exoblades into regular cooldown for the right click ljunge + for (int i = 0; i < Main.maxProjectiles; ++i) { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(source, startPos, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ai1); + Projectile p = Main.projectile[i]; + if (!p.active || p.owner != player.whoAmI || p.type != Item.shoot || p.ai[0] != 1 || p.ai[1] != 1) + continue; + + p.timeLeft = LungeCooldown; + p.netUpdate = true; + p.netSpam = 0; } } - if (!target.canGhostHeal || player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 5; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - var source = player.GetSource_ItemUse(Item); - if (crit) - damage /= 2; - - if (target.statLife <= (target.statLifeMax2 * 0.05f)) - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, Item.knockBack, Main.myPlayer); - - target.ExoDebuffs(); - SoundEngine.PlaySound(SoundID.Item88, player.Center); - float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - float yPos = player.position.Y + Main.rand.Next(-800, 801); - Vector2 startPos = new Vector2(xPos, yPos); - Vector2 velocity = target.position - startPos; - float dir = 10 / startPos.X; - velocity.X *= dir * 150; - velocity.Y *= dir * 150; - velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); - velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) + if (player.altFunctionUse == 2) { - for (int comet = 0; comet < 2; comet++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(source, startPos, velocity, ModContent.ProjectileType(), damage, Item.knockBack, player.whoAmI, 0f, ai1); - } + state = 1; } - if (player.moonLeech) - return; + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, state, 0); - int healAmount = Main.rand.Next(3) + 5; - player.statLife += healAmount; - player.HealEffect(healAmount); + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Exoblade.png b/Items/Weapons/Melee/Exoblade.png index ab57117c0e..79046570cf 100644 Binary files a/Items/Weapons/Melee/Exoblade.png and b/Items/Weapons/Melee/Exoblade.png differ diff --git a/Items/Weapons/Melee/ExobladeSquare.png b/Items/Weapons/Melee/ExobladeSquare.png new file mode 100644 index 0000000000..275e253abe Binary files /dev/null and b/Items/Weapons/Melee/ExobladeSquare.png differ diff --git a/Items/Weapons/Melee/FallenPaladinsHammer.cs b/Items/Weapons/Melee/FallenPaladinsHammer.cs index 5332182e0d..5c25f41927 100644 --- a/Items/Weapons/Melee/FallenPaladinsHammer.cs +++ b/Items/Weapons/Melee/FallenPaladinsHammer.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 13; Item.knockBack = 20f; Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.height = 28; - Item.value = Item.buyPrice(gold: 80); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/Melee/FaultLine.cs b/Items/Weapons/Melee/FaultLine.cs index c04bb314b5..e4e152c473 100644 --- a/Items/Weapons/Melee/FaultLine.cs +++ b/Items/Weapons/Melee/FaultLine.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 26; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 88; // 110 pre-nerf Item.knockBack = 4f; Item.useTime = 22; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Yellow; - Item.value = Item.buyPrice(gold: 80); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 490244bdc2..8870607b02 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 66; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index 248eb63358..564cd2a6ec 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 66; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index 4280dab996..fbb43767f6 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index a0bedc9fae..96d6655267 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/ForsakenSaber.cs b/Items/Weapons/Melee/ForsakenSaber.cs index fd3b169971..dd03f41ef1 100644 --- a/Items/Weapons/Melee/ForsakenSaber.cs +++ b/Items/Weapons/Melee/ForsakenSaber.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 56; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index c8423000a7..19ab84fc73 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -1,17 +1,18 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.DataStructures; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; using Terraria.ModLoader.IO; using static Terraria.ModLoader.ModContent; @@ -147,11 +148,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 24f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } #region saving and syncing attunements diff --git a/Items/Weapons/Melee/FracturedArk.cs b/Items/Weapons/Melee/FracturedArk.cs index 5d2c61f730..798a5b9dab 100644 --- a/Items/Weapons/Melee/FracturedArk.cs +++ b/Items/Weapons/Melee/FracturedArk.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = Item.height = 60; Item.damage = 80; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 5bcbb3a4c2..dafd20b49e 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -41,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Melee //NOTE: GetWeaponDamage is in the CalamityPlayer file public override void SetDefaults() { - Item.width = 86; - Item.height = 94; + Item.width = 112; + Item.height = 102; Item.damage = BaseDamage; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 12; @@ -52,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GaelsGreatsword.png b/Items/Weapons/Melee/GaelsGreatsword.png index 06379a5eb7..5af2cc305c 100644 Binary files a/Items/Weapons/Melee/GaelsGreatsword.png and b/Items/Weapons/Melee/GaelsGreatsword.png differ diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 8292d0c3af..05f78cf517 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,8 +18,10 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Galactus Blade"); Tooltip.SetDefault("Forged with the fury of nuclear chaos\n" + - "Launches a barrage of comets from the sky"); + "Launches a barrage of comets from the sky\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() @@ -35,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 58; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 23f; } diff --git a/Items/Weapons/Melee/GalaxySmasher.cs b/Items/Weapons/Melee/GalaxySmasher.cs index bb6e95fa07..e5b99e2fc6 100644 --- a/Items/Weapons/Melee/GalaxySmasher.cs +++ b/Items/Weapons/Melee/GalaxySmasher.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee [LegacyName("GalaxySmasherMelee", "GalaxySmasherRogue")] public class GalaxySmasher : ModItem { - public static int BaseDamage = 264; + public static int BaseDamage = 300; public static float Speed = 18f; public override void SetStaticDefaults() @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 72; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = BaseDamage; Item.knockBack = 9f; Item.useAnimation = 13; @@ -38,9 +39,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; - Item.value = Item.buyPrice(platinum: 1, gold: 80); + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 425554b466..f459414c46 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -1,9 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,78 +15,37 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Galileo Gladius"); Tooltip.SetDefault("Don't underestimate the power of small space swords\n" + "Shoots a homing crescent moon\n" + - "Spawns planetoids on enemy hits"); + "Spawns planetoids on enemy hits\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() { - Item.useStyle = ItemUseStyleID.Thrust; - Item.useTurn = false; + Item.useStyle = ItemUseStyleID.Rapier; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 10; Item.useTime = 10; Item.width = 44; Item.height = 44; Item.damage = 110; - Item.DamageType = DamageClass.Melee; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; - Item.useTurn = true; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.noUseGraphic = true; + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2.4f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int moonDamage = (int)(damage * 0.3333f); - Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, moonDamage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - SpawnMeteor(player); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - SpawnMeteor(player); - } - - private void SpawnMeteor(Player player) - { - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_ItemUse(Item); - if (player.Calamity().galileoCooldown <= 0) - { - int damage = player.GetWeaponDamage(player.ActiveItem()) * 2; - CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); - player.Calamity().galileoCooldown = 15; - } - } + Item.rare = ModContent.RarityType(); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Gladius). //This may be too rare for this recipe, we'll see I guess. - Merkalto + AddIngredient(ItemID.Gladius). AddIngredient(8). AddIngredient(5). AddIngredient(15). diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index e5ed0a28d9..ac332eec26 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 62; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index 09007e8fee..c9f5e43f11 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Gilded Proboscis"); Tooltip.SetDefault("Heals the player on hit"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index 21b339b20b..953fcae055 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Goldplume Spear"); Tooltip.SetDefault("Shoots falling feathers"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 54; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index ba2c5a497b..894270ad5b 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(1, 0, 0, 0); + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index 98a8a4f201..c25bf19ebc 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 9c1817cb95..9a35205b68 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index 1963484a7e..d28aaeb143 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 60; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 4ea8b1293b..2a282402fe 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Shoots a flower spear tip\n" + "Summons petals from the sky on critical hits"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 64; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 30b5e7f6f5..620af39f48 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 84; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index 6f52c0fe4b..6be7e811a3 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,9 +1,10 @@ using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -32,9 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.shootSpeed = 10f; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index d7714842c3..5295614fec 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -24,19 +25,19 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 44; Item.damage = 400; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 12; + Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; + Item.useTime = 10; Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; Item.height = 62; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 672a200b7d..02a46c5b65 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Insidious Impaler"); Tooltip.SetDefault("Fires a harpoon that sticks to enemies and explodes"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -33,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 5f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 5299967a18..49b68da302 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 26; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 107; Item.knockBack = 7f; Item.useTime = 20; @@ -40,8 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/LifefruitScythe.cs b/Items/Weapons/Melee/LifefruitScythe.cs index 80ed39784c..e8b3eb2695 100644 --- a/Items/Weapons/Melee/LifefruitScythe.cs +++ b/Items/Weapons/Melee/LifefruitScythe.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 72; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 775d800f98..f2b770adfe 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Cooldowns; +using CalamityMod.Cooldowns; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,8 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index 0d1aca5476..ed7e9b7654 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -5,76 +5,44 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles.Melee.Shortswords; namespace CalamityMod.Items.Weapons.Melee { public class Lucrecia : ModItem { - public const int OnHitIFrames = 5; - public override void SetStaticDefaults() { DisplayName.SetDefault("Lucrecia"); Tooltip.SetDefault("Finesse\n" + "Striking an enemy makes you immune for a short time\n" + - "Fires a DNA chain"); + "Fires a DNA chain\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() { - Item.useStyle = ItemUseStyleID.Thrust; + Item.useStyle = ItemUseStyleID.Rapier; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTurn = false; Item.useAnimation = 25; Item.useTime = 25; Item.width = 58; Item.height = 58; Item.damage = 90; - Item.DamageType = DamageClass.Melee; Item.knockBack = 8.25f; Item.UseSound = SoundID.Item1; - Item.useTurn = true; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 32f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 234); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.GiveIFrames(OnHitIFrames, false); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - { - player.immune = true; - player.immuneTime = Item.useTime / 5; - } - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index adbe08061a..35cc7a0b0d 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index 6f2942a15c..e50b931e56 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 20; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Melee/MarniteSpear.cs b/Items/Weapons/Melee/MarniteSpear.cs deleted file mode 100644 index 1dc7bfb254..0000000000 --- a/Items/Weapons/Melee/MarniteSpear.cs +++ /dev/null @@ -1,49 +0,0 @@ -using CalamityMod.Projectiles.Melee.Spears; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class MarniteSpear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marnite Spear"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.width = 50; - Item.damage = 26; - Item.DamageType = TrueMeleeDamageClass.Instance; - Item.noMelee = true; - Item.useTurn = true; - Item.noUseGraphic = true; - Item.useAnimation = 21; - Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 21; - Item.knockBack = 5.25f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.height = 50; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnyGoldBar", 5). - AddIngredient(ItemID.Granite, 9). - AddIngredient(ItemID.Marble, 9). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/MarniteSpear.png b/Items/Weapons/Melee/MarniteSpear.png deleted file mode 100644 index 621d38bfda..0000000000 Binary files a/Items/Weapons/Melee/MarniteSpear.png and /dev/null differ diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index d783b83dbe..6a6a9a8083 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 62; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index 521271c3d1..836fef92c5 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 18; Item.damage = 4; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 21; @@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.ThrowingKnife, 200). AddIngredient(ItemID.LifeCrystal). AddIngredient(ItemID.LesserHealingPotion, 5). - AddIngredient(10). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index 6ffff9ccf1..5557064fed 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,15 +27,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.channel = true; Item.autoReuse = true; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = 10; Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item116; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 793e4607f4..f1d0be476c 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,11 +40,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 5; Item.knockBack = 6.5f; Item.autoReuse = false; - Item.value = Item.buyPrice(2, 50, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 14)); } diff --git a/Items/Weapons/Melee/MycelialClaws.cs b/Items/Weapons/Melee/MycelialClaws.cs index ff6d04d091..b49562bc66 100644 --- a/Items/Weapons/Melee/MycelialClaws.cs +++ b/Items/Weapons/Melee/MycelialClaws.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatBuffs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,13 +11,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Mycelial Claws"); + Tooltip.SetDefault("Grants the Mushy buff for 6 seconds on enemy hits"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 22; - Item.damage = 20; + Item.damage = 21; Item.DamageType = DamageClass.Melee; Item.useAnimation = 7; Item.useStyle = ItemUseStyleID.Swing; @@ -26,10 +28,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 24; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) => player.AddBuff(ModContent.BuffType(), 360); + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) => player.AddBuff(ModContent.BuffType(), 360); + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 2c3f124a13..8007d538d3 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("Fires void essences which flay nearby enemies with tentacles\n" + "Ignores immunity frames\n" + "'The abyss has stared back at you long enough. It now speaks, and it does not speak softly.'"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -37,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index cfce4d955f..229bba9103 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.channel = true; Item.autoReuse = true; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = 18; Item.useTime = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2f; Item.UseSound = SoundID.Item117; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 821c149e76..e817f99ec1 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 9cef3a131a..7a562573b7 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 28; Item.height = 38; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 55; Item.knockBack = 4f; Item.useTime = 22; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Lime; - Item.value = Item.buyPrice(gold: 60); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; } } } diff --git a/Items/Weapons/Melee/OldLordOathsword.cs b/Items/Weapons/Melee/OldLordOathsword.cs index 59e16465b6..92b0df6dbe 100644 --- a/Items/Weapons/Melee/OldLordOathsword.cs +++ b/Items/Weapons/Melee/OldLordOathsword.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.noUseGraphic = true; Item.channel = true; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; } diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 4ab17121d4..beeb6c6e37 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 146; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index fe70c7074c..e2935f759a 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 58; Item.height = 50; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = YoyoBaseDamage; Item.knockBack = 4f; Item.useTime = 20; @@ -50,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/Pandemic.cs b/Items/Weapons/Melee/Pandemic.cs index f7b4a944d9..894948ff5b 100644 --- a/Items/Weapons/Melee/Pandemic.cs +++ b/Items/Weapons/Melee/Pandemic.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 32; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 66; Item.knockBack = 2.5f; Item.useTime = 22; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Yellow; - Item.value = Item.buyPrice(gold: 80); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; } } } diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 6c25e36cde..27952cd245 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 50; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.cs b/Items/Weapons/Melee/PhosphorescentGauntlet.cs index 07c0040f90..e36ddefab8 100644 --- a/Items/Weapons/Melee/PhosphorescentGauntlet.cs +++ b/Items/Weapons/Melee/PhosphorescentGauntlet.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults. diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index d0e9d69804..cb87e0444d 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -40,8 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 9bc58b221b..5ef6b2735c 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; +using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,7 +11,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Tools; namespace CalamityMod.Items.Weapons.Melee { @@ -40,6 +41,8 @@ namespace CalamityMod.Items.Weapons.Melee "The sword is boosted by both melee and ranged damage"); Item.staff[Item.type] = true; SacrificeTotal = 1; + + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() @@ -60,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/Pwnagehammer.cs b/Items/Weapons/Melee/Pwnagehammer.cs index d84dddd76d..69306c0f78 100644 --- a/Items/Weapons/Melee/Pwnagehammer.cs +++ b/Items/Weapons/Melee/Pwnagehammer.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.height = 66; - Item.value = Item.buyPrice(gold: 48); + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24.4f; diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 66b0afd0a3..c31145dd16 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 36; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 52; Item.knockBack = 3.5f; Item.useTime = 22; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 10f; Item.rare = ItemRarityID.Lime; - Item.value = Item.buyPrice(gold: 60); + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index 37e0a98ba7..ac3c577cc4 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 15f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Melee/RedtideSpear.cs b/Items/Weapons/Melee/RedtideSpear.cs index 7e512bd277..14ee4fc91e 100644 --- a/Items/Weapons/Melee/RedtideSpear.cs +++ b/Items/Weapons/Melee/RedtideSpear.cs @@ -19,12 +19,13 @@ namespace CalamityMod.Items.Weapons.Melee "[c/5C95A1:The people of the sea were adept hunters, but they abhorred unnecessary violence.]\n" + "[c/5C95A1:Unfortunately, neighboring nations were brutish, so they fashioned their tools for war.]"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() { Item.width = 56; - Item.damage = 33; + Item.damage = 25; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = null; Item.autoReuse = true; Item.height = 56; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; @@ -58,4 +59,18 @@ namespace CalamityMod.Items.Weapons.Melee Register(); } } + + public class SpearChargePlayer : ModPlayer + { + public bool ChargingKnockbackResist = false; + + public override void PostUpdateMiscEffects() + { + if (ChargingKnockbackResist) + { + Player.noKnockback = true; + ChargingKnockbackResist = false; + } + } + } } diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index 42d82682eb..2580282863 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.damage = 375; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 44; Item.height = 34; Item.useTime = 15; diff --git a/Items/Weapons/Melee/Riptide.cs b/Items/Weapons/Melee/Riptide.cs index f2caa1f011..c587d5e1d2 100644 --- a/Items/Weapons/Melee/Riptide.cs +++ b/Items/Weapons/Melee/Riptide.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 44; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 16; Item.knockBack = 1f; Item.useTime = 25; @@ -41,12 +42,13 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 18f; Item.rare = ItemRarityID.Green; - Item.value = Item.buyPrice(gold: 2); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; } public override void AddRecipes() { CreateRecipe(). + AddIngredient(3). AddIngredient(7). AddIngredient(10). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index fd1b23d1c9..0173dd3cda 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Sausage Maker"); Tooltip.SetDefault("Sprays homing blood on hit"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 42; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 3e237ff7d2..8528aba91c 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = Item.height = 64; Item.damage = 478; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 20; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs index 7da482237c..c3dc632176 100644 --- a/Items/Weapons/Melee/SeashineSword.cs +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 30; Item.damage = 26; Item.DamageType = DamageClass.Melee; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.width = 38; Item.height = 38; Item.knockBack = 2; @@ -39,6 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(3). AddIngredient(7). AddIngredient(10). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 425b68923b..39b296d852 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -28,13 +29,12 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 17; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.height = 62; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index a67c8820d0..452f6d95ac 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 50; Item.height = 36; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 41; Item.knockBack = 3.5f; Item.useTime = 25; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(gold: 36); + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/SolarFlare.cs b/Items/Weapons/Melee/SolarFlare.cs index cd9e0e2f29..5d5e6c135b 100644 --- a/Items/Weapons/Melee/SolarFlare.cs +++ b/Items/Weapons/Melee/SolarFlare.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 40; Item.height = 38; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 71; Item.knockBack = 7.5f; Item.useTime = 20; @@ -38,8 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Weapons/Melee/SoulEdge.cs b/Items/Weapons/Melee/SoulEdge.cs index 6f28d11ff9..91e28d33ec 100644 --- a/Items/Weapons/Melee/SoulEdge.cs +++ b/Items/Weapons/Melee/SoulEdge.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 23083cd2f4..5f231b72d5 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item71; Item.autoReuse = true; Item.height = 64; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index 474758049f..8a31b71ebb 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,14 +23,13 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = Item.height = 28; Item.damage = 260; - Item.rare = ItemRarityID.Red; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.autoReuse = true; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 8f; diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index 5192be2284..4770df2ed3 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Starnight Lance"); Tooltip.SetDefault("Shoots a starnight beam"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 72; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index bcb6d23deb..f707021c24 100644 --- a/Items/Weapons/Melee/StellarContempt.cs +++ b/Items/Weapons/Melee/StellarContempt.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 74; Item.height = 74; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = BaseDamage; Item.knockBack = 9f; Item.useTime = 13; diff --git a/Items/Weapons/Melee/StormRuler.cs b/Items/Weapons/Melee/StormRuler.cs index 14b3caf6fc..00bb84eef2 100644 --- a/Items/Weapons/Melee/StormRuler.cs +++ b/Items/Weapons/Melee/StormRuler.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 74; + Item.width = 80; Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.useAnimation = 25; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 82; + Item.height = 84; Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/StormRuler.png b/Items/Weapons/Melee/StormRuler.png index f9d3b49b6d..c903862c99 100644 Binary files a/Items/Weapons/Melee/StormRuler.png and b/Items/Weapons/Melee/StormRuler.png differ diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 93962c5e49..0756a55634 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 64; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index 63e1772945..0b7fd66b74 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -43,10 +44,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 9607a814bb..5047569e64 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles.Melee.Shortswords; namespace CalamityMod.Items.Weapons.Melee { @@ -17,46 +18,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.useStyle = ItemUseStyleID.Thrust; + Item.useStyle = ItemUseStyleID.Rapier; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTurn = false; Item.useAnimation = 10; Item.useTime = 10; Item.width = 32; Item.height = 32; Item.damage = 60; - Item.DamageType = DamageClass.Melee; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; - Item.useTurn = true; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.noUseGraphic = true; + Item.noMelee = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - var source = player.GetSource_ItemUse(Item); - if (crit) - damage /= 2; - - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), knockback, Main.myPlayer); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - var source = player.GetSource_ItemUse(Item); - if (crit) - damage /= 2; - - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), Item.knockBack, Main.myPlayer); - } } } diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs index 7c5e7d8adc..9d4335b53b 100644 --- a/Items/Weapons/Melee/SulphurousGrabber.cs +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 50; Item.height = 36; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 82; Item.knockBack = 3.5f; Item.useTime = 25; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(gold: 36); + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; } } } diff --git a/Items/Weapons/Melee/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index 4b00242c8c..b0379dc4cb 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -14,8 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Swordsplosion"); - Tooltip.SetDefault("Sword swarm"); + Tooltip.SetDefault("Sword swarm\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 145a48f6e6..67ee6bdb18 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 66; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index ebe0a297a8..d594e9042c 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -15,8 +15,11 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Tenebreus Tides"); Tooltip.SetDefault("Inundatio ex Laminis\n" + "Shoots a water spear that pierces enemies and terrain\n" + - "Striking enemies summon liquid blades and spears to assault the struck foe"); + "Striking enemies summon liquid blades and spears to assault the struck foe\n" + + "Receives 33% benefit from melee speed bonuses"); SacrificeTotal = 1; + ItemID.Sets.BonusAttackSpeedMultiplier[Item.type] = 0.33f; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TerraEdge.cs b/Items/Weapons/Melee/TerraEdge.cs index d5d89ab679..67343748fe 100644 --- a/Items/Weapons/Melee/TerraEdge.cs +++ b/Items/Weapons/Melee/TerraEdge.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -80,14 +80,14 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(ItemID.TrueExcalibur). AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). AddIngredient(ItemID.TrueNightsEdge). AddIngredient(ItemID.TrueExcalibur). AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TerraLance.cs b/Items/Weapons/Melee/TerraLance.cs index 3981a1054f..98fed94c19 100644 --- a/Items/Weapons/Melee/TerraLance.cs +++ b/Items/Weapons/Melee/TerraLance.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Terra Lance"); Tooltip.SetDefault("Fires a lance beam"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.ChlorophytePartisan). AddIngredient(ItemID.DarkLance). AddIngredient(ItemID.Gungnir). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 2ad7270b6a..2d536c3cec 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 66; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; } diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index 33c75ed257..988229a051 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 20f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 61f7f094c3..db029ecf42 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -1,7 +1,9 @@ -using Terraria.DataStructures; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -42,8 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -60,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee return false; } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Daybreak, 300); - public override void OnHitPvp(Player player, Player target, int damage, bool crit) => target.AddBuff(BuffID.Daybreak, 300); + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPvp(Player player, Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index d6faf2bc3e..f6584c15e1 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -1,13 +1,14 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -34,9 +35,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9f; Item.UseSound = SoundID.Item20; Item.autoReuse = true; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 3132e50554..b2ed4bb9cf 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 40; Item.height = 26; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 29; Item.knockBack = 3.5f; Item.useTime = 21; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 10f; Item.rare = ItemRarityID.LightRed; - Item.value = Item.buyPrice(gold: 12); + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index b10ca26194..6aa2bd3cbf 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index 4a5bd43dd4..48e5895050 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 34; Item.height = 34; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 65; Item.knockBack = 3f; Item.useTime = 22; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.rare = ItemRarityID.Cyan; - Item.value = Item.buyPrice(gold: 95); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; } } } diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index b59a7bf152..c47e82ffa8 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -1,10 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index d262758f5b..6e33707563 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 42; Item.height = 40; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 255; Item.knockBack = 7.5f; Item.useTime = 20; @@ -38,8 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index bd73eb3bec..5b7448eb68 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -28,12 +29,12 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTime = 10; Item.knockBack = 50f; Item.UseSound = SoundID.Item1; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 78e0609d6f..a5b29e6e5e 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = Item.height = 72; Item.damage = 188; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; Item.useAnimation = 25; @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.5f; Item.UseSound = null; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; @@ -184,7 +184,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(ItemID.TrueExcalibur). AddIngredient(). - AddIngredient(3). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TrueBloodyEdge.cs b/Items/Weapons/Melee/TrueBloodyEdge.cs index 3c9118d0e6..41d58ad2f1 100644 --- a/Items/Weapons/Melee/TrueBloodyEdge.cs +++ b/Items/Weapons/Melee/TrueBloodyEdge.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 64; Item.scale = 1.5f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index 866ca8ae1d..13944ba37a 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; @@ -119,8 +119,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(3). - AddIngredient(3). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs index c5b4c4aa28..2b3ae35df0 100644 --- a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.height = 102; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index b5e09f1d52..0cbbf56695 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.damage = 125; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 30; Item.height = 10; Item.useTime = 20; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index dcc8a9f26c..032b67a6c6 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/TyrantYharimsUltisword.cs b/Items/Weapons/Melee/TyrantYharimsUltisword.cs index 9371ad7230..99254501a8 100644 --- a/Items/Weapons/Melee/TyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TyrantYharimsUltisword.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 88; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index a67f8a1aa9..b9f082ed7a 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.autoReuse = true; Item.UseSound = SoundID.Item1; } diff --git a/Items/Weapons/Melee/UrchinFlail.cs b/Items/Weapons/Melee/UrchinFlail.cs index f84ee26352..32fbb58f4c 100644 --- a/Items/Weapons/Melee/UrchinFlail.cs +++ b/Items/Weapons/Melee/UrchinFlail.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.damage = 33; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.width = 44; Item.height = 36; Item.useTime = 25; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index 2dba577151..676d1af1ad 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 42; - Item.damage = 20; + Item.damage = 23; Item.channel = true; Item.noUseGraphic = true; Item.noMelee = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 4; Item.UseSound = SoundID.Item1; Item.height = 48; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index 7cdfd6766d..ade4afab29 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 50; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/Verdant.cs b/Items/Weapons/Melee/Verdant.cs index bbfc2fb006..89e814df13 100644 --- a/Items/Weapons/Melee/Verdant.cs +++ b/Items/Weapons/Melee/Verdant.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 30; Item.height = 30; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 86; Item.knockBack = 6f; Item.useTime = 22; @@ -40,8 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index c7863c8ce2..3214650e22 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.height = Item.width = 142; Item.damage = 404; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.channel = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Melee/Virulence.cs b/Items/Weapons/Melee/Virulence.cs index 2399a228e2..b845aae321 100644 --- a/Items/Weapons/Melee/Virulence.cs +++ b/Items/Weapons/Melee/Virulence.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 62; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Melee/VulcaniteLance.cs b/Items/Weapons/Melee/VulcaniteLance.cs index 6f59244cfd..cb91ef6ab4 100644 --- a/Items/Weapons/Melee/VulcaniteLance.cs +++ b/Items/Weapons/Melee/VulcaniteLance.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Vulcanite Lance"); Tooltip.SetDefault("Explodes on enemy hits and summons homing flares on critical hits"); SacrificeTotal = 1; + ItemID.Sets.Spears[Item.type] = true; } public override void SetDefaults() @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 22c408a173..7dcc3ad9fb 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 58; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; diff --git a/Items/Weapons/Melee/WulfrumBlade.cs b/Items/Weapons/Melee/WulfrumBlade.cs deleted file mode 100644 index b48de10bf2..0000000000 --- a/Items/Weapons/Melee/WulfrumBlade.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class WulfrumBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Blade"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.width = 32; - Item.height = 46; - Item.damage = 12; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; - Item.useTurn = true; - Item.knockBack = 3.75f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = Item.buyPrice(0, 1, 0, 0); - Item.rare = ItemRarityID.Blue; - } - - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - hitbox = CalamityUtils.FixSwingHitbox(39, 39); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/WulfrumBlade.png b/Items/Weapons/Melee/WulfrumBlade.png deleted file mode 100644 index 121c4cfe6e..0000000000 Binary files a/Items/Weapons/Melee/WulfrumBlade.png and /dev/null differ diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs new file mode 100644 index 0000000000..fb9465da20 --- /dev/null +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -0,0 +1,215 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using CalamityMod.Projectiles.Melee; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using static CalamityMod.CalamityUtils; +using Terraria.DataStructures; +using System.Linq; + +namespace CalamityMod.Items.Weapons.Melee +{ + [LegacyName("WulfrumBlade")] + public class WulfrumScrewdriver : ModItem + { + public static int DefaultTime = 10; + public static readonly SoundStyle ThrustSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThrust") { PitchVariance = 0.4f }; + public static readonly SoundStyle ThudSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThud") { PitchVariance = 0.2f, Volume = 0.7f }; + public static readonly SoundStyle ScrewGetSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverScrewGet") { PitchVariance = 0.1f}; + public static readonly SoundStyle ScrewHitSound = new("CalamityMod/Sounds/Item/WulfrumScrewdriverScrewHit") { Volume = 0.7f }; + public static readonly SoundStyle FunnyUltrablingSound = new("CalamityMod/Sounds/Custom/UltrablingHit"); + + public static bool ScrewQeuedForStorage = false; + public bool ScrewStored = false; + public bool ScrewAvailable => ScrewStored && ScrewTimer == 0; + public static Vector3 ScrewStart = new Vector3(0); + public static Vector3 ScrewPosition; + public static Vector2 PrevOffset; + public static float ScrewTimer; + public static float ScrewTime = 40; + public static Asset ScrewTex; + public static Asset ScrewOutlineTex; + public static float ScrewBaseDamageMult = 1.5f; + 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 override ModItem Clone(Item item) + { + return base.Clone(item); + + ModItem clone = base.Clone(item); + if (clone is WulfrumScrewdriver a && item.ModItem is WulfrumScrewdriver a2 && a2.ScrewStored) + { + a.ScrewStored = a2.ScrewStored; + } + return clone; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Screwdriver"); + Tooltip.SetDefault("Can be used to rapidly and royally screw over any foe, provided they're weak enough\n" + + "Striking an enemy has a chance to give you a wulfrum screw, that you can throw back at them by right clicking\n" + + "Hitting a flung screw with the screwdriver will boost its damage and speed, sending it hurling forwards at high speeds\n" + + "[c/83B87E:\"Who makes flatheads this large?? The hell am I supposed to use it for, the thing could take an eye out!\"]\n" + + "[c/83B87E:\"…Ah.\"]"); + SacrificeTotal = 1; + } + + public override float UseSpeedMultiplier(Player player) + { + //Super speedy + if (player.altFunctionUse == 2) + return 2f; + + return base.UseSpeedMultiplier(player); + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 50; + Item.damage = 9; + Item.DamageType = DamageClass.Melee; + Item.useAnimation = DefaultTime + WulfrumScrewdriverProj.MaxTime; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useTime = DefaultTime + WulfrumScrewdriverProj.MaxTime; + Item.useTurn = true; + Item.knockBack = 3.75f; + Item.UseSound = ThrustSound; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(12). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) => ScrewStored = false; + public override void UpdateInventory(Player player) + { + if (player.HeldItem != Item) + ScrewStored = false; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + + if (Main.myPlayer == player.whoAmI) + { + if (ScrewQeuedForStorage) + { + ScrewStored = true; + ScrewQeuedForStorage = false; + } + + if (ScrewTimer > 0) + ScrewTimer--; + + if (ScrewTimer == 1) + { + Vector2 dustPos = new Vector2(ScrewPosition.X, ScrewPosition.Y) + Main.screenPosition; + int numDust = Main.rand.Next(5, 15); + for (int i = 0; i < numDust; i++) + { + Dust.NewDustPerfect(dustPos, Main.rand.NextBool() ? 246 : 247, Main.rand.NextVector2Circular(1f, 1f), Scale: Main.rand.NextFloat(0.9f, 1.4f)); + } + + SoundEngine.PlaySound(ScrewGetSound); + } + } + + base.HoldItem(player); + } + + public override bool AltFunctionUse(Player player) => ScrewAvailable; + public override bool CanUseItem(Player player) => player.altFunctionUse == 2 ? !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()) : true; + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + if (player.altFunctionUse == 2) damage = (int)(damage * ScrewBaseDamageMult); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2) + { + Vector2 chuckSpeed = new Vector2(Math.Sign(velocity.X) * 0.4f, -1.24f) + player.velocity / 4f; + + //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); + + ScrewStored = false; + return false; + } + + return base.Shoot(player, source, position, velocity, type, damage, knockback); + } + + public CurveSegment InitialAway = new CurveSegment(SineOutEasing, 0f, 0f, -0.2f, 3); + public CurveSegment AccelerateTowards = new CurveSegment(PolyInEasing, 0.3f, -0.2f, 1.2f, 3); + public CurveSegment Bump1Segment = new CurveSegment(SineBumpEasing, 0.5f, 1f, 0.24f); + public CurveSegment Bump2Segment = new CurveSegment(SineBumpEasing, 0.8f, 1f, -0.1f); + internal float ProgressionOfScrew => PiecewiseAnimation(ScrewTimer / ScrewTime, new CurveSegment[] { InitialAway, AccelerateTowards, Bump1Segment, Bump2Segment }); + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (!ScrewStored) + return; + + Player myPlayer = Main.LocalPlayer; + + if (myPlayer.HeldItem != Item || !myPlayer.active || myPlayer.dead) + return; + + spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.GameViewMatrix.TransformationMatrix); + + if (ScrewTex == null) + ScrewTex = ModContent.Request("CalamityMod/Projectiles/Melee/WulfrumScrew"); + if (ScrewOutlineTex == null) + ScrewOutlineTex = ModContent.Request("CalamityMod/Projectiles/Melee/WulfrumScrewOutline"); + + Texture2D screwTex = ScrewTex.Value; + Texture2D screwOutlineTex = ScrewOutlineTex.Value; + + Vector2 realIdealSpot = myPlayer.MountedCenter + myPlayer.gfxOffY * Vector2.UnitY - Main.screenPosition - Vector2.UnitY * 50f - Vector2.Lerp(myPlayer.velocity, PrevOffset, 0.5f); + realIdealSpot.Y += (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 5f; + realIdealSpot.X += (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1f) * 7.8f; + + ScrewPosition = new Vector3(realIdealSpot, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f) * MathHelper.PiOver4 * 0.34f); + + 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); + + 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); + + spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); + + + PrevOffset = myPlayer.velocity; + base.PostDrawInInventory(spriteBatch, position, frame, drawColor, itemColor, origin, scale); + } + } +} diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.png b/Items/Weapons/Melee/WulfrumScrewdriver.png new file mode 100644 index 0000000000..703a796de6 Binary files /dev/null and b/Items/Weapons/Melee/WulfrumScrewdriver.png differ diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index fce0ffefea..e90dde4535 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 26; Item.height = 24; - Item.DamageType = DamageClass.Melee; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 50; Item.knockBack = 3.5f; Item.useTime = 25; diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 4097501f5b..8ba39f8253 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 6f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item36; diff --git a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs index 1b6e6fcb94..578af81dd7 100644 --- a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs +++ b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 100; + Item.damage = 65; Item.DamageType = DamageClass.Ranged; Item.width = 54; Item.height = 52; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3f; Item.channel = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shootSpeed = 6f; diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 1ed3082209..5094bbefd8 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,14 +32,13 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (!canHit) offset -= velocity; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { int newType = type; switch (i) diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 9e68187b71..416b380f4d 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -1,12 +1,13 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -41,7 +42,7 @@ Fighting 'til the war's won"); Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shootSpeed = BulletSpeed; diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 95e9d2c912..9f319d5446 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -30,7 +30,7 @@ Right click to fire a burst of bullets"); Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item31; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index 1d4e7e597b..e384c9cd1c 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -1,12 +1,13 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 3240; + Item.damage = 2800; Item.DamageType = DamageClass.Ranged; Item.width = 154; Item.height = 40; @@ -32,14 +33,13 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.5f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound; Item.autoReuse = true; Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (type == ProjectileID.Bullet) Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.3), knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index ae302784fd..213a4420c4 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 2ffdd25fd1..5a8189bfc1 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -18,16 +18,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 18; + Item.damage = 9; Item.DamageType = DamageClass.Ranged; Item.width = 78; Item.height = 36; - Item.useTime = 18; - Item.useAnimation = 18; + Item.useTime = 11; + Item.useAnimation = 11; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 140def7f2e..d7837bae03 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 4.25f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item102; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -82,7 +82,7 @@ namespace CalamityMod.Items.Weapons.Ranged num79 *= num80; float speedX4 = num78; float speedY5 = num79; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { int bloodfire = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 80f); Main.projectile[bloodfire].tileCollide = false; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index a6ab989774..affb3ddc4f 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item41; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/AstralRepeater.cs b/Items/Weapons/Ranged/AstralRepeater.cs index dffb9d5199..34446af00c 100644 --- a/Items/Weapons/Ranged/AstralRepeater.cs +++ b/Items/Weapons/Ranged/AstralRepeater.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index 9f54e6ea86..af31e9618b 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 6d28cc97e9..b38fcb8320 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index c11890eae8..868b866d5d 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index ecbcade026..502ec38d89 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item10; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index 9295b948c7..ae9920d745 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BlightSpewer.cs b/Items/Weapons/Ranged/BlightSpewer.cs index 4f50043171..87186b48e1 100644 --- a/Items/Weapons/Ranged/BlightSpewer.cs +++ b/Items/Weapons/Ranged/BlightSpewer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 2f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 6b1f1e2c58..a45b4c797a 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 7.5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.shootSpeed = 24f; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 35d58c42de..7d4b52c3be 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index e69bdac6b3..92f5f0e3d5 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 04a365306b..6d5c1114f3 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); // No use sound is intentional Item.autoReuse = true; Item.shootSpeed = 14.5f; diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index d36671cb89..1a72063047 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; Item.autoReuse = true; Item.rare = ItemRarityID.Pink; diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index b6810ad779..32db81d2a9 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5.5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item40; Item.autoReuse = true; Item.shootSpeed = 24f; diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 7bbdd815a8..8a4d1a34be 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,13 +32,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 4f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.useAmmo = AmmoID.Gel; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index 99345c32f4..f8fdbaa4fe 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item31; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index f764aa49c1..436ed8f966 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14.5f; diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 232f9f1bf5..193377daee 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Arrow; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/ContinentalGreatbow.cs b/Items/Weapons/Ranged/ContinentalGreatbow.cs index 4a3b219bc4..e5ff8fd60f 100644 --- a/Items/Weapons/Ranged/ContinentalGreatbow.cs +++ b/Items/Weapons/Ranged/ContinentalGreatbow.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged { offset -= velocity; } - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { type = ProjectileID.FireArrow; } diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs index 0e617c66b8..f86b50ddc6 100644 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ b/Items/Weapons/Ranged/CoralCannon.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 45e5dee2f8..5f2539094a 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index fa9f8d3fa5..e3790160b9 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item75; Item.autoReuse = true; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (!canHit) offset -= velocity; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(5). + AddIngredient(12). AddIngredient(ItemID.HallowedBar, 5). AddIngredient(ItemID.SoulofSight, 5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Ranged/CrackshotColt.cs b/Items/Weapons/Ranged/CrackshotColt.cs new file mode 100644 index 0000000000..8a550fe63e --- /dev/null +++ b/Items/Weapons/Ranged/CrackshotColt.cs @@ -0,0 +1,152 @@ +using System; +using System.IO; +using CalamityMod.Items.Materials; +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; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; +using CalamityMod.Projectiles.Ranged; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class CrackshotColt : ModItem + { + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/CrackshotColtShot") { PitchVariance = 0.1f }; + + public static readonly SoundStyle BlingSound = new("CalamityMod/Sounds/Custom/Ultrabling") { PitchVariance = 0.5f }; + public static readonly SoundStyle BlingHitSound = new("CalamityMod/Sounds/Custom/UltrablingHit") { PitchVariance = 0.5f }; + + public static float MaxDownwardsAngle4Coin = MathHelper.PiOver4; + public static float RicochetDamageMult = 2f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crackshot Colt"); + Tooltip.SetDefault("Right click to throw a coin in the air. Hitting the coin with a bullet redirects the shot into the nearest enemy\n" + + "Coin throws consume copper coins"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.damage = 13; + Item.DamageType = DamageClass.Ranged; + Item.width = 23; + Item.height = 8; + Item.useTime = 35; + Item.useAnimation = 35; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = ShootSound with { Volume = 0.6f}; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.shootSpeed = 14f; + Item.Calamity().canFirePointBlankShots = true; + } + + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + return player.CanBuyItem(1); //Breaks if the player has > 999 plat. Ask tml people to fix that? + return true; + } + + public override bool? UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.BuyItem(1); + } + + return base.UseItem(player); + } + + public override void UseAnimation(Player player) + { + Item.UseSound = ShootSound with { Volume = 0.6f}; + if (player.altFunctionUse == 2) + Item.UseSound = BlingSound; + } + + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 1.3f; + return 1f; + } + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + + //Override every projectile + type = ModContent.ProjectileType(); + + if (player.altFunctionUse == 2) + { + damage = 0; + type = ModContent.ProjectileType() ; + + //Ok the velocity is flipped because the in world coordinates have 0 at the top, so to do the typical trigo stuff we flip it, you get me. + float shootAngle = (player.Calamity().mouseWorld - player.MountedCenter).ToRotation() * -1; + + if (shootAngle > -MathHelper.Pi + MaxDownwardsAngle4Coin && shootAngle < -MathHelper.PiOver2) + shootAngle = -MathHelper.Pi + MaxDownwardsAngle4Coin; + + else if (shootAngle < -MaxDownwardsAngle4Coin && shootAngle >= -MathHelper.PiOver2) + shootAngle = -MaxDownwardsAngle4Coin; + + velocity = (shootAngle * -1).ToRotationVector2() * 1.3f - Vector2.UnitY * 1.12f + player.velocity / 4f; + } + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(40, 20); + Vector2 itemOrigin = new Vector2(-15, 1); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.45f * (float)Math.Pow((0.4f - animProgress) / 0.4f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ModContent.ItemType()). + AddRecipeGroup("AnyGoldBar", 3). + AddIngredient(ItemID.CopperCoin, 5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/CrackshotColt.png b/Items/Weapons/Ranged/CrackshotColt.png new file mode 100644 index 0000000000..335905aa49 Binary files /dev/null and b/Items/Weapons/Ranged/CrackshotColt.png differ diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 8d33ab3949..cb10bf6ab9 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Arrow; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 3fcc6e0b17..e6a6486215 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index af571c1630..d2ba35a78a 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f; float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index a18f2be615..086414d195 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -1,10 +1,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index 6f769efa7a..259f2f8ba5 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public const int BetweenShotsPause = 15; public const int PelletsPerShot = 6; - public const float FullAutoFireRateMult = 1.25f; + public const float FullAutoFireRateMult = 0.8f; public const float FullAutoDamageMult = 0.8f; // note this is extremely low because it's per pellet public const float Spread = 0.018f; @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; } public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.66f; diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index ca0c6ce998..a48e24557a 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -38,8 +39,7 @@ Right click to fire two devastating barrages of five empowered fireballs. Item.height = 84; Item.UseSound = SoundID.Item5; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(platinum: 2, gold: 50); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; @@ -47,7 +47,7 @@ Right click to fire two devastating barrages of five empowered fireballs. Item.useTurn = false; Item.useAmmo = AmmoID.Arrow; Item.autoReuse = true; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Ranged/EffluviumBow.cs b/Items/Weapons/Ranged/EffluviumBow.cs index 578a458513..4a16683c9d 100644 --- a/Items/Weapons/Ranged/EffluviumBow.cs +++ b/Items/Weapons/Ranged/EffluviumBow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index 2783e4abd7..69bb88219c 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.useAmmo = AmmoID.Arrow; Item.UseSound = SoundID.Item5; diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 406eb5070b..f5c749ed7e 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item40; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 7c83f38d06..55a0ae067c 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index b5327ef9fd..d91c7ebf20 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -97,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.FlareGun). AddIngredient(ItemID.Boomstick). AddRecipeGroup("AnyGoldBar", 10). - AddIngredient(10). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 0b2cb72003..b6a77b8ca0 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 0f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = CommonCalamitySounds.LaserCannonSound; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index c5b06fdb29..26e59e3193 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item109; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index 0cbf9d9579..3165b574fb 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Flarewing Bow"); - Tooltip.SetDefault("Shoots a spread of 5 arrows\n" + + Tooltip.SetDefault("Shoots a spread of 4 arrows\n" + "Wooden arrows are converted into bouncing obsidian bats"); SacrificeTotal = 1; } @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged { value9 -= vector7; } - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { int num123 = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); Main.projectile[num123].noDropItem = true; diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index 8a1261872e..11cdfbd329 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.IllegalGunParts). AddIngredient(10). AddIngredient(ItemID.Bone, 50). - AddIngredient(25). + AddIngredient(25). AddIngredient(ItemID.WaterBucket, 3). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 1f8ffbf1da..0ed5298763 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item36; diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index e27c44e88f..d9303b5bb3 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index fe087b8348..e6ab5e9ca6 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/GodsBellows.cs b/Items/Weapons/Ranged/GodsBellows.cs index 2f298a6dc7..5a2f292226 100644 --- a/Items/Weapons/Ranged/GodsBellows.cs +++ b/Items/Weapons/Ranged/GodsBellows.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3.5f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index fa0a53d898..c98b0589fc 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index ec93c9062b..e1e6867cf2 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item36; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index f79d75d581..be663b758b 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -20,15 +21,15 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 50; Item.DamageType = DamageClass.Ranged; - Item.width = 108; - Item.height = 54; + Item.width = 118; + Item.height = 56; Item.useTime = 10; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; - Item.rare = ItemRarityID.Red; + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(1, 0, 0, 0); + Item.value = CalamityGlobalItem.Rarity16BuyPrice; Item.UseSound = null; Item.autoReuse = true; Item.shoot = ProjectileID.Bullet; diff --git a/Items/Weapons/Ranged/HalibutCannon.png b/Items/Weapons/Ranged/HalibutCannon.png index e325a73b5a..80807b3a78 100644 Binary files a/Items/Weapons/Ranged/HalibutCannon.png and b/Items/Weapons/Ranged/HalibutCannon.png differ diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 215609248a..ac885b79b6 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -36,9 +37,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index c18c365f1e..ae9b3efff9 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/HavocsBreath.cs b/Items/Weapons/Ranged/HavocsBreath.cs index 6b284481be..0e356e5aed 100644 --- a/Items/Weapons/Ranged/HavocsBreath.cs +++ b/Items/Weapons/Ranged/HavocsBreath.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Havoc's Breath"); + Tooltip.SetDefault("50% chance to not consume gel"); SacrificeTotal = 1; } @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index ded91b9016..742c62a064 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -1,114 +1,78 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class HeavenlyGale : ModItem { - public const float NormalArrowDamageMult = 1.25f; - private static int[] ExoArrows; + public const int ShootDelay = 32; + + public const int ArrowsPerBurst = 9; + + public const int ArrowShootRate = 4; + + public const int ArrowShootTime = ArrowsPerBurst * ArrowShootRate; + + public const int MaxChargeTime = 300; + + public const float ArrowTargetingRange = 1100f; + + public const float MaxChargeDamageBoost = 4.5f; + + public const float LightningDamageFactor = 0.36f; + + public const float ChargeLightningCreationThreshold = 0.8f; + + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/HeavenlyGaleFire"); + + public static readonly SoundStyle LightningStrikeSound = new("CalamityMod/Sounds/Custom/HeavenlyGaleLightningStrike"); public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenly Gale"); - Tooltip.SetDefault("Converts wooden arrows into barrages of 5 random exo arrows\n" + - "Green exo arrows erupt into swirling tornadoes\n" + - "Blue exo arrows burst into barrages of following arrows\n" + - "Orange exo arrows explode into flames\n" + - "Teal exo arrows pierce infinitely and ignore immunity frames\n" + - $"Any non-wooden arrows used will deal {NormalArrowDamageMult}x damage\n" + - "66% chance to not consume ammo"); - - ExoArrows = new int[] - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; + Tooltip.SetDefault("Fires a rapid stream of supercharged exo-crystals\n" + + "Holding the bow and waiting for some time before firing causes the crystals to become more powerful\n" + + "If the crystals are sufficiently powerful enough they will summon torrents of exo-lightning above whatever target they hit"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 198; + Item.damage = 350; Item.DamageType = DamageClass.Ranged; - Item.width = 44; - Item.height = 58; - Item.useTime = 15; - Item.useAnimation = 30; + Item.width = 138; + Item.height = 138; + Item.useTime = 42; + Item.useAnimation = 42; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; Item.UseSound = SoundID.Item5; Item.autoReuse = true; + Item.noUseGraphic = true; Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.useTurn = true; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.Calamity().canFirePointBlankShots = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 vel = velocity; - float piOver10 = MathHelper.Pi * 0.1f; - - // This is not related to speed, but rather placing the arrows correctly along the large bow. - Vector2 baseOffset = velocity; - baseOffset.Normalize(); - baseOffset *= 40f; - - bool againstWall = !Collision.CanHit(source, 0, 0, source + baseOffset, 0, 0); - - int numArrows = 5; - for (int i = 0; i < numArrows; i++) - { - float offsetAmt = i - (numArrows - 1f) / 2f; - Vector2 offset = baseOffset.RotatedBy(piOver10 * offsetAmt); - if (againstWall) - offset -= baseOffset; - - if (type == ProjectileID.WoodenArrowFriendly) - { - int thisArrowType = Main.rand.Next(ExoArrows); - // Teal exo arrows deal less damage. - float dmgMult = thisArrowType == ProjectileType() ? 0.66f : 1f; - int finalDamage = (int)(damage * dmgMult); - Projectile.NewProjectile(spawnSource, source + offset, vel, thisArrowType, finalDamage, knockback, player.whoAmI); - } - else - { - int normalArrowDamage = (int)(damage * NormalArrowDamageMult); - int proj = Projectile.NewProjectile(spawnSource, source + offset, vel, type, normalArrowDamage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } - } - return false; - } - - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.rand.Next(0, 100) < 66) - return false; - return true; - } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(). //Why is this here AddIngredient(). diff --git a/Items/Weapons/Ranged/HeavenlyGale.png b/Items/Weapons/Ranged/HeavenlyGale.png index 2288859de7..d6d2448ba7 100644 Binary files a/Items/Weapons/Ranged/HeavenlyGale.png and b/Items/Weapons/Ranged/HeavenlyGale.png differ diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 321a5945d5..0f8bfaf4ff 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -28,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.width = 66; Item.height = 34; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity5BuyPrice; @@ -42,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } - public override float UseSpeedMultiplier(Player player) => 1f - 0.5f * (player.Calamity().hellbornBoost * (1f / 600f)); + public override float UseTimeMultiplier(Player player) => 1f - 0.5f * (player.Calamity().hellbornBoost * (1f / 600f)); public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage *= 1f + player.Calamity().hellbornBoost * (1f / 600f); diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 936607181f..5f97e0f3e5 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAnimation = 7; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 478b411ce1..2878593d87 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 45; + Item.damage = 130; Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 24; @@ -35,9 +36,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index 805545e347..8fecb2d588 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -1,12 +1,13 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 191cb0118d..0c34b42f02 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item92; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index 4ab22199f4..5d8f6505a3 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item75; Item.autoReuse = true; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (!canHit) offset -= velocity; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { diff --git a/Items/Weapons/Ranged/MagnaStriker.cs b/Items/Weapons/Ranged/MagnaStriker.cs index 8a1a78fe61..f91b5c844c 100644 --- a/Items/Weapons/Ranged/MagnaStriker.cs +++ b/Items/Weapons/Ranged/MagnaStriker.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = OpalStriker.FireSound; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index a46dec82d5..54853fe496 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,13 +34,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 9.5f; Item.UseSound = SoundID.Item11; - Item.value = Item.buyPrice(2, 50, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Rocket; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 6258c7a0cc..9ab4284993 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item97; Item.autoReuse = true; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f; float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 1b03cc5e78..ae5468fba4 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Arrow; - Item.value = Item.buyPrice(gold: 80); // crafted out of nothing but 31 ectoplasm so it has unique pricing + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //Convert wooden arrows to Jester's Arrows - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) type = ProjectileID.JestersArrow; for (int i = 0; i < 3; i++) diff --git a/Items/Weapons/Ranged/MarniteBayonet.cs b/Items/Weapons/Ranged/MarniteBayonet.cs deleted file mode 100644 index e8c2b181a9..0000000000 --- a/Items/Weapons/Ranged/MarniteBayonet.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; -using Terraria; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Items.Weapons.Ranged -{ - [LegacyName("MarniteRifleSpear")] - public class MarniteBayonet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marnite Bayonet"); - Tooltip.SetDefault("The gun damages enemies that touch it"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 20; - Item.DamageType = DamageClass.Ranged; - Item.width = 72; - Item.height = 20; - Item.useTime = 28; - Item.useAnimation = 28; - Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item41; - Item.autoReuse = true; - Item.shootSpeed = 22f; - Item.useAmmo = AmmoID.Bullet; - Item.shoot = ProjectileID.PurificationPowder; - Item.Calamity().canFirePointBlankShots = true; - } - - //Custom melee hitbox - public override bool? CanHitNPC(Player player, NPC target) - { - Rectangle targetHitbox = target.Hitbox; - - float collisionPoint = 0f; - float gunLenght = 66f; - float gunHeight = 20f; - - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLenght), gunHeight, ref collisionPoint) ? null : false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnyGoldBar", 7). - AddIngredient(ItemID.Granite, 5). - AddIngredient(ItemID.Marble, 5). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/MarniteBayonet.png b/Items/Weapons/Ranged/MarniteBayonet.png deleted file mode 100644 index fac866dbf2..0000000000 Binary files a/Items/Weapons/Ranged/MarniteBayonet.png and /dev/null differ diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 895c4d968c..ea624c2947 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Meowthrower.cs b/Items/Weapons/Ranged/Meowthrower.cs index 4639f4d963..d3edddcd89 100644 --- a/Items/Weapons/Ranged/Meowthrower.cs +++ b/Items/Weapons/Ranged/Meowthrower.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Meowthrower"); - Tooltip.SetDefault("50% chance to not consume gel\n" + + Tooltip.SetDefault("85% chance to not consume gel\n" + "Fires blue and pink flames that emit meows on enemy hits"); SacrificeTotal = 1; } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.25f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs new file mode 100644 index 0000000000..9b194ca6dc --- /dev/null +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -0,0 +1,256 @@ +using System; +using System.IO; +using CalamityMod.Items.Materials; +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; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; +using CalamityMod.Projectiles.Ranged; +using System.Collections.Generic; +using static Microsoft.Xna.Framework.Input.Keys; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class MidasPrime : ModItem + { + public static float MaxDownwardsAngle4Coin = MathHelper.PiOver4; + + public static int ShotCoin = 0; + public static float SilverRicochetDamageMult = 1.5f; + public static float GoldRicochetDamageMult = 1.75f; + public static int RipeningTime = 100; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Midas Prime"); + Tooltip.SetDefault("Struck enemies drop extra coins\n" + + "Right click to throw a coin in the air. Hitting the coin with a bullet redirects the shot into the nearest enemy\n" + + "If you have multiple coins up in the air, bullets will first redirect towards other coins up to a maximum of 4\n" + + "Coin ricochets will increase the damage of the bullet, provided the coins have been in the air for long enough\n" + + "Coin throws consume gold and silver coins"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.damage = 52; + Item.DamageType = DamageClass.Ranged; + Item.width = 23; + Item.height = 8; + Item.useTime = 32; + Item.useAnimation = 32; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = Item.sellPrice(0, 7, 20, 0); + Item.rare = ItemRarityID.Pink; + Item.UseSound = CrackshotColt.ShootSound; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.useAmmo = AmmoID.Bullet; + Item.shootSpeed = 14f; + Item.Calamity().canFirePointBlankShots = true; + } + + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + //Using player.CanBuyItem() breaks if the player has too many platinum coins + long coinCount = Utils.CoinsCount(out bool overflow, player.inventory); + return overflow || coinCount >= 100; + } + return true; + } + + public override bool? UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + long coinCount = Utils.CoinsCount(out bool overflow, player.inventory); + + if (overflow || coinCount > 10000) + { + player.BuyItem(10000); + ShotCoin = 1; + } + + else + { + player.BuyItem(100); + ShotCoin = 0; + } + + //Clear prev coins + int ownedCoins = 0; + int oldestCoinIndex = -1; + int oldestCoinTime = 10000; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + + if (proj.active && proj.owner == player.whoAmI && proj.type == ModContent.ProjectileType()) + { + ownedCoins++; + if (proj.timeLeft < oldestCoinTime) + { + oldestCoinIndex = proj.whoAmI; + oldestCoinTime = proj.timeLeft; + } + } + } + + if (ownedCoins >= 4) + Main.projectile[oldestCoinIndex].Kill(); + + } + + return base.UseItem(player); + } + + public override void UseAnimation(Player player) + { + Item.UseSound = CrackshotColt.ShootSound; + if (player.altFunctionUse == 2) + Item.UseSound = CrackshotColt.BlingSound; + } + + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 5f; + return 1f; + } + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + position -= Vector2.UnitY * 13f; + + //Override every projectile + type = ModContent.ProjectileType(); + + if (player.altFunctionUse == 2) + { + damage = 0; + type = ModContent.ProjectileType(); + + //Ok the velocity is flipped because the in world coordinates have 0 at the top, so to do the typical trigo stuff we flip it, you get me. + float shootAngle = (player.Calamity().mouseWorld - player.MountedCenter).ToRotation() * -1; + + if (shootAngle > -MathHelper.Pi + MaxDownwardsAngle4Coin && shootAngle < -MathHelper.PiOver2) + shootAngle = -MathHelper.Pi + MaxDownwardsAngle4Coin; + + else if (shootAngle < -MaxDownwardsAngle4Coin && shootAngle >= -MathHelper.PiOver2) + shootAngle = -MaxDownwardsAngle4Coin; + + velocity = (shootAngle * -1).ToRotationVector2() * 1.3f - Vector2.UnitY * 1.12f + player.velocity / 4f; + } + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, ShotCoin); + return false; + } + + return base.Shoot(player, source, position, velocity, type, damage, knockback); + } + + + public override void ModifyTooltips(List tooltips) + { + if (Main.keyState.IsKeyDown(LeftShift)) + { + int tooltipIndex = -1; + int tooltipCount = 0; + + for (int i = 0; i < tooltips.Count; i++) + { + if (tooltips[i].Name.StartsWith("Tooltip")) + { + if (tooltipIndex == -1) + tooltipIndex = i; + + tooltipCount++; + } + } + + if (tooltipIndex != -1) + { + tooltips.RemoveRange(tooltipIndex, tooltipCount); + + TooltipLine bloodIsFuel = new TooltipLine(Mod, "CalamityMod:HiddenTooltip", "MANKIND IS DEAD.\nBLOOD IS FUEL.\nHELL IS FULL."); + bloodIsFuel.OverrideColor = Color.Red; + tooltips.Insert(tooltipIndex, bloodIsFuel); + } + } + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(50, 24); + Vector2 itemOrigin = new Vector2(-17, 3); + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.45f * (float)Math.Pow((0.4f - animProgress) / 0.4f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + } + + public class MidasPrimeItem : GlobalItem + { + public override bool InstancePerEntity => true; + public bool magnetMode = false; + + public override void GrabRange(Item item, Player player, ref int grabRange) + { + if (player.HeldItem.type == ModContent.ItemType() && magnetMode && item.timeSinceItemSpawned > 60) + grabRange *= 8; + } + + public override bool GrabStyle(Item item, Player player) + { + if (player.HeldItem.type == ModContent.ItemType() && magnetMode && item.timeSinceItemSpawned > 60) + { + //This is just Player.PullItemPickup() but not private + + Vector2 towardsPlayer = player.Center - item.Center; + float movementSpeed = towardsPlayer.Length(); + movementSpeed = 12 / movementSpeed; + towardsPlayer *= movementSpeed; + item.velocity = (item.velocity * 4f + towardsPlayer) / 5f; + return true; + } + + return false; + } + } + +} diff --git a/Items/Weapons/Ranged/MidasPrime.png b/Items/Weapons/Ranged/MidasPrime.png new file mode 100644 index 0000000000..75b73293e2 Binary files /dev/null and b/Items/Weapons/Ranged/MidasPrime.png differ diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index adedd19206..8597a50824 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Minigun.cs b/Items/Weapons/Ranged/Minigun.cs index 0ec6988d4c..5438f659dd 100644 --- a/Items/Weapons/Ranged/Minigun.cs +++ b/Items/Weapons/Ranged/Minigun.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,13 +30,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item41; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 22f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index 09c08bd9d1..f98668efa8 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item33; Item.autoReuse = true; Item.shootSpeed = 25f; diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 1664e6df92..6e031c5830 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ProjectileID.WoodenArrowFriendly; @@ -56,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (!canHit) offset -= velocity; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { int newType = type; switch (p) diff --git a/Items/Weapons/Ranged/NettlevineGreatbow.cs b/Items/Weapons/Ranged/NettlevineGreatbow.cs index 29d844516b..d9bb3c0bed 100644 --- a/Items/Weapons/Ranged/NettlevineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlevineGreatbow.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index c4080a1548..c4c7101c2a 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item92; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; diff --git a/Items/Weapons/Ranged/NullificationRifle.cs b/Items/Weapons/Ranged/NullificationRifle.cs index 98c64bf8fa..7e56de0cb5 100644 --- a/Items/Weapons/Ranged/NullificationRifle.cs +++ b/Items/Weapons/Ranged/NullificationRifle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item33; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 4ac07f7761..a5e7e6db81 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 4.5f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item36; Item.autoReuse = true; Item.shoot = ProjectileID.BlackBolt; diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index a903ba84ea..9c4ff812f8 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Opal Striker"); - Tooltip.SetDefault("Fires a string of opal strikes"); + Tooltip.SetDefault("50% chance to not consume ammo\n" + + "Fires a string of opal strikes"); SacrificeTotal = 1; } @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = FireSound; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index 4e731f1ae9..822ce39d16 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index 2b293c1f65..7abdc855e3 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.5f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item40; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 3037518166..b8c1d1337d 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -1,9 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,15 +22,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 110; - Item.width = 20; - Item.height = 12; + Item.damage = 180; + Item.width = 48; + Item.height = 82; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 3f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = SoundID.Item5; Item.noMelee = true; Item.noUseGraphic = true; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } @@ -50,6 +51,11 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/PhangasmGlow").Value); + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Phangasm.png b/Items/Weapons/Ranged/Phangasm.png index c18ca4431f..afd265a4dd 100644 Binary files a/Items/Weapons/Ranged/Phangasm.png and b/Items/Weapons/Ranged/Phangasm.png differ diff --git a/Items/Weapons/Ranged/PhangasmGlow.png b/Items/Weapons/Ranged/PhangasmGlow.png new file mode 100644 index 0000000000..21d211a1ac Binary files /dev/null and b/Items/Weapons/Ranged/PhangasmGlow.png differ diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 6b355ba7b2..162fcf73ac 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -40,8 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Gel; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 2742307561..824376a1cc 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Ranged num80 = num72 / num80; num78 *= num80; num79 *= num80; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { for (int i = 0; i < 7; i++) { diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs similarity index 97% rename from Items/Fishing/AstralCatches/PolarisParrotfish.cs rename to Items/Weapons/Ranged/PolarisParrotfish.cs index c8851bfa3e..c0827bea69 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -7,7 +7,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Sounds; -namespace CalamityMod.Items.Fishing.AstralCatches +namespace CalamityMod.Items.Weapons.Ranged { public class PolarisParrotfish : ModItem { diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.png b/Items/Weapons/Ranged/PolarisParrotfish.png similarity index 100% rename from Items/Fishing/AstralCatches/PolarisParrotfish.png rename to Items/Weapons/Ranged/PolarisParrotfish.png diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 2fe21ada13..850bc91ce5 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -40,9 +41,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 11f; Item.useAmmo = AmmoID.Gel; - Item.rare = ItemRarityID.Purple; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => new Vector2(-25, -10); diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 4e4f32d5fc..8a759a84c5 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 27; + Item.damage = 18; Item.DamageType = DamageClass.Ranged; Item.width = 72; Item.height = 34; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.noUseGraphic = true; Item.UseSound = SoundID.Item20; diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index 9e4bc188e3..eafb00ee1f 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item38; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ReedBlowgun.cs b/Items/Weapons/Ranged/ReedBlowgun.cs index 6c6048ef6f..f9051fd38f 100644 --- a/Items/Weapons/Ranged/ReedBlowgun.cs +++ b/Items/Weapons/Ranged/ReedBlowgun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 19; + Item.damage = 14; Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 46; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.holdStyle = 16; Item.noMelee = true; Item.knockBack = 13.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = null; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index 113f44eefd..e19fbecc3b 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 3039a82670..6198cb8543 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,14 +32,13 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index 7576bbc38e..d2a684a0e7 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index c8d1f1a923..9b3fad7b22 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -1,12 +1,13 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { @@ -37,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 8.7f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shootSpeed = 12.6f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index d01f8196fd..d88f0de65e 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.GrenadeLauncher). AddIngredient(ItemID.RocketLauncher). AddIngredient(ItemID.FragmentVortex, 20). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 9320dc9b71..7dce68c15a 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index 4091fccdfe..8ab249204e 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Shadethrower.cs b/Items/Weapons/Ranged/Shadethrower.cs index ffc2c9fefe..5b572fd44e 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index e33e76d1f7..626f92d13a 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index a6ed9244f4..5cdff65ae7 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item41; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index bfa05840d4..742416b9b5 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +28,7 @@ Replaces standard bullets with High Velocity Bullets public override void SetDefaults() { - Item.damage = 130; + Item.damage = 370; Item.DamageType = DamageClass.Ranged; Item.width = 94; Item.height = 34; @@ -42,7 +43,7 @@ Replaces standard bullets with High Velocity Bullets Item.useAmmo = AmmoID.Bullet; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.Calamity().canFirePointBlankShots = true; } @@ -64,7 +65,7 @@ Replaces standard bullets with High Velocity Bullets Vector2 vel = velocity; Projectile shot = Projectile.NewProjectileDirect(source, position, vel, type, damage, knockback, player.whoAmI); CalamityGlobalProjectile cgp = shot.Calamity(); - cgp.canSupercrit = true; + cgp.supercritHits = -1; cgp.appliesSomaShred = true; return false; } diff --git a/Items/Weapons/Ranged/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index 3d7dfcc794..7452177386 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; } diff --git a/Items/Weapons/Ranged/SpectreRifle.cs b/Items/Weapons/Ranged/SpectreRifle.cs index bf08a74b53..7d89c4ee19 100644 --- a/Items/Weapons/Ranged/SpectreRifle.cs +++ b/Items/Weapons/Ranged/SpectreRifle.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item40; Item.autoReuse = false; diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index d9a3e30a78..28a0ed4d61 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = null; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index bdbb1f3159..a51cf59d5f 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 6f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item108; Item.autoReuse = true; Item.shootSpeed = 9f; diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index 70c808b56d..fbfe1e3a7b 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 15f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item92; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index b4d59d2810..e4dcb27588 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 50; Item.UseSound = SoundID.Item92; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.useAmmo = AmmoID.FallenStar; Item.autoReuse = true; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index fd6a6fb6cc..e992b514b1 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item92; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 5d14f2f62e..6fb4f6f4f4 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -1,6 +1,7 @@ -using Terraria.DataStructures; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3.25f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/StormSurge.cs b/Items/Weapons/Ranged/StormSurge.cs index 936603dcb6..035f986c41 100644 --- a/Items/Weapons/Ranged/StormSurge.cs +++ b/Items/Weapons/Ranged/StormSurge.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5f; Item.UseSound = SoundID.Item122; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.autoReuse = true; //GRRRRRRRRRRRRRRRR false begone Item.shoot = ModContent.ProjectileType(); @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). + AddIngredient(3). AddIngredient(7). AddIngredient(10). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index ed1759a25a..6f0f9794a2 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -27,11 +28,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 6f; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item95; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => Vector2.UnitX * -15f; diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index ce109fabaf..007f257080 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index b1427beda5..9917158633 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.UseSound = SoundID.Item31; diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index b788428f2b..65afc9b5a1 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item102; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TerraFlameburster.cs b/Items/Weapons/Ranged/TerraFlameburster.cs index 19d074fa83..333702ef4f 100644 --- a/Items/Weapons/Ranged/TerraFlameburster.cs +++ b/Items/Weapons/Ranged/TerraFlameburster.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3.25f; Item.UseSound = SoundID.Item34; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 14ae918f00..732429e673 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index a7601bdbfe..8348d2e83b 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 88085341d9..17e42598d1 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -27,8 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index b18b583790..1a23c2cc2d 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 397; + Item.damage = 530; Item.width = 20; Item.height = 12; Item.useTime = 45; @@ -28,8 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 3f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index 828f62ee7f..9e7895162f 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs new file mode 100644 index 0000000000..4132ce2595 --- /dev/null +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -0,0 +1,184 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class TheSevensStriker : ModItem + { + public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest}; + public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f}; + public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust"); + public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles"); + public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples"); + public static readonly SoundStyle JackpotSound = new("CalamityMod/Sounds/Item/SevensStrikerJackpot"); + public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f }; + + public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier + public static readonly float RightClickCopperMultiplier = 0.04f; + public static readonly float RightClickSilverMultiplier = 0.08f; + public static readonly float RightClickGoldMultiplier = 0.16f; + + public static readonly float DoublesMultiplier = 2f; // Doubles means double damage! + public static readonly float TriplesCherryMultiplier = 1f; + public static readonly float TriplesGrapeMultiplier = 0.333f; // fixed the grapes interfering with each other's iframes + public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("The Sevens Striker"); + Tooltip.SetDefault("Left click to consume 1 coin and play a slot machine\n" + + "Quality of the outcome depends on the coin used\n" + + "Right click to rapidly fire a barrage of coins\n" + + "Right click has an 80% chance to not consume coins and will not fire platinum coins\n" + + "'A gun given to a great gunslinger\n" + + "Forged by the arms of a man given no name'"); + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.damage = 777; + Item.knockBack = 9f; + Item.useTime = 30; + Item.useAnimation = 30; + Item.DamageType = DamageClass.Ranged; + Item.noMelee = true; + Item.channel = true; + Item.useTurn = true; + Item.autoReuse = true; + Item.width = 170; + Item.height = 56; + Item.useStyle = ItemUseStyleID.Shoot; + Item.useAmmo = AmmoID.Coin; + Item.shootSpeed = 24f; + Item.reuseDelay = 0; + Item.shoot = ProjectileID.PlatinumCoin; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool? UseItem(Player player) + { + // Right click has a 20% chance to consume money + if (player.altFunctionUse == 2) + { + bool consumeCoin = Main.rand.NextFloat() > 0.8f; + long coinCount = Utils.CoinsCount(out bool overflow, player.inventory); + int price; + + if (overflow || coinCount > 10000) + { + price = 10000; + ShotCoin = ProjectileID.GoldCoin; + } + else if (coinCount > 100) + { + price = 100; + ShotCoin = ProjectileID.SilverCoin; + } + else + { + price = 1; + ShotCoin = ProjectileID.CopperCoin; + } + + if (consumeCoin) + player.BuyItem(price); + } + + // Left click does nothing, it just spawns the holdout + else + Item.shoot = ModContent.ProjectileType(); + + return base.UseItem(player); + } + + public override Vector2? HoldoutOffset() => new Vector2(-30, -11); + + // Left click spawns a holdout, so the item must not appear normally. + // Right click uses the item like a standard gun, so draw it normally. + public override void UseAnimation(Player player) + { + if (player.altFunctionUse == 2) + { + Item.UseSound = CoinSound; + Item.noUseGraphic = false; + } + else + { + Item.UseSound = null; + Item.noUseGraphic = true; + } + } + + // Right click fires coins extremely rapidly (3 use time) + public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.1f : 1f; + + // Right click consumes coins manually instead of using Terraria's ammo system + // (otherwise it could shoot Platinum Coins) + public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; + + public override bool CanUseItem(Player player) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) + return true; + + if (player.altFunctionUse == 2) + { + Utils.CoinsCount(out bool overflow, player.inventory); + return overflow; + } + return true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + // Right click damage multiplier varies by coin type + if (player.altFunctionUse == 2) + { + Vector2 shootDirection = velocity.SafeNormalize(Vector2.UnitX * player.direction); + Vector2 gunTip = position + shootDirection * Item.scale * 90f; + gunTip.Y -= 20f; + + // spread copied from Onyxia, angular conic spread instead of Terraria's square spread + float randAngle = Main.rand.NextFloat(-0.05f, 0.05f); + float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); + Vector2 finalVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; + float damageMult = ShotCoin == ProjectileID.GoldCoin + ? RightClickGoldMultiplier : ShotCoin == ProjectileID.SilverCoin + ? RightClickSilverMultiplier : RightClickCopperMultiplier; + int finalDamage = (int)(damage * damageMult); + Projectile.NewProjectile(source, gunTip, finalVelocity, ShotCoin, finalDamage, knockback, player.whoAmI); + } + + // Left click just spawns the holdout + else + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, type, 0f); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.CoinGun). + AddIngredient(1). + AddIngredient(ItemID.PlatinumCoin, 7). + AddIngredient(ItemID.GoldCoin, 77). + AddIngredient(2). + AddIngredient(ItemID.LunarBar, 12). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/TheSevensStriker.png b/Items/Weapons/Ranged/TheSevensStriker.png new file mode 100644 index 0000000000..fd7fa9bcd4 Binary files /dev/null and b/Items/Weapons/Ranged/TheSevensStriker.png differ diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index a810f59c3e..e20bcd8c3b 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item122; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Ranged num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.01f; float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.01f; - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) { Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, knockback, i); Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, knockback, i); diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index de9fdcd5ed..412a6aedb8 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 275; + Item.damage = 370; Item.DamageType = DamageClass.Ranged; Item.width = 62; Item.height = 32; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.channel = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item77 with { Volume = SoundID.Item77.Volume * 0.7f }; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 795b4d8a82..87adb73c6e 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (type == ProjectileID.WoodenArrowFriendly) + if (CalamityUtils.CheckWoodenAmmo(type, player)) Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, 0f, player.whoAmI); else Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index fca01b23da..4334aa9684 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -1,12 +1,13 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { @@ -23,11 +24,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 2250; + Item.damage = 1800; Item.knockBack = 9.5f; Item.DamageType = DamageClass.Ranged; - Item.useTime = 55; - Item.useAnimation = 55; + Item.useTime = 60; + Item.useAnimation = 60; Item.shoot = ProjectileID.BulletHighVelocity; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 49bceec011..53b50a468e 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -43,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index c58fd3db8f..66e81f06fb 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item38; Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Voidragon.cs b/Items/Weapons/Ranged/Voidragon.cs index 8966963f29..36b0029c2a 100644 --- a/Items/Weapons/Ranged/Voidragon.cs +++ b/Items/Weapons/Ranged/Voidragon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs new file mode 100644 index 0000000000..35ca114d55 --- /dev/null +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -0,0 +1,235 @@ +using System; +using System.IO; +using CalamityMod.Items.Materials; +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; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Weapons.Ranged +{ + [LegacyName("WulfrumBow")] + public class WulfrumBlunderbuss : ModItem + { + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFire") { PitchVariance = 0.1f }; + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.1f }; + + public static float MinSpreadDistance = 460f; + public static float MaxSpreadDistance = 60f; + public static float MinSpread = 0.2f; + public static float MaxSpread = 0.6f; + public static float MaxDamageFalloff = 0.8f; + public static int BulletCount = 6; + + public static int ShotsPerScrap = 30; + public int storedScrap = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Blunderbuss"); + Tooltip.SetDefault("Consumes wulfrum scrap or silver coins to fire\n" + + "The shot's spread can be diminished by aiming further away, at the cost of less damage\n" + + "Ignores 3 points of enemy Defense\n" + + "[c/83B87E:\"The good thing about Wulfrum is that while it breaks fast, it can be reused even faster\"]\n" + + "[c/83B87E:\"In fact, it is quite common for a robot to be turned into ammo right after it stops functioning\"]"); + //Funny lore quip about how it can perform ecgologically be recyling the scrap parts of the faulty robots youre forced to shoot at as new ammo. + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.damage = 8; + Item.ArmorPenetration = 3; + Item.DamageType = DamageClass.Ranged; + Item.width = 23; + Item.height = 8; + Item.useTime = 55; + Item.useAnimation = 55; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.rare = ItemRarityID.Blue; + Item.UseSound = ShootSound; + Item.autoReuse = false; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.Calamity().canFirePointBlankShots = true; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override bool CanUseItem(Player player) => storedScrap > 0 || (player.HasItem(ModContent.ItemType()) || player.HasItem(ItemID.SilverCoin)); + + public override void UseAnimation(Player player) + { + Item.UseSound = ShootSound; + if (storedScrap == 1 && (player.HasItem(ModContent.ItemType()) || player.HasItem(ItemID.SilverCoin))) + Item.UseSound = ShootAndReloadSound; + } + + public override bool? UseItem(Player player) + { + storedScrap--; + + if (storedScrap <= 0) + { + bool ammoConsumed = false; + + if (player.HasItem(ModContent.ItemType())) + { + player.ConsumeItem(ModContent.ItemType()); + ammoConsumed = true; + } + + else if (player.HasItem(ItemID.SilverCoin)) + { + player.ConsumeItem(ItemID.SilverCoin); + ammoConsumed = true; + } + + if (ammoConsumed) + storedScrap = ShotsPerScrap; + } + + return base.UseItem(player); + } + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + float aimLenght = (Main.MouseWorld - player.MountedCenter).Length(); + float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLenght - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance)); + damage = (int)(damage * damageMult); + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.Calamity().GeneralScreenShakePower < 3f) + player.Calamity().GeneralScreenShakePower = 3f; + + float aimLenght = (Main.MouseWorld - player.MountedCenter).Length(); + float spreadDistance = Math.Clamp(aimLenght - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance); + float spread = MathHelper.Lerp(MaxSpread, MinSpread, spreadDistance); + + Vector2 nuzzleDir = velocity.SafeNormalize(Vector2.Zero); + + + for (int i = 0; i < BulletCount; i++) + { + Vector2 direction = nuzzleDir.RotatedByRandom(spread); + Vector2 nuzzlePos = player.MountedCenter + direction * 15f; + + Projectile.NewProjectile(player.GetSource_ItemUse_WithPotentialAmmo(Item, Item.useAmmo), nuzzlePos, direction * Item.shootSpeed * Main.rand.NextFloat(1.5f, 2f), type, damage, (int)Item.knockBack, player.whoAmI, 0, 0); + } + + return false; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(46, 16); + Vector2 itemOrigin = new Vector2(-13, 3); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.45f * (float)Math.Pow((0.4f - animProgress) / 0.4f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + + //Reloads the gun + if (animProgress > 0.5f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + float barScale = 1.2f; + + var barBG = ModContent.Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/ExtraTextures/GenericBarFront").Value; + + Vector2 drawPos = position + Vector2.UnitY * (frame.Height - 2 + 6f) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f; + Rectangle frameCrop = new Rectangle(0, 0, (int)(storedScrap / (float)ShotsPerScrap * barFG.Width), barFG.Height); + Color colorBG = Color.RoyalBlue; + Color colorFG = Color.Lerp(Color.Teal, Color.YellowGreen, storedScrap / (float)ShotsPerScrap); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, origin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG * 0.8f, 0f, origin, scale * barScale, 0f, 0f); + + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, storedScrap.ToString(), drawPos + new Vector2(-3, -3) * scale, Color.GreenYellow, Color.Black, scale); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(9). + AddTile(TileID.Anvils). + Register(); + } + + public override void OnCraft(Recipe recipe) + { + storedScrap = ShotsPerScrap; + } + + #region saving the durability + public override ModItem Clone(Item item) + { + ModItem clone = base.Clone(item); + if (clone is WulfrumBlunderbuss a && item.ModItem is WulfrumBlunderbuss a2) + { + a.storedScrap = a2.storedScrap; + } + return clone; + } + + public override void SaveData(TagCompound tag) + { + tag["ammoStored"] = storedScrap; + } + + public override void LoadData(TagCompound tag) + { + storedScrap = tag.GetInt("ammoStored"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(storedScrap); + } + + public override void NetReceive(BinaryReader reader) + { + storedScrap = reader.ReadInt32(); + } + #endregion + } +} diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.png b/Items/Weapons/Ranged/WulfrumBlunderbuss.png new file mode 100644 index 0000000000..92018ea6fb Binary files /dev/null and b/Items/Weapons/Ranged/WulfrumBlunderbuss.png differ diff --git a/Items/Weapons/Ranged/WulfrumBow.cs b/Items/Weapons/Ranged/WulfrumBow.cs deleted file mode 100644 index 18f96b284e..0000000000 --- a/Items/Weapons/Ranged/WulfrumBow.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class WulfrumBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Bow"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 12; - Item.DamageType = DamageClass.Ranged; - Item.width = 27; - Item.height = 38; - Item.useTime = 25; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2.25f; - Item.value = Item.buyPrice(0, 1, 0, 0); - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item5; - Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 12f; - Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/WulfrumBow.png b/Items/Weapons/Ranged/WulfrumBow.png deleted file mode 100644 index c935117185..0000000000 Binary files a/Items/Weapons/Ranged/WulfrumBow.png and /dev/null differ diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs index cf1c2fb4cc..8c3c149906 100644 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ b/Items/Weapons/Rogue/AcidicRainBarrel.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class AcidicRainBarrel : ModItem + public class AcidicRainBarrel : RogueWeapon { public override void SetStaticDefaults() { @@ -31,12 +31,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { velocity.Y *= 0.667f; @@ -47,6 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index a353953650..c98dc683ab 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class AdamantiteThrowingAxe : ModItem + public class AdamantiteThrowingAxe : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index 513e95341e..0190e5ea0b 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class AlphaVirus : ModItem + public class AlphaVirus : RogueWeapon { public override void SetStaticDefaults() { @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index a5c6efbc9e..e66dd63d18 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Apoctolith : ModItem + public class Apoctolith : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index 0f42c6b718..c06cdf6031 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class AshenStalactite : ModItem + public class AshenStalactite : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index 1863722c8d..83f6233d7c 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -9,7 +9,7 @@ using Terraria.GameContent; namespace CalamityMod.Items.Weapons.Rogue { - public class AuroradicalThrow : ModItem + public class AuroradicalThrow : RogueWeapon { public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item117; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 710f0d323f..b764e0565f 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BallisticPoisonBomb : ModItem + public class BallisticPoisonBomb : RogueWeapon { public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 38; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/BlastBarrel.cs b/Items/Weapons/Rogue/BlastBarrel.cs index e694373e73..be8094d0bd 100644 --- a/Items/Weapons/Rogue/BlastBarrel.cs +++ b/Items/Weapons/Rogue/BlastBarrel.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BlastBarrel : ModItem + public class BlastBarrel : RogueWeapon { public const int BaseDamage = 32; public override void SetStaticDefaults() @@ -32,12 +32,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 12, 0, 0); //2 gold 40 silver sellprice + Item.value = CalamityGlobalItem.Rarity4BuyPrice; //2 gold 40 silver sellprice Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { velocity.Y *= 0.85f; diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index bb90746812..51ab5becbb 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -8,15 +8,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BlazingStar : ModItem + public class BlazingStar : RogueWeapon { public const float Speed = 13f; public override void SetStaticDefaults() { DisplayName.SetDefault("Blazing Star"); - Tooltip.SetDefault("Stacks up to 4\n" + + Tooltip.SetDefault("Stacks up to 3\n" + "Stealth strikes release all stars at once with infinite piercing"); - SacrificeTotal = 4; + SacrificeTotal = 3; } public override void SetDefaults() @@ -31,10 +31,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; - Item.maxStack = 4; + Item.maxStack = 3; Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index f5d5f30bd4..8ced1713b8 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BloodsoakedCrasher : ModItem //This weapon has been coded by Ben || Termi + public class BloodsoakedCrasher : RogueWeapon //This weapon has been coded by Ben || Termi { public override void SetStaticDefaults() { @@ -36,8 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } 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/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index ab35eeb47f..be85a8698e 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BouncingEyeball : ModItem + public class BouncingEyeball : RogueWeapon { public const int BaseDamage = 15; public override void SetStaticDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.5f; Item.rare = ItemRarityID.Green; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.DamageType = RogueDamageClass.Instance; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 10f; Item.autoReuse = true; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool bloodMoon = Main.bloodMoon; diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index 39f558d4a4..8abd0f4ae1 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -7,14 +7,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BouncySpikyBall : ModItem + public class BouncySpikyBall : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Bouncy Spiky Ball"); Tooltip.SetDefault(@"Throws a very bouncy ball that ricochets off walls and enemies Receives a small boost in damage and velocity after bouncing off an enemy -Stealth strikes provide a bigger boost after ricocheting"); +Stealth strikes throw four at once"); SacrificeTotal = 99; } @@ -44,9 +44,17 @@ Stealth strikes provide a bigger boost after ricocheting"); { 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; + int spread = 3; + for (int i = 0; i < 4; i++) + { + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + } + spread -= Main.rand.Next(1,4); + } return false; } return true; diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 3490a97e28..f075ea1c9c 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BrackishFlask : ModItem + public class BrackishFlask : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.height = 30; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 8e5cfd0fc2..2a93c4d3e0 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Brimblade : ModItem + public class Brimblade : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.height = 26; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 654044ff6b..82b99bc32d 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BurningStrife : ModItem + public class BurningStrife : RogueWeapon { public override void SetStaticDefaults() { @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 28; Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index c82d19e31f..61c46f04d6 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CelestialReaper : ModItem + public class CelestialReaper : RogueWeapon { public const int BaseDamage = 140; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.value = Item.buyPrice(platinum: 1); //sell price of 20 gold + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index f2f699b328..bbdc909203 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Celestus : ModItem + public class Celestus : RogueWeapon { public override void SetStaticDefaults() { @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } 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/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index 3af6184919..a6d4bcf3c1 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Cinquedea : ModItem + public class Cinquedea : RogueWeapon { public static int BaseDamage = 36; public static float Knockback = 5f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 234e552f20..0294996832 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CobaltKunai : ModItem + public class CobaltKunai : RogueWeapon { public override void SetStaticDefaults() { @@ -41,8 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - damage = (int)(damage * 1.4f); - for (int i = -6; i <= 6; i += 6) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index d08b5e152b..c116bdd535 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ConsecratedWater : ModItem + public class ConsecratedWater : RogueWeapon { public const int BaseDamage = 48; diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index c84522e366..4919bf14ac 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ContaminatedBile : ModItem + public class ContaminatedBile : RogueWeapon { public override void SetStaticDefaults() { @@ -28,21 +28,22 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; Item.rare = ItemRarityID.Green; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 16b1b82cf0..48cac4eb3a 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CorpusAvertor : ModItem + public class CorpusAvertor : RogueWeapon { public override void SetStaticDefaults() { @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 18; - Item.height = 32; + Item.width = 32; + Item.height = 44; Item.damage = 98; Item.noMelee = true; Item.noUseGraphic = true; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(gold: 80); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/CorpusAvertor.png b/Items/Weapons/Rogue/CorpusAvertor.png index 1d32c48c94..5d8b4f5e86 100644 Binary files a/Items/Weapons/Rogue/CorpusAvertor.png and b/Items/Weapons/Rogue/CorpusAvertor.png differ diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index a4455b66a8..73fef73163 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { - public class CosmicKunai : ModItem + public class CosmicKunai : RogueWeapon { private int counter = 0; @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.height = 48; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index f53496f153..5893cad1a9 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CraniumSmasher : ModItem + public class CraniumSmasher : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 15; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index eac3b694cc..85bc15f8c9 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CrushsawCrasher : ModItem + public class CrushsawCrasher : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 22; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 945116069b..3dd373c484 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CrystalPiercer : ModItem + public class CrystalPiercer : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index 32a7f006a3..c0e463d9b4 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Crystalline : ModItem + public class Crystalline : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/CursedDagger.cs b/Items/Weapons/Rogue/CursedDagger.cs index 2342e63dc5..4ab5ef7025 100644 --- a/Items/Weapons/Rogue/CursedDagger.cs +++ b/Items/Weapons/Rogue/CursedDagger.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CursedDagger : ModItem + public class CursedDagger : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 34; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index f89160d94f..5bd89fe969 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class DeepSeaDumbbell : ModItem + public class DeepSeaDumbbell : RogueWeapon { private const float FlexMultMax = 5f; private float flexMult = 1f; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -89,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Rogue } if (player.Calamity().StealthStrikeAvailable()) - damage = (int)(damage * 1.3); + damage = (int)(damage * 0.4); int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 8fb5f9e540..c50c9a9c51 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class DeepWounder : ModItem + public class DeepWounder : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 48; Item.maxStack = 1; Item.rare = ItemRarityID.Lime; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 9af906c732..ffcb44a4c5 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -8,7 +8,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Rogue { - public class DefectiveSphere : ModItem + public class DefectiveSphere : RogueWeapon { public static int BaseDamage = 130; public static float Speed = 15f; @@ -38,7 +38,7 @@ Stealth strikes launch all 4 sphere types at once"); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item15; //phaseblade sound effect - Item.value = Item.buyPrice(0, 16, 0, 0); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice / 5; // Stacks up to 5 Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/DeificThunderbolt.cs b/Items/Weapons/Rogue/DeificThunderbolt.cs index 01c93b6d2d..f113ee2f23 100644 --- a/Items/Weapons/Rogue/DeificThunderbolt.cs +++ b/Items/Weapons/Rogue/DeificThunderbolt.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class DeificThunderbolt : ModItem + public class DeificThunderbolt : RogueWeapon { public override void SetStaticDefaults() { @@ -34,8 +35,7 @@ Stealth strikes summon more lightning and travel faster"); Item.useTime = 21; Item.useAnimation = 21; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; @@ -67,7 +67,7 @@ Stealth strikes summon more lightning and travel faster"); { CreateRecipe(). AddIngredient(). - AddIngredient(8). + AddIngredient(3). AddIngredient(15). AddIngredient(5). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Rogue/DesecratedWater.cs b/Items/Weapons/Rogue/DesecratedWater.cs index 01d3b1dca0..9e740aaf8b 100644 --- a/Items/Weapons/Rogue/DesecratedWater.cs +++ b/Items/Weapons/Rogue/DesecratedWater.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class DesecratedWater : ModItem + public class DesecratedWater : RogueWeapon { public const int BaseDamage = 55; public override void SetStaticDefaults() diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index bc49b6427a..1ca5ed059d 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -7,13 +7,13 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class DukesDecapitator : ModItem + public class DukesDecapitator : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Duke's Decapitator"); Tooltip.SetDefault("Throws a hydro axe which shreds enemies when it comes into contact with them\n" - +"The faster it�s spinning, the more times it hits before disappearing\n" + +"The faster it's spinning, the more times it hits before disappearing\n" +"Stealth Strikes make it emit short-ranged bubbles."); SacrificeTotal = 1; } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 30; Item.knockBack = 2f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index f7215c654e..a76b3373c2 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class DuststormInABottle : ModItem + public class DuststormInABottle : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.height = 24; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs new file mode 100644 index 0000000000..10e311b62d --- /dev/null +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -0,0 +1,84 @@ +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class DynamicPursuer : RogueWeapon + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Dynamic Pursuer"); + Tooltip.SetDefault("A weapon that, as it flies, processes calculations and fires electricity\n" + + "Releases a flying disk that fires electricity at nearby enemies\n" + + "Stealth strikes allow the disk to ricochet multiple times and unleash an electric explosion, then fire inaccurate lasers while returning"); + } + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + + Item.damage = 3100; + Item.DamageType = RogueDamageClass.Instance; + + Item.width = 30; + Item.height = 34; + Item.useTime = 40; + Item.useAnimation = 40; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = false; + Item.knockBack = 3f; + + Item.value = CalamityGlobalItem.Rarity15BuyPrice; + Item.rare = ModContent.RarityType(); + + Item.noUseGraphic = true; + + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; + + modItem.UsesCharge = true; + modItem.MaxCharge = 320f; // Tesla Cannon = 250f + modItem.ChargePerUse = 0.5f; // Tesla Cannon = 0.9f + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Vector2 initialVelocity = velocity; + int totalDamage = damage; + if (player.Calamity().StealthStrikeAvailable()) + { + initialVelocity *= 1.2f; + totalDamage = (int)(damage * 0.15f); + } + int proj = Projectile.NewProjectile(source, position, initialVelocity, type, totalDamage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(). + AddIngredient(5). + AddTile(). + Register(); + } + } +} diff --git a/Items/Weapons/Rogue/DynamicPursuer.png b/Items/Weapons/Rogue/DynamicPursuer.png new file mode 100644 index 0000000000..30c3bdd018 Binary files /dev/null and b/Items/Weapons/Rogue/DynamicPursuer.png differ diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 7f8ec3a307..b70ca6c9ec 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class EclipsesFall : ModItem + public class EclipsesFall : RogueWeapon { public override void SetStaticDefaults() { @@ -36,8 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } 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/ElementalDisk.cs b/Items/Weapons/Rogue/ElementalDisk.cs index 2eb0aae451..36fe42ada4 100644 --- a/Items/Weapons/Rogue/ElementalDisk.cs +++ b/Items/Weapons/Rogue/ElementalDisk.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { [LegacyName("AccretionDisk")] - public class ElementalDisk : ModItem + public class ElementalDisk : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index 51bddc7524..d87d0c09c2 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class EnchantedAxe : ModItem + public class EnchantedAxe : RogueWeapon { public override void SetStaticDefaults() { @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.maxStack = 1; Item.value = 1000; Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; Item.DamageType = RogueDamageClass.Instance; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(100). AddIngredient(ItemID.FallenStar, 5). - AddIngredient(10). + AddIngredient(10). AddIngredient(ItemID.Bone, 30). AddTile(TileID.Anvils). Register(); @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(100). AddIngredient(ItemID.FallenStar, 5). - AddIngredient(10). + AddIngredient(10). AddIngredient(ItemID.Bone, 30). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Rogue/EpidemicShredder.cs b/Items/Weapons/Rogue/EpidemicShredder.cs index 565528a31b..339fabf5d3 100644 --- a/Items/Weapons/Rogue/EpidemicShredder.cs +++ b/Items/Weapons/Rogue/EpidemicShredder.cs @@ -8,7 +8,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class EpidemicShredder : ModItem + public class EpidemicShredder : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 286d5278da..79a8b4be30 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Equanimity : ModItem + public class Equanimity : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 3e95b96ab8..da3bd27dd1 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Eradicator : ModItem + public class Eradicator : RogueWeapon { public static float Speed = 10.5f; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 65aff16e60..41aaa81ff3 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -1,16 +1,17 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ExecutionersBlade : ModItem + public class ExecutionersBlade : RogueWeapon { private int counter = 0; @@ -36,12 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item73; Item.autoReuse = true; Item.height = 64; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 26f; Item.DamageType = RogueDamageClass.Instance; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 48ae7d12b8..ab6588b120 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Exorcism : ModItem + public class Exorcism : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 362c5bf9da..62c5ba7c74 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class FantasyTalisman : ModItem + public class FantasyTalisman : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 29d3f95014..6f7fc3fef1 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class FeatherKnife : ModItem + public class FeatherKnife : RogueWeapon { public override void SetStaticDefaults() { @@ -21,17 +21,17 @@ Stealth strike throws a volley of knives"); public override void SetDefaults() { Item.width = 18; - Item.damage = 25; - Item.noMelee = true; - Item.consumable = true; - Item.noUseGraphic = true; - Item.useAnimation = 11; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; - Item.knockBack = 2f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; Item.height = 32; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.damage = 16; + Item.useAnimation = Item.useTime = 20; + Item.knockBack = 2f; + Item.autoReuse = true; + Item.consumable = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; Item.maxStack = 999; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs index a9adc4b9dd..3c367cea84 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,7 +7,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Rogue { - public class FinalDawn : ModItem + public class FinalDawn : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.autoReuse = false; diff --git a/Items/Weapons/Rogue/FishboneBoomerang.cs b/Items/Weapons/Rogue/FishboneBoomerang.cs index 0ac9d43dc7..6b0c30ad48 100644 --- a/Items/Weapons/Rogue/FishboneBoomerang.cs +++ b/Items/Weapons/Rogue/FishboneBoomerang.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { [LegacyName("SeashellBoomerang")] - public class FishboneBoomerang : ModItem + public class FishboneBoomerang : RogueWeapon { public override void SetStaticDefaults() { @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 18; - Item.damage = 24; + Item.damage = 27; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 15; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5.5f; Item.UseSound = null; Item.height = 34; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index f49c245846..7ce3f000f5 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -11,7 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class FrostcrushValari : ModItem + public class FrostcrushValari : RogueWeapon { public static float Speed = 15f; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl Item.damage = 100; Item.knockBack = 12; Item.DamageType = DamageClass.Throwing; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.useTime = 19; Item.useAnimation = 19; diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 5ed5d33784..1cf368e7cc 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class FrostyFlare : ModItem + public class FrostyFlare : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Fishing/AstralCatches/GacruxianMollusk.cs b/Items/Weapons/Rogue/GacruxianMollusk.cs similarity index 90% rename from Items/Fishing/AstralCatches/GacruxianMollusk.cs rename to Items/Weapons/Rogue/GacruxianMollusk.cs index 4cebdeee9f..92189c974d 100644 --- a/Items/Fishing/AstralCatches/GacruxianMollusk.cs +++ b/Items/Weapons/Rogue/GacruxianMollusk.cs @@ -5,10 +5,9 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Fishing.AstralCatches +namespace CalamityMod.Items.Weapons.Rogue { - // TODO -- This is a rogue weapon. It should be in Items/Weapons/Rogue. I do not care if it comes from fishing. - public class GacruxianMollusk : ModItem + public class GacruxianMollusk : RogueWeapon { public static int BaseDamage = 36; public static float Knockback = 5f; diff --git a/Items/Fishing/AstralCatches/GacruxianMollusk.png b/Items/Weapons/Rogue/GacruxianMollusk.png similarity index 100% rename from Items/Fishing/AstralCatches/GacruxianMollusk.png rename to Items/Weapons/Rogue/GacruxianMollusk.png diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index 72d9204984..bfb35fc67a 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class GelDart : ModItem + public class GelDart : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index 6f59304af2..d6b4acf8be 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class GhoulishGouger : ModItem + public class GhoulishGouger : RogueWeapon { public override void SetStaticDefaults() { @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index e7c942cae2..9b392526f2 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class GildedDagger : ModItem + public class GildedDagger : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index 65245d9d42..86740191ca 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Glaive : ModItem + public class Glaive : RogueWeapon { public static int BaseDamage = 45; public static float Knockback = 3f; @@ -34,7 +34,7 @@ Stealth strikes are super fast and pierce infinitely"); Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = Knockback; - Item.value = Item.buyPrice(0, 1, 40, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice / 3; // Stacks up to 3 Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.maxStack = 3; diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 0edd2e0739..194b60fb93 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class GleamingDagger : ModItem + public class GleamingDagger : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index a88f65f593..f18caf3c50 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -1,16 +1,17 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class GodsParanoia : ModItem + public class GodsParanoia : RogueWeapon { private static int damage = 98; private static int knockBack = 5; @@ -37,9 +38,8 @@ Right click to delete all existing spiky balls"); Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = knockBack; - Item.value = Item.buyPrice(0, 18, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice / 10; // Stacks up to 10 + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 10; diff --git a/Items/Weapons/Rogue/GraveGrimreaver.cs b/Items/Weapons/Rogue/GraveGrimreaver.cs new file mode 100644 index 0000000000..1910a18ca9 --- /dev/null +++ b/Items/Weapons/Rogue/GraveGrimreaver.cs @@ -0,0 +1,70 @@ +using Terraria.DataStructures; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class GraveGrimreaver : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grave Grimreaver"); + Tooltip.SetDefault("Hurls a cursed scythe which homes in\n"+ + "The scythe summons skulls as it flies and explodes into bats on hit\n"+ + "Stealth strikes spawn a flood of bats and falling skulls\n"+ + "Inflicts cursed flames and confusion\n"+ + "'A dapper skeleton's weapon of choice'"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 80; + Item.damage = 25; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = 50; + Item.useTime = 50; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 4f; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.height = 68; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.DamageType = RogueDamageClass.Instance; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.rare = ItemRarityID.LightPurple; + Item.Calamity().donorItem = true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + damage = (int)(damage * 1.1); + int proj = Projectile.NewProjectile(source, position, velocity * 1.1f, type, damage / 2, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + } + return false; + } + return true; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Sickle, 1). + AddRecipeGroup("TombstonesGroup"). + AddIngredient(ItemID.Bone, 50). + AddIngredient(ItemID.CursedFlame, 5). + AddIngredient(ItemID.SoulofFright, 10). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Rogue/GraveGrimreaver.png b/Items/Weapons/Rogue/GraveGrimreaver.png new file mode 100644 index 0000000000..30129f3d37 Binary files /dev/null and b/Items/Weapons/Rogue/GraveGrimreaver.png differ diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 4394dcad83..f6d6283d88 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class HardenedHoneycomb : ModItem + public class HardenedHoneycomb : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index 352af066e6..d9c6dd1617 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class HeavenfallenStardisk : ModItem + public class HeavenfallenStardisk : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index 484917e262..a9b11a0431 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -9,11 +9,11 @@ using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { - public class HellsSun : ModItem + public class HellsSun : RogueWeapon { - private static int damage = 85; + private static int damage = 240; private static int knockBack = 5; - private static float SdamageMult = 0.6f; + private static float SdamageMult = 0.12f; public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index b409bcc3cb..19e9f2e093 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Hypothermia : ModItem + public class Hypothermia : RogueWeapon { // For more consistent DPS, always alternates between throwing 1 and 2 instead of picking randomly private bool throwTwo = true; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item7; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.damage = 200; Item.useAnimation = 21; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index edee433555..560f30e084 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class IceStar : ModItem + public class IceStar : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index 2e16dff828..0c5f089ec1 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Icebreaker : ModItem + public class Icebreaker : RogueWeapon { public override void SetStaticDefaults() { @@ -22,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 60; Item.noMelee = true; Item.noUseGraphic = true; + Item.autoReuse = true; Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 14; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.Melee; Item.height = 60; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index 3dda00b5f7..96dc09d51a 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class IchorSpear : ModItem + public class IchorSpear : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index 3e69b93141..8309c66e92 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class InfernalKris : ModItem + public class InfernalKris : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/InfestedClawmerang.cs b/Items/Weapons/Rogue/InfestedClawmerang.cs index 66cc9197b7..c15a868376 100644 --- a/Items/Weapons/Rogue/InfestedClawmerang.cs +++ b/Items/Weapons/Rogue/InfestedClawmerang.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Rogue { // only renamed because vanilla added a Shroomerang [LegacyName("Shroomerang")] - public class InfestedClawmerang : ModItem + public class InfestedClawmerang : RogueWeapon { public override void SetStaticDefaults() { @@ -30,9 +30,10 @@ Stealth strikes grant the Mushy buff to the user on enemy hits and summon homing Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item1; + Item.autoReuse = true; Item.height = 50; Item.rare = ItemRarityID.Green; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 613a00f44a..cdc5a15591 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class IronFrancisca : ModItem + public class IronFrancisca : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index b16a885650..1a2834e2b3 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class JawsOfOblivion : ModItem + public class JawsOfOblivion : RogueWeapon { public override void SetStaticDefaults() { @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 60f188fc81..e3f9564a1b 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -11,7 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class KelvinCatalyst : ModItem + public class KelvinCatalyst : RogueWeapon { public override void SetStaticDefaults() { @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.height = 20; - Item.value = Item.buyPrice(gold: 36); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index d6533005ba..58f7506044 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Kylie : ModItem + public class Kylie : RogueWeapon { public static float Speed = 11f; public override void SetStaticDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 63; Item.knockBack = 12; Item.DamageType = DamageClass.Throwing; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.useTime = 25; Item.useAnimation = 25; diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 6b51d2f271..e786d46b36 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class LeadTomahawk : ModItem + public class LeadTomahawk : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index ae6b37296a..f2bde4ba13 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class LeonidProgenitor : ModItem + public class LeonidProgenitor : RogueWeapon { public static readonly Color blueColor = new Color(48, 208, 255); public static readonly Color purpleColor = new Color(208, 125, 218); diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index f173bbd4d4..8b491446df 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class LeviathanTeeth : ModItem + public class LeviathanTeeth : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.height = 38; Item.maxStack = 1; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 5da9c663da..fab062fe35 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Lionfish : ModItem + public class Lionfish : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 40; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/LuminousStriker.cs b/Items/Weapons/Rogue/LuminousStriker.cs index a4d79ac64c..926e570b7d 100644 --- a/Items/Weapons/Rogue/LuminousStriker.cs +++ b/Items/Weapons/Rogue/LuminousStriker.cs @@ -8,7 +8,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class LuminousStriker : ModItem + public class LuminousStriker : RogueWeapon { public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(1, 0, 0, 0); + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index a6b55b50c4..dceeecbc34 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -8,7 +8,7 @@ using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.Weapons.Rogue { - public class LunarKunai : ModItem + public class LunarKunai : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 203a5c8450..80ea64f05e 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Malachite : ModItem + public class Malachite : RogueWeapon { public override void SetStaticDefaults() { @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 28; - Item.damage = 120; + Item.damage = 55; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 10; + Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1.25f; Item.UseSound = SoundID.Item1; @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Rogue for (float i = -6.5f; i <= 6.5f; i += 6.5f) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage * 2, knockback, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, type, (int)(damage * 1.3), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 75a997b9c7..2cf2daec4a 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MangroveChakram : ModItem + public class MangroveChakram : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.height = 38; - Item.value = Item.buyPrice(gold: 60); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/MetalMonstrosity.cs b/Items/Weapons/Rogue/MetalMonstrosity.cs index b5fe82926a..6983d31850 100644 --- a/Items/Weapons/Rogue/MetalMonstrosity.cs +++ b/Items/Weapons/Rogue/MetalMonstrosity.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MetalMonstrosity : ModItem + public class MetalMonstrosity : RogueWeapon { public override void SetStaticDefaults() { @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.damage = 30; Item.useAnimation = 40; diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 49be1de2db..f9fb0bb411 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MeteorFist : ModItem + public class MeteorFist : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.height = 28; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index b2a439c5f0..1a058971b4 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MoltenAmputator : ModItem + public class MoltenAmputator : RogueWeapon { public const float Speed = 21f; @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.height = 60; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs index 840f82cf16..9408a71556 100644 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ b/Items/Weapons/Rogue/MonkeyDarts.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MonkeyDarts : ModItem + public class MonkeyDarts : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index f54fdddc4b..ad9fab39cc 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -1,26 +1,28 @@ -using Terraria.DataStructures; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Mycoroot : ModItem + public class Mycoroot : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Mycoroot"); Tooltip.SetDefault("Fires a stream of short-range fungal roots\n" + - "Stealth strikes spawn an explosion of fungi spores"); + "Stealth strikes spawn an explosion of fungi spores\n" + + "and grant you and all other players the Mushy buff for 15 seconds"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 32; - Item.damage = 10; + Item.damage = 12; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 5; @@ -31,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.height = 32; Item.rare = ItemRarityID.Green; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; @@ -43,13 +45,24 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - for (float i = 0; i < Main.rand.Next(7,11); i++) + int projAmt = Main.rand.Next(7,11); + for (int i = 0; i < projAmt; i++) { - int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockback, player.whoAmI); if (spore.WithinBounds(Main.maxProjectiles)) Main.projectile[spore].ai[1] = 1f; } + for (int i = 0; i < Main.maxPlayers; i++) + { + Player other = Main.player[i]; + if (other is null || !other.active || other.dead) + continue; + if ((other.team == player.team && player.team != 0) || player.whoAmI == i) + { + if (player.Distance(other.Center) <= 800f) + other.AddBuff(ModContent.BuffType(), 900); + } + } } return false; } diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index 459e4e729d..0a5a243d27 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MythrilKnife : ModItem + public class MythrilKnife : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index 5ecdcd76ee..0709ef2d95 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue { // Deny me no longer! [LegacyName("NanoblackReaperMelee", "NanoblackReaperRogue")] - public class NanoblackReaper : ModItem + public class NanoblackReaper : RogueWeapon { public static int BaseDamage = 130; public static float Knockback = 9f; @@ -43,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item18; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 5fb49506e7..392bc5dfaa 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class NastyCholla : ModItem + public class NastyCholla : RogueWeapon { public static int BaseDamage = 9; diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index f2ce812b5e..6ff2c3df15 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -1,16 +1,17 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class NightsGaze : ModItem + public class NightsGaze : RogueWeapon { public override void SetStaticDefaults() { @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index 610592df19..85cb07d3bb 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Nychthemeron : ModItem + public class Nychthemeron : RogueWeapon { public override void SetStaticDefaults() { @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.height = 18; Item.maxStack = 10; - Item.value = Item.buyPrice(0, 3, 60, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice / 10; // Stacks up to 10 Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index 8bbcda6eeb..be727d5988 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class OrichalcumSpikedGemstone : ModItem + public class OrichalcumSpikedGemstone : RogueWeapon { public override void SetStaticDefaults() { @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[gemstone].Calamity().stealthStrike = true; Main.projectile[gemstone].usesLocalNPCImmunity = true; Main.projectile[gemstone].timeLeft = 900; - Main.projectile[gemstone].penetrate = -1; + Main.projectile[gemstone].penetrate = 4; } return false; } diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 8763406645..cd3e3943f3 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class PalladiumJavelin : ModItem + public class PalladiumJavelin : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index c4cc4b7f6b..72beb71f0b 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Penumbra : ModItem + public class Penumbra : RogueWeapon { public static float ShootSpeed = 8f; public override void SetStaticDefaults() @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item103; - Item.value = Item.buyPrice(1, 80, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.damage = 1008; Item.useAnimation = 40; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = ShootSpeed; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index 134e866597..b0ae83b4e3 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class PhantasmalRuin : ModItem + public class PhantasmalRuin : RogueWeapon { public override void SetStaticDefaults() { @@ -38,7 +39,7 @@ Stealth strikes continuously leave spectral clones in their wake"); Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index cc518ed6fa..2ccb83658f 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -8,7 +8,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class PhantomLance : ModItem + public class PhantomLance : RogueWeapon { public override void SetStaticDefaults() { @@ -60,9 +60,9 @@ Stealth strikes don't slow down and souls always deal full damage"); public override void AddRecipes() { CreateRecipe(100). - AddIngredient(ItemID.SpectreBar, 2). + AddIngredient(ItemID.SpectreBar). AddIngredient(). - AddIngredient(2). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 48ea20eda4..88faa2b065 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Plaguenade : ModItem + public class Plaguenade : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index afc7eff994..cb5ab022c5 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -8,7 +8,7 @@ using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { - public class PoisonPack : ModItem + public class PoisonPack : RogueWeapon { private static int baseDamage = 20; private static float baseKnockback = 1.8f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = baseKnockback; - Item.value = Item.buyPrice(0, 0, 33, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice / 3; // Stacks up to 3 Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item1; Item.maxStack = 3; diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 51873c7c37..38c5d74a52 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Prismalline : ModItem + public class Prismalline : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 46; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index eabdc273bb..04aaebe0c1 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class ProfanedPartisan : ModItem + public class ProfanedPartisan : RogueWeapon { public override void SetStaticDefaults() { @@ -33,8 +34,7 @@ Stealth strikes spawn smaller spears to fly along side it"); Item.useAnimation = 18; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index 7c6c45c4f8..f4282fe01d 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class RadiantStar : ModItem + public class RadiantStar : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 48; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index a012400b5b..726643515f 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class RefractionRotor : ModItem + public class RefractionRotor : RogueWeapon { public override void SetStaticDefaults() { @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } 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/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index 0ce6055479..ee83e53200 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -7,7 +7,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class RegulusRiot : ModItem + public class RegulusRiot : RogueWeapon { public override void SetStaticDefaults() { @@ -28,7 +28,7 @@ Stealth strikes explode into energy stars"); Item.noMelee = true; Item.noUseGraphic = true; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.useTime = 26; Item.useAnimation = 26; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs new file mode 100644 index 0000000000..d71dcde21e --- /dev/null +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -0,0 +1,12 @@ +using Terraria.ModLoader; +using static Terraria.ID.ContentSamples.CreativeHelper; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public abstract class RogueWeapon : ModItem + { + public override bool RangedPrefix() => false; + + public override void ModifyResearchSorting(ref ItemGroup itemGroup) => itemGroup = (ItemGroup)CalamityResearchSorting.RogueWeapon; + } +} diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 35553d6da6..57ee8fdfae 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class RotBall : ModItem + public class RotBall : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index 4a17c1b51e..ce46989ca0 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Sacrifice : ModItem + public class Sacrifice : RogueWeapon { public override void SetStaticDefaults() { @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index c0790081db..f302998958 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SandDollar : ModItem + public class SandDollar : RogueWeapon { public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3.5f; Item.autoReuse = true; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice / 2; // Stacks to 2 Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index b4ae8fbaeb..c497629e31 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -8,7 +8,7 @@ using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.Weapons.Rogue { - public class Sandslasher : ModItem + public class Sandslasher : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 7f; diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index c9fc7aac16..b96c8c32fe 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ScarletDevil : ModItem + public class ScarletDevil : RogueWeapon { public override void SetStaticDefaults() { @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index a99ae75c8c..85d47c5273 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ScourgeoftheDesert : ModItem + public class ScourgeoftheDesert : RogueWeapon { public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ Stealth strikes gain damage as they damage enemies"); Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index 87fa73dc25..5589b801b1 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ScourgeoftheSeas : ModItem + public class ScourgeoftheSeas : RogueWeapon { public override void SetStaticDefaults() { @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; } 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/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index 1b62d3082e..75fbec3e64 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -1,5 +1,6 @@ using Terraria.DataStructures; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SeafoamBomb : ModItem + public class SeafoamBomb : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +32,7 @@ Stealth strikes are faster and explode into 5 bubbles"); Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; @@ -55,6 +56,7 @@ Stealth strikes are faster and explode into 5 bubbles"); CreateRecipe(). AddIngredient(ItemID.Bomb, 25). AddIngredient(10). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index b39690ad16..0ba8dc410c 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SealedSingularity : ModItem + public class SealedSingularity : RogueWeapon { public override void SetStaticDefaults() { @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item106; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index f1b71b23dc..a2c6dfad58 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -1,16 +1,17 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { - public class SearedPan : ModItem + public class SearedPan : RogueWeapon { public static readonly SoundStyle SmashSound = new("CalamityMod/Sounds/Item/SearedPanSmash"); @@ -45,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index 35e6a97ed0..02d55dc82a 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Seraphim : ModItem + public class Seraphim : RogueWeapon { public const int SplitDaggerCount = 6; public const int StealthStrikeLightCount = 7; @@ -37,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = SeraphimProjectile.InitialSpeed; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index a6bd04ebe2..fafe0939a6 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { [LegacyName("XerocPitchfork")] - public class ShardofAntumbra : ModItem + public class ShardofAntumbra : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/ShatteredSun.cs b/Items/Weapons/Rogue/ShatteredSun.cs index 76706712f3..dd340640b7 100644 --- a/Items/Weapons/Rogue/ShatteredSun.cs +++ b/Items/Weapons/Rogue/ShatteredSun.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ShatteredSun : ModItem + public class ShatteredSun : RogueWeapon { public override void SetStaticDefaults() { @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/ShinobiBlade.cs b/Items/Weapons/Rogue/ShinobiBlade.cs index 9d802805d7..0abf32a92b 100644 --- a/Items/Weapons/Rogue/ShinobiBlade.cs +++ b/Items/Weapons/Rogue/ShinobiBlade.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ShinobiBlade : ModItem + public class ShinobiBlade : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index f23552da02..2eb5f7dab5 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ShockGrenade : ModItem + public class ShockGrenade : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index 7df5a86764..ebf8aeb7ac 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -9,7 +9,7 @@ using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { - public class SkyStabber : ModItem + public class SkyStabber : RogueWeapon { private static int damage = 50; private static int knockBack = 2; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = knockBack; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice / 4; // stacks up to 4 Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.maxStack = 4; diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index 12f1faab67..b96eacf2a1 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SkyfinBombers : ModItem + public class SkyfinBombers : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.height = 30; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index a1c78ac472..99c9eb505e 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SlickCane : ModItem + public class SlickCane : RogueWeapon { public override void SetStaticDefaults() { @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index 4db35f155b..3422597972 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -9,7 +9,7 @@ using Terraria.Audio; namespace CalamityMod.Items.Weapons.Rogue { - public class SludgeSplotch : ModItem + public class SludgeSplotch : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/SnapClam.cs b/Items/Weapons/Rogue/SnapClam.cs index fe70b2374a..5c85fb5587 100644 --- a/Items/Weapons/Rogue/SnapClam.cs +++ b/Items/Weapons/Rogue/SnapClam.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SnapClam : ModItem + public class SnapClam : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index f0dcab6a2c..6b8edaee9c 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SpearofDestiny : ModItem + public class SpearofDestiny : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index 908152367a..f4cc535cbf 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SpearofPaleolith : ModItem + public class SpearofPaleolith : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 54; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 35f; diff --git a/Items/Weapons/Rogue/SpentFuelContainer.cs b/Items/Weapons/Rogue/SpentFuelContainer.cs index 1cd5995900..35d4d1a36b 100644 --- a/Items/Weapons/Rogue/SpentFuelContainer.cs +++ b/Items/Weapons/Rogue/SpentFuelContainer.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SpentFuelContainer : ModItem + public class SpentFuelContainer : RogueWeapon { public override void SetStaticDefaults() diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 52372f3499..c22cd95956 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class StarofDestruction : ModItem + public class StarofDestruction : RogueWeapon { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 10f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index f48a374a75..96ddb566f0 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class StellarKnife : ModItem + public class StellarKnife : RogueWeapon { int knifeCount = 10; int knifeLimit = 20; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 2fd5db3240..3954fe5f25 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -7,13 +7,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class StickySpikyBall : ModItem + public class StickySpikyBall : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Sticky Spiky Ball"); Tooltip.SetDefault(@"Throws a spiky ball that sticks to everything -Stealth strikes throw seven at once and last a lot longer"); +Stealth strikes throw four at once and last a lot longer"); SacrificeTotal = 99; } @@ -43,7 +43,7 @@ Stealth strikes throw seven at once and last a lot longer"); if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 3; - for (int i = 0; i < 7; i++) + for (int i = 0; i < 4; i++) { Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index c0c6217f8a..91bad534fe 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class StormfrontRazor : ModItem + public class StormfrontRazor : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/SubductionSlicer.cs b/Items/Weapons/Rogue/SubductionSlicer.cs index 7024a35b69..a1f87c1880 100644 --- a/Items/Weapons/Rogue/SubductionSlicer.cs +++ b/Items/Weapons/Rogue/SubductionSlicer.cs @@ -9,7 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { [LegacyName("FlameScythe")] - public class SubductionSlicer : ModItem + public class SubductionSlicer : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 20; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(gold: 80); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 3f11351fb5..17f4d80575 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -1,15 +1,16 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class Supernova : ModItem + public class Supernova : RogueWeapon { public override void SetStaticDefaults() { @@ -34,11 +35,10 @@ Stealth strikes release energy as they fly"); Item.autoReuse = true; Item.height = 36; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } 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/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 5de8ccea82..f6795961be 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TarragonThrowingDart : ModItem + public class TarragonThrowingDart : RogueWeapon { public override void SetStaticDefaults() { @@ -34,11 +35,10 @@ Stealth strikes erupt into thorns on enemy hits"); Item.height = 34; Item.maxStack = 999; Item.value = Item.sellPrice(copper: 30); - Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } 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/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index d0ed9712b9..9d446ffac8 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TerraDisk : ModItem + public class TerraDisk : RogueWeapon { public static int BaseDamage = 100; public static float Speed = 12f; @@ -37,7 +37,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(gold: 80); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; @@ -86,7 +86,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); AddIngredient(). AddIngredient(). AddIngredient(ItemID.ThornChakram). - AddIngredient(8). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index b9b3a2c6f0..111d3a800f 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TerrorTalons : ModItem + public class TerrorTalons : RogueWeapon { private float sign = 1f; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item39; Item.autoReuse = true; Item.height = 24; - Item.value = Item.buyPrice(0, 48, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10.5f; diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index ea7031ebc6..67a9f5a602 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TheAtomSplitter : ModItem + public class TheAtomSplitter : RogueWeapon { public override void SetStaticDefaults() { @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } 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/TheReaper.cs b/Items/Weapons/Rogue/TheReaper.cs index 58e8c73fbf..50871c2ef4 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheReaper.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TheReaper : ModItem + public class TheReaper : RogueWeapon { public override void SetStaticDefaults() { @@ -35,8 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } 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/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index 91203d16d2..ddb6601bf5 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -7,7 +7,7 @@ using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.Weapons.Rogue { - public class TheSyringe : ModItem + public class TheSyringe : RogueWeapon { public static int BaseDamage = 60; public static float Knockback = 5f; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index da7dccd758..648743b81f 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ThrowingBrick : ModItem + public class ThrowingBrick : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index f31090309c..e5a281b8e5 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TimeBolt : ModItem + public class TimeBolt : RogueWeapon { public override void SetStaticDefaults() { @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 4e0527ee89..d6ac51147c 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TitaniumShuriken : ModItem + public class TitaniumShuriken : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 71be65fc1a..31b10ebe31 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ToothBall : ModItem + public class ToothBall : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index 337e8a043d..61504c22d5 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -8,7 +8,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { - public class TotalityBreakers : ModItem + public class TotalityBreakers : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ Stealth strikes leak tar as they fly"); Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.height = 42; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index db00f1986d..256c89cb22 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class ToxicantTwister : ModItem + public class ToxicantTwister : RogueWeapon { public override void SetStaticDefaults() { @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 46; - Item.damage = 323; + Item.damage = 300; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 20; @@ -35,15 +36,20 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int boomer = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (boomer.WithinBounds(Main.maxProjectiles)) - Main.projectile[boomer].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; + if (player.Calamity().StealthStrikeAvailable()) + { + damage = (int)(damage * 1.35f); + int boomer = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (boomer.WithinBounds(Main.maxProjectiles)) + Main.projectile[boomer].Calamity().stealthStrike = true; + return false; + } + return true; } } } diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index 38700d38fc..44fab4f7a7 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Turbulance : ModItem + public class Turbulance : RogueWeapon { public override void SetStaticDefaults() { @@ -32,7 +32,7 @@ Stealth strikes are trailed by homing wind slashes"); Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 14; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index 192e11c94d..cd630d1c6c 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class UrchinStinger : ModItem + public class UrchinStinger : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 2f9a9a671b..9a7c697f59 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class UtensilPoker : ModItem + public class UtensilPoker : RogueWeapon { private int counter = 0; public override void SetStaticDefaults() diff --git a/Items/Weapons/Rogue/Valediction.cs b/Items/Weapons/Rogue/Valediction.cs index fb3c01641d..840a1f6ca2 100644 --- a/Items/Weapons/Rogue/Valediction.cs +++ b/Items/Weapons/Rogue/Valediction.cs @@ -1,13 +1,14 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Valediction : ModItem + public class Valediction : RogueWeapon { public override void SetStaticDefaults() { @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/WaveSkipper.cs b/Items/Weapons/Rogue/WaveSkipper.cs index 8e47041689..4185cee9f4 100644 --- a/Items/Weapons/Rogue/WaveSkipper.cs +++ b/Items/Weapons/Rogue/WaveSkipper.cs @@ -11,7 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { [LegacyName("DuneHopper")] - public class WaveSkipper : ModItem + public class WaveSkipper : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index 704b4e5dd3..bf5e2688de 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class WebBall : ModItem + public class WebBall : RogueWeapon { public override void SetStaticDefaults() { diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index c4989bd9f7..ffe90f43ce 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -1,14 +1,15 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { [LegacyName("ProfanedTrident")] - public class Wrathwing : ModItem + public class Wrathwing : RogueWeapon { public override void SetStaticDefaults() { @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 221d095dcf..f0e5217d69 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -5,18 +5,30 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Particles; namespace CalamityMod.Items.Weapons.Rogue { - public class WulfrumKnife : ModItem + public class WulfrumKnife : RogueWeapon { + public static readonly SoundStyle Throw3Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowFull") { PitchVariance = 0.4f }; + public static readonly SoundStyle Throw2Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowTwo") { PitchVariance = 0.4f }; + public static readonly SoundStyle Throw1Sound = new("CalamityMod/Sounds/Item/WulfrumKnifeThrowSingle") { PitchVariance = 0.4f }; + public static readonly SoundStyle TileHitSound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2) { PitchVariance = 0.4f , MaxInstances = 3}; + public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Knife"); - Tooltip.SetDefault("Stealth strikes make the knife fly further and hit several times at once"); + Tooltip.SetDefault("Fires wulfrum knives in bursts of 3\n" + + "Stealth strikes make the knife fly further and hit several times at once\n" + + "Hold right click to magnetize all nearby fallen knives back to you"); SacrificeTotal = 99; } + public int shootCount = 0; + public bool stealthStrikeStarted = false; + public override void SetDefaults() { Item.width = 22; @@ -24,44 +36,129 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + //Clockwork burst + Item.useAnimation = 10; + Item.useTime = 4; + Item.reuseDelay = 24; + Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; + Item.UseSound = Throw3Sound; Item.autoReuse = true; Item.height = 38; Item.maxStack = 999; Item.value = Item.sellPrice(0, 0, 0, 5); Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 4f; Item.DamageType = RogueDamageClass.Instance; } + //Magnetization + public override void HoldItem(Player player) + { + player.Calamity().rightClickListener = true; + + if (player.Calamity().mouseRight && Main.rand.NextBool(7)) + { + Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.2f, 0.5f), Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(170f, 670f), Main.rand.NextFloat(30f, 44f), Color.GreenYellow, Color.DeepSkyBlue, Main.rand.Next(15, 30)); + GeneralParticleHandler.SpawnParticle(streak); + } + } + + public override void GrabRange(Player player, ref int grabRange) + { + float rangeMult = 2f; + if (player.Distance(Item.Center) < 670 && player.HeldItem.type == ModContent.ItemType() && player.Calamity().mouseRight) + rangeMult = 20f; + + grabRange = (int)(grabRange * rangeMult); + + if (rangeMult > 2f && player.Distance(Item.Center) > 50f) + { + Item.velocity = (player.DirectionTo(Item.Center) * -20f); + + if (Main.rand.NextBool(3)) + { + Vector2 dustCenter = Item.Center + Main.rand.NextVector2Circular(4f, 4f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Item.velocity * Main.rand.NextFloat(0.2f, 0.1f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + } + } + } + + + //While this may look stupid, its necessary because ReuseDelay fucks up the consumption of the item otherwise. + public override bool ConsumeItem(Player player) => shootCount < 0; + public override bool? UseItem(Player player) + { + int placeholderStock = shootCount; + shootCount = -1; + + if (ItemLoader.ConsumeItem(Item, player)) + { + Item.stack--; + + if (Item.stack <= 0) + Item.TurnToAir(); + } + + shootCount = placeholderStock; + + shootCount++; + return base.UseItem(player); + } + + //Random spread + public override void UseAnimation(Player player) + { + shootCount = 0; + stealthStrikeStarted = false; + + Item.UseSound = Throw3Sound; + + if (Item.stack == 2) + Item.UseSound = Throw2Sound; + if (Item.stack == 1) + Item.UseSound = Throw1Sound; + } + + // TODO -- All rogue weapons with special stat changes for stealth strikes should do so in ModifyShootStats instaed of Shoot + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + bool stealthStrike = player.Calamity().StealthStrikeAvailable() || stealthStrikeStarted; + float spread = stealthStrike ? MathHelper.PiOver4 * 0.04f : MathHelper.PiOver4 * 0.1f; + float speedBoost = stealthStrike ? 1.25f : 1f; + + velocity = velocity.RotatedByRandom(shootCount / 2f * spread) * speedBoost; + if (stealthStrike) + damage = (int)(damage * 3.2f); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() || stealthStrikeStarted) { + stealthStrikeStarted = true; + int p = Projectile.NewProjectile(source, position, velocity * 1.3f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); Projectile proj = Main.projectile[p]; if (p.WithinBounds(Main.maxProjectiles)) { proj.Calamity().stealthStrike = true; - proj.penetrate = 4; - proj.usesLocalNPCImmunity = true; - proj.localNPCHitCooldown = 1; + proj.penetrate = 2; } return false; } return true; } + public override void AddRecipes() { CreateRecipe(100). - AddIngredient(). - AddTile(TileID.Anvils). + AddIngredient(). Register(); } } diff --git a/Items/Weapons/Rogue/WulfrumKnife.png b/Items/Weapons/Rogue/WulfrumKnife.png index 94ca6dcea6..c09ca757d6 100644 Binary files a/Items/Weapons/Rogue/WulfrumKnife.png and b/Items/Weapons/Rogue/WulfrumKnife.png differ diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs new file mode 100644 index 0000000000..1427f25b87 --- /dev/null +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -0,0 +1,151 @@ +using CalamityMod.Particles; +using CalamityMod.Projectiles.Summon.SmallAresArms; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class AresExoskeleton : ModItem + { + public int FrameCounter = 0; + + public int Frame = 0; + + public const int BoxParticleLifetime = 95; + + public const int PlasmaCannonShootRate = 30; + + public const int TeslaCannonShootRate = 36; + + public const int LaserCannonNormalShootRate = 15; + + public const int GaussNukeShootRate = 240; + + public const float TargetingDistance = 1020f; + + public const float MinionSlotsPerCannon = 3f; + + public const float PlasmaCannonBlastFactor = 0.9f; + + // Multiple orbs can arc together when there are 2+ tesla cannons, resulting in a LOT of hits. + // The local i-frames are also quite high to combat this problem. + public const float TeslaOrbDamageFactor = 1f; + + public const float LaserDamageFactor = 1.1f; + + public const float NukeDamageFactor = 1f; + + public const float MaxNukeExplosionRadius = 720f; + + public const float TeslaOrbDetatchDistance = 1500f; + + public static bool ArmExists(Player player) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + + return false; + } + + public override void Load() + { + // Add the body equip texture. + if (Main.netMode != NetmodeID.Server) + EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ares' Exoskeleton"); + Tooltip.SetDefault("Creates a panel with four slots and four choices above it: Plasma, Tesla, Laser, and Gauss\n" + + "Clicking one of the choices and then clicking one of the slots allows you to summon a cannon that stays close to you and attacks nearby enemies\n" + + "Clicking on a slot that's already occupied destroys its associated cannon and clears the slot\n" + + $"Cannons take {MinionSlotsPerCannon} minion slots each"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.mana = 80; + Item.damage = 625; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.noUseGraphic = true; + Item.width = Item.height = 36; + Item.useTime = Item.useAnimation = 9; + Item.noMelee = true; + Item.knockBack = 1f; + + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ModContent.RarityType(); + + Item.UseSound = SoundID.Item117; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value; + if (ArmExists(Main.LocalPlayer)) + { + texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeletonRemote").Value; + position.X += scale * 6f; + } + + spriteBatch.Draw(texture, position, new(0, 0, texture.Width, texture.Height), Color.White, 0f, origin, scale, 0, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref Frame, ref FrameCounter, 1, 1), lightColor, 0f, Vector2.Zero, 1f, 0, 0); + return false; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + int panelID = ModContent.ProjectileType(); + + // If the player owns a panel, make it fade away. + if (player.ownedProjectileCounts[panelID] >= 1) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != panelID || Main.projectile[i].owner != player.whoAmI || !Main.projectile[i].active) + continue; + + Main.projectile[i].ai[0] = 1f; + Main.projectile[i].netUpdate = true; + } + } + + // Otherwise, create one. While it doesn't do damage on its own, it does store it for reference by the cannons that might be spawned. + else + { + int panel = Projectile.NewProjectile(source, position, Vector2.Zero, panelID, damage, 0f, player.whoAmI); + if (Main.projectile.IndexInRange(panel)) + Main.projectile[panel].originalDamage = Item.damage; + + // Also throw a cool mechanical box particle out. + Vector2 boxVelocity = -Vector2.UnitY.RotatedByRandom(0.7f) * 6f + Vector2.UnitX * player.direction * 4f; + Particle box = new AresSummonCrateParticle(player, boxVelocity, BoxParticleLifetime); + GeneralParticleHandler.SpawnParticle(box); + } + + return false; + } + } +} diff --git a/Items/Weapons/Summon/AresExoskeleton.png b/Items/Weapons/Summon/AresExoskeleton.png new file mode 100644 index 0000000000..fa76b67f33 Binary files /dev/null and b/Items/Weapons/Summon/AresExoskeleton.png differ diff --git a/Items/Weapons/Summon/AresExoskeletonRemote.png b/Items/Weapons/Summon/AresExoskeletonRemote.png new file mode 100644 index 0000000000..afa7801772 Binary files /dev/null and b/Items/Weapons/Summon/AresExoskeletonRemote.png differ diff --git a/Items/Weapons/Summon/AresExoskeleton_Body.png b/Items/Weapons/Summon/AresExoskeleton_Body.png new file mode 100644 index 0000000000..5cd9d002d9 Binary files /dev/null and b/Items/Weapons/Summon/AresExoskeleton_Body.png differ diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index ce4db5324f..bddd3cbd4e 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index c909a90c21..d345218350 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -12,13 +12,15 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Black Hawk Remote"); - Tooltip.SetDefault("Summons a Black Hawk jet to fight for you"); + Tooltip.SetDefault("Summons a Black Hawk jet to fight for you\n" + + "Jets will fire bullets from your inventory\n" + + "50% chance to not consume ammo"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 32; + Item.damage = 25; Item.mana = 10; Item.width = 46; Item.height = 28; @@ -26,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 6f; // Affects bullet speed Item.DamageType = DamageClass.Summon; Item.rare = ItemRarityID.LightRed; } @@ -41,10 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.whoAmI == Main.myPlayer) { - position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs index 4f3867917c..b22d0b5b5b 100644 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ b/Items/Weapons/Summon/BloodClotStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 8ee803a241..5d8fbab902 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; //item.autoReuse = true; diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index c93c1b92de..9e99b027e5 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 8f9a2cdd1b..70b2b5d7d0 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -1,5 +1,6 @@ using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 95; + Item.damage = 110; Item.mana = 10; Item.width = 62; Item.height = 62; @@ -26,14 +27,13 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.UseSound = SoundID.Item83; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index f7662735b7..d12dd3c7c5 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item34; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index df5476a6dc..ec0a8f39ea 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 0f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs similarity index 86% rename from Items/Weapons/Melee/Cnidarian.cs rename to Items/Weapons/Summon/Cnidarian.cs index 60eeb20d2f..481f383928 100644 --- a/Items/Weapons/Melee/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -1,6 +1,6 @@ using System.Linq; using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,11 +8,11 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -namespace CalamityMod.Items.Weapons.Melee +namespace CalamityMod.Items.Weapons.Summon { public class Cnidarian : ModItem { - public override string Texture => "CalamityMod/Items/Weapons/Melee/CnidarianFishingRod"; + public override string Texture => "CalamityMod/Items/Weapons/Summon/CnidarianFishingRod"; public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 26; Item.DamageType = DamageClass.Summon; - Item.damage = 11; + Item.damage = 8; Item.knockBack = 3f; Item.useTime = 25; Item.useAnimation = 25; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 10f; Item.rare = ItemRarityID.Green; - Item.value = Item.buyPrice(gold: 2); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; } public override bool CanUseItem(Player player) @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee } - CalamityUtils.CleanHoldStyle(player, player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir, player.GetFrontHandPositionImproved(player.compositeFrontArm), new Vector2(42, 34), new Vector2(-15, 11)); + CalamityUtils.CleanHoldStyle(player, player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir, player.GetFrontHandPositionImproved(player.compositeFrontArm), new Vector2(42, 34), new Vector2(-15, 11), true); } @@ -135,20 +135,15 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Melee/Cnidarian").Value; + Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; - //Scale the jellyfish sprite properly, since its larger than the fishing rod (Largest dimension of the jellyfish sprite : 52. Largest dimension of the fishing rod : 42) - float scaleRatio = 42 / 52f; - //Offset the jellyfish sprite properly, since the fishing rod is larger than the jellyfish (Jellyfish width : 28px, Fishing rod width : 42) - Vector2 positionOffset = new Vector2(21 - 14, 0) * scale; - - spriteBatch.Draw(properSprite, position + positionOffset, null, drawColor, 0f, origin, scale * scaleRatio, 0, 0); + spriteBatch.DrawNewInventorySprite(properSprite, new Vector2(42f, 34), position, drawColor, origin, scale); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Melee/Cnidarian").Value; + Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); return false; diff --git a/Items/Weapons/Melee/Cnidarian.png b/Items/Weapons/Summon/Cnidarian.png similarity index 100% rename from Items/Weapons/Melee/Cnidarian.png rename to Items/Weapons/Summon/Cnidarian.png diff --git a/Items/Weapons/Melee/CnidarianFishingRod.png b/Items/Weapons/Summon/CnidarianFishingRod.png similarity index 100% rename from Items/Weapons/Melee/CnidarianFishingRod.png rename to Items/Weapons/Summon/CnidarianFishingRod.png diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 4aa058fd30..c46bf46712 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index c3f0a843f0..a44c45ce66 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,9 +36,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; - Item.value = Item.buyPrice(2, 50, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); } 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/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index a56527f521..e70bd8985a 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,12 +34,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 0f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item60; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 10; diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 32b2411d5c..4becae43e3 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,11 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -16,13 +17,17 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Viper Engine"); - Tooltip.SetDefault("Summons a cosmic gunship to shoot down your foes"); + Tooltip.SetDefault("Summons a cosmic gunship to shoot down your foes\n" + + "Gunships will fire bullets from your inventory\n" + + "50% chance to not consume ammo\n" + + "Alternates firing rockets and bullets\n" + + "Rockets do not consume ammo"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 138; + Item.damage = 321; Item.mana = 10; Item.width = 46; Item.height = 28; @@ -33,45 +38,44 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 10f; // Affects bullet speed Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + 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.altFunctionUse != 2) { - int i = Main.myPlayer; - float num72 = Item.shootSpeed; + float speed = Item.shootSpeed; player.itemTime = Item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xPos = (float)Main.mouseX + Main.screenPosition.X - spawnPos.X; + float yPos = (float)Main.mouseY + Main.screenPosition.Y - spawnPos.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + yPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - spawnPos.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + Vector2 vel = new Vector2(xPos, yPos); + float dist = vel.Length(); + if ((float.IsNaN(vel.X) && float.IsNaN(vel.Y)) || (vel.X == 0f && vel.Y == 0f)) { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; + vel.X = (float)player.direction; + vel.Y = 0f; + dist = speed; } else { - num80 = num72 / num80; + dist = speed / dist; } - num78 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - int p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + vel.X *= dist; + vel.Y *= dist; + spawnPos.X = (float)Main.mouseX + Main.screenPosition.X; + spawnPos.Y = (float)Main.mouseY + Main.screenPosition.Y; + vel = vel.RotatedBy(MathHelper.PiOver2, default); + int p = Projectile.NewProjectile(source, spawnPos + vel, vel, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index a0a37ca941..972b111cfa 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 89; + Item.damage = 155; Item.mana = 10; Item.width = 42; Item.height = 60; @@ -29,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item44; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 0979145480..b9d95cdcc0 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index e5792383f9..90f8d3a99a 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index e77b92ed58..8b24e79615 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.DD2_DarkMageHealImpact; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 56; + Item.damage = 127; Item.knockBack = 2f; Item.autoReuse = true; Item.useTime = Item.useAnimation = 15; @@ -33,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } 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/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 2c7453f6c9..d92a490a6f 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 7beac3b873..9155676a1f 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; } 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/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 948935deef..1f4b11bdbc 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 160; + Item.damage = 215; Item.mana = 10; Item.width = 64; Item.height = 62; @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_SkeletonDeath; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index 7da2b2128f..4c8b801dd2 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item113; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index bd422bde36..a429aab9e4 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 50; + Item.damage = 57; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.width = 36; diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 7e787a69e1..0b35b22b02 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -35,9 +36,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.value = Item.buyPrice(2, 50, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); } 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/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index b6e5fb7346..0863a8d0d3 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -47,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } @@ -65,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Summon ModContent.ProjectileType() }); - SummonEndoCooper(source, AttackMode, Main.MouseWorld, damage, knockback, player, out _, out _); + SummonEndoCooper(source, AttackMode, Main.MouseWorld, damage, Item.damage, knockback, player, out _, out _); AttackMode++; if (AttackMode > 3) @@ -74,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Summon return false; } - public static void SummonEndoCooper(IEntitySource source, int attackMode, Vector2 spawnPosition, int damage, float knockback, Player owner, out int bodyIndex, out int limbsIndex) + public static void SummonEndoCooper(IEntitySource source, int attackMode, Vector2 spawnPosition, int damage, int baseDamage, float knockback, Player owner, out int bodyIndex, out int limbsIndex) { bodyIndex = limbsIndex = -1; if (Main.myPlayer != owner.whoAmI) @@ -92,8 +93,8 @@ namespace CalamityMod.Items.Weapons.Summon bodyIndex = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockback, owner.whoAmI, attackMode, 0f); limbsIndex = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockback, owner.whoAmI, attackMode, bodyIndex); Main.projectile[bodyIndex].ai[1] = limbsIndex; - Main.projectile[bodyIndex].originalDamage = (int)(damage * dmgMult); - Main.projectile[limbsIndex].originalDamage = (int)(damage * dmgMult); + Main.projectile[bodyIndex].originalDamage = (int)(baseDamage * dmgMult); + Main.projectile[limbsIndex].originalDamage = (int)(baseDamage * dmgMult); } public override void AddRecipes() diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index 06957ed75e..c6bc532540 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item82; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 3c327b55e0..b039355a9c 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,14 +30,13 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.UseSound = SoundID.Item82; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index a42f6709d1..71beef9019 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -1,17 +1,18 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; using System.Collections.Generic; using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { @@ -67,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.UseSound = SoundID.Item117; diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index 52c2548cd1..d6741d9022 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Flowers of Mortality"); Tooltip.SetDefault("Summons five rainbow flowers over your head\n" + - "The combined flowers consume two and a half minion slots"); + "The combined flowers consume three minion slots"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 140; + Item.damage = 72; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.width = 36; diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index d22224a73f..b4b04706a2 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item89; Item.noMelee = true; Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.autoReuse = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 032f5cf6fc..431d9bfea3 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item28; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 37822aed5d..687137e5a7 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useTime = Item.useAnimation = 20; Item.noMelee = true; Item.knockBack = 7f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item106; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 16e80e5130..c46a427871 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,15 +26,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item42; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 173; + Item.damage = 120; Item.knockBack = 3f; Item.autoReuse = true; Item.useTime = Item.useAnimation = 14; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.rare = ModContent.RarityType(); } 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/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index 960671ce70..d79ab19f8b 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/GuidelightofOblivion.cs b/Items/Weapons/Summon/GuidelightofOblivion.cs index c609013450..52cec5511b 100644 --- a/Items/Weapons/Summon/GuidelightofOblivion.cs +++ b/Items/Weapons/Summon/GuidelightofOblivion.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,8 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.Calamity().customRarity = CalamityRarity.Turquoise; - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item44; diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index b853f1cd3b..4fa5ced0c4 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.Wood, 10). AddIngredient(ItemID.SoulofLight, 5). AddIngredient(ItemID.SoulofNight, 5). - AddIngredient(ItemID.Bowl). + AddIngredient(ItemID.FoodPlatter, 3). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index d128a78b77..a7e83b1b88 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item21; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index e24115c160..8409ce711a 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item78; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index d3b13c84b3..998c6de7bb 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item71; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/MagicalConch.cs b/Items/Weapons/Summon/MagicalConch.cs index 2ae0c04d27..05bfe24002 100644 --- a/Items/Weapons/Summon/MagicalConch.cs +++ b/Items/Weapons/Summon/MagicalConch.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index 557f14e4d0..6a62aaea75 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 666; + Item.damage = 380; Item.mana = 10; Item.width = 66; Item.height = 78; @@ -34,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 49a51ff32e..14f0bb1b45 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 191; + Item.damage = 150; Item.mana = 10; Item.width = Item.height = 32; Item.useTime = Item.useAnimation = 10; @@ -37,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } 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/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index d5325bc7a7..2158b07a68 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item42; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index e35366fb5b..4000405c2f 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Summon { @@ -36,8 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.sentry = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } public override bool AltFunctionUse(Player player) => true; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 0c05be4891..72737e2776 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item76; Item.shoot = ModContent.ProjectileType(); @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(). AddIngredient(). AddIngredient(ItemID.OpticStaff). - AddIngredient(10). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(). AddIngredient(). AddIngredient(ItemID.OpticStaff). - AddIngredient(10). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 89a5811f8d..2f3172ad9c 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = 2; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index cc24f159bd..44e5df871b 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 9143482dea..1cce489cda 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,15 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 171; + Item.damage = 210; Item.knockBack = 4f; Item.useTime = Item.useAnimation = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); } public override void HoldItem(Player player) diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 6c2441a810..5ca0c79a3f 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item83; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/SeaboundStaff.cs b/Items/Weapons/Summon/SeaboundStaff.cs index 0067aec2a5..da3c63f379 100644 --- a/Items/Weapons/Summon/SeaboundStaff.cs +++ b/Items/Weapons/Summon/SeaboundStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index 6d24dbbd96..361875cc6a 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index f4622e1fbe..d75680540e 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -32,15 +33,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 160; + Item.damage = 175; Item.knockBack = 3f; Item.useTime = Item.useAnimation = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.value = Item.buyPrice(1, 40, 0, 0); - Item.rare = ItemRarityID.Red; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.rare = ModContent.RarityType(); } public override void HoldItem(Player player) diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 97326d4b47..ed853e80ef 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shootSpeed = 20f; diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index cb781e814b..3ca5677e19 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = Item.buyPrice(0, 0, 50, 0); + Item.value = CalamityGlobalItem.Rarity0BuyPrice; Item.rare = ItemRarityID.White; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 284c25e669..d23676e716 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using System.Linq; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon public class StaffoftheMechworm : ModItem { // This value is also referenced by the God Slayer and Auric summoner helmets. - public const int BaseDamage = 161; // originally 325 + public const int BaseDamage = 118; // originally 325 public override void SetStaticDefaults() { DisplayName.SetDefault("Staff of the Mechworm"); @@ -30,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.DarkBlue; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item113; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Summon return true; } - public static void SummonBaseMechworm(IEntitySource source, int damage, float knockback, Player owner, out int tailIndex) + public static void SummonBaseMechworm(IEntitySource source, int damage, int baseDamage, float knockback, Player owner, out int tailIndex) { tailIndex = -1; if (Main.myPlayer != owner.whoAmI) @@ -66,25 +66,25 @@ namespace CalamityMod.Items.Weapons.Summon int curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); if (Main.projectile.IndexInRange(curr)) - Main.projectile[curr].originalDamage = damage; + Main.projectile[curr].originalDamage = baseDamage; curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) - Main.projectile[curr].originalDamage = damage; + Main.projectile[curr].originalDamage = baseDamage; int prev = curr; curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) - Main.projectile[curr].originalDamage = damage; + Main.projectile[curr].originalDamage = baseDamage; Main.projectile[prev].localAI[1] = curr; prev = curr; curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); if (Main.projectile.IndexInRange(curr)) - Main.projectile[curr].originalDamage = damage; + Main.projectile[curr].originalDamage = baseDamage; Main.projectile[prev].localAI[1] = curr; tailIndex = curr; } - public static void AddSegmentToMechworm(IEntitySource source, int tailIndex, int damage, float knockback, Player owner) + public static void AddSegmentToMechworm(IEntitySource source, int tailIndex, int damage, int baseDamage, float knockback, Player owner) { if (Main.myPlayer != owner.whoAmI) return; @@ -99,9 +99,9 @@ namespace CalamityMod.Items.Weapons.Summon Main.projectile[tailIndex].ai[0] = Main.projectile[body].identity; Main.projectile[tailIndex].netUpdate = true; if (Main.projectile.IndexInRange(body)) - Main.projectile[body].originalDamage = damage; + Main.projectile[body].originalDamage = baseDamage; if (Main.projectile.IndexInRange(body2)) - Main.projectile[body2].originalDamage = damage; + Main.projectile[body2].originalDamage = baseDamage; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -127,9 +127,9 @@ namespace CalamityMod.Items.Weapons.Summon } } if (head == -1 && tail == -1) - SummonBaseMechworm(source, damage, knockback, player, out _); + SummonBaseMechworm(source, damage, Item.damage, knockback, player, out _); else if (head != -1 && tail != -1) - AddSegmentToMechworm(source, tail, damage, knockback, player); + AddSegmentToMechworm(source, tail, damage, Item.damage, knockback, player); return false; } } diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 1953f19c5b..2e2487d4ea 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.NPCDeath34; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index ddfb3c81eb..136a7a3c9d 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = Item.buyPrice(0, 48, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item44; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index d8a10b8e57..2907abf72d 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -14,14 +14,16 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Tactical Plague Engine"); Tooltip.SetDefault("Summons a plague jet to pummel your enemies into submission\n" + - "Jets will fire ammo from your inventory, 66% chance to not consume ammo\n" + - "Sometimes shoots a missile instead of a bullet"); + "Jets will fire bullets from your inventory\n" + + "50% chance to not consume ammo\n" + + "Sometimes shoots a missile instead of a bullet\n" + + "Missiles do not consume ammo"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 52; + Item.damage = 250; Item.mana = 10; Item.width = 28; Item.height = 20; @@ -35,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.autoReuse = true; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 7f; // Affects bullet speed } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -44,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon { int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index c9198d3169..09331bb955 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.UseSound = SoundID.Item68; Item.value = CalamityGlobalItem.Rarity16BuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index d6dcb55f9b..6062187123 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.SummonItems; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.Calamity().customRarity = CalamityRarity.HotPink; + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 35a2b1a45a..57e78ca821 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 150; + Item.damage = 115; Item.mana = 10; Item.width = Item.height = 32; Item.useTime = Item.useAnimation = 10; @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); } 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/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index 492bb7d05d..70e478ba42 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item2; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index fce9e9ea58..95b8145f50 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item71; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } 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/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 3b4bdec377..2c7b3ea846 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -30,14 +31,13 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.DD2_EtherianPortalOpen; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 150; + Item.damage = 105; Item.knockBack = 4f; Item.useTime = Item.useAnimation = 15; // 14 because of useStyle 1 Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Turquoise; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 0467ead024..73fd3384f6 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Items.Weapons.Summon { @@ -13,13 +14,17 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Controller"); - Tooltip.SetDefault("Summons a wulfrum droid to fight for you"); + Tooltip.SetDefault("Summons a wulfrum droid to fight for you\n" + + "Hold right click while holding the remote to switch all of your drones into supercharge mode\n" + + "Supercharged droids will stop attacking and focus wulfrum energy onto you\n" + + "The beam provides extra regeneration and defense\n" + + "Can also be used to heal other players by keeping your mouse cursor close enough to them"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 10; + Item.damage = 16; Item.mana = 10; Item.width = 28; Item.height = 20; @@ -27,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; @@ -36,6 +41,12 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } + public override void HoldItem(Player player) + { + 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) { if (player.altFunctionUse != 2) @@ -53,9 +64,45 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(9). AddTile(TileID.Anvils). Register(); } } + + public class WulfrumControllerPlayer : ModPlayer + { + public int buffingDrones = 0; + + public override void ResetEffects() + { + } + public override void UpdateDead() + { + buffingDrones = 0; + } + + public override void UpdateLifeRegen() + { + if (buffingDrones > 0) + { + Player.lifeRegen += (int)(buffingDrones * 3); + Player.statDefense += buffingDrones * 3; + + buffingDrones = 0; + } + } + + public override void PostUpdateMiscEffects() + { + if (buffingDrones > 0 && Main.rand.NextBool(3)) + { + Vector2 dustPos = Player.position + (Player.height * Main.rand.NextFloat(0.7f, 1f) + Player.gfxOffY) * Vector2.UnitY + Vector2.UnitX * Main.rand.NextFloat() * Player.width; + + Dust chust = Dust.NewDustPerfect(dustPos, 274, -Vector2.UnitY * Main.rand.NextFloat(1.4f, 7f) + Player.velocity , Alpha: 100, Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + chust.noLight = true; + } + } + } } diff --git a/Items/Weapons/Summon/WulfrumController.png b/Items/Weapons/Summon/WulfrumController.png index 7222b843e5..fd16ef10c8 100644 Binary files a/Items/Weapons/Summon/WulfrumController.png and b/Items/Weapons/Summon/WulfrumController.png differ diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index 35d73976e1..46bff3bb0f 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -1,10 +1,11 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Rarities; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; using Terraria.ID; -using CalamityMod.Sounds; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { @@ -32,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.Rarity15BuyPrice; - Item.rare = ItemRarityID.Purple; - Item.Calamity().customRarity = CalamityRarity.Violet; + Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.FlareSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index 6f0644f759..746462710e 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -41,6 +41,11 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 5f; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Typeless/EyeofMagnus.cs b/Items/Weapons/Typeless/EyeofMagnus.cs index 9743d80ca2..6e90590c03 100644 --- a/Items/Weapons/Typeless/EyeofMagnus.cs +++ b/Items/Weapons/Typeless/EyeofMagnus.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -37,6 +37,11 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 12f; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + public override Vector2? HoldoutOffset() { return new Vector2(-15, 0); diff --git a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs index 083d50e0a6..94a7426ca5 100644 --- a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs +++ b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 10f; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = FireSound; Item.autoReuse = true; @@ -43,6 +43,11 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.Calamity().timesUsed = 2; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs index 8a7a93efd3..9b2a05fbac 100644 --- a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs @@ -40,6 +40,11 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.Calamity().timesUsed = 3; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 66; diff --git a/Items/Weapons/Typeless/FiniteUse/Hydra.cs b/Items/Weapons/Typeless/FiniteUse/Hydra.cs index 47965ce3b4..df3542f111 100644 --- a/Items/Weapons/Typeless/FiniteUse/Hydra.cs +++ b/Items/Weapons/Typeless/FiniteUse/Hydra.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 10f; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = FireSound; Item.autoReuse = true; @@ -43,6 +43,11 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.Calamity().timesUsed = 1; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) diff --git a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs index 8592a2923e..8bbae3b121 100644 --- a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs +++ b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 48, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = Magnum.FireSound; Item.autoReuse = true; @@ -40,6 +40,11 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.Calamity().timesUsed = 3; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 56; diff --git a/Items/Weapons/Typeless/FiniteUse/Magnum.cs b/Items/Weapons/Typeless/FiniteUse/Magnum.cs index efbb3f5985..5f5348d35c 100644 --- a/Items/Weapons/Typeless/FiniteUse/Magnum.cs +++ b/Items/Weapons/Typeless/FiniteUse/Magnum.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = FireSound; Item.autoReuse = true; @@ -43,6 +43,11 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse Item.Calamity().timesUsed = 3; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 46; diff --git a/Items/Weapons/Typeless/GoldenGun.cs b/Items/Weapons/Typeless/GoldenGun.cs index 92122066d1..463102c246 100644 --- a/Items/Weapons/Typeless/GoldenGun.cs +++ b/Items/Weapons/Typeless/GoldenGun.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Typeless Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -34,6 +34,11 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 12f; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index a79a062314..f5a638adde 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -38,6 +38,11 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 12f; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); @@ -50,6 +55,7 @@ namespace CalamityMod.Items.Weapons.Typeless AddIngredient(15). AddIngredient(15). AddIngredient(ItemID.SunplateBlock, 15). + AddIngredient(2). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 011ef5ec90..ec6d43c92e 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -35,6 +35,11 @@ namespace CalamityMod.Items.Weapons.Typeless Item.Calamity().CannotBeEnchanted = true; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs index aae2dccef0..24b5ef67df 100644 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Typeless "You gain a small cooldown when summoning a new bulwark.\n" + "If a bulwark already exists, using this item will relocate it"); SacrificeTotal = 1; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -41,6 +42,12 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0f; } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.RelicOfResilience.ID); public override bool? UseItem(Player player) => true; diff --git a/Items/Weapons/Typeless/Skynamite.cs b/Items/Weapons/Typeless/Skynamite.cs index 50abcaa7e8..de27a1f978 100644 --- a/Items/Weapons/Typeless/Skynamite.cs +++ b/Items/Weapons/Typeless/Skynamite.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Items.Weapons.Typeless Tooltip.SetDefault("You don't need an aerodynamics major to use this\n" + "Throws a floaty explosive that defies gravity"); SacrificeTotal = 99; + ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[Item.type] = true; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; } public override void SetDefaults() @@ -34,16 +36,14 @@ namespace CalamityMod.Items.Weapons.Typeless Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; - Item.value = Item.buyPrice(0, 0, 40, 0); // Crafted 10 at a time + Item.value = CalamityGlobalItem.Rarity3BuyPrice / 10; // Crafted 10 at a time Item.rare = ItemRarityID.Orange; } - public override void UpdateInventory(Player player) - { - //Get the Demolitionist to spawn. Also check for Merchant because he does that. - if (NPC.FindFirstNPC(NPCID.Merchant) != -1 && NPC.FindFirstNPC(NPCID.Demolitionist) == -1) - Main.townNPCCanSpawn[NPCID.Demolitionist] = true; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Bombs; + } public override void AddRecipes() { diff --git a/Items/Weapons/Typeless/StarStruckWater.cs b/Items/Weapons/Typeless/StarStruckWater.cs index 3477b5804f..3666bcb23d 100644 --- a/Items/Weapons/Typeless/StarStruckWater.cs +++ b/Items/Weapons/Typeless/StarStruckWater.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Typeless DisplayName.SetDefault("Star Struck Water"); Tooltip.SetDefault("Spreads the astral infection to some blocks"); SacrificeTotal = 99; + ItemID.Sets.SortingPriorityTerraforming[Type] = 92; // Blood Water } public override void SetDefaults() diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs index 48234c38bc..e7371946ad 100644 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -43,6 +43,11 @@ namespace CalamityMod.Items.Weapons.Typeless Item.shootSpeed = 24f; } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; + } + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index f4408b886a..e8be92b01b 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Localization new [] { "PlagueBossText", "PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!" }, new [] { "PlagueBossText2", "MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!" }, - new [] { "ProfanedBossText", "The air is burning..." }, + new [] { "ProfanedBossText", "Holy flames burn away at your wings..." }, new [] { "ProfanedBossText2", "Shrieks are echoing from the dungeon." }, new [] { "ProfanedBossText3", "The calamitous beings have been inundated with bloodstone." }, new [] { "ProfanedBossText4", "The Profaned Goddess has recognised your devotion to purity!" }, @@ -158,7 +158,7 @@ namespace CalamityMod.Localization new [] { "ArmageddonDodgeDisable", "All of your dodges are now disabled." }, new [] { "ArmageddonDodgeEnable", "All of your dodges are now re-enabled." }, - new [] { "ChangingTheRules", "You cannot change the rules now." }, + new [] { "ChangingTheRules", "You cannot change the rules now!" }, new [] { "FlameText", "The air is getting warmer around you." }, @@ -171,17 +171,6 @@ namespace CalamityMod.Localization new [] { "BossRushTierFourEndText2", "Go forth and conquer 'til the ritual's end!" }, new [] { "BossRushTierFiveEndText", "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will become apparent in time..." }, - new [] { "MeleeLevelUp", "Melee weapon proficiency level up!" }, - new [] { "MeleeLevelUpFinal", "Melee weapon proficiency maxed out!" }, - new [] { "RangedLevelUp", "Ranged weapon proficiency level up!" }, - new [] { "RangedLevelUpFinal", "Ranged weapon proficiency maxed out!" }, - new [] { "MagicLevelUp", "Magic weapon proficiency level up!" }, - new [] { "MagicLevelUpFinal", "Magic weapon proficiency maxed out!" }, - new [] { "SummonLevelUp", "Summoner weapon proficiency level up!" }, - new [] { "SummonLevelUpFinal", "Summoner weapon proficiency maxed out!" }, - new [] { "RogueLevelUp", "Rogue weapon proficiency level up!" }, - new [] { "RogueLevelUpFinal", "Rogue weapon proficiency maxed out!" }, - new [] { "OpenSunkenSea", "The depths of the underground desert are rumbling..." }, new [] { "SandstormTrigger", "The desert wind is blowing furiously!" }, @@ -207,6 +196,17 @@ namespace CalamityMod.Localization new [] { "JungleSchematicRecipeCondition", "Place a schematic from the lab deep within the jungle in your inventory at least once" }, new [] { "UnderworldSchematicRecipeCondition", "Place a schematic from the lab near the edges of the underworld in your inventory at least once" }, new [] { "IceSchematicRecipeCondition", "Place a schematic from the lab within the frozen caverns in your inventory at least once" }, + + new [] { "BloodOrangeText", "You have already consumed a Blood Orange. Eating any more would not be good for you." }, + new [] { "MiracleFruitText", "You have already consumed a Miracle Fruit. Having another would make you sick." }, + new [] { "ElderberryText", "You have already consumed an Elderberry. It is probably not wise to eat more than one." }, + new [] { "DragonfruitText", "You have already consumed a Dragonfruit. Your stomach cannot take any more." }, + + new [] { "CometShardText", "You have already used a Comet Shard. Using more would make you nauseous." }, + new [] { "EtherealCoreText", "You have already used an Ethereal Core. It's best to not use more than you are able to." }, + new [] { "PhantomHeartText", "You have already used a Phantom Heart. It's probably good that you can't use another." }, + + new [] { "SlimeGodRun", "The Slime God flees to fight another day..." }, }; } diff --git a/Localization/enUS.hjson b/Localization/enUS.hjson index c642f38ed7..7dfc0377d0 100644 --- a/Localization/enUS.hjson +++ b/Localization/enUS.hjson @@ -13,6 +13,7 @@ Config: "Graphics": "Graphics Changes", "Revengeance": "Revengeance Mode Changes", "UI": "UI Changes", + "BaseBoosts": "Base Stat Boosts", } EntryTitle: @@ -35,11 +36,16 @@ Config: "EarlyHardmodeProgressionRework": "Early Hardmode Progression Rework", "ForceTownSafety": "Force Town Safety", "MeterPosLock": "Lock Meter Positions", + "FasterBaseSpeed": "Higher Base Speed", + "HigherJumpHeight": "Higher Jump Height", + "FasterJumpSpeed": "Higher Jump Speed", + "FasterFallHotkey": "Faster Fall Acceleration Hotkey", + "FasterTilePlacement": "Faster Base Tile Placement Speed", "NerfExpertDebuffs": "Remove Increased Debuff Duration", "ParticleLimit": "Max Particle Limit", - "Proficiency": "Proficiency", "RageMeterPosX": "Rage Meter X Position", "RageMeterPosY": "Rage Meter Y Position", + "RemoveReforgeRNG": "Remove Reforge RNG", "RipperMeterShake": "Rage and Adrenaline Meter Shake", "Screenshake": "Screenshake", "ShopNewAlert": "New Shop Inventory Alerts", @@ -53,6 +59,7 @@ Config: "TownNPCSpawnRateMultiplier": "Town NPC Spawn Rate Multiplier", "TownNPCsSpawnAtNight": "Town NPCs Spawn at Night", "VanillaCooldownDisplay": "Display Vanilla Cooldowns", + "WikiStatusMessage": "Wiki Status Message", } EntryTooltip: @@ -75,11 +82,16 @@ Config: "EarlyHardmodeProgressionRework": "Demon Altars no longer spawn ores and crimson/corruption blocks when broken.\nWall of Flesh spawns Cobalt and Palladium ore on first kill.\nThe first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill.\nThe second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill.\nThe third mech boss spawns Hallowed Ore on first kill", "ForceTownSafety": "Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates.\nThis can have unintended side effects such as making critters difficult to find.", "MeterPosLock": "Prevents clicking on the Stealth, Charge, Rage, and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.", + "FasterBaseSpeed": "Increases the player's base movement speed", + "HigherJumpHeight": "Increases the player's base jump height", + "FasterJumpSpeed": "Increases the player's base jump speed", + "FasterFallHotkey": "Pressing down increases the speed at which the player reaches their maximum fall velocity", + "FasterTilePlacement": "Increases the player's base tile placement speed", "NerfExpertDebuffs": "Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player.\nCalamity is balanced around this setting being enabled.", "ParticleLimit": "Sets the maximum of particle effects that can exist at once.\nParticles are separate from dust and gores.\nTurn down to improve performance.", - "Proficiency": "Enables the Proficiency system which allows the player to gain slight stat bonuses by persistently using one damage class.\nDisabling the system does not remove levels players already have, but disables their stat bonuses and prevents experience gain.", "RageMeterPosX": "The X position of the Rage Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", "RageMeterPosY": "The Y position of the Rage Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", + "RemoveReforgeRNG": "Removes randomness from the Goblin Tinkerer's reforges for both weapons and accessories.\nDisable this if using mods that change reforging on their own to prevent conflicts.", "RipperMeterShake": "How much the Rage and Adrenaline Meters shake while in use.\nSet to zero to disable the shaking entirely.", "Screenshake": "Enable or disable all screen-shaking effects.", "ShopNewAlert": "Adds an icon that appears over Town NPCs when they have new items in their shops.", @@ -93,6 +105,7 @@ Config: "TownNPCSpawnRateMultiplier": "Directly multiply the rate at which town NPCs spawn and respawn.\nThis reduces waiting times if a boss or event wipes your whole town.", "TownNPCsSpawnAtNight": "When enabled, town NPCs can spawn and respawn at night.\nThis includes the Old Man.", "VanillaCooldownDisplay": "Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack.\nThis doesn't remove them from your buff list, but can help with visibility nontheless", + "WikiStatusMessage": "Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry.", } } @@ -126,6 +139,48 @@ BiomeName: UndergroundAstralBiome: "Astral Underground", } +ItemName: +{ + AstralPylon: "Astral Pylon", + CragsPylon: "Crags Pylon", + SulphurPylon: "Sulphur Pylon", + SunkenPylon: "Sunken Pylon", +} + +ItemTooltip: +{ + AstralPylon: + ''' + Teleport to another pylon when 2 villagers are nearby + You can only place one per type and in the matching biome + ''' + CragsPylon: + ''' + Teleport to another pylon + The nature of the Crags allows you to teleport to this pylon without nearby villagers + You can only place one per type and in the matching biome + ''' + SulphurPylon: + ''' + Teleport to another pylon when 2 villagers are nearby + You can only place one per type and in the matching biome + ''' + SunkenPylon: + ''' + Teleport to another pylon when 2 villagers are nearby + You can only place one per type and in the matching biome + ''' + +} + +MapObject: +{ + AstralPylonTile: "{$Mods.CalamityMod.ItemName.AstralPylon}" + CragsPylonTile: "{$Mods.CalamityMod.ItemName.CragsPylon}" + SulphurPylonTile: "{$Mods.CalamityMod.ItemName.SulphurPylon}" + SunkenPylonTile: "{$Mods.CalamityMod.ItemName.SunkenPylon}" +} + TownNPCMood: { DILF: @@ -217,4 +272,36 @@ TownNPCMood: }, } +GameTips: +{ + SunkenSeaTip: "Deep below the Underground Desert lie the ruined outskirts of a fallen kingdom." + ArsenalLabTip: "Old labs can be found scattered throughout the Underground." + PlanetoidTip: "You can find Planetoids in outer space!" + AbyssTip: "The Abyss can be found deep below the Sulphurous Sea. It's very difficult to explore without proper diving gear." + BanditTip: "The Bandit is most interested in those who save up enough money worth to swindle." + RefundTip: "If you've been reforging a lot with the Goblin Tinkerer, it might pay off to give the Bandit a visit." + DrunkPrincessTip: "The Drunk Princess is great to party with. If you carry her favorite vodka, she might move in." + SeaKingTip: "The Sea King used to like clams. He changed his mind when he got eaten by one." + AmidiasBlessingTip: "The Sea King can provide a bubble to aid with breathing underwater to any who ask for help." + ArchmageTip: "The Archmage can be freed if you destroy the very castle he was imprisoned in." + BrimstoneWitchTip: "The Brimstone Witch can enchant items to grant them new powers." + TitanHeartTip: "Titan Hearts can be used as an offering at a Beacon found in the Astral Infection." + NightProvTip: "Summoning the sun goddess under the light of the moon massively empowers her strength and endurance." + DayEoLTip: "Summoning the fae goddess under the light of day will start a vicious and persistent battle." + BossEnemyTip: "Killing the most harmless of enemies can awaken the wrath of a much stronger monster. Slay them at your own risk!" + RoDAbyssTip: "Use the Rod of Discord in the Abyss at your own risk. The chaotic traces left behind may attract the attention of unwanted foes." + TerminusTip: "An ancient artifact resides at the bottom of the Abyss. Use with great caution." + CodebreakerTip: "The Codebreaker can be upgraded, allowing you to decrypt new schematics found in various labs around the world." + ChargeTip: "Certain weaponry requires charge to use. Weapons can be charged at a Charging Station with Draedon Power Cells." + PowerCellTip: "Power Cell Factories generate Draedon Power Cells over time." + FactoryChargingTip: "Power Cell Factories and Charging Stations can be looted from labs in the Underground." + StealthTip: "Wearing any rogue class armor lets you build stealth!" + SummonNerfTip: "Holding a non-summoner weapon reduces the damage of your minions." + DefenseDamageTip: "Certain attacks will chip away at your defense, but it will quickly regenerate afterward." + PointBlankTip: "Ranged weapons fired at point blank will do a lot more damage." + RevengeanceTip: "Need a challenge beyond Expert Mode? Try Revengeance Mode!" + BloodOrbTip: "Blood Orbs collected during the Blood Moon can craft almost any potion." + KeybindsTip: "Modded controls can be bound in Settings." +} + }} diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index c221785fd3..d8d8d371cc 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -6,6 +6,7 @@ using CalamityMod.Cooldowns; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; @@ -1378,21 +1379,33 @@ namespace CalamityMod public static bool DisableAllDodges(bool disable) => Main.LocalPlayer.Calamity().disableAllDodges = disable; #endregion - #region Item Rarity - public static int GetCalamityRarity(Item item) + #region Can Fire Point Blank Shots + /// + /// Gets whether the given item can fire point blank shots. + /// + /// The item which is being checked. + /// Whether the item can fire point blank shots. + public static bool CanFirePointBlank(Item it) { - CalamityGlobalItem cgi = item.Calamity(); - CalamityRarity calrare = cgi.customRarity; - if (calrare == CalamityRarity.NoEffect) - return item.rare; - return (int)calrare; + if (it is null || it.Calamity() is null) + return false; + CalamityGlobalItem cgi = it.Calamity(); + return cgi.canFirePointBlankShots; } - public static bool SetCalamityRarity(Item item, int rarityNum) + /// + /// Sets whether the given item can fire point blank shots. + /// + /// The item whose point blank capabilities is being toggled. + /// The value to apply. + /// Whether the item can fire point blank shots. + public static bool SetFirePointBlank(Item it, bool enabled) { - CalamityGlobalItem cgi = item.Calamity(); - cgi.customRarity = (CalamityRarity)rarityNum; - return cgi.customRarity != CalamityRarity.NoEffect; + if (it is null || it.Calamity() is null) + return false; + CalamityGlobalItem cgi = it.Calamity(); + cgi.canFirePointBlankShots = enabled; + return cgi.canFirePointBlankShots; } #endregion @@ -1642,6 +1655,26 @@ namespace CalamityMod return new ArgumentNullException("ERROR: Must specify a bool."); return SetBossHealthBarVisible(bossBarEnabled); + case "CanFirePointBlank": + case "CanFirePointBlankShots": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify an Item object (or int index of an Item in the Main.item array).");; + if (!isValidItemArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"CanFirePointBlank\" must be an Item or an int."); + return CanFirePointBlank(castItem(args[1])); + + case "SetFirePointBlank": + case "SetFirePointBlankShots": + if (args.Length < 2) + return new ArgumentNullException("ERROR: Must specify both an Item object (or int index of an Item in the Main.item array) and a bool."); + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify whether the item can fire point blank as a bool."); + if (!(args[2] is bool firePointBlank)) + return new ArgumentException("ERROR: The second argument to \"SetFirePointBlank\" must be a bool."); + if (!isValidItemArg(args[1])) + return new ArgumentException("ERROR: The first argument to \"SetFirePointBlank\" must be an Item or an int."); + return SetFirePointBlank(castItem(args[1]), firePointBlank); + case "NoDodges": case "DodgesDisabled": case "GetDodgesDisabled": @@ -1654,35 +1687,6 @@ namespace CalamityMod return new ArgumentNullException("ERROR: Must specify a bool."); return DisableAllDodges(disableDodges); - case "GetRarity": - case "GetItemRarity": - case "GetCalamityRarity": - case "GetPostMLRarity": - case "GetPostMoonLordRarity": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify an Item."); - if (!(args[1] is Item)) - return new ArgumentException("ERROR: The first argument to \"GetCalamityRarity\" must be an Item."); - Item itemToGet = (Item)args[1]; - return GetCalamityRarity(itemToGet); - - case "SetRarity": - case "SetItemRarity": - case "SetCalamityRarity": - case "SetPostMLRarity": - case "SetPostMoonLordRarity": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both an Item and desired rarity as an int or short ID."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify desired rarity as an int or short ID."); - if (!castID(args[2], out int rarity)) - return new ArgumentException("ERROR: The second argument to \"SetCalamityRarity\" must be an int or short ID."); - if (!(args[1] is Item)) - return new ArgumentException("ERROR: The first argument to \"SetCalamityRarity\" must be an Item."); - - Item itemToSet = (Item)args[1]; - return SetCalamityRarity(itemToSet, rarity); - case "AcidRainActive": case "IsAcidRainActive": case "GetAcidRainActive": @@ -1847,6 +1851,8 @@ namespace CalamityMod return new ArgumentNullException("ERROR: Must specify a Mod instance to load particles from."); GeneralParticleHandler.LoadModParticleInstances(args[1] as Mod); + FusableParticleManager.ExtraModsToLoadSetsFrom.Add(args[1] as Mod); + FusableParticleManager.LoadParticleRenderSets(true); return null; case "RegisterModCooldowns": diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 22a541ecf6..c0d4bab62e 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.Furniture.CraftingStations; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Potions; @@ -29,6 +30,7 @@ using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AdultEidolonWyrm; using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; @@ -46,7 +48,9 @@ using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.Polterghast; @@ -56,6 +60,7 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; @@ -69,6 +74,7 @@ using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; using static CalamityMod.Downed; using static Terraria.ModLoader.ModContent; @@ -77,6 +83,7 @@ namespace CalamityMod { internal class Downed { + public static readonly Func NotDownedCalamitas = () => !DownedBossSystem.downedCalamitas; public static readonly Func DownedDesertScourge = () => DownedBossSystem.downedDesertScourge; public static readonly Func DownedGiantClam = () => DownedBossSystem.downedCLAM; public static readonly Func DownedCrabulon = () => DownedBossSystem.downedCrabulon; @@ -113,11 +120,13 @@ namespace CalamityMod internal class WeakReferenceSupport { + public const string CalamityWikiURL = "calamitymod.wiki.gg"; + private static readonly Dictionary BossDifficulty = new Dictionary { - { "DesertScourge", 1.5f }, - { "GiantClam", 1.6f }, - { "Crabulon", 2.5f }, + { "DesertScourge", 1.6f }, + { "GiantClam", 1.61f }, + { "Crabulon", 2.7f }, { "HiveMind", 3.98f }, { "Perforators", 3.99f }, { "SlimeGod", 6.5f }, @@ -126,34 +135,34 @@ namespace CalamityMod { "BrimstoneElemental", 10.5f }, { "Calamitas", 11.7f }, { "GreatSandShark", 12.09f }, - { "Leviathan", 12.5f }, - { "AstrumAureus", 12.6f }, - { "PlaguebringerGoliath", 13.5f }, - { "Ravager", 15.5f }, - { "AstrumDeus", 16.5f }, - { "ProfanedGuardians", 17.5f }, - { "Dragonfolly", 17.6f }, - { "Providence", 18.01f }, // Thorium's Ragnarok will most likely be 18f - { "CeaselessVoid", 18.5f }, - { "StormWeaver", 18.51f }, - { "Signus", 18.52f }, - { "Polterghast", 19f }, - { "OldDuke", 19.5f }, - { "DevourerOfGods", 20f }, - { "Yharon", 21f }, - { "ExoMechs", 21.5f }, - { "SupremeCalamitas", 22f }, - { "AdultEidolonWyrm", 22.5f }, - // { "Yharim", 23f }, - // { "Noxus", 24f }, - // { "Xeroc", 25f }, + { "Leviathan", 12.8f }, + { "AstrumAureus", 12.81f }, + { "PlaguebringerGoliath", 14.5f }, + { "Ravager", 16.5f }, + { "AstrumDeus", 17.5f }, + { "ProfanedGuardians", 18.5f }, + { "Dragonfolly", 18.6f }, + { "Providence", 19.01f }, // Thorium's Ragnarok will most likely be 19f + { "CeaselessVoid", 19.5f }, + { "StormWeaver", 19.51f }, + { "Signus", 19.52f }, + { "Polterghast", 20f }, + { "OldDuke", 20.5f }, + { "DevourerOfGods", 21f }, + { "Yharon", 22f }, + { "ExoMechs", 22.5f }, + { "SupremeCalamitas", 23f }, + { "AdultEidolonWyrm", 23.5f }, + // { "Yharim", 24f }, + // { "Noxus", 25f }, + // { "Xeroc", 26f }, }; private static readonly Dictionary InvasionDifficulty = new Dictionary { - { "Acid Rain Initial", 2.4f }, + { "Acid Rain Initial", 2.67f }, { "Acid Rain Aquatic Scourge", 9.51f }, - { "Acid Rain Polterghast", 19.49f } + { "Acid Rain Polterghast", 20.49f } }; public static void Setup() @@ -164,32 +173,123 @@ namespace CalamityMod SummonersAssociationSupport(); } + public static void WikiThisSupport() + { + // Wikithis is a clientside mod + if (Main.netMode == NetmodeID.Server) + return; + + CalamityMod calamity = GetInstance(); + Mod wiki = calamity.wikithis; + if (wiki is null) + return; + + wiki.Call("AddModURL", calamity, CalamityWikiURL); + wiki.Call("0", calamity, CalamityWikiURL); + + // Clear up name conflicts + void ItemRedirect(int item, string pageName) + { + wiki.Call(1, item, pageName); + } + void EnemyRedirect(int item, string pageName) + { + wiki.Call(2, item, pageName); + } + + // Items + ItemRedirect(ModContent.ItemType(), "Blood Orange (calamity)"); + ItemRedirect(ModContent.ItemType(), "Elderberry (calamity)"); + ItemRedirect(ModContent.ItemType(), "Pineapple (calamity)"); + ItemRedirect(ModContent.ItemType(), "Trash Can (pet)"); + ItemRedirect(ModContent.ItemType(), "Butcher (weapon)"); + ItemRedirect(ModContent.ItemType(), "Sandstorm (weapon)"); + ItemRedirect(ModContent.ItemType(), "Thunderstorm (weapon)"); + // Lore items + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + + // Enemies + EnemyRedirect(ModContent.NPCType(), "Catfish (enemy)"); + EnemyRedirect(ModContent.NPCType(), "Hive (enemy)"); + EnemyRedirect(ModContent.NPCType(), "Crown Jewel (enemy)"); + EnemyRedirect(ModContent.NPCType(), "Tooth Ball (Old Duke)"); + EnemyRedirect(ModContent.NPCType(), "Enchantment"); + EnemyRedirect(ModContent.NPCType(), "%3F%3F%3F"); + } + // Wrapper function to add bosses to Boss Checklist. private static void AddBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, int npcType, Func downed, object summon, - List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null) + List collection, string instructions, string despawn, Func available, Action portrait = null, string bossHeadTex = null) { - bossChecklist.Call("AddBoss", difficulty, npcType, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex); + bossChecklist.Call("AddBoss", hostMod, name, npcType, difficulty, downed, available, collection, summon ?? null, instructions, despawn, portrait, bossHeadTex); } // Wrapper function to add bosses with multiple segments or phases to Boss Checklist. private static void AddBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, List npcTypes, Func downed, object summon, - List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null) + List collection, string instructions, string despawn, Func available, Action portrait = null, string bossHeadTex = null) { - bossChecklist.Call("AddBoss", difficulty, npcTypes, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex); - } - - // Wrapper function to add bosses with multiple segments or phases to Boss Checklist. - private static void AddInvasion(Mod bossChecklist, Mod hostMod, string name, float difficulty, List npcTypes, Func downed, object summon, - List loot, List collection, string instructions, string despawn, string invasionTexture = null, string iconTexture = null) - { - bossChecklist.Call("AddEventWithInfo", difficulty, npcTypes, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, invasionTexture, iconTexture); + bossChecklist.Call("AddBoss", hostMod, name, npcTypes, difficulty, downed, available, collection, summon ?? null, instructions, despawn, portrait, bossHeadTex); } // Wrapper function to add minibosses to Boss Checklist. private static void AddMiniBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, int npcType, Func downed, object summon, - List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null) + List collection, string instructions, string despawn, Func available, Action portrait = null, string bossHeadTex = null) { - bossChecklist.Call("AddMiniBoss", difficulty, npcType, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex); + bossChecklist.Call("AddMiniBoss", hostMod, name, npcType, difficulty, downed, available, collection, summon ?? null, instructions, despawn, portrait, bossHeadTex); + } + + // Wrapper function to add events to Boss Checklist. + private static void AddInvasion(Mod bossChecklist, Mod hostMod, string name, float difficulty, List npcTypes, Func downed, object summon, + List collection, string instructions, Func available, Action portrait = null, string bossHeadTex = null) + { + bossChecklist.Call("AddEvent", hostMod, name, npcTypes, difficulty, downed, available, collection, summon ?? null, instructions, portrait, bossHeadTex); } // Wrapper function to add loot and collection items to vanilla bosses for Boss Checklist. @@ -243,10 +343,11 @@ namespace CalamityMod /// 11.0 = Skeletron Prime
/// 12.0 = Plantera
/// 13.0 = Golem
- /// 14.0 = Empress of Light
- /// 15.0 = Duke Fishron
- /// 16.0 = Lunatic Cultist
- /// 17.0 = Moon Lord + /// 14.0 = Betsy
+ /// 15.0 = Empress of Light
+ /// 16.0 = Duke Fishron
+ /// 17.0 = Lunatic Cultist
+ /// 18.0 = Moon Lord ///
private static void BossChecklistSupport() { @@ -273,22 +374,25 @@ namespace CalamityMod BossDifficulty.TryGetValue("DesertScourge", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemID.SandBlock, ItemType(), ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Desert Biome"; string despawn = CalamityUtils.ColorMessage("The scourge of the desert delved back into the sand.", new Color(0xEE, 0xE8, 0xAA)); - string bossLogTex = "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist"; - AddBoss(bossChecklist, calamity, "Desert Scourge", order, segments, DownedDesertScourge, summon, loot, collection, instructions, despawn, bossLogTex); + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + string bossHeadTex = "CalamityMod/NPCs/DesertScourge/DesertScourgeHead_Head_Boss"; + AddBoss(bossChecklist, calamity, "Desert Scourge", order, segments, DownedDesertScourge, summon, collection, instructions, despawn, () => true, portrait, bossHeadTex); } // Giant Clam { BossDifficulty.TryGetValue("GiantClam", out float order); int type = NPCType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "Can spawn naturally in the Sunken Sea"; string despawn = CalamityUtils.ColorMessage("The Giant Clam returns into hiding in its grotto.", new Color(0x7F, 0xFF, 0xD4)); - AddMiniBoss(bossChecklist, calamity, "Giant Clam", order, type, DownedGiantClam, null, loot, null, instructions, despawn); + AddMiniBoss(bossChecklist, calamity, "Giant Clam", order, type, DownedGiantClam, null, null, instructions, despawn, () => true); } // Crabulon @@ -296,11 +400,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("Crabulon", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemID.GlowingMushroom, ItemID.MushroomGrassSeeds, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Mushroom Biome"; string despawn = CalamityUtils.ColorMessage("The mycleium crab has lost interest.", new Color(0x64, 0x95, 0xED)); - AddBoss(bossChecklist, calamity, "Crabulon", order, type, DownedCrabulon, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Crabulon", order, type, DownedCrabulon, summon, collection, instructions, despawn, () => true); } // Hive Mind @@ -308,11 +411,11 @@ namespace CalamityMod BossDifficulty.TryGetValue("HiveMind", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.DemoniteBar, ItemID.RottenChunk, ItemID.CorruptSeeds, ItemID.CursedFlame, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Kill a Cyst in the Corruption or use a [i:{summon}] in the Corruption"; string despawn = CalamityUtils.ColorMessage("The corrupted colony began searching for a new breeding ground.", new Color(0x94, 0x00, 0xD3)); - AddBoss(bossChecklist, calamity, "Hive Mind", order, type, DownedHiveMind, summon, loot, collection, instructions, despawn); + string bossHeadTex = "CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss"; + AddBoss(bossChecklist, calamity, "The Hive Mind", order, type, DownedHiveMind, summon, collection, instructions, despawn, () => true, null, bossHeadTex); } // Perforators @@ -320,11 +423,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("Perforators", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.CrimtaneBar, ItemID.Vertebrae, ItemID.CrimsonSeeds, ItemID.Ichor, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.LesserHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Kill a Cyst in the Crimson or use a [i:{summon}] in the Crimson"; string despawn = CalamityUtils.ColorMessage("The parasitic hive began searching for a new host.", new Color(0xDC, 0x14, 0x3C)); - AddBoss(bossChecklist, calamity, "The Perforators", order, type, DownedPerfs, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "The Perforators", order, type, DownedPerfs, summon, collection, instructions, despawn, () => true); } // Slime God @@ -332,11 +434,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("SlimeGod", out float order); List bosses = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemID.Gel, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The gelatinous monstrosity achieved vengeance for its brethren.", new Color(0xBA, 0x55, 0x33)); - AddBoss(bossChecklist, calamity, "Slime God", order, bosses, DownedSlimeGod, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Slime God", order, bosses, DownedSlimeGod, summon, collection, instructions, despawn, () => true); } // Cryogen @@ -344,12 +445,11 @@ namespace CalamityMod BossDifficulty.TryGetValue("Cryogen", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FrozenKey, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Snow Biome"; string despawn = CalamityUtils.ColorMessage("Cryogen drifts away, carried on a freezing wind.", new Color(0x00, 0xFF, 0xFF)); - string bossLogTex = "CalamityMod/NPCs/Cryogen/Cryogen_BossChecklist"; - AddBoss(bossChecklist, calamity, "Cryogen", order, type, DownedCryogen, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/Cryogen/Cryogen_Phase1_Head_Boss"; + AddBoss(bossChecklist, calamity, "Cryogen", order, type, DownedCryogen, summon, collection, instructions, despawn, () => true, null, bossLogTex); } // Aquatic Scourge @@ -357,12 +457,16 @@ namespace CalamityMod BossDifficulty.TryGetValue("AquaticScourge", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"; string despawn = CalamityUtils.ColorMessage("The Aquatic Scourge swam back into the open ocean.", new Color(0xF0, 0xE6, 0x8C)); - string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist"; - AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourgeHead_Head_Boss"; + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Brimstone Elemental @@ -370,11 +474,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("BrimstoneElemental", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Brimstone Crag"; string despawn = CalamityUtils.ColorMessage("Brimstone Elemental withdraws to the ruins of her shrine.", new Color(0xDC, 0x14, 0x3C)); - AddBoss(bossChecklist, calamity, "Brimstone Elemental", order, type, DownedBrimstoneElemental, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Brimstone Elemental", order, type, DownedBrimstoneElemental, summon, collection, instructions, despawn, () => true); } // Calamitas @@ -382,11 +485,12 @@ namespace CalamityMod BossDifficulty.TryGetValue("Calamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.BrokenHeroSword, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night"; string despawn = CalamityUtils.ColorMessage("If you wanted a fight, you should've came more prepared.", new Color(0xFF, 0xA5, 0x00)); - AddBoss(bossChecklist, calamity, "Calamitas", order, type, DownedCalamitas, summon, loot, collection, instructions, despawn); + //Func available = () => !DownedBossSystem.downedCalamitas; + AddBoss(bossChecklist, calamity, "The Calamitas Clone", order, type, DownedCalamitas, summon, collection, instructions, despawn, () => true); + //AddBoss(bossChecklist, calamity, "Calamitas", order, type, DownedCalamitas, summon, collection, instructions, despawn, available); } // Great Sand Shark @@ -394,23 +498,26 @@ namespace CalamityMod BossDifficulty.TryGetValue("GreatSandShark", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemID.AncientBattleArmorMaterial, ItemID.DungeonDesertKey, ItemID.LightShard, ItemID.DarkShard }; List collection = new List() { ItemID.MusicBoxSandstorm }; string instructions = $"Kill 10 sand sharks after defeating Plantera or use a [i:{summon}] in the Desert Biome"; string despawn = CalamityUtils.ColorMessage("The apex predator of the sands disappears into the dunes...", new Color(0xDA, 0xA5, 0x20)); - AddMiniBoss(bossChecklist, calamity, "Great Sand Shark", order, type, DownedGSS, summon, loot, collection, instructions, despawn); + AddMiniBoss(bossChecklist, calamity, "Great Sand Shark", order, type, DownedGSS, summon, collection, instructions, despawn, () => true); } // Siren and Leviathan { BossDifficulty.TryGetValue("Leviathan", out float order); List bosses = new List() { NPCType(), NPCType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "By killing an unknown entity in the Ocean Biome"; string despawn = CalamityUtils.ColorMessage("The aquatic entities sink back beneath the ocean depths.", new Color(0x7F, 0xFF, 0xD4)); - string bossLogTex = "CalamityMod/NPCs/Leviathan/AnahitaLevi_BossChecklist"; - AddBoss(bossChecklist, calamity, "Leviathan", order, bosses, DownedLeviathan, null, loot, collection, instructions, despawn, bossLogTex); + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/Leviathan/AnahitaLevi_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Leviathan", order, bosses, DownedLeviathan, null, collection, instructions, despawn, () => true, portrait); } // Astrum Aureus @@ -418,12 +525,11 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumAureus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); - string bossLogTex = "CalamityMod/NPCs/AstrumAureus/AstrumAureus_BossChecklist"; - AddBoss(bossChecklist, calamity, "Astrum Aureus", order, type, DownedAureus, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/AstrumAureus/AstrumAureus_Head_Boss"; + AddBoss(bossChecklist, calamity, "Astrum Aureus", order, type, DownedAureus, summon, collection, instructions, despawn, () => true, null, bossLogTex); } // Plaguebringer Goliath @@ -431,12 +537,17 @@ namespace CalamityMod BossDifficulty.TryGetValue("PlaguebringerGoliath", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.Stinger, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.", new Color(0x00, 0xFF, 0x00)); - string bossLogTex = "CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_BossChecklist"; - AddBoss(bossChecklist, calamity, "Plaguebringer Goliath", order, type, DownedPBG, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_Head_Boss"; + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Plaguebringer Goliath", order, type, DownedPBG, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Ravager @@ -444,12 +555,17 @@ namespace CalamityMod BossDifficulty.TryGetValue("Ravager", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The automaton of misshapen victims went looking for the true perpetrator.", new Color(0xB2, 0x22, 0x22)); - string bossLogTex = "CalamityMod/NPCs/Ravager/Ravager_BossChecklist"; - AddBoss(bossChecklist, calamity, "Ravager", order, segments, DownedRavager, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/Ravager/RavagerBody_Head_Boss"; + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/Ravager/Ravager_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Ravager", order, segments, DownedRavager, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Astrum Deus @@ -460,12 +576,18 @@ namespace CalamityMod int summon2 = ItemType(); int altar = ItemType(); List summons = new List() { summon1, summon2 }; - List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon1}] or [i:{summon2}] as offering at an [i:{altar}]"; string despawn = CalamityUtils.ColorMessage("The infected deity retreats to the heavens.", new Color(0xFF, 0xD7, 0x00)); - string bossLogTex = "CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist"; - AddBoss(bossChecklist, calamity, "Astrum Deus", order, segments, DownedDeus, summons, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/AstrumDeus/AstrumDeusHead_Head_Boss"; + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + + AddBoss(bossChecklist, calamity, "Astrum Deus", order, segments, DownedDeus, summons, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Profaned Guardians @@ -473,12 +595,17 @@ namespace CalamityMod BossDifficulty.TryGetValue("ProfanedGuardians", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Hallow or Underworld Biomes"; string despawn = CalamityUtils.ColorMessage("The guardians must protect their goddess at all costs.", new Color(0xFF, 0xA5, 0x00)); - string bossLogTex = "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist"; - AddBoss(bossChecklist, calamity, "Profaned Guardians", order, type, DownedGuardians, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommander_Head_Boss"; + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Profaned Guardians", order, type, DownedGuardians, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Dragonfolly @@ -486,11 +613,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("Dragonfolly", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("The failed experiment returns to its reproductive routine.", new Color(0xFF, 0xD7, 0x00)); - AddBoss(bossChecklist, calamity, "Dragonfolly", order, type, DownedBirb, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Dragonfolly", order, type, DownedBirb, summon, collection, instructions, despawn, () => true); } // Providence @@ -498,12 +624,17 @@ namespace CalamityMod BossDifficulty.TryGetValue("Providence", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Hallow or Underworld Biomes"; string despawn = CalamityUtils.ColorMessage("The Profaned Goddess vanishes in a burning blaze.", new Color(0xFF, 0xA5, 0x00)); - string bossLogTex = "CalamityMod/NPCs/Providence/Providence_BossChecklist"; - AddBoss(bossChecklist, calamity, "Providence", order, type, DownedProvidence, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/Providence/Providence_Head_Boss"; + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/Providence/Providence_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Providence", order, type, DownedProvidence, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Ceaseless Void @@ -511,11 +642,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("CeaselessVoid", out float order); List bosses = new List() { NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Dungeon"; string despawn = CalamityUtils.ColorMessage("The rift in time and space has moved away from your reach.", new Color(0x4B, 0x00, 0x82)); - AddBoss(bossChecklist, calamity, "Ceaseless Void", order, bosses, DownedCeaselessVoid, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Ceaseless Void", order, bosses, DownedCeaselessVoid, summon, collection, instructions, despawn, () => true); } // Storm Weaver @@ -523,12 +653,16 @@ namespace CalamityMod BossDifficulty.TryGetValue("StormWeaver", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in Space"; string despawn = CalamityUtils.ColorMessage("Storm Weaver hid itself once again within the stormfront.", new Color(0xEE, 0x82, 0xEE)); - string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist"; - AddBoss(bossChecklist, calamity, "Storm Weaver", order, segments, DownedStormWeaver, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaverHead_Head_Boss"; + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Storm Weaver", order, segments, DownedStormWeaver, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } // Signus @@ -536,11 +670,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("Signus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Underworld"; string despawn = CalamityUtils.ColorMessage("The Devourer's assassin has finished its easy task.", new Color(0xBA, 0x55, 0xD3)); - AddBoss(bossChecklist, calamity, "Signus", order, type, DownedSignus, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Signus", order, type, DownedSignus, summon, collection, instructions, despawn, () => true); } // Polterghast @@ -548,11 +681,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("Polterghast", out float order); List bosses = new List() { NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Kill 30 phantom spirits or use a [i:{summon}] in the Dungeon"; string despawn = CalamityUtils.ColorMessage("The volatile spirits disperse throughout the depths of the dungeon.", new Color(0xB0, 0xE0, 0xE6)); - AddBoss(bossChecklist, calamity, "Polterghast", order, bosses, DownedPolterghast, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Polterghast", order, bosses, DownedPolterghast, summon, collection, instructions, despawn, () => true); } // Old Duke @@ -560,11 +692,10 @@ namespace CalamityMod BossDifficulty.TryGetValue("OldDuke", out float order); List bosses = new List() { NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Defeat the Acid Rain event post-Polterghast or fish using a [i:{summon}] in the Sulphurous Sea"; string despawn = CalamityUtils.ColorMessage("The old duke disappears amidst the acidic downpour.", new Color(0xF0, 0xE6, 0x8C)); - AddBoss(bossChecklist, calamity, "Old Duke", order, bosses, DownedBoomerDuke, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Old Duke", order, bosses, DownedBoomerDuke, summon, collection, instructions, despawn, () => true); } // Devourer of Gods @@ -572,13 +703,16 @@ namespace CalamityMod BossDifficulty.TryGetValue("DevourerOfGods", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF)); - string bossLogTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist"; string bossHeadTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; - AddBoss(bossChecklist, calamity, "Devourer of Gods", order, type, DownedDoG, summon, loot, collection, instructions, despawn, bossLogTex, bossHeadTex); + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Devourer of Gods", order, type, DownedDoG, summon, collection, instructions, despawn, () => true, portrait, bossHeadTex); } // Yharon @@ -586,12 +720,11 @@ namespace CalamityMod BossDifficulty.TryGetValue("Yharon", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), /*ItemType(), */ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("Yharon found you too weak to stay near your gravestone.", new Color(0xFF, 0xA5, 0x00)); - string bossLogTex = "CalamityMod/NPCs/Yharon/Yharon_BossChecklist"; - AddBoss(bossChecklist, calamity, "Yharon", order, type, DownedYharon, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/Yharon/Yharon_Head_Boss"; + AddBoss(bossChecklist, calamity, "Yharon", order, type, DownedYharon, summon, collection, instructions, despawn, () => true, null, bossLogTex); } // Exo Mechs @@ -601,12 +734,18 @@ namespace CalamityMod { BossDifficulty.TryGetValue("ExoMechs", out float order); List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "By using a high-tech computer"; string despawn = CalamityUtils.ColorMessage("An imperfection after all... what a shame.", new Color(0x7F, 0xFF, 0xD4)); - string bossLogTex = "CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist"; - AddBoss(bossChecklist, calamity, "Exo Mechs", order, bosses, DownedExoMechs, null, loot, collection, instructions, despawn, bossLogTex); + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = Request("CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist").Value; + float scale = 0.7f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + }; + + AddBoss(bossChecklist, calamity, "Exo Mechs", order, bosses, DownedExoMechs, null, collection, instructions, despawn, () => true, portrait); } // Supreme Calamitas @@ -617,12 +756,11 @@ namespace CalamityMod int summon2 = ItemType(); int altar = ItemType(); List summons = new List() { summon1, summon2 }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon1}] or a [i:{summon2}] as offering at an [i:{altar}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); string bossHeadTex = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; - AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summons, loot, collection, instructions, despawn, null, bossHeadTex); + AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summons, collection, instructions, despawn, () => true, null, bossHeadTex); } // Adult Eidolon Wyrm @@ -630,12 +768,17 @@ namespace CalamityMod BossDifficulty.TryGetValue("AdultEidolonWyrm", out float order); int type = NPCType(); int summon = ItemID.RodofDiscord; - List loot = new List() { ItemType(), ItemType(), ItemID.Ectoplasm, ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { }; string instructions = $"While in the Abyss, use an item that inflicts Chaos State"; string despawn = CalamityUtils.ColorMessage("...", new Color(0x7F, 0xFF, 0xD4)); - string bossLogTex = "CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrm_BossChecklist"; - AddBoss(bossChecklist, calamity, "Adult Eidolon Wyrm", order, type, DownedAdultEidolonWyrm, summon, loot, collection, instructions, despawn, bossLogTex); + string bossLogTex = "CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead_Head_Boss"; + + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrm_BossChecklist").Value; + Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); + sb.Draw(texture, centered, color); + }; + AddBoss(bossChecklist, calamity, "Adult Eidolon Wyrm", order, type, DownedAdultEidolonWyrm, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } } @@ -646,13 +789,16 @@ namespace CalamityMod InvasionDifficulty.TryGetValue("Acid Rain Initial", out float order); List enemies = AcidRainEvent.PossibleEnemiesPreHM.Select(enemy => enemy.Key).ToList(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Eye of Cthulhu is defeated."; - string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the ocean.", new Color(146, 183, 116)); - string bossLogTex = "CalamityMod/Events/AcidRainT1_BossChecklist"; string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; - AddInvasion(bossChecklist, calamity, "Acid Rain", order, enemies, DownedAcidRainInitial, summon, loot, collection, instructions, despawn, bossLogTex, iconTexture); + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/Events/AcidRainT1_BossChecklist").Value; + float scale = 1.3f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + }; + AddInvasion(bossChecklist, calamity, "Acid Rain", order, enemies, DownedAcidRainInitial, summon, collection, instructions, () => true, portrait, iconTexture); } // Post-Aquatic Scourge Acid Rain { @@ -661,13 +807,16 @@ namespace CalamityMod enemies.Add(ModContent.NPCType()); enemies.AddRange(AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Key)); List summons = new List() { ItemType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{ItemType()}] or wait for the invasion to occur naturally after the Aquatic Scourge is defeated"; - string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); - string bossLogTex = "CalamityMod/Events/AcidRainT2_BossChecklist"; string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; - AddInvasion(bossChecklist, calamity, "Acid Rain (Post-AS)", order, enemies, DownedAcidRainHardmode, summons, loot, collection, instructions, despawn, bossLogTex, iconTexture); + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/Events/AcidRainT2_BossChecklist").Value; + float scale = 0.9f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + }; + AddInvasion(bossChecklist, calamity, "Acid Rain (Post-AS)", order, enemies, DownedAcidRainHardmode, summons, collection, instructions, () => true, portrait, iconTexture); } // Post-Polterghast Acid Rain { @@ -675,13 +824,16 @@ namespace CalamityMod List enemies = AcidRainEvent.PossibleEnemiesPolter.Select(enemy => enemy.Key).ToList(); enemies.AddRange(AcidRainEvent.PossibleMinibossesPolter.Select(miniboss => miniboss.Key)); List summons = new List() { ItemType() }; - List loot = new List() { ItemID.SharkFin, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{ItemType()}] or wait for the invasion to occur naturally after the Polterghast is defeated"; - string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); - string bossLogTex = "CalamityMod/Events/AcidRainT3_BossChecklist"; string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; - AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Polter)", order, enemies, DownedBoomerDuke, summons, loot, collection, instructions, despawn, bossLogTex, iconTexture); + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/Events/AcidRainT3_BossChecklist").Value; + float scale = 0.9f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + }; + AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Polter)", order, enemies, DownedBoomerDuke, summons, collection, instructions, () => true, portrait, iconTexture); } } diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 2414af484a..d2438fb90d 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -164,7 +164,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override void FindFrame(int frameHeight) @@ -192,7 +193,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 10, 20); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); } diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index cb004a0784..fb1f59645d 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -250,14 +250,15 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 7, 10)); - npcLoot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 3); + npcLoot.AddIf(DropHelper.PostPolter(), ModContent.ItemType(), 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 35dfd26964..6f0ebff4c5 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -198,7 +198,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); + if (damage > 0) + player.AddBuff(BuffID.Venom, 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 9e4e157e8c..9b5636dc99 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -256,7 +256,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180); if (puffedUp) { diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index cf7939ef10..907313c626 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -301,7 +301,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); NPC.gfxOffY = player7.gfxOffY; NPC.velocity = Vector2.Zero; - player7.AddBuff(163, 59, true); + player7.AddBuff(BuffID.Obstructed, 59, true); } } NPC.rotation = NPC.velocity.X * 0.05f; @@ -548,7 +548,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -556,10 +557,10 @@ namespace CalamityMod.NPCs.Abyss npcLoot.Add(ItemID.BlackInk, 1, 3, 5); npcLoot.Add(ModContent.ItemType(), 5); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 26, 38, 31, 45)); - npcLoot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 3); + npcLoot.AddIf(DropHelper.PostPolter(), ModContent.ItemType(), 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 0a1790393d..dcf8eaa6f4 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -365,7 +365,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 120, true); + if (damage > 0) + player.AddBuff(BuffID.Darkness, 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index dda4ba5d09..d6ce81e25b 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.Abyss bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A sturdy fish, which has spent a long time seething in the Abyss. Males are easily identified by their forward-facing horns, and females by their curled horns.") + new FlavorTextBestiaryInfoElement("A sturdy fish, which has spent a long time seething in the Abyss. Males are easily identified by their forward-facing horns.") }); } @@ -298,7 +298,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -316,7 +317,7 @@ namespace CalamityMod.NPCs.Abyss public static void DefineDevilFishLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); postClone.Add(ModContent.ItemType(), 2); npcLoot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 1, 3, 9); diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index a348ebf5bb..4c94233c0d 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Abyss bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A sturdy fish, which has spent a long time seething in the Abyss. Males are easily identified by their forward-facing horns, and females by their curled horns.") + new FlavorTextBestiaryInfoElement("A sturdy fish, which has spent a long time seething in the Abyss. Females are easily identified by their curled horns.") }); } @@ -294,7 +294,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index a90852c262..38e438d45e 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -444,7 +444,7 @@ namespace CalamityMod.NPCs.Abyss } if (adultWyrmAlive) - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; @@ -513,14 +513,14 @@ namespace CalamityMod.NPCs.Abyss aewMinionCondition.Add(ModContent.ItemType(), 1, 30, 40); // Post-Polterghast: Soul Edge, Eidolic Wail, Stardust Staff - LeadingConditionRule postPolter = new(DropHelper.If(() => DownedBossSystem.downedPolterghast)); + LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); aewMinionCondition.Add(postPolter); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); // Post-Clone: 6-8 Lumenyl (8-11 on Expert) - LeadingConditionRule postClone = new(DropHelper.If(() => DownedBossSystem.downedCalamitas)); + LeadingConditionRule postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); aewMinionCondition.Add(postClone); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); @@ -558,7 +558,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 972851896a..be855c165f 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -241,13 +241,16 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Darkness, 180, true); + if (damage > 0) + { + player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } } public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(ModContent.ItemType(), 2); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index a6f4082452..867ea3fc7f 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { NPC.damage = 90; //70 - NPC.width = 56; //36 - NPC.height = 36; + NPC.width = 40; //36 + NPC.height = 48; NPC.defense = 30; NPC.lifeMax = 60000; NPC.aiStyle = -1; //new @@ -117,9 +117,9 @@ namespace CalamityMod.NPCs.Abyss NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) NPC.spriteDirection = 1; + else if (num191 > 0f) + NPC.spriteDirection = -1; } } @@ -167,7 +167,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/Abyss/GulperEelBody.png b/NPCs/Abyss/GulperEelBody.png index 02a0ee98da..fb79dc639f 100644 Binary files a/NPCs/Abyss/GulperEelBody.png and b/NPCs/Abyss/GulperEelBody.png differ diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index bb8228de69..7edfd40517 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { NPC.damage = 90; //70 - NPC.width = 36; //36 - NPC.height = 36; + NPC.width = 40; //36 + NPC.height = 48; NPC.defense = 30; NPC.lifeMax = 60000; NPC.aiStyle = -1; //new @@ -117,9 +117,9 @@ namespace CalamityMod.NPCs.Abyss NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) NPC.spriteDirection = 1; + else if (num191 > 0f) + NPC.spriteDirection = -1; } } @@ -167,7 +167,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/Abyss/GulperEelBodyAlt.png b/NPCs/Abyss/GulperEelBodyAlt.png index 1b715e703f..b913ecfe72 100644 Binary files a/NPCs/Abyss/GulperEelBodyAlt.png and b/NPCs/Abyss/GulperEelBodyAlt.png differ diff --git a/NPCs/Abyss/GulperEelBodyAltGlow.png b/NPCs/Abyss/GulperEelBodyAltGlow.png index 106da36968..363279be79 100644 Binary files a/NPCs/Abyss/GulperEelBodyAltGlow.png and b/NPCs/Abyss/GulperEelBodyAltGlow.png differ diff --git a/NPCs/Abyss/GulperEelBodyGlow.png b/NPCs/Abyss/GulperEelBodyGlow.png index 32fdd42499..bd7324a232 100644 Binary files a/NPCs/Abyss/GulperEelBodyGlow.png and b/NPCs/Abyss/GulperEelBodyGlow.png differ diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 2d06a3c83d..b520cb9936 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -32,9 +32,11 @@ namespace CalamityMod.NPCs.Abyss { Scale = 0.75f, CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/GulperEel_Bestiary", - PortraitPositionXOverride = 40 + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 }; - value.Position.X += 20; + value.Position.X += 50; + value.Position.Y += 20; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -42,8 +44,8 @@ namespace CalamityMod.NPCs.Abyss { NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 135; - NPC.width = 66; //36 - NPC.height = 86; //20 + NPC.width = 40; //36 + NPC.height = 84; //20 NPC.defense = 10; NPC.lifeMax = 48000; NPC.aiStyle = -1; @@ -139,11 +141,11 @@ namespace CalamityMod.NPCs.Abyss } if (NPC.velocity.X < 0f) { - NPC.spriteDirection = -1; + NPC.spriteDirection = 1; } else if (NPC.velocity.X > 0f) { - NPC.spriteDirection = 1; + NPC.spriteDirection = -1; } if (Main.player[NPC.target].dead) { @@ -355,7 +357,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 3, 4)); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 6, 8, 8, 11)); } @@ -381,7 +383,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Abyss/GulperEelHead.png b/NPCs/Abyss/GulperEelHead.png index 00e25c1d75..b840a7904d 100644 Binary files a/NPCs/Abyss/GulperEelHead.png and b/NPCs/Abyss/GulperEelHead.png differ diff --git a/NPCs/Abyss/GulperEelHeadGlow.png b/NPCs/Abyss/GulperEelHeadGlow.png index 10b965122b..f7d7b57f39 100644 Binary files a/NPCs/Abyss/GulperEelHeadGlow.png and b/NPCs/Abyss/GulperEelHeadGlow.png differ diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 830e6e6e83..7c5c03f1e5 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { NPC.damage = 65; //70 - NPC.width = 54; //28 - NPC.height = 76; //28 + NPC.width = 40; //28 + NPC.height = 54; //28 NPC.defense = 50; NPC.lifeMax = 60000; NPC.aiStyle = -1; //new @@ -117,9 +117,9 @@ namespace CalamityMod.NPCs.Abyss NPC.position.Y = NPC.position.Y + num192; if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) NPC.spriteDirection = 1; + else if (num191 > 0f) + NPC.spriteDirection = -1; } } @@ -166,7 +166,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 60, true); } } } diff --git a/NPCs/Abyss/GulperEelTail.png b/NPCs/Abyss/GulperEelTail.png index 5ad140ba0a..acade0c0a0 100644 Binary files a/NPCs/Abyss/GulperEelTail.png and b/NPCs/Abyss/GulperEelTail.png differ diff --git a/NPCs/Abyss/GulperEelTailGlow.png b/NPCs/Abyss/GulperEelTailGlow.png index b7a15e8890..b07de25a2d 100644 Binary files a/NPCs/Abyss/GulperEelTailGlow.png and b/NPCs/Abyss/GulperEelTailGlow.png differ diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index b9505f1ac5..1d6127b1c8 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => DownedBossSystem.downedCalamitas, ModContent.ItemType(), 2); + npcLoot.AddIf(DropHelper.PostCal(), ModContent.ItemType(), 2); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 68e642fef1..935b903c2d 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -293,7 +293,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -308,7 +309,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 8, 15); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); postClone.Add(ModContent.ItemType(), 2); } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 547877527b..261fe3d889 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -225,7 +225,7 @@ namespace CalamityMod.NPCs.Abyss { npcLoot.AddIf(() => NPC.downedBoss3, ModContent.ItemType(), 10); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); @@ -235,8 +235,11 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 240, true); - player.AddBuff(BuffID.Electrified, 120, true); + if (damage > 0) + { + player.AddBuff(BuffID.Venom, 240, true); + player.AddBuff(BuffID.Electrified, 120, true); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index d0595384c4..ea03aac09f 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -94,7 +94,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 90, true); + if (damage > 0) + player.AddBuff(BuffID.Venom, 90, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index f1d098851d..a61e0b9953 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 3, 5, 4, 7)); } @@ -340,7 +340,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 90); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index e934b190b6..230b3d109d 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -642,7 +642,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -664,12 +665,12 @@ namespace CalamityMod.NPCs.Abyss npcLoot.Add(ModContent.ItemType(), 1, 40, 50); npcLoot.Add(ModContent.ItemType(), 1, 2, 3); - var postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); + var postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); postPolter.Add(ModContent.ItemType(), 1, 3, 4); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 10, 17, 14, 22)); } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 7197837a56..3d6833254e 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -137,7 +137,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Poisoned, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Poisoned, 240, true); } public override void FindFrame(int frameHeight) @@ -188,7 +189,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 4, 6)); } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 6b9617e5e2..9a897baa6d 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -133,7 +133,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -151,7 +152,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); postClone.Add(ModContent.ItemType(), 4); } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 79cff8592f..8681a07131 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -6,12 +6,13 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using System; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -153,7 +154,8 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); - npcLoot.AddIf(() => DownedBossSystem.downedAquaticScourge, ModContent.ItemType(), 20); + LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(DropHelper.PostAS()); + postAS.Add(ModContent.ItemType(), 20); } public override void FindFrame(int frameHeight) @@ -192,6 +194,10 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 120); + } } } diff --git a/NPCs/AcidRain/BabyFlakCrab.cs b/NPCs/AcidRain/BabyFlakCrab.cs index 4430ff5bbf..de1a577a42 100644 --- a/NPCs/AcidRain/BabyFlakCrab.cs +++ b/NPCs/AcidRain/BabyFlakCrab.cs @@ -30,7 +30,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 5; NPC.defense = 5; - NPC.value = Item.buyPrice(0, 0, 5, 55); NPC.lavaImmune = true; NPC.noGravity = false; NPC.noTileCollide = false; @@ -139,17 +138,6 @@ namespace CalamityMod.NPCs.AcidRain return 0.15f; } - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } - catch - { - return; - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index f8cdd80779..b50fcd1421 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -124,17 +124,5 @@ namespace CalamityMod.NPCs.AcidRain return spawnRate; } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - - } - catch - { - return; - } - } } } diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index cfe4d73e75..eea7e86afe 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -1,21 +1,22 @@ using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Rogue; using Terraria.Utilities; using Terraria.WorldBuilding; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -496,18 +497,24 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 300); + } public override void ModifyNPCLoot(NPCLoot npcLoot) { // If post-Polter, the drop rates are 10%. Otherwise they're 100%. - // This is accomplished by adding rules if the CONDITION "Post-Polter" fails. + // This is accomplished by adding rules if the CONDITION "Post-Polter" fails. LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); - postPolter.Add(ModContent.ItemType(), 10); - postPolter.Add(ModContent.ItemType(), 10); - postPolter.OnFailedConditions(ItemDropRule.Common(ModContent.ItemType())); - postPolter.OnFailedConditions(ItemDropRule.Common(ModContent.ItemType())); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + postPolter.Add(ModContent.ItemType(), 10, hideLootReport: !DownedBossSystem.downedPolterghast); + postPolter.Add(ModContent.ItemType(), 10, hideLootReport: !DownedBossSystem.downedPolterghast); + postPolter.AddFail(ModContent.ItemType(), hideLootReport: DownedBossSystem.downedPolterghast); + postPolter.AddFail(ModContent.ItemType(), hideLootReport: DownedBossSystem.downedPolterghast); + + npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 8aeec6b197..3e779f5f34 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -9,6 +9,7 @@ using System; using System.IO; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -181,8 +182,9 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 20); - npcLoot.AddIf(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), 3, 1, 3); - npcLoot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 15, 1, 3); + LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); + postPolter.Add(ModContent.ItemType(), 15, 1, 3, !DownedBossSystem.downedPolterghast); + postPolter.AddFail(ModContent.ItemType(), 3, 1, 3, DownedBossSystem.downedPolterghast); } public override void FindFrame(int frameHeight) diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index e1310af528..a9736df275 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -206,6 +206,10 @@ namespace CalamityMod.NPCs.AcidRain CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 8edb27b688..4da41f3579 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -127,7 +127,8 @@ namespace CalamityMod.NPCs.AcidRain public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 6914695fda..e6a9c2c1ca 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -1,7 +1,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; @@ -75,8 +75,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath60; NPC.knockBackResist = 0f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); NPC.RemoveWaterSlowness(); NPC.Calamity().canBreakPlayerDefense = true; NPC.Calamity().VulnerableToHeat = false; @@ -446,14 +444,16 @@ namespace CalamityMod.NPCs.AcidRain public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 420); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 420); } public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.SharkFin, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 3); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 5c85a81915..667b2e684f 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -1,6 +1,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; @@ -517,13 +518,18 @@ namespace CalamityMod.NPCs.AcidRain Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 300); + } public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 3); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index eb7249ddd3..e32e79e0f8 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -8,10 +8,11 @@ using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { @@ -165,11 +166,16 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); - npcLoot.AddIf(() => !DownedBossSystem.downedAquaticScourge, ModContent.ItemType(), 20); - npcLoot.AddIf(() => DownedBossSystem.downedAquaticScourge, ModContent.ItemType(), 100); + LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourge); + postAS.Add(ModContent.ItemType(), 100, hideLootReport: !DownedBossSystem.downedAquaticScourge); + postAS.AddFail(ModContent.ItemType(), 20, hideLootReport: DownedBossSystem.downedAquaticScourge); } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 120); + } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value, true); } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 7845706bfe..1496a02f58 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -5,12 +5,13 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.NPCs.AcidRain { @@ -196,8 +197,9 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 20); - npcLoot.AddIf(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), 3, 1, 3); - npcLoot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 15, 1, 3); + LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); + postPolter.Add(ModContent.ItemType(), 15, 1, 3, !DownedBossSystem.downedPolterghast); + postPolter.AddFail(ModContent.ItemType(), 3, 1, 3, DownedBossSystem.downedPolterghast); } public override void FindFrame(int frameHeight) @@ -228,6 +230,10 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 33121ec935..f3f1c9c8eb 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -72,18 +72,21 @@ namespace CalamityMod.NPCs.AcidRain { Lighting.AddLight(NPC.Center, 0.3f, 1.5f, 0.3f); - int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) - Player player = Main.player[Main.myPlayer]; - if (!player.dead && player.active && (double) (player.Center - NPC.Center).Length() < auraSize) - { - player.AddBuff(ModContent.BuffType(), 3, false); - player.AddBuff(BuffID.Poisoned, 2, false); - if (DownedBossSystem.downedPolterghast) - { - player.AddBuff(ModContent.BuffType(), 3, false); - player.AddBuff(BuffID.Venom, 2, false); - } - } + if (Main.netMode != NetmodeID.Server) + { + int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) + Player player = Main.player[Main.myPlayer]; + if (!player.dead && player.active && (player.Center - NPC.Center).Length() < auraSize && !player.creativeGodMode) + { + player.AddBuff(ModContent.BuffType(), 3, false); + player.AddBuff(BuffID.Poisoned, 2, false); + if (DownedBossSystem.downedPolterghast) + { + player.AddBuff(ModContent.BuffType(), 3, false); + player.AddBuff(BuffID.Venom, 2, false); + } + } + } } public override void FindFrame(int frameHeight) @@ -108,17 +111,6 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } - catch - { - return; - } - } - public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 9426d88164..9a928ed6c8 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -7,6 +7,7 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -178,7 +179,8 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); - npcLoot.AddIf(() => DownedBossSystem.downedAquaticScourge, ModContent.ItemType(), 20); + LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(DropHelper.PostAS()); + postAS.Add(ModContent.ItemType(), 20); } public override void HitEffect(int hitDirection, double damage) @@ -198,6 +200,10 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 120); + } } } diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index b309a79cd4..c18ec8c856 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -11,6 +11,7 @@ using System; using System.IO; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -246,10 +247,15 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 20); - npcLoot.AddIf(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), 3, 1, 3); - npcLoot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 15, 1, 3); + LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); + postPolter.Add(ModContent.ItemType(), 15, 1, 3, !DownedBossSystem.downedPolterghast); + postPolter.AddFail(ModContent.ItemType(), 3, 1, 3, DownedBossSystem.downedPolterghast); } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 120); + } } } diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 7789b81264..221e35853a 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -1,4 +1,5 @@ using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; @@ -7,11 +8,11 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { public class Trilobite : ModNPC @@ -145,8 +146,9 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), 3, 1, 3); - npcLoot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 15, 1, 3); + LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); + postPolter.Add(ModContent.ItemType(), 15, 1, 3, !DownedBossSystem.downedPolterghast); + postPolter.AddFail(ModContent.ItemType(), 3, 1, 3, DownedBossSystem.downedPolterghast); } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -207,7 +209,8 @@ namespace CalamityMod.NPCs.AcidRain public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index 7d98b1483e..0592722621 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -1,14 +1,15 @@ using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.NPCs.AcidRain { @@ -219,8 +220,9 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => !DownedBossSystem.downedAquaticScourge, ModContent.ItemType(), 20); - npcLoot.AddIf(() => DownedBossSystem.downedAquaticScourge, ModContent.ItemType(), 100); + LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourge); + postAS.Add(ModContent.ItemType(), 100, hideLootReport: !DownedBossSystem.downedAquaticScourge); + postAS.AddFail(ModContent.ItemType(), 20, hideLootReport: DownedBossSystem.downedAquaticScourge); } } } diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs index 31fff706fd..2b9a93ef8e 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs @@ -121,7 +121,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.DeathSound = SoundID.NPCDeath6; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ?? MusicID.Boss3; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -1344,7 +1343,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; @@ -1436,7 +1435,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void OnHitPlayer(Player player, int damage, bool crit) { - if (NPC.Opacity == 1f) + if (NPC.Opacity == 1f && damage > 0) player.AddBuff(ModContent.BuffType(), 600, true); } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index c12f1d397b..56f25c1782 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -157,7 +157,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index dd03b806e3..1eea04dcf9 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -155,7 +155,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 2fc88f26b8..8235cd50d1 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -45,6 +46,7 @@ namespace CalamityMod.NPCs.AquaticScourge value.Position.X += 40f; value.Position.Y += 20f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -121,9 +123,6 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.getGoodWorld) - Music = CalamityMod.Instance.GetMusicFromMusicMod("AquaticScourge") ?? MusicID.Boss2; - CalamityAI.AquaticScourgeAI(NPC, Mod, true); } @@ -230,8 +229,7 @@ namespace CalamityMod.NPCs.AquaticScourge ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); @@ -240,6 +238,7 @@ namespace CalamityMod.NPCs.AquaticScourge // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), 10); normalOnly.Add(ModContent.ItemType(), 10); @@ -247,14 +246,14 @@ namespace CalamityMod.NPCs.AquaticScourge normalOnly.Add(ModContent.ItemType()); } - npcLoot.Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 8, 14)); + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore bool firstASKill() => !DownedBossSystem.downedAquaticScourge; - npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType()); - npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -316,7 +315,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 4376837b95..5e64aa1323 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -154,7 +154,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/AquaticScourge/AquaticUrchin.cs b/NPCs/AquaticScourge/AquaticUrchin.cs index c4ed94b810..290e1c9f32 100644 --- a/NPCs/AquaticScourge/AquaticUrchin.cs +++ b/NPCs/AquaticScourge/AquaticUrchin.cs @@ -55,7 +55,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 625dbfdf0a..9374283f58 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -119,7 +119,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 49fbde9e45..7777de7b4f 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -347,7 +347,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 035a104756..87fc9fa70f 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -87,7 +87,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 7e1e1ffec5..aeef47d2fc 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -179,7 +179,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public static void ModifyAstralachneaLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index c9857d6b72..1d81b82e21 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -128,7 +128,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) => AstralachneaGround.ModifyAstralachneaLoot(npcLoot); diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 3c94da74d7..11b44b8634 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -141,13 +141,6 @@ namespace CalamityMod.NPCs.Astral NPC.knockBackResist = 0.04f; NPC.lifeMax = 1600; } - if (NPC.downedAncientCultist) - { - NPC.damage = 150; - NPC.defense = 75; - NPC.knockBackResist = 0f; - NPC.lifeMax = 2400; - } if (CalamityWorld.death) { target_walkAcceleration = 0.18f; @@ -637,10 +630,6 @@ namespace CalamityMod.NPCs.Astral { return 0f; } - else if (spawnInfo.Player.InAstral(1) && NPC.downedAncientCultist && !DownedBossSystem.downedAstrumDeus) - { - return 0.27f; - } else if (spawnInfo.Player.InAstral(1)) { return 0.09f; @@ -650,7 +639,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index ce2496787a..51baf1e6d1 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -178,7 +178,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -246,6 +247,13 @@ namespace CalamityMod.NPCs.Astral { if (damage > 0) { + if (target.HasNPCBannerBuff(ModContent.NPCType())) + { + if (Main.expertMode) + damage = (int)(damage * 0.5f); + else + damage = (int)(damage * 0.75f); + } NPC.StrikeNPCNoInteraction(9999, 0, 0); } } @@ -262,7 +270,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } private void DoKillDust() diff --git a/NPCs/Astral/EnchantedNightcrawler.cs b/NPCs/Astral/EnchantedNightcrawler.cs deleted file mode 100644 index a8906995ef..0000000000 --- a/NPCs/Astral/EnchantedNightcrawler.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.Astral -{ - public class EnchantedNightcrawler : ModNPC - { - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - DisplayName.SetDefault("Enchanted Nightcrawler"); - Main.npcFrameCount[NPC.type] = 2; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; - } - - public override void SetDefaults() - { - NPC.CloneDefaults(NPCID.EnchantedNightcrawler); //ID is 484 - AIType = NPCID.EnchantedNightcrawler; - AnimationType = NPCID.EnchantedNightcrawler; - } - - public override bool PreAI() - { - NPC.type = NPCID.EnchantedNightcrawler; //Make it immediately turn into vanilla critter - return true; - } - - public override bool? CanBeHitByItem(Player player, Item item) => null; - - public override bool? CanBeHitByProjectile(Projectile projectile) => null; - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) - { - return 0f; - } - else if (spawnInfo.Player.InAstral()) - { - return SpawnCondition.TownCritter.Chance; - } - return 0f; - } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } catch - { - return; - } - } - } -} diff --git a/NPCs/Astral/EnchantedNightcrawler.png b/NPCs/Astral/EnchantedNightcrawler.png deleted file mode 100644 index 9a3a1b74bf..0000000000 Binary files a/NPCs/Astral/EnchantedNightcrawler.png and /dev/null differ diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 3e5f92676e..cb474f2cbd 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -304,7 +304,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 3fbb7ee13c..f791efaee2 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -212,13 +212,14 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 1, 3, 1, 4)); - npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 20); + npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), 10); } } } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/HiveEnemy.cs similarity index 97% rename from NPCs/Astral/Hive.cs rename to NPCs/Astral/HiveEnemy.cs index 0bdef59d1b..2d637b819d 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -17,7 +17,7 @@ using CalamityMod.Sounds; namespace CalamityMod.NPCs.Astral { - public class Hive : ModNPC + public class HiveEnemy : ModNPC { private static Texture2D glowmask; @@ -139,7 +139,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/Hive.png b/NPCs/Astral/HiveEnemy.png similarity index 100% rename from NPCs/Astral/Hive.png rename to NPCs/Astral/HiveEnemy.png diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 726f4d20f3..d2f5584b3e 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -147,7 +147,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 60, true); } } } diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index febba3d296..ff58fbfd1a 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -242,7 +242,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 0c56fdc14f..47c509e84d 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -271,9 +271,13 @@ namespace CalamityMod.NPCs.Astral public override void ModifyNPCLoot(NPCLoot npcLoot) { var exploded = npcLoot.DefineConditionalDropSet((info) => info.npc.ai[3] <= -10000f); - exploded.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); + + // 2-3 Stardust (3-4 Expert+) + exploded.OnFailedConditions(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); + exploded.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedAstrumAureus), ModContent.ItemType(), 7)); + + // If exploded, then have a chance to drop Glorious End and nothing else exploded.Add(ModContent.ItemType(), 7); - exploded.Add(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedAstrumAureus), ModContent.ItemType(), 7)); } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -300,7 +304,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index b74e39241d..4e01c62999 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -149,7 +149,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 60, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index a840aa60b7..e1a0236f6b 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -127,7 +127,8 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index ed60b0e1ec..97a7810b6f 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -75,15 +75,5 @@ namespace CalamityMod.NPCs.Astral } return 0f; } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } catch - { - return; - } - } } } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 8f494bc144..547fb78e9f 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.AstrumAureus [AutoloadBossHead] public class AstrumAureus : ModNPC { - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AstrumAureusHit"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AureusHit", 4); public static readonly SoundStyle StompSound = new("CalamityMod/Sounds/Custom/LegStomp"); private bool stomping = false; @@ -52,6 +52,7 @@ namespace CalamityMod.NPCs.AstrumAureus }; value.Position.Y -= 20f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -65,14 +66,13 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.height = 374; NPC.defense = 40; NPC.DR_NERD(0.5f); - NPC.LifeMaxNERB(NPC.downedMoonlord ? 196000 : 98000, NPC.downedMoonlord ? 235200 : 117600, 740000); // 30 seconds in boss rush + NPC.LifeMaxNERB(98000, 117600, 740000); // 30 seconds in boss rush NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 60, 0, 0); NPC.boss = true; NPC.DeathSound = SoundID.NPCDeath14; - Music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumAureus") ?? MusicID.Boss3; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToHeat = true; @@ -355,17 +355,16 @@ namespace CalamityMod.NPCs.AstrumAureus // Other normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 9, 12)); normalOnly.Add(ModContent.ItemType(), 10); - - normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => NPC.downedMoonlord), ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType()); } npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedAstrumAureus, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -506,7 +505,8 @@ namespace CalamityMod.NPCs.AstrumAureus public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480, true); } } } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 631ae83b96..947ffae56f 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.height = 60; NPC.alpha = 255; NPC.defense = 10; - NPC.lifeMax = NPC.downedMoonlord ? 8250 : 3000; + NPC.lifeMax = 3000; NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; @@ -361,7 +361,8 @@ namespace CalamityMod.NPCs.AstrumAureus public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override bool CheckDead() @@ -369,7 +370,7 @@ namespace CalamityMod.NPCs.AstrumAureus SoundEngine.PlaySound(SoundID.Item14, NPC.position); NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.damage = (NPC.downedMoonlord && !BossRushEvent.BossRushActive) ? NPC.defDamage * 2 : NPC.defDamage; + NPC.damage = NPC.defDamage; NPC.width = NPC.height = 432; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 004282884a..1d0cdb10bf 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -54,7 +54,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.DeathSound = AstrumDeusHead.DeathSound; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; NPC.dontCountMe = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -211,7 +210,8 @@ namespace CalamityMod.NPCs.AstrumDeus public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 7dd98aad0d..5fde816d18 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -86,7 +86,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = DeathSound; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; @@ -319,12 +318,11 @@ namespace CalamityMod.NPCs.AstrumDeus normalOnly.Add(ModContent.ItemType(), 1, 50, 80); } - npcLoot.Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 8, 14)); + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary lastWorm.Add(ModContent.ItemType(), 10); // Relic - bool shouldDropRelic(DropAttemptInfo info) => (CalamityWorld.revenge || Main.masterMode) && !ShouldNotDropThings(info.npc); - npcLoot.AddIf(shouldDropRelic, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf((info) => !ShouldNotDropThings(info.npc), ModContent.ItemType()); // Fragments lastWorm.Add(DropHelper.NormalVsExpertQuantity(ItemID.FragmentSolar, 1, 16, 24, 20, 32)); @@ -334,13 +332,14 @@ namespace CalamityMod.NPCs.AstrumDeus // Lore bool firstDeusKill(DropAttemptInfo info) => !DownedBossSystem.downedAstrumDeus && !ShouldNotDropThings(info.npc); - npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType()); - npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index cff2ce0fc0..103c5b34d0 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -54,7 +54,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.DeathSound = AstrumDeusHead.DeathSound; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; NPC.dontCountMe = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; @@ -192,7 +191,8 @@ namespace CalamityMod.NPCs.AstrumDeus public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index b721e6b6e7..35f40e0ed3 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath39; - if (DownedBossSystem.downedProvidence) - { - NPC.lifeMax = 26000; - } if (BossRushEvent.BossRushActive) { NPC.lifeMax = 10000; @@ -83,7 +79,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void AI() { - Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + // Despawn if Brim doesn't exist if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) { NPC.active = false; @@ -91,9 +89,38 @@ namespace CalamityMod.NPCs.BrimstoneElemental return; } - bool goIntoShell = NPC.life <= NPC.lifeMax * 0.25; - bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; - if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) + // Variables for buffing the AI + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + + // Percent life remaining for Brim + float lifeRatio = Main.npc[CalamityGlobalNPC.brimstoneElemental].life / (float)Main.npc[CalamityGlobalNPC.brimstoneElemental].lifeMax; + + // Enraged Brim checks + bool biomeEnraged = Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().newAI[3] <= 0f || bossRush; + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged && (!Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].ZoneUnderworldHeight || bossRush)) + { + Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + if (biomeEnraged && (!Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Calamity().ZoneCalamity || bossRush)) + { + Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + // Brim phase checks + bool brimIsAboutToTeleport = Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 1f && Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha == 0; + bool brimIsFlyingAboveAndShooting = Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 3f; + bool brimIsInCocoon = Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f; + bool brimIsFiringLaser = Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 5f; + + // Set alpha to Brim alpha + NPC.alpha = Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha; + + // Go into cocoon if Brim is in her cocoon + if (brimIsInCocoon) { boostDR = true; NPC.chaseable = false; @@ -107,56 +134,85 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Set DR based on boost status NPC.Calamity().DR = boostDR ? boostedDR : normalDR; - float num1446 = goIntoShell ? 1f : 6f; - int num1447 = 480; - if (NPC.localAI[1] == 1f) + // Brimlings only shoot if Brim is shooting + if (brimIsFlyingAboveAndShooting || brimIsFiringLaser) { - NPC.localAI[1] = 0f; - if (Main.rand.NextBool(4)) + float shootDivisor = death ? 45f : 60f; + if (brimIsFlyingAboveAndShooting) { - NPC.ai[0] = (float)num1447; + float divisor = (death ? 80f : 45f) - (float)Math.Ceiling(10f * (1f - lifeRatio)); + divisor -= 5f * enrageScale; + shootDivisor = divisor * 2f; } - } - NPC.TargetClosest(true); - NPC.rotation = Math.Abs(NPC.velocity.X) * (float)NPC.direction * 0.1f; - NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; - Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); - Vector2 vector251 = Main.player[NPC.target].Center - value53; - bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); - NPC.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 180f : 360f) && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) - { - NPC.localAI[0] = 0f; - float speed = 5f; - Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); - float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X; - float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, num6, num7, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.player[NPC.target].Center.X, Main.player[NPC.target].Center.Y); - } - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) + + NPC.ai[1] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[1] % shootDivisor == 0f) { - value54.Normalize(); - value54 *= num1446; + float projectileVelocity = 5f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center - NPC.Center) * projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); } - int num1448 = 30; - NPC.velocity = (NPC.velocity * (float)(num1448 - 1) + value54) / (float)num1448; } else + NPC.ai[1] = 0f; + + // Face Brim's target + if (Math.Abs(NPC.Center.X - Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center.X) > 10f) { - NPC.velocity *= 0.98f; + float playerLocation = NPC.Center.X - Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; } + + // Rotate slightly + NPC.rotation = Math.Abs(NPC.velocity.X) * NPC.direction * 0.05f; + + // Move towards Brim + float movementVelocity = (death ? 12f : 10f) * (brimIsFlyingAboveAndShooting ? 1.5f : boostDR ? 0.5f : 1f); + movementVelocity += 5f * enrageScale; + Vector2 distanceFromMother = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center - NPC.Center; + if (distanceFromMother.Length() > 120f) + { + Vector2 value54 = distanceFromMother; + if (value54.Length() > movementVelocity) + { + value54.Normalize(); + value54 *= movementVelocity; + } + int inertia = 20; + NPC.velocity = (NPC.velocity * (inertia - 1) + value54) / inertia; + } + else + NPC.velocity *= 0.96f; + + // Push away from other Brimlings + float pushVelocity = 0.5f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) + { + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 40f * NPC.scale) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + } + } + } + + // Teleport to Brim's new location if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) { - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); for (int num1449 = 0; num1449 < 20; num1449++) { int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); @@ -165,13 +221,15 @@ namespace CalamityMod.NPCs.BrimstoneElemental Main.dust[num1450].noGravity = true; Main.dust[num1450].scale = 2.5f; } + NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); NPC.velocity = Vector2.Zero; + NPC.ai[2] = 0f; NPC.ai[3] = 0f; - if (NPC.localAI[0] > 240f) //Lower firing cooldown to prevent firing so quickly after a teleport - NPC.localAI[0] = 240f; + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); + for (int num1451 = 0; num1451 < 20; num1451++) { int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); @@ -181,27 +239,28 @@ namespace CalamityMod.NPCs.BrimstoneElemental Main.dust[num1452].scale = 2.5f; } } - NPC.ai[0] += 1f; - if (NPC.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) + + // Shoot a fireball when Brim is about to teleport + // Shoot before she goes invisible to make it as fair as possible + if (brimIsAboutToTeleport && Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileVelocity = 5f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center - NPC.Center) * projectileVelocity, type, damage, 0f, Main.myPlayer, Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].position.X, Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].position.Y); + } + + // Teleport when Brim teleports + if (Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha == 255 && Main.netMode != NetmodeID.MultiplayerClient) { - if (NPC.localAI[0] > 260f) - { - NPC.localAI[0] -= 60f; - } - NPC.ai[0] = 0f; Point point12 = NPC.Center.ToTileCoordinates(); - Point point13 = Main.player[NPC.target].Center.ToTileCoordinates(); - int num1453 = 20; + Point point13 = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates(); + int num1453 = 6; int num1454 = 3; - int num1455 = 10; + int num1455 = 4; int num1456 = 1; int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) + while (num1457 < 100) { num1457++; int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); @@ -210,21 +269,19 @@ namespace CalamityMod.NPCs.BrimstoneElemental { bool flag107 = true; if (flag107 && Main.tile[num1458, num1459].LiquidType == LiquidID.Lava) - { flag107 = false; - } if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { flag107 = false; - } + if (flag107) { - NPC.ai[2] = (float)num1458; - NPC.ai[3] = (float)num1459; + NPC.ai[2] = num1458; + NPC.ai[3] = num1459; break; } } } + NPC.netUpdate = true; } } @@ -239,10 +296,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.frame.Y = NPC.frame.Y + frameHeight; NPC.frameCounter = 0.0; } + if (NPC.frame.Y >= frameHeight * 4) - { NPC.frame.Y = 0; - } } else { @@ -251,39 +307,31 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.frame.Y = NPC.frame.Y + frameHeight; NPC.frameCounter = 0.0; } + if (NPC.frame.Y < frameHeight * 4) - { NPC.frame.Y = frameHeight * 4; - } + if (NPC.frame.Y >= frameHeight * 8) - { NPC.frame.Y = frameHeight * 4; - } } } public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 570e52be9e..d0ac4ba5eb 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Placeables.Pylons; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -40,6 +41,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental }; value.Position.Y -= 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -52,13 +54,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.value = Item.buyPrice(0, 40, 0, 0); NPC.LifeMaxNERB(41000, 49200, 780000); NPC.DR_NERD(0.15f); - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - { - NPC.damage *= 3; - NPC.defense *= 4; - NPC.lifeMax *= 5; - NPC.value *= 3f; - } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; @@ -70,7 +65,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.netAlways = true; NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath39; - Music = CalamityMod.Instance.GetMusicFromMusicMod("BrimstoneElemental") ?? MusicID.Boss4; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; @@ -113,13 +107,14 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } public override void FindFrame(int frameHeight) // 9 total frames @@ -182,43 +177,43 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); - { - LeadingConditionRule postProvidence = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedProvidence)); - normalOnly.Add(postProvidence); - + { // Weapons int[] weapons = new int[] { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); normalOnly.Add(ModContent.ItemType(), 10); // Materials normalOnly.Add(ModContent.ItemType(), 1, 4, 8); - postProvidence.Add(ModContent.ItemType(), 1, 20, 30); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + int[] accs = new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, accs)); normalOnly.Add(ModContent.ItemType(), 10); - postProvidence.Add(ModContent.ItemType()); // Vanity normalOnly.Add(ModContent.ItemType(), 7); } + // Trophy npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -272,7 +267,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental } if (Main.netMode != NetmodeID.Server) { - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("BrimstoneGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("BrimstoneGore2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("BrimstoneGore3").Type, 1f); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 7d8a64b82e..efda3e49c4 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -43,6 +43,7 @@ namespace CalamityMod.NPCs.Bumblebirb value.Position.X += 20f; value.Position.Y += 8f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -65,7 +66,6 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.knockBackResist = 0f; NPC.boss = true; NPC.noTileCollide = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Dragonfolly") ?? MusicID.Boss4; NPC.lavaImmune = true; NPC.noGravity = true; NPC.value = Item.buyPrice(1, 25, 0, 0); @@ -419,17 +419,17 @@ namespace CalamityMod.NPCs.Bumblebirb { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); normalOnly.Add(ModContent.ItemType(), 10); // Materials - normalOnly.Add(ModContent.ItemType(), 1, 11, 17); + normalOnly.Add(ModContent.ItemType(), 1, 25, 30); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -438,10 +438,10 @@ namespace CalamityMod.NPCs.Bumblebirb npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 8e3d1ae7dc..8744581f82 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -50,12 +50,9 @@ namespace CalamityMod.NPCs.Bumblebirb public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Calamitas/CalSky.cs b/NPCs/Calamitas/CalSky.cs index de1bec4506..787e8dc8ac 100644 --- a/NPCs/Calamitas/CalSky.cs +++ b/NPCs/Calamitas/CalSky.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.Calamitas if (maxDepth >= 0 && minDepth < 0) { float intensity = this.GetIntensity(); - spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Black * intensity); } } diff --git a/NPCs/Calamitas/CalamitasClone.cs b/NPCs/Calamitas/CalamitasClone.cs index e21ad75b5f..44bf01d600 100644 --- a/NPCs/Calamitas/CalamitasClone.cs +++ b/NPCs/Calamitas/CalamitasClone.cs @@ -44,6 +44,7 @@ namespace CalamityMod.NPCs.Calamitas }; value.Position.Y -= 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -61,13 +62,6 @@ namespace CalamityMod.NPCs.Calamitas NPC.value = Item.buyPrice(0, 50, 0, 0); NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.075f : 0.15f); NPC.LifeMaxNERB(37500, 45000, 520000); - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - { - NPC.damage *= 3; - NPC.defense *= 3; - NPC.lifeMax *= 2; - NPC.value *= 2.5f; - } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -78,7 +72,6 @@ namespace CalamityMod.NPCs.Calamitas NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; @@ -192,41 +185,39 @@ namespace CalamityMod.NPCs.Calamitas // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { - LeadingConditionRule postProvidence = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedProvidence)); - normalOnly.Add(postProvidence); - // Items int[] items = new int[] { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), 10); // Materials - normalOnly.Add(ModContent.ItemType(), 1, 4, 8); - normalOnly.Add(ModContent.ItemType(), 1, 9, 14); - postProvidence.Add(ModContent.ItemType(), 1, 30, 40); + normalOnly.Add(ModContent.ItemType(), 1, 5, 10); + normalOnly.Add(ModContent.ItemType(), 1, 25, 30); // Vanity normalOnly.Add(ModContent.ItemType(), 7); - normalOnly.Add(ItemDropRule.Common(ModContent.ItemType(), 10).OnSuccess(ItemDropRule.Common(ModContent.ItemType()))); + var calVanity = ItemDropRule.Common(ModContent.ItemType(), 10); + calVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(calVanity); } npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -310,13 +301,14 @@ namespace CalamityMod.NPCs.Calamitas public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Calamitas/Cataclysm.cs b/NPCs/Calamitas/Cataclysm.cs index 4bdbf1375e..0dbee9e480 100644 --- a/NPCs/Calamitas/Cataclysm.cs +++ b/NPCs/Calamitas/Cataclysm.cs @@ -47,12 +47,6 @@ namespace CalamityMod.NPCs.Calamitas NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); NPC.LifeMaxNERB(11000, 13200, 80000); - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - { - NPC.damage *= 3; - NPC.defense *= 5; - NPC.lifeMax *= 5; - } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -62,7 +56,6 @@ namespace CalamityMod.NPCs.Calamitas NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; @@ -168,12 +161,9 @@ namespace CalamityMod.NPCs.Calamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -227,13 +217,14 @@ namespace CalamityMod.NPCs.Calamitas public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/NPCs/Calamitas/Catastrophe.cs b/NPCs/Calamitas/Catastrophe.cs index 3e0ec135fd..0d19e75495 100644 --- a/NPCs/Calamitas/Catastrophe.cs +++ b/NPCs/Calamitas/Catastrophe.cs @@ -47,12 +47,6 @@ namespace CalamityMod.NPCs.Calamitas NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); NPC.LifeMaxNERB(9200, 11025, 80000); - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - { - NPC.damage *= 3; - NPC.defense *= 5; - NPC.lifeMax *= 5; - } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -62,7 +56,6 @@ namespace CalamityMod.NPCs.Calamitas NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; @@ -168,12 +161,9 @@ namespace CalamityMod.NPCs.Calamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -227,13 +217,14 @@ namespace CalamityMod.NPCs.Calamitas public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index dd1e98be0e..89b87d202c 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -168,12 +168,9 @@ namespace CalamityMod.NPCs.Calamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CheckActive() => false; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 83ff3ac717..957ba6d914 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -39,6 +39,9 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + if (head) + CalamityGlobalNPC.aquaticScourge = npc.whoAmI; + // Adjust hostility and stats if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) { @@ -403,12 +406,12 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] == 1f) { - num188 = revenge ? 9f : 7f; - num189 = revenge ? 0.12f : 0.1f; + num188 = revenge ? 14.4f : 12f; + num189 = revenge ? 0.18f : 0.15f; if (expertMode) { - num188 += 8f * (1f - lifeRatio); - num189 += 0.06f * (1f - lifeRatio); + num188 += 2.4f * (1f - lifeRatio); + num189 += 0.03f * (1f - lifeRatio); } num188 += 3f * enrageScale; num189 += 0.06f * enrageScale; @@ -416,8 +419,8 @@ namespace CalamityMod.NPCs { num188 += 5f; num189 -= 0.03f; - num188 += Vector2.Distance(player.Center, npc.Center) * 0.0015f; - num189 += Vector2.Distance(player.Center, npc.Center) * 0.00003f; + num188 += Vector2.Distance(player.Center, npc.Center) * 0.001f; + num189 += Vector2.Distance(player.Center, npc.Center) * 0.000045f; } // Increase acceleration after spiral attack @@ -649,7 +652,6 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - bool provy = DownedBossSystem.downedProvidence && !bossRush; bool phase2 = lifeRatio < 0.5f && revenge; bool phase3 = lifeRatio < 0.33f; @@ -701,21 +703,14 @@ namespace CalamityMod.NPCs // How fast Brimmy moves to the destination float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (npc.ai[0] == 5f ? 0.05f : npc.ai[0] == 3f ? 1.5f : 1f); + baseVelocity += 3f * enrageScale; if (expertMode) baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - baseVelocity += 5f * enrageScale; float baseAcceleration = (death ? 0.12f : 0.1f) * (npc.ai[0] == 5f ? 0.5f : npc.ai[0] == 3f ? 1.5f : 1f); - baseAcceleration += 0.1f * enrageScale; + baseAcceleration += 0.06f * enrageScale; if (expertMode) - { baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (provy) - { - baseVelocity *= 1.25f; - baseAcceleration *= 1.25f; - } // This is where Brimmy should be Vector2 destination = npc.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); @@ -886,7 +881,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; - divisor -= 5f * enrageScale; + divisor -= 3f * enrageScale; float divisor2 = divisor * 2f; if (npc.ai[1] % divisor == divisor - 1f) @@ -895,16 +890,16 @@ namespace CalamityMod.NPCs { float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type) + (provy ? 30 : 0); + int damage = npc.GetProjectileDamage(type); Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * velocity; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(projectileVelocity) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(projectileVelocity) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); Main.projectile[proj].timeLeft = 240; if (npc.ai[1] % divisor2 == divisor2 - 1f) { velocity = (death ? 5f : 4f) + 2f * enrageScale; type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type) + (provy ? 30 : 0); + damage = npc.GetProjectileDamage(type); projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * velocity; int numProj = death ? 8 : 4; int spread = death ? 90 : 45; @@ -947,14 +942,14 @@ namespace CalamityMod.NPCs npc.localAI[0] += 2f; if (expertMode) npc.localAI[0] += 1f - lifeRatio; - npc.localAI[0] += 1f * enrageScale; + npc.localAI[0] += enrageScale; if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; float projectileSpeed = death ? 9f : revenge ? 8f : 6f; - projectileSpeed += 3f * enrageScale; + projectileSpeed += 2f * enrageScale; vectorCenter = player.Center - vectorCenter; @@ -975,7 +970,7 @@ namespace CalamityMod.NPCs { float radians = j - (totalProjectiles - 1f) / 2f; Vector2 offset = velocity.RotatedBy(offsetAngle * radians); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, vectorCenter, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, vectorCenter, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 300; Main.projectile[proj].tileCollide = false; } @@ -991,7 +986,7 @@ namespace CalamityMod.NPCs for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 5f, vector255, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f); } if (death) @@ -1000,7 +995,7 @@ namespace CalamityMod.NPCs for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 5f, vector255 * 0.75f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f); } } @@ -1086,9 +1081,9 @@ namespace CalamityMod.NPCs laserVelocity2.Normalize(); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } } } @@ -1157,15 +1152,14 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - bool provy = DownedBossSystem.downedProvidence && !bossRush; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool phase3 = lifeRatio < 0.7f || death; - bool phase4 = lifeRatio < 0.35f; - bool phase5 = lifeRatio <= 0.1f && revenge; + bool phase2 = lifeRatio < 0.7f || death; + bool phase3 = lifeRatio < 0.35f; + bool phase4 = lifeRatio <= 0.1f && death; // Don't take damage during bullet hells npc.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; @@ -1177,7 +1171,7 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.calamitas = npc.whoAmI; // Seeker ring - if (calamityGlobalNPC.newAI[1] == 0f && phase4 && expertMode) + if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1312,14 +1306,11 @@ namespace CalamityMod.NPCs Vector2 rotationVector = npcCenter - lookAt; // Boss Rush predictive charge rotation - if (npc.ai[1] == 4f && phase5 && bossRush) + if (npc.ai[1] == 4f && phase4 && bossRush) { // Velocity float chargeVelocity = 30f; chargeVelocity += 5f * enrageScale; - if (provy) - chargeVelocity *= 1.25f; - lookAt += Main.player[npc.target].velocity * 20f; rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; } @@ -1398,15 +1389,15 @@ namespace CalamityMod.NPCs float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (npc.ai[1] == 4f ? 1.4f : 1f); baseVelocity += 4f * enrageScale; baseAcceleration += 0.1f * enrageScale; + if (revenge) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } if (death) { - baseVelocity += 2f * (1f - lifeRatio); - baseAcceleration += 0.04f * (1f - lifeRatio); - } - if (provy) - { - baseVelocity *= 1.25f; - baseAcceleration *= 1.25f; + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); } if (Main.getGoodWorld) { @@ -1425,7 +1416,7 @@ namespace CalamityMod.NPCs // How far Cal Clone should be from the target float averageDistance = 500f; - float chargeDistance = phase5 ? 300f : 400f; + float chargeDistance = phase4 ? 300f : 400f; // This is where Cal Clone should be Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || npc.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : @@ -1474,7 +1465,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[2] == 2f) { int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type) + (provy ? 30 : 0); + int damage = npc.GetProjectileDamage(type); float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; float projSpeed = bossRush ? 6.25f : 5f; if (calamityGlobalNPC.newAI[3] <= 300f) @@ -1500,7 +1491,7 @@ namespace CalamityMod.NPCs { npc.ai[0] = 0f; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type) + (provy ? 30 : 0); + int damage = npc.GetProjectileDamage(type); float projSpeed = bossRush ? 5f : 4f; if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) { @@ -1535,7 +1526,7 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[3] = 0f; // Prevent bullshit charge hits when second bullet hell ends. - if (phase5) + if (phase4) { npc.ai[1] = 4f; npc.ai[2] = -105f; @@ -1607,9 +1598,9 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase5) + if (npc.ai[2] >= phaseTimer || phase4) { - if (death && !phase5 && Main.rand.NextBool() && !brotherAlive) + if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) npc.ai[1] = 4f; else npc.ai[1] = 1f; @@ -1643,7 +1634,7 @@ namespace CalamityMod.NPCs int damage = npc.GetProjectileDamage(type); Vector2 fireballVelocity = Vector2.Normalize(player.Center - npc.Center) * projectileVelocity; Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); } } } @@ -1677,26 +1668,25 @@ namespace CalamityMod.NPCs { type = ModContent.ProjectileType(); damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); } else { - float ai0 = type == ModContent.ProjectileType() ? 1f : 0f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, ai0, 0f); - if (type == ModContent.ProjectileType()) - Main.projectile[proj].tileCollide = true; + float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; + float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); } } } npc.ai[2] += 1f; float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase5) + if (npc.ai[2] >= phaseTimer || phase4) { - if (death && !phase5 && Main.rand.NextBool() && !brotherAlive) + if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) npc.ai[1] = 0f; else - npc.ai[1] = !brotherAlive && phase3 && revenge ? 4f : 0f; + npc.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; npc.ai[2] = 0f; if (death) @@ -1710,13 +1700,10 @@ namespace CalamityMod.NPCs { npc.rotation = rotation; - float chargeVelocity = phase5 ? 30f : death ? 28f : 25f; + float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; chargeVelocity += 5f * enrageScale; - if (provy) - chargeVelocity *= 1.25f; - - Vector2 vector = Vector2.Normalize(player.Center + (phase5 && bossRush ? player.velocity * 20f : Vector2.Zero) - npc.Center); + Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - npc.Center); npc.velocity = vector * chargeVelocity; npc.ai[1] = 3f; @@ -1726,7 +1713,7 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; - float chargeTime = phase5 ? 35f : death ? 40f : 45f; + float chargeTime = phase4 ? 35f : death ? 40f : 45f; if (npc.ai[2] >= chargeTime) { npc.velocity *= 0.9f; @@ -1740,18 +1727,18 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Leave behind slow hellblasts in Death Mode - if (Main.netMode != NetmodeID.MultiplayerClient && death && phase4 && npc.ai[2] % (phase5 ? 6f : 10f) == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && npc.ai[2] % (phase4 ? 6f : 10f) == 0f) { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Vector2 fireballVelocity = npc.velocity * 0.01f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, fireballVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); } } if (npc.ai[2] >= chargeTime + 10f) { - if (!phase5) + if (!phase4) npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -1773,7 +1760,7 @@ namespace CalamityMod.NPCs else { npc.ai[2] += 1f; - if (npc.ai[2] >= (phase5 ? 15f : 30f)) + if (npc.ai[2] >= (phase4 ? 15f : 30f)) { npc.TargetClosest(); @@ -1803,7 +1790,6 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - bool provy = DownedBossSystem.downedProvidence && !bossRush; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1892,12 +1878,6 @@ namespace CalamityMod.NPCs num861 += 2f * enrageScale; num862 += 0.06f * enrageScale; - if (provy) - { - num861 *= 1.25f; - num862 *= 1.25f; - } - if (Main.getGoodWorld) { num861 *= 1.15f; @@ -1913,7 +1893,7 @@ namespace CalamityMod.NPCs float num865 = player.position.Y + (player.height / 2) - vector86.Y; float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); - if (expertMode || provy) + if (expertMode) { if (num866 > 300f) num861 += 0.5f; @@ -2002,7 +1982,7 @@ namespace CalamityMod.NPCs num864 += npc.velocity.X * 0.5f; vector86.X -= num864; vector86.Y -= num865; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num864, num865, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num864, num865, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -2020,8 +2000,6 @@ namespace CalamityMod.NPCs num870 += 2f; if (revenge) num870 += 2f; - if (provy) - num870 *= 1.15f; if (Main.getGoodWorld) num870 *= 1.25f; @@ -2092,7 +2070,6 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - bool provy = DownedBossSystem.downedProvidence && !bossRush; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -2181,12 +2158,6 @@ namespace CalamityMod.NPCs num861 += 2f * enrageScale; num862 += 0.1f * enrageScale; - if (provy) - { - num861 *= 1.25f; - num862 *= 1.25f; - } - if (Main.getGoodWorld) { num861 *= 1.15f; @@ -2202,7 +2173,7 @@ namespace CalamityMod.NPCs float num865 = player.Center.Y - vector86.Y; float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); - if (expertMode || provy) + if (expertMode) { if (num866 > 300f) num861 += 0.5f; @@ -2291,7 +2262,7 @@ namespace CalamityMod.NPCs num864 += npc.velocity.X * 0.5f; vector86.X -= num864; vector86.Y -= num865; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num864, num865, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector86.X, vector86.Y, num864, num865, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -2309,8 +2280,6 @@ namespace CalamityMod.NPCs num870 += 2f; if (revenge) num870 += 2f; - if (provy) - num870 *= 1.15f; if (Main.getGoodWorld) num870 *= 1.25f; @@ -2376,8 +2345,7 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - bool postMoonLordBuff = NPC.downedMoonlord && !bossRush; - npc.damage = postMoonLordBuff ? npc.defDamage * 2 : npc.defDamage; + npc.damage = npc.defDamage; // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit float noProjectileOrPhaseIncrementTime = 240f; @@ -2505,9 +2473,6 @@ namespace CalamityMod.NPCs float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (postMoonLordBuff) - damage *= 2; - float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f; float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); @@ -2538,9 +2503,6 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (postMoonLordBuff) - damage *= 2; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < maxProjectiles; i++) @@ -2557,9 +2519,6 @@ namespace CalamityMod.NPCs type = ModContent.ProjectileType(); damage = npc.GetProjectileDamage(type); - if (postMoonLordBuff) - damage *= 2; - projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * flameVelocity; rotation = MathHelper.ToRadians(spread); for (int i = 0; i < maxProjectiles; i++) @@ -2578,9 +2537,6 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (postMoonLordBuff) - damage *= 2; - int centralLaser = maxProjectiles / 2; int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; @@ -2859,9 +2815,6 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (postMoonLordBuff) - damage *= 2; - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * npc.scale); Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; @@ -2882,9 +2835,6 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (postMoonLordBuff) - damage *= 2; - int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * laserVelocity; float rotation = MathHelper.ToRadians(spread); @@ -4122,7 +4072,7 @@ namespace CalamityMod.NPCs } } - float succPower = 0.1f + finalPhaseDustRatio * 0.1f; + float succPower = 0.125f + finalPhaseDustRatio * 0.125f; for (int i = 0; i < Main.maxPlayers; i++) { float distance = Vector2.Distance(Main.player[i].Center, vector); @@ -4137,11 +4087,6 @@ namespace CalamityMod.NPCs Main.player[i].velocity.X += succPower * multiplier; else Main.player[i].velocity.X -= succPower * multiplier; - - if (Main.player[i].Center.Y < vector.Y) - Main.player[i].velocity.Y += succPower * multiplier; - else - Main.player[i].velocity.Y -= succPower * multiplier; } } } @@ -4157,6 +4102,12 @@ namespace CalamityMod.NPCs npc.life -= damageAmt; npc.HealEffect(-damageAmt, true); + if (npc.life <= ((npc.lifeMax / 200) * 5) && !npc.ModNPC().playedbuildsound) + { + SoundEngine.PlaySound(CeaselessVoid.CeaselessVoid.BuildupSound, npc.Center); + npc.ModNPC().playedbuildsound = true; + } + if (npc.life <= 0) { npc.life = 0; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 8a7a06a445..788e20251e 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -6122,9 +6122,15 @@ namespace CalamityMod.NPCs int damage = 10; int projType = ProjectileID.SandBallFalling; - int projAmt = Main.rand.Next(8, 14); - if (Main.rand.NextBool(1000)) - projAmt = Main.rand.Next(80, 131); + + // 3 to 5 in Death, if FTW is also enabled, 8 to 13 (random chance for 10x the amount) + int projAmt = Main.rand.Next(3, 6); + if (Main.getGoodWorld) + { + projAmt = Main.rand.Next(8, 14); + if (Main.rand.NextBool(1000)) + projAmt = Main.rand.Next(80, 131); + } for (int i = 0; i < projAmt; i++) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 21b07f8bfc..b8b544325e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -219,6 +219,7 @@ namespace CalamityMod.NPCs public int cDepth = 0; public int gsInferno = 0; + public int dragonFire = 0; public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; @@ -252,6 +253,7 @@ namespace CalamityMod.NPCs public static int primeCannon = -1; public static int primeVice = -1; public static int primeSaw = -1; + public static int aquaticScourge = -1; public static int brimstoneElemental = -1; public static int cataclysm = -1; public static int catastrophe = -1; @@ -272,11 +274,19 @@ namespace CalamityMod.NPCs public static int ghostBossClone = -1; public static int ghostBoss = -1; public static int DoGHead = -1; + public static int DoGP2 = -1; + public static int yharon = -1; + public static int yharonP2 = -1; public static int SCalCataclysm = -1; public static int SCalCatastrophe = -1; public static int SCal = -1; public static int SCalWorm = -1; + public static int SCalGrief = -1; + public static int SCalLament = -1; + public static int SCalEpiphany = -1; + public static int SCalAcceptance = -1; public static int draedon = -1; + public static int draedonAmbience = -1; public static int draedonExoMechWorm = -1; public static int draedonExoMechTwinRed = -1; public static int draedonExoMechTwinGreen = -1; @@ -404,6 +414,7 @@ namespace CalamityMod.NPCs myClone.cDepth = cDepth; myClone.gsInferno = gsInferno; + myClone.dragonFire = dragonFire; myClone.astralInfection = astralInfection; myClone.wDeath = wDeath; myClone.nightwither = nightwither; @@ -475,6 +486,7 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref primeCannon, NPCID.PrimeCannon); ResetSavedIndex(ref primeVice, NPCID.PrimeVice); ResetSavedIndex(ref primeSaw, NPCID.PrimeSaw); + ResetSavedIndex(ref aquaticScourge, NPCType()); ResetSavedIndex(ref brimstoneElemental, NPCType()); ResetSavedIndex(ref cataclysm, NPCType()); ResetSavedIndex(ref catastrophe, NPCType()); @@ -495,12 +507,20 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref ghostBossClone, NPCType()); ResetSavedIndex(ref ghostBoss, NPCType()); ResetSavedIndex(ref DoGHead, NPCType()); + ResetSavedIndex(ref DoGP2, NPCType()); + ResetSavedIndex(ref yharon, NPCType()); + ResetSavedIndex(ref yharonP2, NPCType()); ResetSavedIndex(ref SCalCataclysm, NPCType()); ResetSavedIndex(ref SCalCatastrophe, NPCType()); ResetSavedIndex(ref SCal, NPCType()); + ResetSavedIndex(ref SCalGrief, NPCType()); + ResetSavedIndex(ref SCalLament, NPCType()); + ResetSavedIndex(ref SCalEpiphany, NPCType()); + ResetSavedIndex(ref SCalAcceptance, NPCType()); ResetSavedIndex(ref SCalWorm, NPCType()); ResetSavedIndex(ref draedon, NPCType()); + ResetSavedIndex(ref draedonAmbience, NPCType()); ResetSavedIndex(ref draedonExoMechWorm, NPCType()); ResetSavedIndex(ref draedonExoMechTwinRed, NPCType()); ResetSavedIndex(ref draedonExoMechTwinGreen, NPCType()); @@ -717,13 +737,14 @@ namespace CalamityMod.NPCs CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type); bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); - double heatDamageMult = npc.drippingSlime ? ((wormBoss || slimeGod) ? 2D : 5D) : 1D; + bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; + double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? 2D : 5D) : 1D; if (VulnerableToHeat.HasValue) { if (VulnerableToHeat.Value) - heatDamageMult *= npc.drippingSlime ? ((wormBoss || slimeGod) ? 1.5 : 2D) : ((wormBoss || slimeGod) ? 2D : 5D); + heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 1.5 : 2D) : ((wormBoss || slimeGod) ? 2D : 5D); else - heatDamageMult *= npc.drippingSlime ? 0.2 : 0.5; + heatDamageMult *= slimed ? 0.2 : 0.5; } double coldDamageMult = 1D; @@ -811,6 +832,26 @@ namespace CalamityMod.NPCs damage = baseHellfireDoTValue / 4; } + // Daybroken + if (npc.daybreak) + { + int projAmt = 0; + int num7 = 4; + for (int k = 0; k < Main.maxProjectiles; k++) + { + if (Main.projectile[k].active && Main.projectile[k].type == ProjectileID.Daybreak && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI) + projAmt++; + } + + if (projAmt == 0) + projAmt = 1; + + int baseDaybreakDoTValue = (int)(projAmt * 2 * 100 * vanillaHeatDamageMult); + npc.lifeRegen -= baseDaybreakDoTValue; + if (damage < baseDaybreakDoTValue / 4) + damage = baseDaybreakDoTValue / 4; + } + // Shadowflame if (npc.shadowFlame) { @@ -841,6 +882,13 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseGodSlayerInfernoDoTValue, baseGodSlayerInfernoDoTValue / 5, ref npc.lifeRegen, ref damage); } + // Dragonfire + if (dragonFire > 0) + { + int baseDragonFireDoTValue = (int)((npc.oiled ? 720 : 360) * heatDamageMult); + ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); + } + // Demon Flames if (dFlames > 0) { @@ -871,6 +919,15 @@ namespace CalamityMod.NPCs damage = baseFrostBurnDoTValue / 4; } + // Frostbite + if (npc.onFrostBurn2) + { + int baseFrostBiteDoTValue = (int)((npc.oiled ? 100 : 50) * vanillaColdDamageMult); + npc.lifeRegen -= baseFrostBiteDoTValue; + if (damage < baseFrostBiteDoTValue / 4) + damage = baseFrostBiteDoTValue / 4; + } + // Nightwither if (nightwither > 0) { @@ -2184,8 +2241,9 @@ namespace CalamityMod.NPCs canBreakPlayerDefense = true; break; - // Make Core hitbox bigger + // Make Core hitbox bigger and reduce HP case NPCID.MartianSaucerCore: + npc.lifeMax = (int)(npc.lifeMax * 0.6); npc.width *= 2; npc.height *= 2; break; @@ -2501,7 +2559,7 @@ namespace CalamityMod.NPCs // Apply modifications to enemy's current defense based on Calamity debuffs. // As with defense and DR, flat reductions apply first, then multiplicative reductions. - int effectiveDefense = npc.defense - + int effectiveDefense = defense - (aCrunch > 0 ? ArmorCrunch.DefenseReduction : 0) - (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) - (wither > 0 ? WitherDebuff.DefenseReduction : 0) - @@ -3626,10 +3684,11 @@ namespace CalamityMod.NPCs if (CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) npc.buffImmune[BuffType()] = true; - // All enemies are automatically immune to the Confused debuff, so we must specifically set them not to be. + // Make all Cal NPCs immune to confused unless otherwise specified // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). - if (CalamityLists.confusionEnemyList.Contains(npc.type)) - npc.buffImmune[BuffID.Confused] = false; + bool cal = npc.ModNPC != null && npc.ModNPC.Mod.Name.Equals(ModContent.GetInstance().Name); + if (!CalamityLists.confusionEnemyList.Contains(npc.type) && cal) + npc.buffImmune[BuffID.Confused] = true; // Any enemy not immune to Venom shouldn't be immune to Sulphuric Poisoning as it is an upgrade. if (!npc.buffImmune[BuffID.Venom]) @@ -3637,19 +3696,20 @@ namespace CalamityMod.NPCs // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.SkeletronHead || npc.type == NPCID.SpikeBall || npc.type == NPCID.BlazingWheel || - (CalamityLists.EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) + (CalamityLists.EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC || NPCID.Sets.ActsLikeTownNPC[npc.type]) { for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } - if (npc.townNPC) + if (npc.townNPC || NPCID.Sets.ActsLikeTownNPC[npc.type]) { npc.buffImmune[BuffID.Wet] = false; npc.buffImmune[BuffID.Slimed] = false; npc.buffImmune[BuffID.Lovestruck] = false; npc.buffImmune[BuffID.Stinky] = false; + npc.buffImmune[BuffID.GelBalloonBuff] = false; } } @@ -3988,6 +4048,8 @@ namespace CalamityMod.NPCs cDepth--; if (gsInferno > 0) gsInferno--; + if (dragonFire > 0) + dragonFire--; if (astralInfection > 0) astralInfection--; if (wDeath > 0) @@ -4087,6 +4149,12 @@ namespace CalamityMod.NPCs #region On Hit Player public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) { + if (damage <= 0) + return; + + if (target.Calamity().sulfurSet) + npc.AddBuff(BuffID.Poisoned, 120); + if (target.Calamity().snowman) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) @@ -4097,6 +4165,27 @@ namespace CalamityMod.NPCs switch (npc.type) { + case NPCID.ShadowFlameApparition: + target.AddBuff(BuffType(), 180); + break; + case NPCID.ChaosBall: + if (Main.hardMode || CalamityPlayer.areThereAnyDamnBosses) + target.AddBuff(BuffType(), 180); + break; + + case NPCID.Spazmatism: + if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) + target.AddBuff(BuffID.Bleeding, 600); + break; + + case NPCID.Plantera: + if (npc.life < npc.lifeMax / 2) + target.AddBuff(BuffID.Poisoned, 600); + break; + case NPCID.PlanterasTentacle: + target.AddBuff(BuffID.Poisoned, 300); + break; + case NPCID.Golem: target.AddBuff(BuffType(), 480); break; @@ -4108,6 +4197,32 @@ namespace CalamityMod.NPCs target.AddBuff(BuffType(), 240); break; + case NPCID.AncientDoom: + target.AddBuff(BuffType(), 180); + break; + case NPCID.AncientLight: + target.AddBuff(BuffType(), 180); + break; + + case NPCID.HallowBoss: + target.AddBuff(BuffType(), 480); + break; + + case NPCID.BloodNautilus: + target.AddBuff(BuffType(), 480); + break; + + case NPCID.GoblinShark: + case NPCID.BloodEelHead: + target.AddBuff(BuffType(), 300); + break; + case NPCID.BloodEelBody: + target.AddBuff(BuffType(), 180); + break; + case NPCID.BloodEelTail: + target.AddBuff(BuffType(), 120); + break; + case NPCID.Lavabat: target.AddBuff(BuffID.OnFire, 180); break; @@ -4203,9 +4318,10 @@ namespace CalamityMod.NPCs // Supercrits var cgp = projectile.Calamity(); - if (cgp.canSupercrit) + if (cgp.supercritHits != 0) { - float critOver100 = player.GetCritChance(projectile.DamageType) - 100f; + cgp.supercritHits--; + float critOver100 = (projectile.ContinuouslyUpdateDamage ? player.GetCritChance(projectile.DamageType) : projectile.CritChance) - 100f; // Supercrits can "supercrit" over and over for each extra 100% critical strike chance. // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. @@ -4322,6 +4438,17 @@ namespace CalamityMod.NPCs // Apply balancing resists/vulnerabilities. BalancingChangesManager.ApplyFromProjectile(npc, ref damage, projectile); + if (CalamityLists.GrenadeResistIDs.Contains(projectile.type)) + { + // Eater of Worlds has a vanilla resist in Expert+, this gives it to him in Normal mode + bool hasResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && !Main.expertMode; + // Add a resist for BoC's creepers and Prehardmode worm bosses + if (npc.type == NPCID.Creeper || CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type)) + hasResist = true; + if (hasResist) + damage = (int)(damage * 0.2); + } + if (CalamityLists.pierceResistList.Contains(npc.type)) PierceResistGlobal(projectile, npc, ref damage); @@ -4332,14 +4459,6 @@ namespace CalamityMod.NPCs // TODO -- What in god's name is this? private void PierceResistGlobal(Projectile projectile, NPC npc, ref int damage) { - if (CalamityLists.GrenadeResistIDs.Contains(projectile.type)) - { - if (!CalamityLists.EaterofWorldsIDs.Contains(npc.type)) - damage = (int)(damage * 0.2); - else if (!Main.expertMode) - damage = (int)(damage * 0.2); - } - // Thanatos segments do not trigger pierce resistance if they are closed if (CalamityLists.ThanatosIDs.Contains(npc.type) && unbreakableDR) return; @@ -4350,7 +4469,7 @@ namespace CalamityMod.NPCs damage -= (int)(damage * damageReduction); - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !CalamityLists.pierceResistExceptionList.Contains(projectile.type) && !projectile.IsSummon() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !CalamityLists.pierceResistExceptionList.Contains(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) projectile.Calamity().timesPierced++; } #endregion @@ -4476,6 +4595,29 @@ namespace CalamityMod.NPCs Main.player[playerIndex].Spawn(PlayerSpawnContext.RecallFromItem); } } + + if (pFlames > 0 && npc.life <= 0) + { + Rectangle hitbox = npc.Hitbox; + for (int i = 0; i < 20; i++) + { + int idx = Dust.NewDust(hitbox.TopLeft(), npc.width, npc.height, 89, 0f, -2.5f); + Dust dust = Main.dust[idx]; + dust.alpha = 200; + dust.velocity *= 1.4f; + dust.scale += Main.rand.NextFloat(); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int j = 0; j < Main.maxNPCs; j++) + { + NPC nPC = Main.npc[j]; + if (nPC.active && !nPC.buffImmune[ModContent.BuffType()] && npc.Distance(nPC.Center) < 100f && !nPC.dontTakeDamage && nPC.lifeMax > 5 && !nPC.friendly && !nPC.townNPC) + nPC.AddBuff(ModContent.BuffType(), 300); + } + } + } } #endregion @@ -4580,7 +4722,7 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 0.2); maxSpawns = (int)(maxSpawns * 5f); } - if (NPC.AnyNPCs(NPCType())) + if (NPC.AnyNPCs(NPCType())) { int otherWulfrumEnemies = NPC.CountNPCS(NPCType()) + NPC.CountNPCS(NPCType()) + NPC.CountNPCS(NPCType()) + NPC.CountNPCS(NPCType()); if (otherWulfrumEnemies < 4) @@ -4729,6 +4871,12 @@ namespace CalamityMod.NPCs pool[0] = 0f; } + // Add Enchanted Nightcrawlers as a critter to the Astral Infection + if (!CalamityGlobalNPC.AnyEvents(spawnInfo.Player) && spawnInfo.Player.InAstral()) + { + pool[NPCID.EnchantedNightcrawler] = SpawnCondition.TownCritter.Chance; + } + if (spawnInfo.Player.Calamity().ZoneSulphur && !spawnInfo.Player.Calamity().ZoneAbyss && AcidRainEvent.AcidRainEventIsOngoing) { pool.Clear(); @@ -4981,6 +5129,23 @@ namespace CalamityMod.NPCs Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); } + if (dragonFire > 0) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.ProfanedFire, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + if (Main.rand.NextBool(4)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); + } + if (astralInfection > 0) { if (Main.rand.Next(5) < 3) @@ -5150,7 +5315,10 @@ namespace CalamityMod.NPCs if (npc.Calamity().kamiFlu > 0 && !CalamityLists.kamiDebuffColorImmuneList.Contains(npc.type)) return new Color(51, 197, 108, npc.alpha); - if (npc.type == NPCID.AncientDoom) + if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) + return new Color(150, 200, 0, npc.alpha); + + if (npc.type == NPCID.AncientDoom || npc.type == NPCID.QueenSlimeMinionBlue || npc.type == NPCID.QueenSlimeMinionPink || npc.type == NPCID.QueenSlimeMinionPurple) return new Color(255, 255, 255, npc.alpha); return null; @@ -5167,6 +5335,8 @@ namespace CalamityMod.NPCs // Damage over time debuffs if (astralInfection > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff").Value); + if (banishingFire > 0) + buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/BanishingFire").Value); if (bFlames > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames").Value); if (bBlood > 0) @@ -5175,6 +5345,8 @@ namespace CalamityMod.NPCs buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/CrushDepth").Value); if (dFlames > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/DemonFlames").Value); + if (dragonFire > 0) + buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/Dragonfire").Value); if (gsInferno > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno").Value); if (hFlames > 0) @@ -5183,6 +5355,8 @@ namespace CalamityMod.NPCs buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/Nightwither").Value); if (pFlames > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/Plague").Value); + if (sagePoisonTime > 0) + buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/SagePoison").Value); if (shellfishVore > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/ShellfishClaps").Value); if (somaShredStacks > 0) @@ -5191,10 +5365,10 @@ namespace CalamityMod.NPCs buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff").Value); if (sulphurPoison > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning").Value); - if (sagePoisonTime > 0) - buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/SagePoison").Value); if (vaporfied > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/Vaporfied").Value); + if (vulnerabilityHex > 0) + buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex").Value); // Stat debuffs if (aCrunch > 0) @@ -5228,6 +5402,10 @@ namespace CalamityMod.NPCs if (wither > 0) buffTextureList.Add(Request("CalamityMod/Buffs/StatDebuffs/WitherDebuff").Value); + // Visual debuff + if (RancorBurnTime > 0) + buffTextureList.Add(Request("CalamityMod/Buffs/RancorBurn").Value); + // Vanilla damage over time debuffs if (electrified > 0) buffTextureList.Add(TextureAssets.Buff[BuffID.Electrified].Value); @@ -5257,6 +5435,12 @@ namespace CalamityMod.NPCs buffTextureList.Add(TextureAssets.Buff[BuffID.DryadsWard].Value); if (npc.soulDrain && npc.realLife == -1) buffTextureList.Add(TextureAssets.Buff[BuffID.SoulDrain].Value); + if (npc.onFire3) // Hellfire + buffTextureList.Add(TextureAssets.Buff[BuffID.OnFire3].Value); + if (npc.onFrostBurn2) // Frostbite + buffTextureList.Add(TextureAssets.Buff[BuffID.Frostburn2].Value); + if (npc.tentacleSpiked) + buffTextureList.Add(TextureAssets.Buff[BuffID.TentacleSpike].Value); // Vanilla stat debuffs if (npc.confused) @@ -5279,6 +5463,10 @@ namespace CalamityMod.NPCs buffTextureList.Add(TextureAssets.Buff[BuffID.Wet].Value); if (npc.drippingSlime) buffTextureList.Add(TextureAssets.Buff[BuffID.Slimed].Value); + if (npc.drippingSparkleSlime) + buffTextureList.Add(TextureAssets.Buff[BuffID.GelBalloonBuff].Value); + if (npc.markedByScytheWhip) // Dark Harvest whip, the only Whip debuff that has an NPC bool + buffTextureList.Add(TextureAssets.Buff[BuffID.ScytheWhipEnemyDebuff].Value); // Total amount of elements in the buff list int buffTextureListLength = buffTextureList.Count; @@ -5518,7 +5706,11 @@ namespace CalamityMod.NPCs // Draw lights if (npc.ai[2] == 0f) { - if ((newAI[3] >= 900f && npc.life / (float)npc.lifeMax < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) + float destroyerLifeRatio = 1f; + if (npc.realLife >= 0) + destroyerLifeRatio = Main.npc[npc.realLife].life / (float)Main.npc[npc.realLife].lifeMax; + + if ((newAI[3] >= 900f && destroyerLifeRatio < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) { for (int i = 0; i < 3; i++) { @@ -5671,7 +5863,7 @@ namespace CalamityMod.NPCs { return DownedBossSystem.downedPerforator; } - else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + else if (type == NPCType()) { return DownedBossSystem.downedSlimeGod; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 9cd4586639..1cc16570af 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -29,6 +29,8 @@ namespace CalamityMod.NPCs { public partial class CalamityGlobalNPC : GlobalNPC { + public static readonly SoundStyle PlagueSound = new("CalamityMod/Sounds/Custom/PlagueUnleash"); + #region Modify NPC Loot Main Hook public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot) { @@ -56,6 +58,19 @@ namespace CalamityMod.NPCs return !NPC.downedMechBossAny && (lastTwinStanding || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime); } + // Convenient shortcut for all Master drops moved to Revengeance + LeadingConditionRule rev = npcLoot.DefineConditionalDropSet(DropHelper.RevNoMaster); + + LeadingConditionRule pMoon = new LeadingConditionRule(new Conditions.PumpkinMoonDropGatingChance()); + LeadingConditionRule fMoon = new LeadingConditionRule(new Conditions.FrostMoonDropGatingChance()); + + // Progression shortcuts + LeadingConditionRule postEoC = npcLoot.DefineConditionalDropSet(DropHelper.PostEoC()); + LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + LeadingConditionRule postCalPlant = npcLoot.DefineConditionalDropSet(DropHelper.PostCalPlant()); + LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + LeadingConditionRule postDoG = npcLoot.DefineConditionalDropSet(DropHelper.PostDoG()); + switch (npc.type) { #region Surface @@ -78,8 +93,8 @@ namespace CalamityMod.NPCs // Sky Glaze @ 3.33% IF Eye of Cthulhu dead // Essence of Cinder @ 50% IF Hardmode and not statue spawned case NPCID.Harpy: - npcLoot.AddIf(() => NPC.downedBoss1, ModContent.ItemType(), 30); - npcLoot.AddIf(() => Main.hardMode && !npc.SpawnedFromStatue, ModContent.ItemType(), 2); + postEoC.Add(ModContent.ItemType(), 30); + hardmode.AddIf(() => !npc.SpawnedFromStatue, ModContent.ItemType(), 2); break; // Angry Nimbus @@ -123,16 +138,19 @@ namespace CalamityMod.NPCs break; // Mimic - // Drops all of its items Calamity Style @ 33.33% each + // Drops all of its items Calamity Style @ 25% each // This requires erasing its vanilla behavior. case NPCID.Mimic: try { - // Remove the vanilla loot rule which controls all Mimic drops. - var mimicLootRules = npcLoot.Get(false); - mimicLootRules.RemoveAll((rule) => rule is OneFromOptionsDropRule mimicItems && mimicItems.dropIds[0] == ItemID.DualHook); + npcLoot.RemoveWhere((rule) => + { + if (rule is OneFromOptionsDropRule vanillaItems) + return vanillaItems.dropIds[0] == ItemID.DualHook; + return false; + }); - var mimicItems = new int[] + int[] mimicItems = new int[] { ItemID.MagicDagger, ItemID.CrossNecklace, @@ -144,7 +162,7 @@ namespace CalamityMod.NPCs // Mimics will not drop any items if spawned from statues. var notStatue = npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()); - notStatue.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, mimicItems)); + notStatue.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, mimicItems)); } catch (ArgumentNullException) { } break; @@ -182,26 +200,35 @@ namespace CalamityMod.NPCs break; // Ice Mimic - // Drops all of its items Calamity Style @ 33.33% each - // This requires erasing its bizarre vanilla behavior involving the Toy Sled. + // Drops all of its items Calamity Style @ 25% each, Toy Sled is drops on its own at a 5% chance + // Since one weapon is guaranteed to drop, it is at least 33.33% chance for a specific weapon case NPCID.IceMimic: try { - // Remove the vanilla loot rule which controls all Ice Mimic drops. - var iceMimicRootRules = npcLoot.Get(false); - iceMimicRootRules.RemoveAll((rule) => rule is CommonDrop sledDrop && sledDrop.itemId == ItemID.ToySled); + npcLoot.RemoveWhere((rule) => + { + if (rule is OneFromOptionsDropRule vanillaItems) + return vanillaItems.dropIds[0] == ItemID.Frostbrand; + return false; + }); + npcLoot.RemoveWhere((rule) => + { + if (rule is CommonDrop sledDrop) + return sledDrop.itemId == ItemID.ToySled; + return false; + }); - var iceMimicItems = new int[] + int[] iceMimicItems = new int[] { ItemID.Frostbrand, ItemID.IceBow, - ItemID.FlowerofFrost, - ItemID.ToySled, + ItemID.FlowerofFrost }; // Ice Mimics will not drop any items if spawned from statues. var notStatue = npcLoot.DefineConditionalDropSet(new Conditions.NotFromStatue()); - notStatue.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, iceMimicItems)); + notStatue.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, iceMimicItems)); + notStatue.Add(ItemID.ToySled, 20, 1, 1); } catch (ArgumentNullException) { } break; @@ -350,7 +377,7 @@ namespace CalamityMod.NPCs // Giant Cursed Skull // Keelhaul @ 6.67% IF Leviathan dead case NPCID.GiantCursedSkull: - npcLoot.AddIf(() => DownedBossSystem.downedLeviathan, ModContent.ItemType(), 15); + postLevi.Add(ModContent.ItemType(), 15); break; // Bone Lee @@ -406,15 +433,17 @@ namespace CalamityMod.NPCs #endregion #region Blood Moon - // Drippler - // Bouncing Eyeball @ 2.5% Normal, 5% Expert+ - case NPCID.Drippler: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 40, 20)); - break; // All Blood Moon fishing enemies // Drop more Blood Orbs @ 100% + + // Wandering Eye Fish + // Bouncing Eyeball @ 10% Normal, 16.66% Expert+ case NPCID.EyeballFlyingFish: + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.Add(ModContent.ItemType(), 1, 3, 6); + break; + case NPCID.ZombieMerman: npcLoot.Add(ModContent.ItemType(), 1, 3, 6); break; @@ -445,6 +474,44 @@ namespace CalamityMod.NPCs break; #endregion + #region Old One's Army + // Dark Mage T1 + // Dark Mage's Tome drops in Revengeance + case NPCID.DD2DarkMageT1: + rev.Add(ItemID.DarkMageMasterTrophy); + rev.Add(ItemID.DarkMageBookMountItem, 4); + break; + + // Dark Mage T3 + // Master items drop in Revengeance + case NPCID.DD2DarkMageT3: + rev.Add(ItemID.DarkMageMasterTrophy); + rev.Add(ItemID.DarkMageBookMountItem, 4); + break; + + // Ogre T3 + // Master items drop in Revengeance + case NPCID.DD2OgreT3: + rev.Add(ItemID.OgreMasterTrophy); + rev.Add(ItemID.DD2OgrePetItem, 4); + break; + #endregion + + #region Pirate Invasion + // Pirate deadeye + // Midas Prime @ 4% Normal, 6.67% Expert+ + case NPCID.PirateDeadeye: + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); + break; + + // Flying Dutchman + // Master items drop in Revengeance + case NPCID.PirateShip: + rev.Add(ItemID.FlyingDutchmanMasterTrophy); + rev.Add(ItemID.PirateShipMountItem, 4); + break; + #endregion + #region Solar Eclipse // Weak Solar Eclipse Enemies: Frankenstein, Swamp Thing, Fritz, Creature from the Deep // Darksun Fragment @ 10% IF Devourer of Gods dead @@ -452,7 +519,7 @@ namespace CalamityMod.NPCs case NPCID.SwampThing: case NPCID.Fritz: case NPCID.CreatureFromTheDeep: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 10); + postDoG.Add(ModContent.ItemType(), 10); break; // Medium Solar Eclipse Enemies: The Possessed, Butcher, Dr. Man Fly @@ -460,7 +527,7 @@ namespace CalamityMod.NPCs case NPCID.ThePossessed: case NPCID.Butcher: case NPCID.DrManFly: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2); + postDoG.Add(ModContent.ItemType(), 2); break; // Reaper, Psycho @@ -468,8 +535,8 @@ namespace CalamityMod.NPCs // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.Reaper: case NPCID.Psycho: - npcLoot.AddIf(() => DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, ModContent.ItemType(), 2, 2, 4); - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2); + postCalPlant.Add(ModContent.ItemType(), 2, 2, 4); + postDoG.Add(ModContent.ItemType(), 2); break; // Vampire / Vampire Bat (same enemy) @@ -481,26 +548,26 @@ namespace CalamityMod.NPCs case NPCID.Vampire: npcLoot.ChangeDropRate(ItemID.MoonStone, 3, 20); npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.BatHook, 40, 20)); - npcLoot.AddIf(() => DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, ModContent.ItemType(), 2, 2, 4); - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2); + postCalPlant.Add(ModContent.ItemType(), 2, 2, 4); + postDoG.Add(ModContent.ItemType(), 2); break; // Eyezor // 1-2 Darksun Fragment @ 100% IF Devourer of Gods dead case NPCID.Eyezor: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 1, 2); + postDoG.Add(ModContent.ItemType(), 1, 1, 2); break; // Nailhead // 3-5 Darksun Fragment @ 100% IF Devourer of Gods dead case NPCID.Nailhead: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 3, 5); + postDoG.Add(ModContent.ItemType(), 1, 3, 5); break; // Mothron // 20-30 Darksun Fragment @ 100% IF Devourer of Gods dead case NPCID.Mothron: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 20, 30); + postDoG.Add(ModContent.ItemType(), 1, 20, 30); break; // Deadly Sphere @@ -508,7 +575,7 @@ namespace CalamityMod.NPCs // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.DeadlySphere: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2); + postDoG.Add(ModContent.ItemType(), 2); break; #endregion @@ -516,32 +583,44 @@ namespace CalamityMod.NPCs // Splinterling // Nightmare Fuel @ 50% IF Devourer of Gods dead case NPCID.Splinterling: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2); + postDoG.Add(ModContent.ItemType(), 2); break; // Hellhound, Poltergeist // 1-2 Nightmare Fuel @ 50% IF Devourer of Gods dead case NPCID.Hellhound: case NPCID.Poltergeist: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2, 1, 2); + postDoG.Add(ModContent.ItemType(), 2, 1, 2); break; // Headless Horseman // 3-5 Nightmare Fuel @ 100% IF Devourer of Gods dead case NPCID.HeadlessHorseman: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 3, 5); + postDoG.Add(ModContent.ItemType(), 1, 3, 5); break; // Mourning Wood - // 5-10 Nightmare Fuel @ 100% IF Devourer of Gods dead case NPCID.MourningWood: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 5, 10); + // 5-10 Nightmare Fuel @ 100% IF Devourer of Gods dead + postDoG.Add(ModContent.ItemType(), 1, 5, 10); + + pMoon.OnSuccess(ItemDropRule.ByCondition(new Conditions.NotExpert(), ItemID.WitchBroom, 5)); + + // Master items drop in Revengeance + pMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.MourningWoodMasterTrophy)); + pMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.SpookyWoodMountItem, 4)); + npcLoot.Add(pMoon); break; // Pumpking - // 10-20 Nightmare Fuel @ 100% IF Devourer of Gods dead case NPCID.Pumpking: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 10, 20); + // 10-20 Nightmare Fuel @ 100% IF Devourer of Gods dead + postDoG.Add(ModContent.ItemType(), 1, 10, 20); + + // Master items drop in Revengeance + pMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.PumpkingMasterTrophy)); + pMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.PumpkingPetItem, 4)); + npcLoot.Add(pMoon); break; #endregion @@ -552,7 +631,7 @@ namespace CalamityMod.NPCs case NPCID.NutcrackerSpinning: case NPCID.ElfCopter: case NPCID.Flocko: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2); + postDoG.Add(ModContent.ItemType(), 2); break; // Medium Frost Moon Enemies: Krampus, Yeti, Present Mimic @@ -560,25 +639,40 @@ namespace CalamityMod.NPCs case NPCID.Krampus: case NPCID.Yeti: case NPCID.PresentMimic: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 2, 1, 2); + postDoG.Add(ModContent.ItemType(), 2, 1, 2); break; // Everscream - // 3-5 Endothermic Energy @ 100% IF Devourer of Gods dead case NPCID.Everscream: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 3, 5); + // 3-5 Endothermic Energy @ 100% IF Devourer of Gods dead + postDoG.Add(ModContent.ItemType(), 1, 3, 5); + + // Master items drop in Revengeance + fMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.EverscreamMasterTrophy)); + fMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.EverscreamPetItem, 4)); + npcLoot.Add(fMoon); break; // Santa-NK1 - // 5-10 Endothermic Energy @ 100% IF Devourer of Gods dead case NPCID.SantaNK1: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 5, 10); + // 5-10 Endothermic Energy @ 100% IF Devourer of Gods dead + postDoG.Add(ModContent.ItemType(), 1, 5, 10); + + // Master items drop in Revengeance + fMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.SantankMasterTrophy)); + fMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.SantankMountItem, 4)); + npcLoot.Add(fMoon); break; // Ice Queen - // 10-20 Endothermic Energy @ 100% IF Devourer of Gods dead case NPCID.IceQueen: - npcLoot.AddIf(() => DownedBossSystem.downedDoG, ModContent.ItemType(), 1, 10, 20); + // 10-20 Endothermic Energy @ 100% IF Devourer of Gods dead + postDoG.Add(ModContent.ItemType(), 1, 10, 20); + + // Master items drop in Revengeance + fMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.IceQueenMasterTrophy)); + fMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.IceQueenPetItem, 4)); + npcLoot.Add(fMoon); break; #endregion @@ -607,9 +701,13 @@ namespace CalamityMod.NPCs break; // Martian Saucer - // Nullification Pistol @ 14.29% Normal, 25% Expert+ case NPCID.MartianSaucerCore: + // Nullification Pistol @ 14.29% Normal, 25% Expert+ npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + + // Master items drop in Revengeance + rev.Add(ItemID.UFOMasterTrophy); + rev.Add(ItemID.MartianPetItem, 4); break; #endregion @@ -668,7 +766,7 @@ namespace CalamityMod.NPCs // Clothier // Clothiers Wrath @ 100% IF Hardmode case NPCID.Clothier: - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType()); + hardmode.Add(ModContent.ItemType()); break; // Angler @@ -676,9 +774,10 @@ namespace CalamityMod.NPCs // OTHERWISE, // Golden Fishing Rod @ 8.33% IF Hardmode case NPCID.Angler: - LeadingConditionRule trasherLCR = new(DropHelper.AnglerFedToTrasherCondition); - trasherLCR.Add(ItemID.GoldenFishingRod); - trasherLCR.OnFailedConditions(ItemDropRule.ByCondition(new Conditions.IsHardmode(), ItemID.GoldenFishingRod, 12)); + LeadingConditionRule trasherLCR = new LeadingConditionRule(DropHelper.AnglerFedToTrasherCondition); + trasherLCR.Add(ItemDropRule.ByCondition(DropHelper.TrasherText, ItemID.GoldenFishingRod)); + trasherLCR.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.GoldenFishingRod, 12)); + npcLoot.Add(trasherLCR); break; #endregion @@ -703,8 +802,12 @@ namespace CalamityMod.NPCs // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), 10); + // Master items drop in Revengeance + rev.Add(ItemID.KingSlimeMasterTrophy); + rev.Add(ItemID.KingSlimePetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedSlimeKing, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedSlimeKing, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.EyeofCthulhu: @@ -715,8 +818,12 @@ namespace CalamityMod.NPCs npcLoot.AddNormalOnly(ModContent.ItemType(), 10); npcLoot.AddNormalOnly(ModContent.ItemType(), 4); + // Master items drop in Revengeance + rev.Add(ItemID.EyeofCthulhuMasterTrophy); + rev.Add(ItemID.EyeOfCthulhuPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss1, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss1, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.EaterofWorldsHead: @@ -725,16 +832,20 @@ namespace CalamityMod.NPCs EoWKill.Add(DropHelper.PerPlayer(ItemID.WormScarf)); npcLoot.AddNormalOnly(EoWKill); + // Master items drop in Revengeance + rev.AddIf((info) => info.npc.boss, ItemID.EaterofWorldsMasterTrophy); + rev.AddIf((info) => info.npc.boss, ItemID.EaterOfWorldsPetItem, 4); + // Corruption World OR Drunk World: Corruption Lore - LeadingConditionRule eowCorruptionLore = new(DropHelper.If((info) => info.npc.boss && (!WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2)); - eowCorruptionLore.Add(ModContent.ItemType()); - eowCorruptionLore.Add(ModContent.ItemType()); + LeadingConditionRule eowCorruptionLore = new(DropHelper.If((info) => info.npc.boss && (!WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); + eowCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); + eowCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(eowCorruptionLore); // Crimson World OR Drunk World: Crimson Lore - LeadingConditionRule eowCrimsonLore = new(DropHelper.If((info) => info.npc.boss && (WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2)); - eowCrimsonLore.Add(ModContent.ItemType()); - eowCrimsonLore.Add(ModContent.ItemType()); + LeadingConditionRule eowCrimsonLore = new(DropHelper.If((info) => info.npc.boss && (WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); + eowCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); + eowCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(eowCrimsonLore); break; @@ -742,19 +853,55 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BrainOfConfusion)); + // Master items drop in Revengeance + rev.Add(ItemID.BrainofCthulhuMasterTrophy); + rev.Add(ItemID.BrainOfCthulhuPetItem, 4); + // Corruption World OR Drunk World: Corruption Lore - LeadingConditionRule bocCorruptionLore = new(DropHelper.If(() => (!WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2)); - bocCorruptionLore.Add(ModContent.ItemType()); - bocCorruptionLore.Add(ModContent.ItemType()); + LeadingConditionRule bocCorruptionLore = new(DropHelper.If(() => (!WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); + bocCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); + bocCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(bocCorruptionLore); // Crimson World OR Drunk World: Crimson Lore - LeadingConditionRule bocCrimsonLore = new(DropHelper.If(() => (WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2)); - bocCrimsonLore.Add(ModContent.ItemType()); - bocCrimsonLore.Add(ModContent.ItemType()); + LeadingConditionRule bocCrimsonLore = new(DropHelper.If(() => (WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); + bocCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); + bocCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(bocCrimsonLore); break; + case NPCID.Deerclops: + // Remove the vanilla loot rule for Deerclops' weapon drops. + try + { + var deerRootRules = npcLoot.Get(false); + IItemDropRule notExpert = deerRootRules.Find((rule) => rule is LeadingConditionRule deerLCR && deerLCR.condition is Conditions.NotExpert); + if (notExpert is LeadingConditionRule LCR_NotExpert) + { + LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => + chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromOptionsNotScaledWithLuckDropRule weapons && weapons.dropIds[0] == ItemID.LucyTheAxe); + + // Define a replacement rule which drops the weapons Calamity style. + var deerWeapons = new int[] + { + ItemID.LucyTheAxe, + ItemID.PewMaticHorn, + ItemID.WeatherPain, + ItemID.HoundiusShootius + }; + LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, deerWeapons)); + } + } + catch (ArgumentNullException) { } + + // Expert+ drops are also available on Normal + npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BoneHelm)); + + // Master items drop in Revengeance + rev.Add(ItemID.DeerclopsMasterTrophy); + rev.Add(ItemID.DeerclopsPetItem, 4); + break; + case NPCID.QueenBee: // Remove the vanilla loot rule for Queen Bee's weapon drops. npcLoot.RemoveWhere((rule) => @@ -777,8 +924,12 @@ namespace CalamityMod.NPCs // Queen Bee drops Stingers in Calamity npcLoot.Add(ItemID.Stinger, 1, 8, 12); + // Master items drop in Revengeance + rev.Add(ItemID.QueenBeeMasterTrophy); + rev.Add(ItemID.QueenBeePetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedQueenBee, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedQueenBee, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.SkeletronHead: @@ -797,80 +948,107 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BoneGlove)); + // Master items drop in Revengeance + rev.Add(ItemID.SkeletronMasterTrophy); + rev.Add(ItemID.SkeletronPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss3, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss3, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.WallofFlesh: // Remove the vanilla loot rule for Wall of Flesh's weapon drops. - npcLoot.RemoveWhere((rule) => + try { - if (rule is LeadingConditionRule wofLCR) - return wofLCR.ChainedRules[0] is OneFromOptionsNotScaledWithLuckDropRule weapons && weapons.dropIds[0] == ItemID.BreakerBlade; - return false; - }); + var wofRootRules = npcLoot.Get(false); + // Emblem rule happens first, so use FindLast + IItemDropRule notExpert = wofRootRules.FindLast((rule) => rule is LeadingConditionRule wofLCR && wofLCR.condition is Conditions.NotExpert); + if (notExpert is LeadingConditionRule LCR_NotExpert) + { + LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => + chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromOptionsNotScaledWithLuckDropRule weapons && weapons.dropIds[0] == ItemID.BreakerBlade); - // Define a replacement rule which drops the weapons Calamity style. - var wofWeapons = new int[] - { - ItemID.BreakerBlade, - ItemID.ClockworkAssaultRifle, - ModContent.ItemType(), - ItemID.LaserRifle, - ModContent.ItemType(), - ItemID.FireWhip, - ModContent.ItemType(), - }; - npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, wofWeapons)); + // Define a replacement rule which drops the weapons Calamity style. + var wofWeapons = new int[] + { + ItemID.BreakerBlade, + ItemID.ClockworkAssaultRifle, + ModContent.ItemType(), + ItemID.LaserRifle, + ModContent.ItemType(), + ItemID.FireWhip, // Firecracker + ModContent.ItemType(), + }; + LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, wofWeapons)); + } + } + catch (ArgumentNullException) { } // Remove the vanilla loot rule for Wall of Flesh's emblem drops. - npcLoot.RemoveWhere((rule) => + try { - if (rule is LeadingConditionRule wofLCR) - return wofLCR.ChainedRules[0] is OneFromOptionsNotScaledWithLuckDropRule emblems && emblems.dropIds[0] == ItemID.WarriorEmblem; - return false; - }); + var wofRootRules = npcLoot.Get(false); + IItemDropRule notExpert = wofRootRules.Find((rule) => rule is LeadingConditionRule wofLCR && wofLCR.condition is Conditions.NotExpert); + if (notExpert is LeadingConditionRule LCR_NotExpert) + { + LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => + chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromOptionsNotScaledWithLuckDropRule emblems && emblems.dropIds[0] == ItemID.WarriorEmblem); - // Define a replacement rule which drops the emblems Calamity style. - var wofEmblems = new int[] - { - ItemID.WarriorEmblem, - ItemID.RangerEmblem, - ItemID.SorcererEmblem, - ItemID.SummonerEmblem, - ModContent.ItemType(), - }; - npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, wofEmblems)); + // Define a replacement rule which drops the emblems Calamity style. + var wofEmblems = new int[] + { + ItemID.WarriorEmblem, + ItemID.RangerEmblem, + ItemID.SorcererEmblem, + ItemID.SummonerEmblem, + ModContent.ItemType(), + }; + LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, wofEmblems)); + } + } + catch (ArgumentNullException) { } // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), 10); // Drop Hermit's Box directly for EACH player, regardles of Expert or not. 100% chance on first kill, 10% chance afterwards. + // The special first kill rule is unlisted in the Bestiary LeadingConditionRule firstWoFKill = new(DropHelper.If(() => !Main.hardMode)); - firstWoFKill.Add(DropHelper.PerPlayer(ModContent.ItemType())); + firstWoFKill.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); npcLoot.Add(firstWoFKill); LeadingConditionRule subsequentWoFKills = new(DropHelper.If(() => Main.hardMode)); subsequentWoFKills.Add(DropHelper.PerPlayer(ModContent.ItemType(), 10)); npcLoot.Add(subsequentWoFKills); // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.DemonHeart)); + // However, Demon Heart does not work in Normal mode, so it's best to not drop it + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.DemonHeart)); // WoF drops Evil Keys npcLoot.Add(ItemID.CorruptionKey, 3); npcLoot.Add(ItemID.CrimsonKey, 3); + // Master items drop in Revengeance + rev.Add(ItemID.WallofFleshMasterTrophy); + rev.Add(ItemID.WallOfFleshGoatMountItem, 4); + // Lore - LeadingConditionRule wofLore = npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType()); - wofLore.Add(DropHelper.PerPlayer(ModContent.ItemType())); + npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.QueenSlimeBoss: // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.VolatileGelatin)); + npcLoot.AddNormalOnly(ItemID.SoulofLight, 1, 15, 20); // Queen Slime drops the Hallowed Key npcLoot.Add(ItemID.HallowedKey, 3); + + // Master items drop in Revengeance + rev.Add(ItemID.QueenSlimeMasterTrophy); + rev.Add(ItemID.QueenSlimePetItem, 4); + break; case NPCID.TheDestroyer: @@ -883,9 +1061,13 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.MechanicalWagonPiece)); + // Master items drop in Revengeance + rev.Add(ItemID.DestroyerMasterTrophy); + rev.Add(ItemID.DestroyerPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss1, ModContent.ItemType()); - npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss1, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); break; case NPCID.Retinazer: @@ -915,9 +1097,13 @@ namespace CalamityMod.NPCs npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ItemID.MechanicalWheelPiece); npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ModContent.ItemType(), 10); + // Master items drop in Revengeance + rev.AddIf((info) => IsLastTwinStanding(info), ItemID.TwinsMasterTrophy); + rev.AddIf((info) => IsLastTwinStanding(info), ItemID.TwinsPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer((info) => !NPC.downedMechBoss2 && IsLastTwinStanding(info), ModContent.ItemType()); - npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer((info) => !NPC.downedMechBoss2 && IsLastTwinStanding(info), ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); break; case NPCID.SkeletronPrime: @@ -930,9 +1116,13 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.MechanicalBatteryPiece)); + // Master items drop in Revengeance + rev.Add(ItemID.SkeletronPrimeMasterTrophy); + rev.Add(ItemID.SkeletronPrimePetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss3, ModContent.ItemType()); - npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss3, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); break; case NPCID.Plantera: @@ -981,48 +1171,17 @@ namespace CalamityMod.NPCs // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), 10); npcLoot.AddNormalOnly(ModContent.ItemType(), 10); - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ModContent.ItemType(), 1, 12, 18)); + npcLoot.AddNormalOnly(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Plantera drops Jungle Key npcLoot.Add(ItemID.JungleKey, 3); + // Master items drop in Revengeance + rev.Add(ItemID.PlanteraMasterTrophy); + rev.Add(ItemID.PlanteraPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedPlantBoss, ModContent.ItemType()); - break; - - case NPCID.HallowBoss: - // Remove the vanilla loot rule for Empress of Light's weapon drops. This requires digging through her loot rule tree. - try - { - var empressRootRules = npcLoot.Get(false); - IItemDropRule notExpert = empressRootRules.Find((rule) => rule is LeadingConditionRule empressLCR && empressLCR.condition is Conditions.NotExpert); - if (notExpert is LeadingConditionRule LCR_NotExpert) - { - LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => - chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromOptionsDropRule empressWeapons); - - // Define a replacement rule which drops the items Calamity style. - // This includes her wings, because they have a pathetically low drop rate normally. - var empressItems = new int[] - { - ItemID.FairyQueenMagicItem, - ItemID.FairyQueenRangedItem, - ItemID.EmpressBlade, - ItemID.RainbowWhip, - ItemID.PiercingStarlight, - ItemID.RainbowWings - }; - LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, empressItems)); - } - - // Remove the vanilla loot rule for Empress Wings because it's part of the Calamity Style set. - empressRootRules.RemoveAll((rule) => - rule is ItemDropWithConditionRule conditionalRule && conditionalRule.condition is Conditions.NotExpert && conditionalRule.itemId == ItemID.RainbowWings); - } - catch (ArgumentNullException) { } - - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EmpressFlightBooster)); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedPlantBoss, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.Golem: @@ -1071,8 +1230,12 @@ namespace CalamityMod.NPCs firstGolemKill.Add(DropHelper.PerPlayer(ItemID.Picksaw)); npcLoot.Add(firstGolemKill); + // Master items drop in Revengeance + rev.Add(ItemID.GolemMasterTrophy); + rev.Add(ItemID.GolemPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedGolemBoss, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedGolemBoss, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.DD2Betsy: @@ -1098,6 +1261,11 @@ namespace CalamityMod.NPCs } } catch (ArgumentNullException) { } + + // Master items drop in Revengeance + rev.Add(ItemID.BetsyMasterTrophy); + rev.Add(ItemID.DD2BetsyPetItem, 4); + break; case NPCID.DukeFishron: @@ -1138,16 +1306,68 @@ namespace CalamityMod.NPCs // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), 10); + // Master items drop in Revengeance + rev.Add(ItemID.DukeFishronMasterTrophy); + rev.Add(ItemID.DukeFishronPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedFishron, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedFishron, ModContent.ItemType(), desc: DropHelper.FirstKillText); + break; + + case NPCID.HallowBoss: + // Remove the vanilla loot rule for Empress of Light's weapon drops. This requires digging through her loot rule tree. + try + { + var empressRootRules = npcLoot.Get(false); + IItemDropRule notExpert = empressRootRules.Find((rule) => rule is LeadingConditionRule empressLCR && empressLCR.condition is Conditions.NotExpert); + if (notExpert is LeadingConditionRule LCR_NotExpert) + { + LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => + chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromOptionsDropRule empressWeapons); + + // Define a replacement rule which drops the items Calamity style. + // This includes her wings, because they have a pathetically low drop rate normally. + var empressItems = new int[] + { + ItemID.PiercingStarlight, // Starlight + ItemID.FairyQueenRangedItem, // Eventide + ItemID.FairyQueenMagicItem, // Nightglow + ItemID.SparkleGuitar, // Stellar Tune + ItemID.EmpressBlade, // Terraprisma + ItemID.RainbowWhip, // Kaleidoscope + ItemID.RainbowWings // Empress Wings + }; + LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, empressItems)); + + // Remove rules for Empress Wings and Stellar Tune because they're in the Calamity Style set. + LCR_NotExpert.ChainedRules.RemoveAll((chain) => + { + var rule = chain.RuleToChain; + return rule is CommonDrop c && (c.itemId == ItemID.RainbowWings || c.itemId == ItemID.SparkleGuitar); + }); + } + } + catch (ArgumentNullException) { } + + // Expert+ drops are also available on Normal + npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EmpressFlightBooster)); + + // Master items drop in Revengeance + rev.Add(ItemID.FairyQueenMasterTrophy); + rev.Add(ItemID.FairyQueenPetItem, 4); + break; case NPCID.CultistBoss: + // Master items drop in Revengeance + rev.Add(ItemID.LunaticCultistMasterTrophy); + rev.Add(ItemID.LunaticCultistPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedAncientCultist, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedAncientCultist, ModContent.ItemType(), desc: DropHelper.FirstKillText); // Special Blood Moon Lore - npcLoot.AddConditionalPerPlayer(() => Main.bloodMoon, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => Main.bloodMoon, ModContent.ItemType(), desc: DropHelper.BloodMoonText); break; case NPCID.MoonLordCore: @@ -1188,8 +1408,12 @@ namespace CalamityMod.NPCs // Would be in the bag otherwise npcLoot.AddNormalOnly(DropHelper.PerPlayer(ModContent.ItemType())); + // Master items drop in Revengeance + rev.Add(ItemID.MoonLordMasterTrophy); + rev.Add(ItemID.MoonLordPetItem, 4); + // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedMoonlord, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedMoonlord, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; default: @@ -1277,13 +1501,9 @@ namespace CalamityMod.NPCs if (CalamityWorld.death && !SplittingWormLootBlockWrapper(npc, Mod)) DropHelper.BlockEverything(); - // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping hearts or partial loot in Rev+ + // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ if (CalamityWorld.revenge && (CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper)) - DropHelper.BlockDrops(ItemID.Heart, ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); - - // Stop certain boss minions from providing hearts in Rev+ - if (CalamityWorld.revenge && CalamityLists.heartDropBlockList.Contains(npc.type)) - DropHelper.BlockDrops(ItemID.Heart); + DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); // Check whether bosses should be spawned naturally as a result of this NPC's death. CheckBossSpawn(npc); @@ -1360,7 +1580,7 @@ namespace CalamityMod.NPCs break; case NPCID.TheDestroyer: - SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); + SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); @@ -1372,7 +1592,7 @@ namespace CalamityMod.NPCs case NPCID.Retinazer: if (lastTwinStanding) { - SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); + SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); @@ -1382,7 +1602,7 @@ namespace CalamityMod.NPCs break; case NPCID.SkeletronPrime: - SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); + SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); SetNewBossJustDowned(npc); @@ -1433,6 +1653,9 @@ namespace CalamityMod.NPCs // If Golem has never been killed, send a message about the Plague. if (!NPC.downedGolemBoss) { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + SoundEngine.PlaySound(PlagueSound, Main.player[Main.myPlayer].position); + string key3 = "Mods.CalamityMod.BabyBossText"; Color messageColor3 = Color.Lime; @@ -1452,15 +1675,6 @@ namespace CalamityMod.NPCs case NPCID.CultistBoss: SetNewBossJustDowned(npc); - - // Deus text (this is not a loot function) - if (!NPC.downedAncientCultist) - { - string key4 = "Mods.CalamityMod.DeusText"; - Color messageColor4 = Color.Gold; - - CalamityUtils.DisplayLocalizedText(key4, messageColor4); - } break; case NPCID.LunarTowerSolar: @@ -1625,6 +1839,7 @@ namespace CalamityMod.NPCs if (lastPlayer >= 0) { + SoundEngine.PlaySound(Polterghast.Polterghast.SpawnSound, Main.player[lastPlayer].Center); NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); CalamityMod.ghostKillCount = 0; } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 05e5d9fcda..40d78c9e70 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; using CalamityMod.Items.Ammo.FiniteUse; @@ -19,6 +20,8 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -29,13 +32,39 @@ namespace CalamityMod.NPCs { public partial class CalamityGlobalNPC : GlobalNPC { + public static float TaxYieldFactor + { + get + { + // Max of 20 platinum. + if (DownedBossSystem.downedYharon) + return 40f; + + // Max of 10 platinum. + if (DownedBossSystem.downedDoG) + return 20f; + + // Max of 5 platinum. + if (NPC.downedMoonlord) + return 10f; + + // Max of 2 platinum. + if (NPC.downedPlantBoss) + return 4f; + + return 1f; + } + } + + public static int TotalTaxesPerNPC => (int)(Item.buyPrice(0, 0, 1, 50) * TaxYieldFactor); + + public static int TaxesToCollectLimit => (int)(Item.buyPrice(0, 50, 0, 0) * TaxYieldFactor); + #region Town NPC Patreon Name Sets - private const int AnglerVanillaNames = 22; private static readonly string[] AnglerNames = { "Dazren", }; - private const int ArmsDealerVanillaNames = 24; private static readonly string[] ArmsDealerNames = { "Drifter", @@ -44,23 +73,20 @@ namespace CalamityMod.NPCs "Fire", // <@!354362326947856384> (fire#0692) "Barney Calhoun", // <@!634462901431697410> (Potato Power#6578) "XiaoEn0426", // <@!440448864772816896> (XiaoEn0426#9157) + "Jeffred", // <@!295362230038560768> (Knight Solaire#0873) }; - private const int ClothierVanillaNames = 25; private static readonly string[] ClothierNames = { "Joeseph Jostar", }; - private const int CyborgVanillaNames = 22; private static readonly string[] CyborgNames = { "Sylux", // <@!331812782183809025> (Gonk#2451) }; - private const int DemolitionistVanillaNames = 22; private static readonly string[] DemolitionistNames = { "Tavish DeGroot", // <@!442447226992721930> (Magicoal#2655) }; - private const int DryadVanillaNames = 21; private static readonly string[] DryadNames = { "Rythmi", @@ -68,9 +94,7 @@ namespace CalamityMod.NPCs "Jasmine", // <@!430532867479699456> (phantasmagoria#6777) "Cybil", // <@!486507232666845185> (Captain Doofus#????) }; - private const int DyeTraderVanillaNames = 16; private static readonly string[] DyeTraderNames = null; - private const int GoblinTinkererVanillaNames = 25; private static readonly string[] GoblinTinkererNames = { "Verth", @@ -81,12 +105,12 @@ namespace CalamityMod.NPCs "G'tok", // <@!335192200956608535> (gtoktas#7589) "Katto", // <@!175972165504466944> (Katto#2858) }; - private const int GuideVanillaNames = 34; + private static readonly string[] GolferNames = null; private static readonly string[] GuideNames = { "Lapp", "Ben Shapiro", - "StreakistYT", + "Streakist", // used to be "StreakistYT". couldn't find the youtube channel, and decided to remove the ad. "Necroplasmic", "Devin", "Woffle", // <@!185980979427540992> (Chipbeam#2268) @@ -94,8 +118,9 @@ namespace CalamityMod.NPCs "Wilbur", // <@!295171926324805634> (ChaosChaos#5979) "Good Game Design", // <@!564267767042277385> (Dominic Karma#7777) "Danmaku", // <@!756259562268524555> (Danmaku#2659) + "Grylken", // <@!299970404435361802> (Grylken#1569) + "Outlaw", // <@!918311619480657922> (TheChosenOutlaw#8746) }; - private const int MechanicVanillaNames = 24; private static readonly string[] MechanicNames = { "Lilly", @@ -103,76 +128,64 @@ namespace CalamityMod.NPCs "Robin", // <@!654737510030639112> (Altzeus#8687) "Curly", // <@!673092101780668416> (Curly~Brace#4830) }; - private const int MerchantVanillaNames = 23; private static readonly string[] MerchantNames = null; - private const int NurseVanillaNames = 24; private static readonly string[] NurseNames = { "Farsni", }; - private const int PainterVanillaNames = 18; private static readonly string[] PainterNames = { "Picasso", // <@!353316526306361347> (SCONICBOOM#2164 -- for the late Picasso's Bean#2819) }; - private const int PartyGirlVanillaNames = 17; private static readonly string[] PartyGirlNames = { "Arin", // <@!268169458302976012> (Kiyotu#0006) }; - private const int PirateVanillaNames = 11; private static readonly string[] PirateNames = { "Tyler Van Hook", "Cap'n Deek", // "Alex N" on Patreon }; - private const int PrincessVanillaNames = 22; private static readonly string[] PrincessNames = { "Catalyst", // <@!156672312425316352> (xAqult#1122) + "Nyapano", // <@!120976656826368003> (Emi - Nyapano She/Her#4040) + "Jade", // <@!187395834625785869> (VeryMasterNinja#7728) }; - private const int SkeletonMerchantVanillaNames = 10; private static readonly string[] SkeletonMerchantNames = { "Sans Undertale", // <@!145379091648872450> (Shayy#5257) "Papyrus Undertale", // <@!262663471189983242> (Nycro#0001) }; - private const int SteampunkerVanillaNames = 20; private static readonly string[] SteampunkerNames = { "Vorbis", "Angel", }; - private const int StylistVanillaNames = 20; private static readonly string[] StylistNames = { "Amber", // <@!114677116473180169> (Mishiro Usui#1295) "Faith", // <@!509050283871961123> (Toasty#1007) "Xsiana", // <@!625780237489143839> (xiana.#0015) }; - private const int TavernkeepVanillaNames = 16; private static readonly string[] TavernkeepNames = { "Tim Lockwood", // <@!605839945483026434> (Deimelo#0001) "Sir Samuel Winchester Jenkins Kester II", // <@!107659695749070848> (Ryaegos#1661) "Brutus", // <@!591889650692521984> (Brutus#4337) }; - private const int TaxCollectorVanillaNames = 19; private static readonly string[] TaxCollectorNames = { "Emmett", }; - private const int TravelingMerchantVanillaNames = 13; private static readonly string[] TravelingMerchantNames = { "Stan Pines", }; - private const int TruffleVanillaNames = 12; private static readonly string[] TruffleNames = { "Aldrimil", // <@!413719640238194689> (Thorioum#2475) }; - private const int WitchDoctorVanillaNames = 10; private static readonly string[] WitchDoctorNames = { "Sok'ar", @@ -181,7 +194,6 @@ namespace CalamityMod.NPCs "Khatunz", // <@!303022375191183360> (jackshiz#7839) "Amnesia Wapers", // <@!326821498323075073> (Retarded Advice from a Retard#6969) }; - private const int WizardVanillaNames = 22; private static readonly string[] WizardNames = { "Mage One-Trick", @@ -194,13 +206,14 @@ namespace CalamityMod.NPCs "Syethas", // <@!325413275066171393> (CosmicStarIight#4430) "Nextdoor Psycho", // <@!173261518572486656> (⋈-NextdoorPsycho-⋈#0001) }; + private static readonly string[] ZoologistNames = null; // The following sets are for the 1.4 Town Pets: Town Dogs, Cats and Bunnies. // All three pet types come in numerous breeds. Each breed has its own name pool. // Donator pet names should be appended to all breeds' name pools equally. - // TODO -- actually allow for naming pets + private const int TownDogLabradorVanillaNames = 17; - private const int TownDogPitbullVanillaNames = 14; + private const int TownDogPitBullVanillaNames = 14; private const int TownDogBeagleVanillaNames = 12; private const int TownDogCorgiVanillaNames = 14; private const int TownDogDalmatianVanillaNames = 13; @@ -208,8 +221,18 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogNames = { "Ozymandias", // <@!146333264871686145> (Ozzatron#0001) - // "Kendra", // <@!237247188005158912> (LordMetarex#6407) ONLY IF the dog is a Beagle - "Yoshi", // <@!541127291426832384> (GregTheSpinarak#6643) ONLY IF the dog is a Husky + }; + private static readonly string[] TownDogLabradorNames = null; + private static readonly string[] TownDogPitBullNames = null; + private static readonly string[] TownDogBeagleNames = + { + "Kendra", // <@!237247188005158912> (LordMetarex#6407) + }; + private static readonly string[] TownDogCorgiNames = null; + private static readonly string[] TownDogDalmatianNames = null; + private static readonly string[] TownDogHuskyNames = + { + "Yoshi", // <@!541127291426832384> (GregTheSpinarak#6643) }; private const int TownCatSiameseVanillaNames = 12; @@ -220,11 +243,22 @@ namespace CalamityMod.NPCs private const int TownCatWhiteVanillaNames = 15; private static readonly string[] TownCatNames = { - // "Bear", // <@!183424826407518208> (Lilac Vrt Olligoci#5585) ONLY IF the cat is a Black Cat - // "Felix" // <@!183424826407518208> (Lilac Vrt Olligoci#5585) ONLY IF the cat is an Orange Tabby "Smoogle", // <@!709968379334623274> (smoogle#5672) "The Meowurer of Gods", // <@!385949114271268864> (GP#7876) + "Katsafaros", // <@!190595401328492544> (NavyGuy#2650) }; + private static readonly string[] TownCatSiameseNames = null; + private static readonly string[] TownCatBlackNames = + { + "Bear", // <@!183424826407518208> (Lilac Vrt Olligoci#5585) + }; + private static readonly string[] TownCatOrangeTabbyNames = + { + "Felix" // <@!183424826407518208> (Lilac Vrt Olligoci#5585) + }; + private static readonly string[] TownCatRussianBlueNames = null; + private static readonly string[] TownCatSilverNames = null; + private static readonly string[] TownCatWhiteNames = null; private const int TownBunnyWhiteVanillaNames = 14; private const int TownBunnyAngoraVanillaNames = 10; @@ -232,13 +266,17 @@ namespace CalamityMod.NPCs private const int TownBunnyFlemishVanillaNames = 12; private const int TownBunnyLopVanillaNames = 13; private const int TownBunnySilverVanillaNames = 13; - private static readonly string[] TownBunnyNames = - { - // None yet - }; + private static readonly string[] TownBunnyNames = null; + private static readonly string[] TownBunnyWhiteNames = null; + private static readonly string[] TownBunnyAngoraNames = null; + private static readonly string[] TownBunnyDutchNames = null; + private static readonly string[] TownBunnyFlemishNames = null; + private static readonly string[] TownBunnyLopNames = null; + private static readonly string[] TownBunnySilverNames = null; #endregion #region Town NPC Names + #region Pets public static void ResetTownNPCNameBools() { void ResetName(int npcID, ref bool nameBool) @@ -247,139 +285,301 @@ namespace CalamityMod.NPCs nameBool = false; } - ResetName(NPCID.Angler, ref CalamityWorld.anglerName); - ResetName(NPCID.ArmsDealer, ref CalamityWorld.armsDealerName); - ResetName(NPCID.Clothier, ref CalamityWorld.clothierName); - ResetName(NPCID.Cyborg, ref CalamityWorld.cyborgName); - ResetName(NPCID.Demolitionist, ref CalamityWorld.demolitionistName); - ResetName(NPCID.Dryad, ref CalamityWorld.dryadName); - ResetName(NPCID.DyeTrader, ref CalamityWorld.dyeTraderName); - ResetName(NPCID.GoblinTinkerer, ref CalamityWorld.goblinTinkererName); - ResetName(NPCID.Guide, ref CalamityWorld.guideName); - ResetName(NPCID.Mechanic, ref CalamityWorld.mechanicName); - ResetName(NPCID.Merchant, ref CalamityWorld.merchantName); - ResetName(NPCID.Nurse, ref CalamityWorld.nurseName); - ResetName(NPCID.Painter, ref CalamityWorld.painterName); - ResetName(NPCID.PartyGirl, ref CalamityWorld.partyGirlName); - ResetName(NPCID.Pirate, ref CalamityWorld.pirateName); - ResetName(NPCID.Princess, ref CalamityWorld.princessName); - ResetName(NPCID.SkeletonMerchant, ref CalamityWorld.skeletonMerchantName); - ResetName(NPCID.Steampunker, ref CalamityWorld.steampunkerName); - ResetName(NPCID.Stylist, ref CalamityWorld.stylistName); - ResetName(NPCID.DD2Bartender, ref CalamityWorld.tavernkeepName); - ResetName(NPCID.TaxCollector, ref CalamityWorld.taxCollectorName); - ResetName(NPCID.TravellingMerchant, ref CalamityWorld.travelingMerchantName); - ResetName(NPCID.Truffle, ref CalamityWorld.truffleName); - ResetName(NPCID.WitchDoctor, ref CalamityWorld.witchDoctorName); - ResetName(NPCID.Wizard, ref CalamityWorld.wizardName); - } - + ResetName(NPCID.TownCat, ref CalamityWorld.catName); + ResetName(NPCID.TownDog, ref CalamityWorld.dogName); + ResetName(NPCID.TownBunny, ref CalamityWorld.bunnyName); + } // Annoyingly, because npc.GivenName is a property, it can't be passed as a ref parameter. - private string ChooseName(ref bool alreadySet, string currentName, int numVanillaNames, string[] patreonNames) - { + private string ChooseName(ref bool alreadySet, string currentName, int numVanillaNames, string[] patreonNames, string[] globalNames) + { if (alreadySet || patreonNames is null || patreonNames.Length == 0) { alreadySet = true; return currentName; - } - + } alreadySet = true; - int index = Main.rand.Next(numVanillaNames + patreonNames.Length); + int index = Main.rand.Next(numVanillaNames + patreonNames.Length + globalNames.Length); // If the roll isn't low enough, then a "vanilla name" was picked, meaning we change nothing. - if (index >= patreonNames.Length) + if (index >= patreonNames.Length + globalNames.Length) return currentName; // Change the name to be a randomly selected Patreon name if the roll is low enough. - return patreonNames[index]; + if (index >= globalNames.Length) + return patreonNames[index - globalNames.Length]; + return globalNames[index]; } public void SetPatreonTownNPCName(NPC npc, Mod mod) - { + { if (setNewName) { setNewName = false; switch (npc.type) { - case NPCID.Angler: - npc.GivenName = ChooseName(ref CalamityWorld.anglerName, npc.GivenName, AnglerVanillaNames, AnglerNames); - break; - case NPCID.ArmsDealer: - npc.GivenName = ChooseName(ref CalamityWorld.armsDealerName, npc.GivenName, ArmsDealerVanillaNames, ArmsDealerNames); - break; - case NPCID.Clothier: - npc.GivenName = ChooseName(ref CalamityWorld.clothierName, npc.GivenName, ClothierVanillaNames, ClothierNames); - break; - case NPCID.Cyborg: - npc.GivenName = ChooseName(ref CalamityWorld.cyborgName, npc.GivenName, CyborgVanillaNames, CyborgNames); - break; - case NPCID.Demolitionist: - npc.GivenName = ChooseName(ref CalamityWorld.demolitionistName, npc.GivenName, DemolitionistVanillaNames, DemolitionistNames); - break; - case NPCID.Dryad: - npc.GivenName = ChooseName(ref CalamityWorld.dryadName, npc.GivenName, DryadVanillaNames, DryadNames); - break; - case NPCID.DyeTrader: - npc.GivenName = ChooseName(ref CalamityWorld.dyeTraderName, npc.GivenName, DyeTraderVanillaNames, DyeTraderNames); - break; - case NPCID.GoblinTinkerer: - npc.GivenName = ChooseName(ref CalamityWorld.goblinTinkererName, npc.GivenName, GoblinTinkererVanillaNames, GoblinTinkererNames); - break; - case NPCID.Guide: - npc.GivenName = ChooseName(ref CalamityWorld.guideName, npc.GivenName, GuideVanillaNames, GuideNames); - break; - case NPCID.Mechanic: - npc.GivenName = ChooseName(ref CalamityWorld.mechanicName, npc.GivenName, MechanicVanillaNames, MechanicNames); - break; - case NPCID.Merchant: - npc.GivenName = ChooseName(ref CalamityWorld.merchantName, npc.GivenName, MerchantVanillaNames, MerchantNames); - break; - case NPCID.Nurse: - npc.GivenName = ChooseName(ref CalamityWorld.nurseName, npc.GivenName, NurseVanillaNames, NurseNames); - break; - case NPCID.Painter: - npc.GivenName = ChooseName(ref CalamityWorld.painterName, npc.GivenName, PainterVanillaNames, PainterNames); - break; - case NPCID.PartyGirl: - npc.GivenName = ChooseName(ref CalamityWorld.partyGirlName, npc.GivenName, PartyGirlVanillaNames, PartyGirlNames); - break; - case NPCID.Pirate: - npc.GivenName = ChooseName(ref CalamityWorld.pirateName, npc.GivenName, PirateVanillaNames, PirateNames); - break; - case NPCID.Princess: - npc.GivenName = ChooseName(ref CalamityWorld.princessName, npc.GivenName, PrincessVanillaNames, PrincessNames); - break; - case NPCID.SkeletonMerchant: - npc.GivenName = ChooseName(ref CalamityWorld.skeletonMerchantName, npc.GivenName, SkeletonMerchantVanillaNames, SkeletonMerchantNames); - break; - case NPCID.Steampunker: - npc.GivenName = ChooseName(ref CalamityWorld.steampunkerName, npc.GivenName, SteampunkerVanillaNames, SteampunkerNames); - break; - case NPCID.Stylist: - npc.GivenName = ChooseName(ref CalamityWorld.stylistName, npc.GivenName, StylistVanillaNames, StylistNames); - break; - case NPCID.DD2Bartender: // Tavernkeep - npc.GivenName = ChooseName(ref CalamityWorld.tavernkeepName, npc.GivenName, TavernkeepVanillaNames, TavernkeepNames); - break; - case NPCID.TaxCollector: - npc.GivenName = ChooseName(ref CalamityWorld.taxCollectorName, npc.GivenName, TaxCollectorVanillaNames, TaxCollectorNames); - break; - case NPCID.TravellingMerchant: - npc.GivenName = ChooseName(ref CalamityWorld.travelingMerchantName, npc.GivenName, TravelingMerchantVanillaNames, TravelingMerchantNames); - break; - case NPCID.Truffle: - npc.GivenName = ChooseName(ref CalamityWorld.truffleName, npc.GivenName, TruffleVanillaNames, TruffleNames); - break; - case NPCID.WitchDoctor: - npc.GivenName = ChooseName(ref CalamityWorld.witchDoctorName, npc.GivenName, WitchDoctorVanillaNames, WitchDoctorNames); - break; - case NPCID.Wizard: - npc.GivenName = ChooseName(ref CalamityWorld.wizardName, npc.GivenName, WizardVanillaNames, WizardNames); - break; - default: - break; - } + case NPCID.TownCat: + switch (npc.townNpcVariationIndex) + { + case 0: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownCatSiameseVanillaNames, TownCatSiameseNames, TownCatNames); + break; + case 1: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownCatBlackVanillaNames, TownCatBlackNames, TownCatNames); + break; + case 2: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownCatOrangeTabbyVanillaNames, TownCatOrangeTabbyNames, TownCatNames); + break; + case 3: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownCatRussianBlueVanillaNames, TownCatRussianBlueNames, TownCatNames); + break; + case 4: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownCatSilverVanillaNames, TownCatSilverNames, TownCatNames); + break; + case 5: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownCatWhiteVanillaNames, TownCatWhiteNames, TownCatNames); + break; + default: + break; + } + break; + case NPCID.TownDog: + switch (npc.townNpcVariationIndex) + { + case 0: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogLabradorVanillaNames, TownDogLabradorNames, TownDogNames); + break; + case 1: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogPitBullVanillaNames, TownDogPitBullNames, TownDogNames); + break; + case 2: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogBeagleVanillaNames, TownDogBeagleNames, TownDogNames); + break; + case 3: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogCorgiVanillaNames, TownDogCorgiNames, TownDogNames); + break; + case 4: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogDalmatianVanillaNames, TownDogDalmatianNames, TownDogNames); + break; + case 5: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogHuskyVanillaNames, TownDogHuskyNames, TownDogNames); + break; + default: + break; + } + break; + case NPCID.TownBunny: + switch (npc.townNpcVariationIndex) + { + case 0: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyWhiteVanillaNames, TownBunnyWhiteNames, TownBunnyNames); + break; + case 1: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyAngoraVanillaNames, TownBunnyAngoraNames, TownBunnyNames); + break; + case 2: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyDutchVanillaNames, TownBunnyDutchNames, TownBunnyNames); + break; + case 3: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyFlemishVanillaNames, TownBunnyFlemishNames, TownBunnyNames); + break; + case 4: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyLopVanillaNames, TownBunnyLopNames, TownBunnyNames); + break; + case 5: + npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnySilverVanillaNames, TownBunnySilverNames, TownBunnyNames); + break; + default: + break; + } + break; + default: + break; + } + } + } + #endregion + + private void AddNewNames(List nameList, string[] patreonNames) + { + if (patreonNames is null || patreonNames.Length == 0) + { + return; } + for (int i = 0; i < patreonNames.Length; i++) + { + nameList.Add(patreonNames[i]); + } + } + + public override void ModifyNPCNameList(NPC npc, List nameList) + { + switch (npc.type) + { + case NPCID.Angler: + AddNewNames(nameList, AnglerNames); + break; + case NPCID.ArmsDealer: + AddNewNames(nameList, ArmsDealerNames); + break; + case NPCID.Clothier: + AddNewNames(nameList, ClothierNames); + break; + case NPCID.Cyborg: + AddNewNames(nameList, CyborgNames); + break; + case NPCID.Demolitionist: + AddNewNames(nameList, DemolitionistNames); + break; + case NPCID.Dryad: + AddNewNames(nameList, DryadNames); + break; + case NPCID.DyeTrader: + AddNewNames(nameList, DyeTraderNames); + break; + case NPCID.GoblinTinkerer: + AddNewNames(nameList, GoblinTinkererNames); + break; + case NPCID.Golfer: + AddNewNames(nameList, GolferNames); + break; + case NPCID.Guide: + AddNewNames(nameList, GuideNames); + break; + case NPCID.Mechanic: + AddNewNames(nameList, MechanicNames); + break; + case NPCID.Merchant: + AddNewNames(nameList, MerchantNames); + break; + case NPCID.Nurse: + AddNewNames(nameList, NurseNames); + break; + case NPCID.Painter: + AddNewNames(nameList, PainterNames); + break; + case NPCID.PartyGirl: + AddNewNames(nameList, PartyGirlNames); + break; + case NPCID.Pirate: + AddNewNames(nameList, PirateNames); + break; + case NPCID.Princess: + AddNewNames(nameList, PrincessNames); + break; + case NPCID.SkeletonMerchant: + AddNewNames(nameList, SkeletonMerchantNames); + break; + case NPCID.Steampunker: + AddNewNames(nameList, SteampunkerNames); + break; + case NPCID.Stylist: + AddNewNames(nameList, StylistNames); + break; + case NPCID.DD2Bartender: // Tavernkeep + AddNewNames(nameList, TavernkeepNames); + break; + case NPCID.TaxCollector: + AddNewNames(nameList, TaxCollectorNames); + break; + case NPCID.TravellingMerchant: + AddNewNames(nameList, TravelingMerchantNames); + break; + case NPCID.Truffle: + AddNewNames(nameList, TruffleNames); + break; + case NPCID.WitchDoctor: + AddNewNames(nameList, WitchDoctorNames); + break; + case NPCID.Wizard: + AddNewNames(nameList, WizardNames); + break; + case NPCID.BestiaryGirl: // Zoologist + AddNewNames(nameList, ZoologistNames); + break; + + // This function doesn't work with Town Pets currently + /*case NPCID.TownCat: + AddNewNames(nameList, TownCatNames); + switch (npc.townNpcVariationIndex) + { + case 0: + AddNewNames(nameList, TownCatSiameseNames); + break; + case 1: + AddNewNames(nameList, TownCatBlackNames); + break; + case 2: + AddNewNames(nameList, TownCatOrangeTabbyNames); + break; + case 3: + AddNewNames(nameList, TownCatRussianBlueNames); + break; + case 4: + AddNewNames(nameList, TownCatSilverNames); + break; + case 5: + AddNewNames(nameList, TownCatWhiteNames); + break; + default: + break; + } + break; + case NPCID.TownDog: + AddNewNames(nameList, TownDogNames); + switch (npc.townNpcVariationIndex) + { + case 0: + AddNewNames(nameList, TownDogLabradorNames); + break; + case 1: + AddNewNames(nameList, TownDogPitBullNames); + break; + case 2: + AddNewNames(nameList, TownDogBeagleNames); + break; + case 3: + AddNewNames(nameList, TownDogCorgiNames); + break; + case 4: + AddNewNames(nameList, TownDogDalmatianNames); + break; + case 5: + AddNewNames(nameList, TownDogHuskyNames); + break; + default: + break; + } + break; + case NPCID.TownBunny: + AddNewNames(nameList, TownBunnyNames); + switch (npc.townNpcVariationIndex) + { + case 0: + AddNewNames(nameList, TownBunnyWhiteNames); + break; + case 1: + AddNewNames(nameList, TownBunnyAngoraNames); + break; + case 2: + AddNewNames(nameList, TownBunnyDutchNames); + break; + case 3: + AddNewNames(nameList, TownBunnyFlemishNames); + break; + case 4: + AddNewNames(nameList, TownBunnyLopNames); + break; + case 5: + AddNewNames(nameList, TownBunnySilverNames); + break; + default: + break; + } + break;*/ + + default: + break; + } } #endregion @@ -899,13 +1099,17 @@ namespace CalamityMod.NPCs { chat = "Space just got way too close for comfort."; } + if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ModContent.ItemType()) && !Main.LocalPlayer.ZoneHallow) + { + chat = "I wanted to sell you a special rod I found in the Hallow, but it appears I have misplaced it. Maybe a trip back there would refresh my memory."; + } break; case NPCID.Dryad: if (Main.rand.NextBool(5) && DownedBossSystem.downedDoG && Main.eclipse) { - chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful... hmm... what power was Yharon holding back?"; + chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, as you progress further the moths get more powerful..."; } if (Main.rand.NextBool(5) && Main.hardMode) @@ -986,6 +1190,17 @@ namespace CalamityMod.NPCs chat = "Is it me or are your weapons getting bigger and bigger?"; } + // If you've beaten Skeletron and don't have Quad-Barrel Shotgun, drop a hint + // This does not show up if you're in hardmode since the weapon is irrelevant by then + if (Main.rand.NextBool(5) && NPC.downedBoss3 && !Main.hardMode && !Main.LocalPlayer.InventoryHas(ItemID.QuadBarrelShotgun) && !Main.LocalPlayer.ZoneGraveyard) + { + chat = "That old man left a cranky old gun on his deathbed. You catching my drift?"; + } + if (Main.rand.NextBool(5) && Main.LocalPlayer.InventoryHas(ItemID.QuadBarrelShotgun)) + { + chat = "Hah! Look at that rusty old shotty. It looks straight out of the 70's!"; + } + break; case NPCID.Merchant: @@ -1382,17 +1597,13 @@ namespace CalamityMod.NPCs if (type == NPCID.GoblinTinkerer) { SetShopItem(ref shop, ref nextSlot, ItemID.StinkPotion, true, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType()); } if (type == NPCID.Mechanic) { SetShopItem(ref shop, ref nextSlot, ItemID.BuilderPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.CombatWrench, true, Item.buyPrice(0, 10, 0, 0)); } if (type == NPCID.Clothier) @@ -1423,6 +1634,8 @@ namespace CalamityMod.NPCs if (type == NPCID.Steampunker) { SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.PurpleSolution, Main.LocalPlayer.ZoneGraveyard && WorldGen.crimson, price: Item.buyPrice(0, 0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.RedSolution, Main.LocalPlayer.ZoneGraveyard && !WorldGen.crimson, price: Item.buyPrice(0, 0, 5)); } if (type == NPCID.Wizard) @@ -1430,9 +1643,10 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.ManaRegenerationPotion, true, Item.buyPrice(0, goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.MagicPowerPotion, true, Item.buyPrice(0, goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.GravitationPotion, true, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.PotionOfReturn, true, Item.buyPrice(0, goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemID.MagicMissile, price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemID.RodofDiscord, Main.hardMode && Main.LocalPlayer.ZoneHallow, price: Item.buyPrice(10), true); + SetShopItem(ref shop, ref nextSlot, ItemID.RodofDiscord, Main.hardMode && Main.LocalPlayer.ZoneHallow, price: Item.buyPrice(10)); SetShopItem(ref shop, ref nextSlot, ItemID.SpectreStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.InfernoFork, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.ShadowbeamStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); @@ -1479,7 +1693,7 @@ namespace CalamityMod.NPCs } } - public void SetShopItem(ref Chest shop, ref int nextSlot, int itemID, bool condition = true, int? price = null, bool ignoreDiscount = false) + public void SetShopItem(ref Chest shop, ref int nextSlot, int itemID, bool condition = true, int? price = null) { if (condition) { @@ -1487,8 +1701,6 @@ namespace CalamityMod.NPCs if (price != null) { shop.item[nextSlot].shopCustomPrice = price; - if (Main.LocalPlayer.discount && !ignoreDiscount) - shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); } nextSlot++; diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 3a2d1d969d..c0e08bf8b3 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -27,6 +27,11 @@ namespace CalamityMod.NPCs.CeaselessVoid [AutoloadBossHead] public class CeaselessVoid : ModNPC { + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CeaselessVoidDeath"); + public static readonly SoundStyle BuildupSound = new("CalamityMod/Sounds/Custom/CeaselessVoidDeathBuild"); + + public bool playedbuildsound = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ceaseless Void"); @@ -38,6 +43,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Scale = 0.55f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -52,7 +58,6 @@ namespace CalamityMod.NPCs.CeaselessVoid global.DR = 0.5f; NPC.LifeMaxNERB(64400, 77280, 72000); NPC.value = Item.buyPrice(2, 0, 0, 0); - Music = CalamityMod.Instance.GetMusicFromMusicMod("Void") ?? MusicID.Boss3; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -61,7 +66,7 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.noGravity = true; NPC.noTileCollide = true; NPC.boss = true; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToSickness = false; } @@ -82,6 +87,7 @@ namespace CalamityMod.NPCs.CeaselessVoid writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); + writer.Write(playedbuildsound); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -89,6 +95,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void ReceiveExtraAI(BinaryReader reader) { NPC.dontTakeDamage = reader.ReadBoolean(); + playedbuildsound = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); @@ -210,25 +217,26 @@ namespace CalamityMod.NPCs.CeaselessVoid normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 2, 3)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); - normalOnly.Add(ItemDropRule.Common(ModContent.ItemType(), 20). - OnSuccess(ItemDropRule.Common(ModContent.ItemType())). - OnSuccess(ItemDropRule.Common(ModContent.ItemType()))); + var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(godSlayerVanity); } npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -243,7 +251,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void HitEffect(int hitDirection, double damage) { - if (NPC.soundDelay == 0) + if (NPC.soundDelay == 0 && NPC.life >= NPC.lifeMax * 0.05f) { NPC.soundDelay = 8; SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); @@ -286,7 +294,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (Main.netMode != NetmodeID.Server) { - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("CeaselessVoid").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("CeaselessVoid2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("CeaselessVoid2").Type, 1f); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index f4a494b49a..507c7dd8db 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -271,7 +271,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.VortexDebuff, 60, true); + if (damage > 0) + player.AddBuff(BuffID.VortexDebuff, 60, true); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index ec6357faa5..c7b7fd1111 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.width = 14; NPC.height = 14; - NPC.lifeMax = 25; + NPC.lifeMax = 15; if (BossRushEvent.BossRushActive) NPC.lifeMax = 15000; if (Main.getGoodWorld) @@ -71,13 +71,13 @@ namespace CalamityMod.NPCs.Crabulon bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; float xVelocityLimit = BossRushEvent.BossRushActive ? 7.5f : 5f; float yVelocityLimit = revenge ? 1.25f : 1f; + NPC.TargetClosest(); Player player = Main.player[NPC.target]; NPC.velocity.Y += 0.02f; if (NPC.velocity.Y > yVelocityLimit) { NPC.velocity.Y = yVelocityLimit; } - NPC.TargetClosest(); if (NPC.position.X + NPC.width < player.position.X) { if (NPC.velocity.X < 0f) @@ -125,17 +125,14 @@ namespace CalamityMod.NPCs.Crabulon public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 3; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hitDirection, -1f, 0, default, 1f); } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 39ba9f3293..1f9491ffa0 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -30,7 +30,6 @@ namespace CalamityMod.NPCs.Crabulon public class Crabulon : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - private int shotSpacing = 1000; private bool stomping = false; public override void SetStaticDefaults() @@ -46,6 +45,7 @@ namespace CalamityMod.NPCs.Crabulon }; value.Position.Y += 80f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -63,7 +63,6 @@ namespace CalamityMod.NPCs.Crabulon AIType = -1; NPC.noGravity = false; NPC.noTileCollide = false; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Crabulon") ?? MusicID.Boss4; NPC.boss = true; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 10, 0, 0); @@ -94,7 +93,6 @@ namespace CalamityMod.NPCs.Crabulon { writer.Write(biomeEnrageTimer); writer.Write(NPC.localAI[0]); - writer.Write(shotSpacing); writer.Write(stomping); } @@ -102,7 +100,6 @@ namespace CalamityMod.NPCs.Crabulon { biomeEnrageTimer = reader.ReadInt32(); NPC.localAI[0] = reader.ReadSingle(); - shotSpacing = reader.ReadInt32(); stomping = reader.ReadBoolean(); } @@ -150,13 +147,12 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.timeLeft > 60) NPC.timeLeft = 60; - if (NPC.ai[0] != 1f) + if (NPC.ai[0] != 0f) { - NPC.ai[0] = 1f; + NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; - shotSpacing = 1000; NPC.netUpdate = true; } return; @@ -191,12 +187,9 @@ namespace CalamityMod.NPCs.Crabulon if (Main.getGoodWorld) enrageScale += 0.5f; - if (NPC.ai[0] != 0f && NPC.ai[0] < 3f) + if (NPC.ai[0] < 2f) { Vector2 vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num349 = player.position.X + (player.width / 2) - vector34.X; - float num350 = player.position.Y + (player.height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); if (Main.netMode != NetmodeID.MultiplayerClient) { int num352 = 1; @@ -239,31 +232,36 @@ namespace CalamityMod.NPCs.Crabulon num353 += 1f; } vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num349 = player.position.X + player.width * 0.5f - vector34.X; - num350 = player.position.Y + player.height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); + float num349 = player.position.X + player.width * 0.5f - vector34.X; + float num350 = player.position.Y + player.height * 0.5f - vector34.Y; + float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num351 = num353 / num351; num349 *= num351; num350 *= num351; vector34.X += num349; vector34.Y += num350; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector34.X, vector34.Y, num349, num350 - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vector34.X, vector34.Y, num349, num350 - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); } } } + if (NPC.ai[0] == 0f) { - if (Main.netMode != NetmodeID.Server) - { - if (!player.dead && player.active && (player.Center - NPC.Center).Length() < 800f) - player.AddBuff(ModContent.BuffType(), 2); - } - int sporeDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, NPC.velocity.X, NPC.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); - Main.dust[sporeDust].noGravity = true; - Main.dust[sporeDust].velocity *= 0.5f; + NPC.velocity *= 0.98f; + NPC.ai[1] += 1f; + if (phase2) + NPC.ai[1] += 1f; + if (phase3) + NPC.ai[1] += 2f; if (NPC.justHit) + NPC.ai[1] += 4f; + + if (NPC.ai[1] >= (death ? 150f : revenge ? 180f : 240f)) { + NPC.TargetClosest(); + NPC.noGravity = true; + NPC.noTileCollide = true; NPC.ai[0] = 1f; NPC.ai[1] = 0f; NPC.netUpdate = true; @@ -271,28 +269,14 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[0] == 1f) { - NPC.velocity *= 0.98f; - NPC.ai[1] += 1f; - if (NPC.ai[1] >= (death ? 5f : revenge ? 10f : 15f)) - { - NPC.TargetClosest(); - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.ai[0] = 2f; - NPC.ai[1] = 0f; - NPC.netUpdate = true; - } - } - else if (NPC.ai[0] == 2f) - { - float num823 = 2f; + float walkingVelocity = 2f; if (phase2) - num823 = 2.5f; + walkingVelocity = 2.5f; if (phase3) - num823 = 3f; + walkingVelocity = 3f; if (death) - num823 += 2f * (1f - lifeRatio); - num823 += 2.5f * enrageScale; + walkingVelocity += 2f * (1f - lifeRatio); + walkingVelocity += 2.5f * enrageScale; bool flag51 = false; if (Math.Abs(NPC.Center.X - player.Center.X) < 50f) @@ -310,9 +294,9 @@ namespace CalamityMod.NPCs.Crabulon NPC.direction = playerLocation < 0 ? 1 : -1; if (NPC.direction > 0) - NPC.velocity.X = (NPC.velocity.X * 20f + num823) / 21f; + NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f; if (NPC.direction < 0) - NPC.velocity.X = (NPC.velocity.X * 20f - num823) / 21f; + NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f; } if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX) @@ -365,7 +349,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.TargetClosest(); NPC.noGravity = false; NPC.noTileCollide = false; - NPC.ai[0] = 3f; + NPC.ai[0] = 2f; NPC.ai[1] = 0f; NPC.netUpdate = true; } @@ -373,7 +357,7 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.velocity.Y > 10f) NPC.velocity.Y = 10f; } - else if (NPC.ai[0] == 3f) + else if (NPC.ai[0] == 2f) { NPC.noTileCollide = false; if (NPC.velocity.Y == 0f) @@ -467,7 +451,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.velocity.X = velocityX * NPC.direction; - NPC.ai[0] = 4f; + NPC.ai[0] = 3f; NPC.ai[1] = 0f; NPC.netUpdate = true; } @@ -481,27 +465,24 @@ namespace CalamityMod.NPCs.Crabulon int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - float velocityY = bossRush ? 8f : death ? 4f : 3f; if (NPC.ai[2] % 2f == 0f && phase2 && revenge) { + SoundEngine.PlaySound(SoundID.Item42, NPC.position); if (Main.netMode != NetmodeID.MultiplayerClient) { - float velocityX = NPC.ai[2] == 0f ? -4f : 4f; - int totalMushrooms = bossRush ? 50 : 20; - int shotSpacingDecrement = bossRush ? 80 : 100; - if (bossRush) - shotSpacing = 2000; - - for (int x = 0; x < totalMushrooms; x++) + float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); + destination *= projectileVelocity; + int numProj = bossRush ? 48 : CalamityWorld.death ? 24 : 20; + float rotation = MathHelper.ToRadians(90); + for (int i = 0; i < numProj; i++) { - float randomVelocityX = velocityX + (Main.rand.NextFloat() - 0.5f) * 4f; - float randomVelocityY = velocityY + (Main.rand.NextFloat() - 0.5f) * 4f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + shotSpacing, NPC.Center.Y - 1000f, randomVelocityX, randomVelocityY, type, damage, 0f, Main.myPlayer); - shotSpacing -= shotSpacingDecrement; + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Vector2 randomVelocityVector = new Vector2((Main.rand.NextFloat() - 0.5f) * 4f, (Main.rand.NextFloat() - 0.5f) * 4f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, new Vector2(perturbedSpeed.X, -projectileVelocity) + randomVelocityVector, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } - - shotSpacing = bossRush ? 2000 : 1000; } } @@ -509,21 +490,31 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[2] += 1f; if (NPC.ai[2] >= (phase2 ? 4f : 3f)) { - if (Main.netMode != NetmodeID.MultiplayerClient && revenge && !phase2) + if (revenge && !phase2) { - for (int x = 0; x < 20; x++) + SoundEngine.PlaySound(SoundID.Item42, NPC.position); + if (Main.netMode != NetmodeID.MultiplayerClient) { - float randomVelocityY = velocityY + (Main.rand.NextFloat() - 0.5f) * 4f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + shotSpacing, NPC.Center.Y - 1000f, 0f, randomVelocityY, type, damage, 0f, Main.myPlayer); - shotSpacing -= 100; + float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); + destination *= projectileVelocity; + int numProj = bossRush ? 30 : CalamityWorld.death ? 15 : 11; + float rotation = MathHelper.ToRadians(60); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Vector2 randomVelocityVector = new Vector2((Main.rand.NextFloat() - 0.5f) * 4f, (Main.rand.NextFloat() - 0.5f) * 4f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, new Vector2(perturbedSpeed.X, -projectileVelocity) + randomVelocityVector, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } } - shotSpacing = 1000; } - NPC.ai[0] = 1f; + NPC.ai[0] = 0f; NPC.ai[2] = 0f; if (revenge) NPC.ai[3] = 0f; + NPC.netUpdate = true; } else @@ -531,7 +522,7 @@ namespace CalamityMod.NPCs.Crabulon float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; - NPC.ai[0] = 3f; + NPC.ai[0] = 2f; if (revenge) NPC.ai[3] += 1f; @@ -694,14 +685,14 @@ namespace CalamityMod.NPCs.Crabulon bool insideRightHitbox = minRightDist <= 45f * NPC.scale; - return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && NPC.ai[0] > 1f; + return insideLeftHitbox || insideBodyHitbox || insideRightHitbox; } public override void FindFrame(int frameHeight) { - if (NPC.ai[0] > 2f) + if (NPC.ai[0] > 1f) { - if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) // Idle just before jump + if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 2f) // Idle just before jump { if (stomping) stomping = false; @@ -771,9 +762,9 @@ namespace CalamityMod.NPCs.Crabulon Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); // Jumping - if (NPC.ai[0] > 2f) + if (NPC.ai[0] > 1f) { - if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 3f) + if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 2f) { spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); @@ -793,7 +784,7 @@ namespace CalamityMod.NPCs.Crabulon } // Walking - else if (NPC.ai[0] == 2f) + else if (NPC.ai[0] == 1f) { vector11 = new Vector2(texture.Width / 2, texture.Height / 2); vector43 = NPC.Center - screenPos; @@ -844,10 +835,10 @@ namespace CalamityMod.NPCs.Crabulon npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCrabulon, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCrabulon, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -899,7 +890,7 @@ namespace CalamityMod.NPCs.Crabulon } if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-200, 200) / 100; + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Crabulon").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Crabulon2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Crabulon3").Type, NPC.scale); diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index ed27d75755..78fdb5c85d 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Crags @@ -129,14 +130,17 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Lens, 2); - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); - npcLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2); + LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); + hardmode.Add(ModContent.ItemType(), 3); + postProv.Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index 70577c929d..c4bc8227a7 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Materials; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Crags @@ -70,7 +71,8 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -91,8 +93,9 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 10, 26); - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); - npcLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2); + npcLoot.Add(ModContent.ItemType(), 3); + LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); + postProv.Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index 0f76d049db..113ea51a09 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Crags @@ -63,7 +64,8 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -89,8 +91,9 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); - npcLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2); + npcLoot.Add(ModContent.ItemType(), 3); + LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); + postProv.Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index daab4f59fc..7c69dc2584 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Crags @@ -68,13 +69,16 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); - npcLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2); + LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); + hardmode.Add(ModContent.ItemType(), 3); + postProv.Add(ModContent.ItemType(), 4); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index 0bf06cc321..ecc5ef093a 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using System; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Crags @@ -94,7 +95,8 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -114,7 +116,8 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 4); + LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + hardmode.Add(ModContent.ItemType(), 3); } } } diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 98a4c04b51..865d254326 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -266,17 +267,19 @@ namespace CalamityMod.NPCs.Crags public static void DefineScryllarLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); - var postProvidence = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - postProvidence.Add(ModContent.ItemType(), 2); - postProvidence.Add(ModContent.ItemType(), 20); + LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); + hardmode.Add(ModContent.ItemType(), 3); + postProv.Add(ModContent.ItemType(), 4); + postProv.Add(ModContent.ItemType(), 20); } public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineScryllarLoot(npcLoot); public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index ba1585bb0a..a2e88ac4a6 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -250,7 +250,19 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void OnKill() + { + // Increase the kill count of Scryllars for the Bestiary + if (NPC.GetWereThereAnyInteractions()) + { + NPC nPC = new NPC(); + nPC.SetDefaults(ModContent.NPCType()); + Main.BestiaryTracker.Kills.RegisterKill(nPC); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 30f68d5984..5997366271 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -11,6 +11,7 @@ using System; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Crags @@ -290,15 +291,20 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(() => !Main.hardMode, ModContent.ItemType(), 10); - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 30); - npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); - npcLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2); + LeadingConditionRule fishing = npcLoot.DefineConditionalDropSet(() => Main.hardMode); + fishing.Add(ModContent.ItemType(), 30, hideLootReport: !Main.hardMode); + fishing.AddFail(ModContent.ItemType(), 10, hideLootReport: Main.hardMode); + + LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); + hardmode.Add(ModContent.ItemType(), 3); + postProv.Add(ModContent.ItemType(), 4); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 63ed2ac16c..004e5b4277 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -35,8 +35,6 @@ namespace CalamityMod.NPCs.Cryogen public class Cryogen : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - private int time = 0; - private int iceShard = 0; private int currentPhase = 1; private int teleportLocationX = 0; @@ -46,6 +44,7 @@ namespace CalamityMod.NPCs.Cryogen { DisplayName.SetDefault("Cryogen"); NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -70,7 +69,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.coldDamage = true; NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath15; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Cryogen") ?? MusicID.FrostMoon; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; @@ -92,8 +90,6 @@ namespace CalamityMod.NPCs.Cryogen public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); - writer.Write(time); - writer.Write(iceShard); writer.Write(teleportLocationX); writer.Write(NPC.dontTakeDamage); for (int i = 0; i < 4; i++) @@ -103,8 +99,6 @@ namespace CalamityMod.NPCs.Cryogen public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); - time = reader.ReadInt32(); - iceShard = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); for (int i = 0; i < 4; i++) @@ -220,7 +214,7 @@ namespace CalamityMod.NPCs.Cryogen { NPC.ai[1] = 0f; teleportLocationX = 0; - iceShard = 0; + calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; } return; @@ -231,6 +225,9 @@ namespace CalamityMod.NPCs.Cryogen float chargePhaseGateValue = bossRush ? 240f : 360f; float chargeDuration = 60f; + float chargeTelegraphTime = NPC.ai[0] == 2f ? 80f : 120f; + float chargeTelegraphMaxRotationIncrement = 1f; + float chargeTelegraphRotationIncrement = chargeTelegraphMaxRotationIncrement / chargeTelegraphTime; float chargeSlowDownTime = 15f; float chargeVelocityMin = 12f; float chargeVelocityMax = 30f; @@ -239,16 +236,16 @@ namespace CalamityMod.NPCs.Cryogen chargePhaseGateValue *= 0.7f; chargeDuration *= 0.8f; } - float chargeGateValue = chargePhaseGateValue + (NPC.ai[0] == 2f ? 20f : 30f); + float chargeGateValue = chargePhaseGateValue + chargeTelegraphTime; float chargeSlownDownPhaseGateValue = chargeGateValue + chargeSlowDownTime; bool chargePhase = NPC.ai[1] >= chargePhaseGateValue; if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (NPC.ai[0] < 5f || !phase6) && !chargePhase) { - time++; - if (time >= (bossRush ? 660 : 900)) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= (bossRush ? 660f : 900f)) { - time = 0; + calamityGlobalNPC.newAI[3] = 0f; SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = 3; float radians = MathHelper.TwoPi / totalProjectiles; @@ -407,10 +404,40 @@ namespace CalamityMod.NPCs.Cryogen { NPC.ai[1] += 1f; - calamityGlobalNPC.newAI[0] += 0.025f; - if (calamityGlobalNPC.newAI[0] > 0.5f) - calamityGlobalNPC.newAI[0] = 0.5f; + float totalSpreads = 3f; + if ((NPC.ai[1] - chargePhaseGateValue) % (chargeTelegraphTime / totalSpreads) == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float maxVelocity = 9f + enrageScale; + float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f); + int totalProjectiles = 10; + int maxTotalProjectileReductionBasedOnRotationSpeed = (int)(totalProjectiles * 0.7f); + int totalProjectilesShot = totalProjectiles - (int)Math.Round(calamityGlobalNPC.newAI[0] * maxTotalProjectileReductionBasedOnRotationSpeed); + for (int i = 0; i < 2; i++) + { + float radians = MathHelper.TwoPi / totalProjectilesShot; + float newVelocity = velocity - (velocity * 0.5f * i); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + for (int k = 0; k < totalProjectilesShot; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + } + } + } + } + } + calamityGlobalNPC.newAI[0] += chargeTelegraphRotationIncrement; NPC.rotation += calamityGlobalNPC.newAI[0]; NPC.velocity *= 0.98f; } @@ -435,32 +462,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[1] = chargeGateValue + chargeDuration; calamityGlobalNPC.newAI[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - float velocity = 9f + enrageScale; - for (int i = 0; i < 2; i++) - { - int totalProjectiles = 10; - float radians = MathHelper.TwoPi / totalProjectiles; - float newVelocity = velocity - (velocity * 0.5f * i); - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); - } - } - } - } } NPC.ai[1] -= 1f; @@ -489,7 +490,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[1] = 0f; NPC.localAI[0] = 0f; calamityGlobalNPC.newAI[0] = 0f; - iceShard = 0; + calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; } } @@ -549,10 +550,40 @@ namespace CalamityMod.NPCs.Cryogen { NPC.ai[1] += 1f; - calamityGlobalNPC.newAI[0] += 0.025f; - if (calamityGlobalNPC.newAI[0] > 0.5f) - calamityGlobalNPC.newAI[0] = 0.5f; + float totalSpreads = 2f; + if ((NPC.ai[1] - chargePhaseGateValue) % (chargeTelegraphTime / totalSpreads) == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float maxVelocity = 9f + enrageScale; + float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f); + int totalProjectiles = calamityGlobalNPC.newAI[1] == 0f ? 8 : 4; + int maxTotalProjectileReductionBasedOnRotationSpeed = (int)(totalProjectiles * 0.4f); + int totalProjectilesShot = totalProjectiles - (int)Math.Round(calamityGlobalNPC.newAI[0] * maxTotalProjectileReductionBasedOnRotationSpeed); + for (int i = 0; i < 3; i++) + { + float radians = MathHelper.TwoPi / totalProjectilesShot; + float newVelocity = velocity - (velocity * 0.33f * i); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = i == 1 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + for (int k = 0; k < totalProjectilesShot; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); + } + } + } + } + } + calamityGlobalNPC.newAI[0] += chargeTelegraphRotationIncrement; NPC.rotation += calamityGlobalNPC.newAI[0]; NPC.velocity *= 0.98f; } @@ -577,32 +608,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[1] = chargeGateValue + chargeDuration; calamityGlobalNPC.newAI[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - float velocity = 9f + enrageScale; - for (int i = 0; i < 3; i++) - { - int totalProjectiles = calamityGlobalNPC.newAI[1] == 0f ? 8 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float newVelocity = velocity - (velocity * 0.33f * i); - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = i == 1 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); - } - } - } - } } NPC.ai[1] -= 1f; @@ -617,6 +622,8 @@ namespace CalamityMod.NPCs.Cryogen NPC.localAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; } + else + NPC.ai[1] = chargePhaseGateValue; NPC.rotation = NPC.velocity.X * 0.1f; } @@ -726,7 +733,7 @@ namespace CalamityMod.NPCs.Cryogen } NPC.ai[1] = 1f; teleportLocationX = num1250; - iceShard = num1251; + calamityGlobalNPC.newAI[2] = num1251; NPC.netUpdate = true; Block: ; @@ -738,7 +745,7 @@ namespace CalamityMod.NPCs.Cryogen // Avoid cheap bullshit NPC.damage = 0; - Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), iceShard * 16f - (NPC.height / 2)); + Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), calamityGlobalNPC.newAI[2] * 16f - (NPC.height / 2)); for (int m = 0; m < 5; m++) { int dust = Dust.NewDust(position, NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); @@ -816,7 +823,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.localAI[2] = 0f; NPC.Opacity = 1f; teleportLocationX = 0; - iceShard = 0; + calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; int chance = 100; @@ -839,34 +846,32 @@ namespace CalamityMod.NPCs.Cryogen { NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); - if (phase7) + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float velocity = 1.5f + enrageScale * 0.5f; + int totalSpreads = phase7 ? 3 : 2; + for (int i = 0; i < totalSpreads; i++) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - float velocity = 9f + enrageScale; - for (int i = 0; i < 4; i++) + int totalProjectiles = bossRush ? 3 : 2; + float radians = MathHelper.TwoPi / totalProjectiles; + float newVelocity = velocity - (velocity * (phase7 ? 0.25f : 0.5f) * i); + float velocityX = 0f; + if (i > 0) { - int totalProjectiles = bossRush ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float newVelocity = velocity - (velocity * 0.25f * i); - float velocityX = 0f; - if (i > 0) - { - double angleA = radians * 0.25 * (4 - i); - double angleB = MathHelper.ToRadians(90f) - angleA; - velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); - } - Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity); - } + double angleA = radians * (phase7 ? 0.25 : 0.5) * (totalSpreads - i); + double angleB = MathHelper.ToRadians(90f) - angleA; + velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + } + Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, NPC.target, 1f); } } } @@ -883,7 +888,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[3] = 0f; - time = 0; + calamityGlobalNPC.newAI[3] = 0f; } else NPC.ai[1] = 60f; @@ -901,7 +906,7 @@ namespace CalamityMod.NPCs.Cryogen return; } - float num1372 = 16f + enrageScale * 2f; + float num1372 = 18f + enrageScale * 2f; Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; @@ -910,32 +915,42 @@ namespace CalamityMod.NPCs.Cryogen float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; - iceShard--; + calamityGlobalNPC.newAI[2] -= 1f; - if (num1375 < 200f || iceShard > 0) + float chargeStartDistance = 300f; + float chargeCooldown = 30f; + + if (num1375 < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f) { - if (num1375 < 200f) - iceShard = 20; + if (num1375 < chargeStartDistance) + calamityGlobalNPC.newAI[2] = chargeCooldown; + + if (NPC.velocity.Length() < num1372) + { + NPC.velocity.Normalize(); + NPC.velocity *= num1372; + } + + NPC.rotation += NPC.direction * 0.5f; - NPC.rotation += NPC.direction * 0.3f; return; } - float inertia = 50f; + float inertia = 30f; if (Main.getGoodWorld) inertia *= 0.5f; NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); - if (num1375 < 350f) + if (num1375 < chargeStartDistance + 200f) { - NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; - NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; + NPC.velocity.X = (NPC.velocity.X * 9f + num1373) / 10f; + NPC.velocity.Y = (NPC.velocity.Y * 9f + num1374) / 10f; } - if (num1375 < 300f) + if (num1375 < chargeStartDistance + 100f) { - NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; - NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; + NPC.velocity.X = (NPC.velocity.X * 4f + num1373) / 5f; + NPC.velocity.Y = (NPC.velocity.Y * 4f + num1374) / 5f; } NPC.rotation = NPC.velocity.X * 0.15f; @@ -944,10 +959,10 @@ namespace CalamityMod.NPCs.Cryogen { NPC.rotation = NPC.velocity.X * 0.1f; - time++; - if (time >= (bossRush ? 50 : 75)) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= (bossRush ? 50f : 75f)) { - time = 0; + calamityGlobalNPC.newAI[3] = 0f; SoundEngine.PlaySound(SoundID.Item28, NPC.Center); int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; @@ -971,8 +986,8 @@ namespace CalamityMod.NPCs.Cryogen NPC.TargetClosest(); NPC.ai[0] = 4f; NPC.ai[1] = 60f; - time = 0; - iceShard = 0; + calamityGlobalNPC.newAI[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; } @@ -1117,7 +1132,7 @@ namespace CalamityMod.NPCs.Cryogen } if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-200, 200) / 100; + float randomSpread = Main.rand.Next(-200, 201) / 100f; for (int i = 1; i < 4; i++) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("CryoDeathGore" + i).Type, NPC.scale); @@ -1146,9 +1161,7 @@ namespace CalamityMod.NPCs.Cryogen ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); normalOnly.Add(ModContent.ItemType(), 10); @@ -1161,6 +1174,8 @@ namespace CalamityMod.NPCs.Cryogen // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); } npcLoot.Add(ItemID.FrozenKey, 3); @@ -1169,10 +1184,10 @@ namespace CalamityMod.NPCs.Cryogen npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCryogen, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCryogen, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -1222,8 +1237,11 @@ namespace CalamityMod.NPCs.Cryogen public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Chilled, 120, true); + if (damage > 0) + { + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Chilled, 120, true); + } } } } diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 4dc7db75c0..d23f730837 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -58,6 +58,9 @@ namespace CalamityMod.NPCs.Cryogen { NPC.velocity = Vector2.Zero; NPC.position = Main.npc[num989].Center; + NPC.ai[1] = Main.npc[num989].velocity.X; + NPC.ai[2] = Main.npc[num989].velocity.Y; + NPC.ai[3] = Main.npc[num989].target; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); return; @@ -91,8 +94,11 @@ namespace CalamityMod.NPCs.Cryogen public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Chilled, 120, true); + if (damage > 0) + { + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Chilled, 120, true); + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -128,33 +134,19 @@ namespace CalamityMod.NPCs.Cryogen Main.dust[num624].velocity *= 2f; } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 6 : 4; - double radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - int damage2 = NPC.GetProjectileDamage(type); - float velocity = 9f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage2, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 300; - } - } - if (Main.netMode != NetmodeID.Server) { - float randomSpread; - for (int spike = 0; spike < 4; spike++) + int totalGores = 16; + double radians = MathHelper.TwoPi / totalGores; + Vector2 spinningPoint = new Vector2(0f, -1f); + for (int k = 0; k < totalGores; k++) { - randomSpread = Main.rand.Next(-200, 200) / 100; + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); for (int x = 1; x <= 4; x++) - Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity * randomSpread, Mod.Find("CryoShieldGore" + x).Type, NPC.scale); + { + float randomSpread = Main.rand.Next(-200, 201) / 100f; + Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.Normalize(vector255) * 80f, vector255 * new Vector2(NPC.ai[1], NPC.ai[2]) * randomSpread, Mod.Find("CryoShieldGore" + x).Type, NPC.scale); + } } } } diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index dcb3e56d2d..b5da12680d 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.realLife = (int)NPC.ai[2]; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(true); + NPC.TargetClosest(); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.DesertScourge { if (Main.netMode != NetmodeID.Server) { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody").Type, 0.65f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody2").Type, 0.65f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody3").Type, 0.65f); @@ -161,7 +161,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 60, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 60, true); } } } diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 37cff76f5c..ad7f719844 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -9,6 +9,7 @@ using Terraria.Audio; namespace CalamityMod.NPCs.DesertScourge { + [AutoloadBossHead] public class DesertNuisanceHead : ModNPC { public bool flies = false; @@ -80,7 +81,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.realLife = (int)NPC.ai[2]; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(true); + NPC.TargetClosest(); NPC.alpha -= 42; if (NPC.alpha < 0) @@ -219,7 +220,7 @@ namespace CalamityMod.NPCs.DesertScourge float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); if (!flag2) { - NPC.TargetClosest(true); + NPC.TargetClosest(); NPC.velocity.Y = NPC.velocity.Y + 0.15f; if (NPC.velocity.Y > num17) { @@ -442,7 +443,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 180, true); } } } diff --git a/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png b/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png new file mode 100644 index 0000000000..ab04fa821f Binary files /dev/null and b/NPCs/DesertScourge/DesertNuisanceHead_Head_Boss.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index b9931c721b..c896b37c71 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.realLife = (int)NPC.ai[2]; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(true); + NPC.TargetClosest(); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -158,7 +158,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 30, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 30, true); } } } diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 42fa8ed329..7662af6ef6 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -72,7 +71,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.realLife = (int)NPC.ai[2]; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(true); + NPC.TargetClosest(); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -160,7 +159,7 @@ namespace CalamityMod.NPCs.DesertScourge { if (Main.netMode != NetmodeID.Server) { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("ScourgeBody3").Type, NPC.scale); @@ -177,7 +176,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 240, true); } } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 3ab29fca4b..e5d98bf9d1 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -50,6 +51,7 @@ namespace CalamityMod.NPCs.DesertScourge value.Position.X += 95; value.Position.Y += 45; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -79,7 +81,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; if (BossRushEvent.BossRushActive) NPC.scale *= 1.25f; @@ -195,6 +196,9 @@ namespace CalamityMod.NPCs.DesertScourge { speed *= 1.25f; turnSpeed *= 1.5f; + + if (NPC.Calamity().newAI[3] == 0f) + NPC.Calamity().newAI[3] = player.Center.Y - 600f; } if (NPC.ai[2] > 0f) @@ -374,7 +378,7 @@ namespace CalamityMod.NPCs.DesertScourge float num19 = turnSpeed; float burrowDistance = bossRush ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; - float lungeTarget = player.Center.Y - 600f; + float lungeTarget = NPC.Calamity().newAI[3]; Vector2 vector3 = NPC.Center; float num20 = player.Center.X; float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; @@ -399,7 +403,7 @@ namespace CalamityMod.NPCs.DesertScourge } // Quickly fall back down once above target - if (lungeUpward && NPC.Center.Y <= player.Center.Y - 420f) + if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[3] + 600f - 420f) { // Spit a huge spread of sand upwards that falls down SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center); @@ -431,10 +435,11 @@ namespace CalamityMod.NPCs.DesertScourge if (quickFall) { NPC.velocity.Y += Main.getGoodWorld ? 1f : 0.5f; - if (NPC.Center.Y >= player.Center.Y) + if (NPC.Center.Y >= NPC.Calamity().newAI[3] + 600f) { NPC.Calamity().newAI[0] = 0f; NPC.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[3] = 0f; playRoarSound = false; } } @@ -448,7 +453,7 @@ namespace CalamityMod.NPCs.DesertScourge if (!flag2) { - NPC.TargetClosest(true); + NPC.TargetClosest(); NPC.velocity.Y = NPC.velocity.Y + 0.15f; if (NPC.velocity.Y > num17) { @@ -684,7 +689,7 @@ namespace CalamityMod.NPCs.DesertScourge npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Extraneous potions - npcLoot.Add(DropHelper.PerPlayer(ItemID.LesserHealingPotion, 1, 8, 14)); + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.LesserHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -696,9 +701,7 @@ namespace CalamityMod.NPCs.DesertScourge ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); @@ -706,13 +709,15 @@ namespace CalamityMod.NPCs.DesertScourge normalOnly.Add(ModContent.ItemType(), 7); // Materials - normalOnly.Add(ItemID.Coral, 1, 5, 9); - normalOnly.Add(ItemID.Seashell, 1, 5, 9); - normalOnly.Add(ItemID.Starfish, 1, 5, 9); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 7, 14)); + normalOnly.Add(ItemID.Coral, 1, 25, 30); + normalOnly.Add(ItemID.Seashell, 1, 25, 30); + normalOnly.Add(ItemID.Starfish, 1, 25, 30); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Fishing normalOnly.Add(ModContent.ItemType()); @@ -722,10 +727,10 @@ namespace CalamityMod.NPCs.DesertScourge npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDesertScourge, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDesertScourge, ModContent.ItemType(), desc: DropHelper.FirstKillText); } #endregion @@ -764,7 +769,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 600, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 600, true); } } } diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 38c0a24f26..a2da51ad5d 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -72,7 +71,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.realLife = (int)NPC.ai[2]; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(true); + NPC.TargetClosest(); bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -177,7 +176,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 180, true); } } } diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 96db3bc1f3..689fa95725 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return NPC.Opacity >= 1f && invinceTime <= 0; } @@ -178,7 +178,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT3").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT4").Type, 1f); @@ -213,7 +213,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index d7040495d8..b974fdb602 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -86,12 +86,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - // Target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(true); - - Player player = Main.player[NPC.target]; - if (invinceTime > 0) { invinceTime--; @@ -106,9 +100,6 @@ namespace CalamityMod.NPCs.DevourerofGods Vector2 vector = NPC.Center; - bool increaseSpeed = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles; - bool increaseSpeedMore = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles; - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); if (NPC.ai[2] > 0f) @@ -145,10 +136,8 @@ namespace CalamityMod.NPCs.DevourerofGods } } - if (player.dead || CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { - NPC.TargetClosest(false); - NPC.velocity.Y -= 3f; if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 3f; @@ -164,6 +153,11 @@ namespace CalamityMod.NPCs.DevourerofGods return; } + Player player = Main.player[Main.npc[CalamityGlobalNPC.DoGHead].target]; + + bool increaseSpeed = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles; + NPC.Opacity = Main.npc[CalamityGlobalNPC.DoGHead].Opacity; // Fly up and despawn if DoG enters phase 2 and isn't in the final Cosmic Guardian spawn phase. @@ -173,8 +167,6 @@ namespace CalamityMod.NPCs.DevourerofGods // Prevents them from doing damage while despawning. NPC.Opacity = 0.99f; - NPC.TargetClosest(false); - NPC.velocity.Y -= 1f; if ((double)NPC.position.Y < Main.topWorld + 16f) NPC.velocity.Y -= 1f; @@ -374,17 +366,14 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return NPC.Opacity >= 1f && invinceTime <= 0; } @@ -436,7 +425,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 6c3d4f687c..293a2c305c 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -160,7 +160,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return NPC.Opacity >= 1f && invinceTime <= 0; } @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT3").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT4").Type, 1f); @@ -210,7 +210,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 90, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 90, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 92444932e1..f9f6b7347f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -67,7 +67,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1") ?? MusicID.Boss3; NPC.dontCountMe = true; if (Main.getGoodWorld) @@ -146,10 +145,6 @@ namespace CalamityMod.NPCs.DevourerofGods { phase2Started = true; - // Play music after the transiton BS - if (Main.npc[(int)NPC.ai[2]].localAI[2] == 530f) - Music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP2") ?? MusicID.LunarBoss; - // Once before DoG spawns, set new size if (Main.npc[(int)NPC.ai[2]].localAI[2] == 60f) { @@ -227,8 +222,8 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.localAI[0] = 0f; if (!AnyTeleportRifts()) { - SoundEngine.PlaySound(SoundID.Item12, player.position); NPC.TargetClosest(); + SoundEngine.PlaySound(SoundID.Item12, player.position); float maxProjectileVelocity = bossRush ? 8f : death ? 7.5f : revenge ? 7.25f : expertMode ? 7f : 6.5f; float minProjectileVelocity = maxProjectileVelocity * 0.25f; float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); @@ -252,9 +247,9 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.localAI[0] += 1f; if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 10f : 20f) == 0f) { + NPC.TargetClosest(); SoundEngine.PlaySound(SoundID.Item12, player.position); NPC.localAI[0] = 0f; - NPC.TargetClosest(); float maxProjectileVelocity = bossRush ? 7.5f : death ? 7f : revenge ? 6.75f : expertMode ? 6.5f : 6f; float minProjectileVelocity = maxProjectileVelocity * 0.25f; float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); @@ -410,7 +405,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; @@ -473,7 +468,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-100, 100) / 100; + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoGS6").Type, NPC.scale); } NPC.position.X = NPC.position.X + (NPC.width / 2); @@ -511,8 +506,11 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + { + player.AddBuff(ModContent.BuffType(), 240, true); + player.AddBuff(ModContent.BuffType(), 480, true); + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 127c0523cd..637ee05477 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -160,6 +160,7 @@ namespace CalamityMod.NPCs.DevourerofGods value.Position.X += 82f; value.Position.Y += 38f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -195,7 +196,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.noTileCollide = true; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1") ?? MusicID.Boss3; if (Main.getGoodWorld) NPC.scale *= 1.5f; @@ -321,6 +321,7 @@ namespace CalamityMod.NPCs.DevourerofGods // whoAmI variable CalamityGlobalNPC.DoGHead = NPC.whoAmI; + CalamityGlobalNPC.DoGP2 = -1; // Stop rain CalamityMod.StopRain(); @@ -498,8 +499,8 @@ namespace CalamityMod.NPCs.DevourerofGods } // Play music after the transiton BS - if (NPC.localAI[2] == 530f) - Music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP2") ?? MusicID.LunarBoss; + if (NPC.localAI[2] <= 530f) + CalamityGlobalNPC.DoGP2 = NPC.whoAmI; // Once before DoG spawns, set new size and become visible again. if (NPC.localAI[2] == 60f) @@ -2364,7 +2365,7 @@ namespace CalamityMod.NPCs.DevourerofGods npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Extraneous potions - npcLoot.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 15)); + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary // Fabsol Mount npcLoot.AddIf((info) => info.player.Calamity().fabsolVodka, ModContent.ItemType()); @@ -2398,19 +2399,19 @@ namespace CalamityMod.NPCs.DevourerofGods } // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Trophy (always directly from boss, never in bag) npcLoot.Add(ModContent.ItemType(), 10); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDoG, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDoG, ModContent.ItemType(), desc: DropHelper.FirstKillText); } // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; @@ -2515,6 +2516,9 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { + if (damage <= 0) + return; + player.AddBuff(ModContent.BuffType(), 300, true); player.AddBuff(ModContent.BuffType(), 600, true); diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 32cccd6e4b..a570624843 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -70,7 +70,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.netAlways = true; NPC.boss = true; NPC.takenDamageMultiplier = 1.25f; - Music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1") ?? MusicID.Boss3; NPC.dontCountMe = true; if (Main.getGoodWorld) @@ -148,10 +147,6 @@ namespace CalamityMod.NPCs.DevourerofGods { phase2Started = true; - // Play music after the transiton BS - if (Main.npc[(int)NPC.ai[2]].localAI[2] == 530f) - Music = CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP2") ?? MusicID.LunarBoss; - // Once before DoG spawns, set new size if (Main.npc[(int)NPC.ai[2]].localAI[2] == 60f) { @@ -345,7 +340,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; @@ -451,8 +446,11 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(ModContent.BuffType(), 360, true); + if (damage > 0) + { + player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(ModContent.BuffType(), 360, true); + } } } } diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index 43b1ad92ad..efc179de13 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -1,4 +1,5 @@ using CalamityMod.BiomeManagers; +using CalamityMod.Items.Critters; using CalamityMod.Items.DraedonMisc; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -52,7 +53,9 @@ namespace CalamityMod.NPCs.DraedonLabThings { DisplayName.SetDefault("Repair Unit"); Main.npcFrameCount[NPC.type] = 17; + Main.npcCatchable[NPC.type] = true; NPCID.Sets.CountsAsCritter[NPC.type] = true; + NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); } public override void SetDefaults() @@ -69,6 +72,7 @@ namespace CalamityMod.NPCs.DraedonLabThings NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath44; + NPC.catchItem = (short)ModContent.ItemType(); SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 5515afde42..d88bb195a9 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -161,7 +161,6 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -400,13 +399,6 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Berserk, final phase of Artemis and Apollo // Phase 7 - 0, 1, 2 - // Predictiveness - float predictionAmt = bossRush ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f; - if (nerfedAttacks) - predictionAmt *= 0.5f; - if (SecondaryAIState == (int)SecondaryPhase.Passive) - predictionAmt *= 0.5f; - // Gate values float reducedTimeForGateValue = bossRush ? 48f : death ? 32f : revenge ? 24f : expertMode ? 16f : 0f; float reducedTimeForGateValue_Berserk = reducedTimeForGateValue * 0.5f; @@ -522,8 +514,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f; // Rotation - Vector2 predictionVector = player.velocity * predictionAmt; - Vector2 aimedVector = player.Center + predictionVector - NPC.Center; + Vector2 aimedVector = player.Center - NPC.Center; float rateOfRotation = 0.1f; Vector2 rotateTowards = player.Center - NPC.Center; bool readyToCharge = AIState == (float)Phase.LineUpChargeCombo && (Vector2.Distance(NPC.Center, destination) <= chargeLocationDistanceGateValue || calamityGlobalNPC.newAI[2] > 0f); @@ -540,8 +531,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } else { - float x = player.Center.X + predictionVector.X - NPC.Center.X; - float y = player.Center.Y + predictionVector.Y - NPC.Center.Y; + float x = player.Center.X - NPC.Center.X; + float y = player.Center.Y - NPC.Center.Y; rotateTowards = Vector2.Normalize(new Vector2(x, y)) * baseVelocity; } @@ -1195,7 +1186,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = (int)(NPC.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); - float velocity = 1f; + float velocity = 0.5f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -1311,7 +1302,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime) { - SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound, NPC.Center); + SoundEngine.PlaySound(Artemis.Artemis.LensSound, NPC.Center); Vector2 lensDirection = Vector2.Normalize(aimedVector); Vector2 offset = lensDirection * 70f; @@ -1338,7 +1329,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index e17653b106..5222e1a8b5 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -30,6 +30,7 @@ using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent.ItemDropRules; using CalamityMod.Sounds; +using CalamityMod.Items.Weapons.Summon; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -174,7 +175,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -185,8 +185,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares //We'll probably want a custom background for Exos like ML has. //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("While it is the most flamboyant of Draedon’s machines, it appears to be lacking some finish, though this trait does not compromise its killing potential whatsoever.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("While it is the most flamboyant of Draedon’s machines, it appears to be lacking some finish, though this trait does not compromise its killing potential whatsoever.") }); } @@ -1346,10 +1346,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType()), ModContent.ItemType())); // Relic - mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => Main.masterMode || CalamityWorld.revenge), ModContent.ItemType())); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType()); // Lore item - mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedExoMechs), ModContent.ItemType())); + mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedExoMechs, desc: DropHelper.FirstKillText), ModContent.ItemType())); // Treasure bag npcLoot.Add(ItemDropRule.BossBagByCondition(DropHelper.If(CanDropLoot), ModContent.ItemType())); @@ -1358,7 +1358,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (!Main.expertMode) { // Materials - normalOnly.Add(ModContent.ItemType(), 1, 24, 32); + normalOnly.Add(ModContent.ItemType(), 1, 25, 30); // Weapons // Higher chance due to how the drops work @@ -1370,6 +1370,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Ares weapons normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(AresLoot), ModContent.ItemType())); normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(AresLoot), ModContent.ItemType())); + normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(AresLoot), ModContent.ItemType())); // Twins weapons normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(ApolloLoot), ModContent.ItemType())); diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 676e87ff56..921ce1d868 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -14,6 +14,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Sounds; +using ReLogic.Utilities; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -60,6 +61,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Total duration of the gauss nuke firing phase private const float gaussNukeReloadDuration = 360f; + //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + private SlotId TelegraphSoundSlot; + + //Telegraph sound + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresGaussNukeArmCharge"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -91,7 +98,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.netAlways = true; NPC.boss = true; NPC.hide = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -383,6 +389,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float telegraphDuration = enraged ? (gaussNukeTelegraphDuration * 0.5f) : gaussNukeTelegraphDuration; if (calamityGlobalNPC.newAI[2] < telegraphDuration) { + // Play a charge up sound so that the player knows when it's about to fire the nuke + if (calamityGlobalNPC.newAI[2] == 1f) + { + TelegraphSoundSlot = SoundEngine.PlaySound(TelSound, NPC.Center); + } + // Set frames to gauss nuke charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { @@ -461,6 +473,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Smooth movement towards the location Ares Gauss Nuke is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); + + //Update the telegraph sound if it's being done. + if (TelegraphSoundSlot != null && SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + { + telSound.Position = NPC.Center; + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index f3fb7f4064..f2834d054c 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -60,9 +60,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Total duration of the deathray private const float deathrayDuration = 60f; - //This stores the sound slot of the crystyl crusher sound it makes, so it may be properly updated in terms of position. + //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. private SlotId DeathraySoundSlot; + //Telegraph sound + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresLaserArmCharge"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -94,7 +97,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.netAlways = true; NPC.boss = true; NPC.hide = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -402,8 +404,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { // Play a charge up sound so that the player knows when it's about to fire the deathray - if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration - 100f && !fireNormalLasers) - DeathraySoundSlot = SoundEngine.PlaySound(CrystylCrusher.ChargeSound, NPC.Center); + if (calamityGlobalNPC.newAI[2] == 1 && !fireNormalLasers) + DeathraySoundSlot = SoundEngine.PlaySound(TelSound, NPC.Center); // Smooth movement towards the location Ares Laser Cannon is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -602,12 +604,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 center = NPC.Center - screenPos; - //Draw an outline to the arm when it charges up + // Draw an outline to the arm when it charges up if ((NPC.Calamity().newAI[2] < deathrayTelegraphDuration) && AIState == (float)Phase.Deathray) { CalamityUtils.EnterShaderRegion(spriteBatch); Color outlineColor = Color.Lerp(Color.OrangeRed, Color.White, NPC.Calamity().newAI[2] / deathrayTelegraphDuration); - Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it + Vector3 outlineHSL = Main.rgbToHsl(outlineColor); // BasicTint uses the opposite hue i guess? Or something is fucked with the way shaders get their colors. Anyways, we invert it float outlineThickness = MathHelper.Clamp(NPC.Calamity().newAI[2] / deathrayTelegraphDuration * 4f, 0f, 3f); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); @@ -615,9 +617,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares GameShaders.Misc["CalamityMod:BasicTint"].Apply(); for (float i = 0; i < 1; i += 0.125f) - { spriteBatch.Draw(texture, center + (i * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * outlineThickness, frame, outlineColor, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - } + CalamityUtils.ExitShaderRegion(spriteBatch); } @@ -644,31 +645,29 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - //Update the parameters - - - //Draw a pulsing version of the cannon above the real one. + // Update the parameters + // Draw a pulsing version of the cannon above the real one if ((NPC.Calamity().newAI[2] < deathrayTelegraphDuration) && AIState == (float)Phase.Deathray) { - //Also draw a telegraph line aha + // Also draw a telegraph line Texture2D lineTex = ModContent.Request("CalamityMod/Particles/BloomLine").Value; Color outlineColor = Color.Lerp(Color.OrangeRed, Color.White, NPC.Calamity().newAI[2] / deathrayTelegraphDuration); - spriteBatch.Draw(lineTex, CoreSpritePosition - NPC.rotation.ToRotationVector2() * NPC.spriteDirection * 104 - screenPos, null, outlineColor, NPC.rotation - MathHelper.PiOver2 * NPC.spriteDirection, new Vector2(lineTex.Width / 2f, lineTex.Height), new Vector2(1f * NPC.Calamity().newAI[2] / deathrayTelegraphDuration, 2000f), spriteEffects, 0f); + spriteBatch.Draw(lineTex, CoreSpritePosition - NPC.rotation.ToRotationVector2() * NPC.spriteDirection * 104 - screenPos, null, outlineColor, NPC.rotation - MathHelper.PiOver2 * NPC.spriteDirection, new Vector2(lineTex.Width / 2f, lineTex.Height), new Vector2(1f * NPC.Calamity().newAI[2] / deathrayTelegraphDuration, 4200f), spriteEffects, 0f); float pulseRatio = (NPC.Calamity().newAI[2] % (deathrayTelegraphDuration / 5f)) / (deathrayTelegraphDuration / 5f); float pulseSize = MathHelper.Lerp(0.1f, 0.6f, (float)Math.Floor(NPC.Calamity().newAI[2] / (deathrayTelegraphDuration / 5f)) / 4f); float pulseOpacity = MathHelper.Clamp((float)Math.Floor(NPC.Calamity().newAI[2] / (deathrayTelegraphDuration / 5f)) * 0.3f, 1f, 2f); spriteBatch.Draw(texture, center, frame, Color.OrangeRed * MathHelper.Lerp(1f, 0f, pulseRatio) * pulseOpacity, NPC.rotation, vector, NPC.scale + pulseRatio * pulseSize, spriteEffects, 0f); - //Draw the bloom + // Draw the bloom EnergyDrawer.DrawBloom(CoreSpritePosition); } EnergyDrawer.DrawPulses(CoreSpritePosition); EnergyDrawer.DrawSet(CoreSpritePosition); - //Back to normal + // Back to normal spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index cd97aef04d..7aa242ab8d 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -14,6 +14,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Items.Weapons.DraedonsArsenal; +using ReLogic.Utilities; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -58,6 +59,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Total duration of the plasma bolt firing phase private const float plasmaBoltDuration = 120f; + //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + private SlotId TelegraphSoundSlot; + + //Telegraph sound + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresPlasmaArmCharge"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -89,7 +96,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.netAlways = true; NPC.boss = true; NPC.hide = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -400,6 +406,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < plasmaBoltTelegraphDuration) { + // Play a charge up sound so that the player knows when it's about to fire fireballs + if (calamityGlobalNPC.newAI[2] == 1) + TelegraphSoundSlot = SoundEngine.PlaySound(TelSound, NPC.Center); + // Set frames to plasma orb charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { @@ -461,6 +471,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Smooth movement towards the location Ares Plasma Flamethrower is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); + + //Update the telegraph sound if it's being done. + if (TelegraphSoundSlot != null && SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + { + telSound.Position = NPC.Center; + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 6e343e0abf..e559c86509 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -14,6 +14,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Sounds; +using ReLogic.Utilities; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -58,6 +59,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Total duration of the tesla orb firing phase private const float teslaOrbDuration = 120f; + //This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + private SlotId TelegraphSoundSlot; + + //Telegraph sound + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresTeslaArmCharge"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -89,7 +96,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.netAlways = true; NPC.boss = true; NPC.hide = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -396,6 +402,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < teslaOrbTelegraphDuration) { + // Play a charge up sound so that the player knows when it's about to fire tesla orbs + if (calamityGlobalNPC.newAI[2] == 1) + TelegraphSoundSlot = SoundEngine.PlaySound(TelSound, NPC.Center); + // Set frames to tesla orb charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { @@ -455,6 +465,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Smooth movement towards the location Ares Tesla Cannon is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); + + //Update the telegraph sound if it's being done. + if (TelegraphSoundSlot != null && SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + { + telSound.Position = NPC.Center; + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 60359eb7a6..c8eca37252 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -27,6 +27,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public static int phase1IconIndex; public static int phase2IconIndex; + public static readonly SoundStyle LensSound = new("CalamityMod/Sounds/Custom/ExoTwinsEject"); + internal static void LoadHeadIcons() { string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead"; @@ -177,7 +179,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -426,7 +427,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phase 7 - 0, 1, 2 // Predictiveness - float predictionAmt = bossRush ? 21f : death ? 18f : revenge ? 16.5f : expertMode ? 15f : 12f; + float predictionAmt = bossRush ? 50f : death ? 40f : revenge ? 35f : expertMode ? 30f : 20f; if (AIState == (float)Phase.LaserShotgun) predictionAmt *= 1.5f; if (nerfedAttacks) @@ -743,7 +744,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 laserVelocity = Vector2.Normalize(aimedVector); Vector2 projectileDestination = player.Center + predictionVector; Vector2 offset = laserVelocity * 70f; - float setVelocityInAI = 6.5f; + float setVelocityInAI = 7.5f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } @@ -795,7 +796,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int spread = bossRush ? 30 : death ? 26 : expertMode ? 21 : 15; float rotation = MathHelper.ToRadians(spread); float distanceFromTarget = Vector2.Distance(NPC.Center, NPC.Center + chargeVelocityNormalized * chargeDistance); - float setVelocityInAI = 6.5f; + float setVelocityInAI = 7.5f; for (int i = 0; i < numLasersPerSpread + 1; i++) { @@ -888,7 +889,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); float rotation = MathHelper.ToRadians(spread); float distanceFromTarget = Vector2.Distance(NPC.Center, player.Center + predictionVector); - float setVelocityInAI = 6.5f; + float setVelocityInAI = 7.5f; for (int i = 0; i < numLasersPerSpread + 1; i++) { @@ -1115,7 +1116,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Shoot lens gore at the target at the proper time if (calamityGlobalNPC.newAI[2] == lensPopTime) { - SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound, NPC.Center); + SoundEngine.PlaySound(LensSound, NPC.Center); Vector2 lensDirection = Vector2.Normalize(aimedVector); Vector2 offset = lensDirection * 70f; @@ -1151,7 +1152,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index eb5ab0cf2a..77623b3823 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -71,6 +71,7 @@ namespace CalamityMod.NPCs.ExoMechs public static readonly SoundStyle LaughSound = new("CalamityMod/Sounds/Custom/DraedonLaugh"); public static readonly SoundStyle TeleportSound = new("CalamityMod/Sounds/Custom/DraedonTeleport"); + public static readonly SoundStyle SelectionSound = new("CalamityMod/Sounds/Custom/Codebreaker/ExoMechsIconSelect"); public override void SetStaticDefaults() { @@ -109,8 +110,8 @@ namespace CalamityMod.NPCs.ExoMechs //We'll probably want a custom background for Exos like ML has. //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The esteemed scientist himself. His AI is uploaded into a database, far from harm, and thus destroying his recon bodies achieves nothing.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("The esteemed scientist himself. His AI is uploaded into a database, far from harm, and thus destroying his recon bodies achieves nothing.") }); } @@ -138,10 +139,17 @@ namespace CalamityMod.NPCs.ExoMechs { // Set the whoAmI variable. CalamityGlobalNPC.draedon = NPC.whoAmI; + CalamityGlobalNPC.draedonAmbience = -1; // Prevent stupid natural despawns. NPC.timeLeft = 3600; + // Emit music. If the battle is ongoing, Draedon emits the battle theme. + // Otherwise, he emits his trademark ambience. + // This takes priority over anything except Moon Lord's music fadeout. + if (!ExoMechIsPresent) + CalamityGlobalNPC.draedonAmbience = NPC.whoAmI; + // Decide an initial target and play a teleport sound on the first frame. if (TalkTimer == 0f) { @@ -269,6 +277,7 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.Server) { SoundEngine.PlaySound(CommonCalamitySounds.FlareSound with { Volume = CommonCalamitySounds.FlareSound.Volume * 1.55f}, PlayerToFollow.Center); + SoundEngine.PlaySound(SelectionSound, PlayerToFollow.Center); } } @@ -396,11 +405,6 @@ namespace CalamityMod.NPCs.ExoMechs DefeatTimer++; } - if (!ExoMechIsPresent && DefeatTimer <= 0f) - Music = MusicLoader.GetMusicSlot(Mod, "Sounds/Music/DraedonAmbience"); - if (ExoMechIsPresent) - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; - TalkTimer++; } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 9d24a59218..4624fd8689 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -80,7 +80,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.dontCountMe = true; NPC.chaseable = false; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -526,7 +525,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 956548f77a..a2a4fdd8e8 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -80,7 +80,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.dontCountMe = true; NPC.chaseable = false; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -527,7 +526,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index cd47e775d8..b754ba711d 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float defaultLifeRatio = 5f; // Base distance from the target for most attacks - private const float baseDistance = 400f; + private const float baseDistance = 800f; // Base distance from target location in order to continue turning private const float baseTurnDistance = 160f; @@ -158,7 +158,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.netAlways = true; NPC.boss = true; NPC.chaseable = false; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -467,7 +466,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Increase speed if too far from target float increaseSpeedMult = 1f; - float increaseSpeedGateValue = 500f; + float increaseSpeedGateValue = 600f; if (distanceFromTarget > increaseSpeedGateValue) { float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); @@ -485,7 +484,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Velocity and turn speed values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); - float baseVelocity = 11.1f * baseVelocityMult; + float baseVelocity = 10f * baseVelocityMult; // Increase top velocity if target is dead or if Thanatos is uncoiling if (targetDead || speedUp) @@ -496,7 +495,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.getGoodWorld) baseVelocity *= 1.15f; - float turnDegrees = baseVelocity * 0.11f * (shouldGetBuffedByBerserkPhase ? 1.25f : 1f); + float turnDegrees = baseVelocity * 0.1f * (shouldGetBuffedByBerserkPhase ? 1.25f : 1f); float turnSpeed = MathHelper.ToRadians(turnDegrees); float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); @@ -993,7 +992,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index ce305ece2d..1b482a61d9 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -80,7 +80,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.dontCountMe = true; NPC.chaseable = false; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -527,7 +526,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Rectangle targetHitbox = target.Hitbox; diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index faec389ec6..9e850f8e8d 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.GreatSandShark }; value.Position.X += 60f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -61,8 +62,6 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.DeathSound = SoundID.NPCDeath1; NPC.timeLeft = NPC.activeTime * 30; NPC.rarity = 2; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; @@ -636,8 +635,11 @@ namespace CalamityMod.NPCs.GreatSandShark npcLoot.Add(ItemID.LightShard, 2); npcLoot.Add(ItemID.DarkShard, 2); + // Trophy + npcLoot.Add(ModContent.ItemType(), 10); + // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } public override void OnKill() @@ -655,7 +657,8 @@ namespace CalamityMod.NPCs.GreatSandShark public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 600, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 600, true); } } } diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index c48f4e465f..d981d77d2b 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -72,8 +72,11 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.ai[1] < 90f) NPC.ai[1] += 1f; + speed = MathHelper.Lerp(3f, speed, NPC.ai[1] / 90f); + NPC.rotation = NPC.velocity.X * 0.05f; + Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); float num1373 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector167.X; float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; @@ -135,12 +138,9 @@ namespace CalamityMod.NPCs.HiveMind public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); if ((Main.expertMode || BossRushEvent.BossRushActive) && Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index b031561300..c9a8470fd3 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.position.X + NPC.width > Main.player[NPC.target].position.X && NPC.position.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width && NPC.position.Y + NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] += 1f; - if (NPC.ai[0] >= (Main.getGoodWorld ? 15f : 30f)) + if (NPC.ai[0] >= (Main.getGoodWorld ? 12f : 24f)) { NPC.ai[0] = 0f; int num1169 = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20)); @@ -143,12 +143,9 @@ namespace CalamityMod.NPCs.HiveMind public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 9bc1212770..9cf034dc37 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.HiveMind if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) NPC.localAI[1] = 180f; - NPC.localAI[1] += 1f; + NPC.localAI[1] += Main.rand.Next(2) + 1f; if (NPC.localAI[1] >= 360f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 80f) { NPC.localAI[1] = 0f; @@ -179,12 +179,9 @@ namespace CalamityMod.NPCs.HiveMind public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CheckActive() diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index fdec9d4c76..7cc0f66249 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.HiveMind if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) NPC.localAI[1] = 180f; - NPC.localAI[1] += 1f; + NPC.localAI[1] += Main.rand.Next(3) + 1f; if (NPC.localAI[1] >= 360f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 80f) { NPC.localAI[1] = 0f; @@ -162,12 +162,9 @@ namespace CalamityMod.NPCs.HiveMind public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CheckActive() diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 6f4da44b56..65634a7647 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -83,6 +83,9 @@ namespace CalamityMod.NPCs.HiveMind private const int maxFramesY_Phase2 = 8; private const int height_Phase2 = 142; + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoar"); + public static readonly SoundStyle FastRoarSound = new("CalamityMod/Sounds/Custom/HiveMindRoarFast"); + public override void SetStaticDefaults() { DisplayName.SetDefault("The Hive Mind"); @@ -97,6 +100,7 @@ namespace CalamityMod.NPCs.HiveMind }; value.Position.Y += 3f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -117,7 +121,6 @@ namespace CalamityMod.NPCs.HiveMind NPC.boss = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("HiveMind") ?? MusicID.Boss2; if (Main.expertMode) { @@ -358,7 +361,7 @@ namespace CalamityMod.NPCs.HiveMind if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { state = 2; - SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + SoundEngine.PlaySound(FastRoarSound, NPC.Center); } else { @@ -369,9 +372,9 @@ namespace CalamityMod.NPCs.HiveMind nextState = 0; if (state == 2) - SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + SoundEngine.PlaySound(RoarSound, NPC.Center); else - SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + SoundEngine.PlaySound(FastRoarSound, NPC.Center); } } @@ -848,7 +851,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity.Normalize(); NPC.velocity *= teleportRadius / (lungeTime - (int)enrageScale); dashStarted = true; - SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + SoundEngine.PlaySound(RoarSound, NPC.Center); } else { @@ -888,7 +891,7 @@ namespace CalamityMod.NPCs.HiveMind if (!dashStarted) { dashStarted = true; - SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = MathHelper.Pi * teleportRadius / arcTime; NPC.velocity *= rotationDirection; NPC.netUpdate = true; @@ -945,7 +948,7 @@ namespace CalamityMod.NPCs.HiveMind if (!dashStarted) { dashStarted = true; - SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = teleportRadius / arcTime * 3; NPC.velocity *= -rotationDirection; NPC.netUpdate = true; @@ -1135,26 +1138,24 @@ namespace CalamityMod.NPCs.HiveMind var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { // Weapons and such - int[] items = new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - }; - normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); - normalOnly.Add(ModContent.ItemType(), 1, 30, 50); + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, new WeightedItemStack[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + })); // Materials - normalOnly.Add(ItemID.DemoniteBar, 1, 12, 15); - normalOnly.Add(ItemID.RottenChunk, 1, 12, 15); - normalOnly.Add(ItemID.CorruptSeeds, 1, 12, 15); + normalOnly.Add(ItemID.DemoniteBar, 1, 10, 15); + normalOnly.Add(ItemID.RottenChunk, 1, 10, 15); + normalOnly.Add(ItemID.CorruptSeeds, 1, 10, 15); normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); - normalOnly.Add(ItemDropRule.ByCondition(new Conditions.IsHardmode(), ItemID.CursedFlame, 1, 10, 20)); + normalOnly.Add(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.CursedFlame, 1, 10, 20)); // Equipment + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity @@ -1165,10 +1166,10 @@ namespace CalamityMod.NPCs.HiveMind npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedHiveMind, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedHiveMind, ModContent.ItemType(), desc: DropHelper.FirstKillText); } } } diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 0d0efb9800..4dabce363c 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -68,7 +68,6 @@ namespace CalamityMod.NPCs.Leviathan NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Anahita") ?? MusicID.Boss3; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -233,10 +232,6 @@ namespace CalamityMod.NPCs.Leviathan } } - // Change music. - if (leviAlive) - Music = CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndAnahita") ?? MusicID.Boss3; - // Ice Shield if (NPC.localAI[2] < 3f) { @@ -852,6 +847,12 @@ namespace CalamityMod.NPCs.Leviathan potionType = ItemID.GreaterHealingPotion; } + public override void OnKill() + { + if (Leviathan.LastAnLStanding()) + Leviathan.RealOnKill(NPC); + } + public override void ModifyNPCLoot(NPCLoot npcLoot) { Leviathan.DefineAnahitaLeviathanLoot(npcLoot); diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index da87ae37c1..891ca785a5 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player player, int damage, bool crit) { - if (NPC.ai[1] == 1f) + if (NPC.ai[1] == 1f || damage <= 0) return; player.AddBuff(BuffID.Frostburn, 240, true); diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 3fe8daf4c6..938fc639cf 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.width = 50; NPC.height = 50; NPC.defense = 14; - NPC.lifeMax = 800; + NPC.lifeMax = 600; if (BossRushEvent.BossRushActive) { NPC.lifeMax = 10000; @@ -43,8 +43,6 @@ namespace CalamityMod.NPCs.Leviathan AIType = -1; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -251,17 +249,15 @@ namespace CalamityMod.NPCs.Leviathan public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 1d6d4bebf1..2cbc96174e 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -40,6 +40,7 @@ namespace CalamityMod.NPCs.Leviathan public static readonly SoundStyle RoarMeteorSound = new("CalamityMod/Sounds/Custom/LeviathanRoarMeteor"); public static readonly SoundStyle RoarChargeSound = new("CalamityMod/Sounds/Custom/LeviathanRoarCharge"); + public static readonly SoundStyle EmergeSound = new("CalamityMod/Sounds/Custom/LeviathanEmerge"); public override void SetStaticDefaults() { @@ -74,7 +75,6 @@ namespace CalamityMod.NPCs.Leviathan NPC.noGravity = true; NPC.boss = true; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndAnahita") ?? MusicID.Boss3; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -261,7 +261,10 @@ namespace CalamityMod.NPCs.Leviathan NPC.velocity = new Vector2(0f, -velocityY); if (calamityGlobalNPC.newAI[3] == 10f) + { + SoundEngine.PlaySound(EmergeSound, vector); SoundEngine.PlaySound(soundChoiceRage, vector); + } NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); @@ -332,7 +335,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.spriteDirection = NPC.direction; NPC.ai[1] += 1f; - float phaseTimer = 240f; + float phaseTimer = 360f; if (!sirenAlive || phase4) phaseTimer -= 120f * (1f - lifeRatio); @@ -408,7 +411,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.ai[1] += num638 / 2; bool flag103 = false; - float num640 = (!sirenAlive || phase4) ? 30f : 60f; + float num640 = (!sirenAlive || phase4) ? 60f : 40f; if (NPC.ai[1] > num640) { NPC.ai[1] = 0f; @@ -416,7 +419,7 @@ namespace CalamityMod.NPCs.Leviathan flag103 = true; } - int spawnLimit = (sirenAlive && !phase4) ? 2 : (death ? 3 : 4); + int spawnLimit = (sirenAlive && !phase4) ? 1 : (death ? 2 : 3); if (flag103 && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) { SoundEngine.PlaySound(soundChoice, vector); @@ -468,7 +471,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - if (NPC.ai[2] > ((sirenAlive && !phase4) ? 2f : 4f)) + if (NPC.ai[2] > spawnLimit) { NPC.ai[0] = canCharge ? (Main.rand.NextBool() ? 2f : 0f) : 0f; NPC.ai[1] = 0f; @@ -726,7 +729,7 @@ namespace CalamityMod.NPCs.Leviathan } if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-200, 200) / 100; + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("LeviGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("LeviGore2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("LeviGore3").Type, NPC.scale); @@ -778,8 +781,7 @@ namespace CalamityMod.NPCs.Leviathan ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); @@ -789,6 +791,7 @@ namespace CalamityMod.NPCs.Leviathan // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), 10); // Fishing @@ -801,12 +804,12 @@ namespace CalamityMod.NPCs.Leviathan } // Relic - npcLoot.AddIf(() => (Main.masterMode || CalamityWorld.revenge) && LastAnLStanding(), ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf((info) => LastAnLStanding(), ModContent.ItemType()); // Lore bool shouldDropLore(DropAttemptInfo info) => !DownedBossSystem.downedLeviathan && LastAnLStanding(); - npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType()); - npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -819,7 +822,8 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Bleeding, 600, true); + if (damage > 0) + target.AddBuff(BuffID.Bleeding, 600, true); } public override bool CheckActive() diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index bacce37cca..02373e1f0e 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -44,7 +44,6 @@ namespace CalamityMod.NPCs.Leviathan NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = null; NPC.rarity = 2; - Music = CalamityMod.Instance.GetMusicFromMusicMod("AnahitaPreboss") ?? -1; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index 1c0f3df348..b97d47781a 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -98,8 +98,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 90, true); - player.AddBuff(BuffID.Chilled, 60, true); + if (damage > 0) + { + player.AddBuff(BuffID.Frostburn, 90, true); + player.AddBuff(BuffID.Chilled, 60, true); + } } public override void AI() diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index d2cf69bc39..0bd3ae2ed4 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -312,6 +312,10 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 4); + npcLoot.Add(ItemID.FossilOre, 1, 4, 5); + } } } diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 36adada5d7..6bc1046c32 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -95,7 +95,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Confused, 180, true); + if (damage > 0) + player.AddBuff(BuffID.Confused, 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 9d46f015e6..c77631eae0 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Amber, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 3012bd9458..98a00c4e28 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Amethyst, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index e327fe0f36..6ebc72b49f 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.CrystalShard, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 98fc0c2f8f..dfa2e03f30 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Diamond, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 648c4eef98..2a2a54f0b0 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Emerald, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 494366adcc..3cc9ccee11 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Ruby, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index d0723eef1d..0b4f932123 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Sapphire, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index af8d756449..9bb26400e1 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Topaz, 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 6); } } } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index cf451f7151..f108311403 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -75,7 +75,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Darkness, 240, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index ecae33ec83..8f64bcb39b 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -63,8 +63,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 120, true); - player.AddBuff(BuffID.Chilled, 90, true); + if (damage > 0) + { + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index fd70c6e052..2c418a2654 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -97,8 +97,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 120, true); - player.AddBuff(BuffID.Chilled, 90, true); + if (damage > 0) + { + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index f22746f5f5..cb25ea6287 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -75,7 +75,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Weak, 240, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index c580018389..d5eb2da337 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -352,11 +352,11 @@ namespace CalamityMod.NPCs.NormalNPCs notDuringCultistFight.Add(ModContent.ItemType(), 4); aewMinionCondition.Add(notDuringCultistFight); - LeadingConditionRule postClone = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedCalamitas)); + LeadingConditionRule postClone = new LeadingConditionRule(DropHelper.PostCal()); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 10, 10, 14)); aewMinionCondition.Add(postClone); - LeadingConditionRule postPlant = new LeadingConditionRule(new Conditions.DownedPlantera()); + LeadingConditionRule postPlant = new LeadingConditionRule(DropHelper.PostPlant()); postPlant.Add(ItemID.Ectoplasm, 1, 3, 5); aewMinionCondition.Add(postPlant); } diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index c87f53dd05..7aba30530a 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -97,7 +97,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 180, true); + if (damage > 0) + player.AddBuff(BuffID.Venom, 180, true); } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 862c379601..bc064aaf59 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -288,7 +288,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index b838d5fc29..a4d95e6cbc 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -260,8 +260,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Chilled, 120, true); + if (damage > 0) + { + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Chilled, 120, true); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index aafa91fe3c..eeb395f0c7 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 projVector = new Vector2(xDist, yDist); float projLength = projVector.Length(); - float speed = 9f; + float speed = 10f; int type = ModContent.ProjectileType(); projLength = speed / projLength; @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override Color? GetAlpha(Color drawColor) { - return new Color(255, 50, 50, 0); + return new Color(255, 255, 255, drawColor.A) * NPC.Opacity; } public override bool CheckActive() diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index e3199e8502..6d6f8af240 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -383,7 +384,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120); } public override void HitEffect(int hitDirection, double damage) @@ -404,7 +406,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType()); - npcLoot.AddIf(() => NPC.downedMoonlord, ModContent.ItemType()); + LeadingConditionRule postML = npcLoot.DefineConditionalDropSet(DropHelper.PostML()); + postML.Add(ModContent.ItemType()); } } } diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 1d6cee365b..ed38f0d9a4 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.CantTakeLunchMoney[Type] = true; + NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); } public override void SetDefaults() @@ -122,15 +123,5 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } catch - { - return; - } - } } } diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 34a8ce21e5..00597e0a31 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -3,10 +3,11 @@ using CalamityMod.Items.Materials; using CalamityMod.World; using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { public class Rimehound : ModNPC @@ -150,7 +151,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 120, true); + if (damage > 0) + player.AddBuff(BuffID.Frostburn, 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -171,7 +173,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Leather, 1, 1, 2); // 100% chance of 1-2 leather - npcLoot.AddIf(() => DownedBossSystem.downedCryogen, ModContent.ItemType(), 3); + LeadingConditionRule postCryo = npcLoot.DefineConditionalDropSet(DropHelper.PostCryo()); + postCryo.Add(ModContent.ItemType(), 3); } } } diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 151f5ffee3..ea741f902d 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -74,7 +74,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); + if (damage > 0) + player.AddBuff(BuffID.Bleeding, 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 66b3c830f0..a1187770c1 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -190,7 +190,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index c510d9731c..f2a5f4dc96 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -55,7 +55,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); + if (damage > 0) + player.AddBuff(BuffID.Venom, 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 13f7427279..43a9eef39f 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -95,7 +95,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Electrified, 120, true); + if (damage > 0) + player.AddBuff(BuffID.Electrified, 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 1f3fa788e0..3aabe1d59b 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -224,7 +224,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 3); diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index 416c95dd69..1450ba70fc 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -1,6 +1,11 @@ using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using System; +using ReLogic.Utilities; +using Terraria; + namespace CalamityMod.NPCs.NormalNPCs { public class SuperDummyNPC : ModNPC @@ -9,6 +14,7 @@ namespace CalamityMod.NPCs.NormalNPCs { this.HideFromBestiary(); DisplayName.SetDefault("Super Dummy"); + Main.npcFrameCount[NPC.type] = 11; NPCID.Sets.CantTakeLunchMoney[Type] = true; } @@ -37,6 +43,51 @@ namespace CalamityMod.NPCs.NormalNPCs return false; } + public override void HitEffect(int hitDirection, double damage) + { + // Dummy AI, no way + NPC.ai[0] = hitDirection * -NPC.direction; + } + + public override void FindFrame(int frameHeight) + { + // Start animating when hit. Continue animating as long as the animation isn't finished + if (NPC.justHit || NPC.frameCounter > 0 || (NPC.frame.Y != 0 && NPC.frame.Y != frameHeight * 4)) + { + NPC.frameCounter += 1.0; + } + if (NPC.frameCounter > 6.0) + { + NPC.frameCounter = 0.0; + NPC.frame.Y += frameHeight; + } + + // Hit from behind + if (NPC.ai[0] == -1) + { + if (NPC.justHit && NPC.frame.Y > frameHeight * 2) + { + NPC.frame.Y = frameHeight; + } + else if (NPC.frame.Y > frameHeight * 3) + { + NPC.frame.Y = 0; + } + } + // Hit from in front + else + { + if (NPC.justHit && NPC.frame.Y > frameHeight * 7) + { + NPC.frame.Y = frameHeight * 5; + } + else if (NPC.frame.Y > frameHeight * 10 || NPC.frame.Y < frameHeight * 4) + { + NPC.frame.Y = frameHeight * 4; + } + } + } + public override bool CheckDead() { if (NPC.lifeRegen < 0) diff --git a/NPCs/NormalNPCs/SuperDummyNPC.png b/NPCs/NormalNPCs/SuperDummyNPC.png index d09be4791b..cff9d29dab 100644 Binary files a/NPCs/NormalNPCs/SuperDummyNPC.png and b/NPCs/NormalNPCs/SuperDummyNPC.png differ diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 7fd58c0136..19ad751af2 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -421,7 +421,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Electrified, 180, true); + if (damage > 0) + player.AddBuff(BuffID.Electrified, 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index 264b64d98f..c45f317dee 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.NormalNPCs CalamityAI.Bumblebirb2AI(NPC, Mod, false); } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 2, 4); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); public override void FindFrame(int frameHeight) { diff --git a/NPCs/NormalNPCs/WulfrumPylon.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs similarity index 80% rename from NPCs/NormalNPCs/WulfrumPylon.cs rename to NPCs/NormalNPCs/WulfrumAmplifier.cs index 80ebc2d7cd..a04abe97b0 100644 --- a/NPCs/NormalNPCs/WulfrumPylon.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; @@ -9,10 +10,11 @@ using Terraria.ModLoader.Utilities; using Microsoft.Xna.Framework; using System.Collections.Generic; using CalamityMod.World; +using CalamityMod.Sounds; namespace CalamityMod.NPCs.NormalNPCs { - public class WulfrumPylon : ModNPC + public class WulfrumAmplifier : ModNPC { public bool Charging { @@ -24,17 +26,11 @@ namespace CalamityMod.NPCs.NormalNPCs get => NPC.ai[1]; set => NPC.ai[1] = value; } - public static List SuperchargableEnemies = new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; public const float ChargeRadiusMax = 495f; public const float SuperchargeTime = 720f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Wulfrum Pylon"); + DisplayName.SetDefault("Wulfrum Amplifier"); Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { @@ -57,9 +53,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.noGravity = false; NPC.noTileCollide = false; NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; - BannerItem = ModContent.ItemType(); + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -77,6 +73,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + List SuperchargableEnemies = new List() + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; + NPC.TargetClosest(false); Player player = Main.player[NPC.target]; @@ -127,15 +131,14 @@ namespace CalamityMod.NPCs.NormalNPCs } } - for (int i = 0; i < Main.npc.Length; i++) + for (int i = 0; i < Main.maxNPCs; i++) { NPC npcAtIndex = Main.npc[i]; if (!npcAtIndex.active) continue; - // For some strange reason, the Wulfrum Rover is not counted when it's added to a static list. - // What I assume is going on is that it hasn't been loaded yet since it's later alphabetically (Pylon is before Rover). - // As a result, they are checked separately. + // For some strange reason, the Wulfrum enemies are not counted when SuperchargableEnemies is a static list declared up front. + // What I assume is going on is that it hasn't been loaded yet since it's later alphabetically (Amplifier is before the other enemies). if (!SuperchargableEnemies.Contains(npcAtIndex.type) && npcAtIndex.type != ModContent.NPCType()) continue; if (npcAtIndex.ai[3] > 0f) @@ -170,16 +173,16 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = !NPC.AnyNPCs(ModContent.NPCType()) ? 1.3f : 1f; + float amplifierMult = !NPC.AnyNPCs(ModContent.NPCType()) ? 1.3f : 1f; if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; // Spawn less frequently in the inner third of the world. if (spawnInfo.PlayerFloorX > Main.maxTilesX * 0.333f && spawnInfo.PlayerFloorX < Main.maxTilesX - Main.maxTilesX * 0.333f) - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.01f : 0.06f) * pylonMult; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.01f : 0.06f) * amplifierMult; - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.033f : 0.15f) * pylonMult; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.033f : 0.15f) * amplifierMult; } public override void HitEffect(int hitDirection, double damage) @@ -194,13 +197,25 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } + + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumAmplifierGore").Type, 1f); + + int randomGoreCount = Main.rand.Next(1, 4); + for (int i = 0; i < randomGoreCount; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumEnemyGore" + Main.rand.Next(1, 11).ToString()).Type, 1f); + } + } } } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 2, 3); + npcLoot.Add(ModContent.ItemType(), 1, 2, 3); npcLoot.Add(ModContent.ItemType(), new Fraction(7, 100)); + npcLoot.Add(ModContent.ItemType(), new Fraction(5, 100)); npcLoot.Add(ModContent.ItemType()); } } diff --git a/NPCs/NormalNPCs/WulfrumPylon.png b/NPCs/NormalNPCs/WulfrumAmplifier.png similarity index 100% rename from NPCs/NormalNPCs/WulfrumPylon.png rename to NPCs/NormalNPCs/WulfrumAmplifier.png diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 7a62faaeb8..e51feb5ea8 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Microsoft.Xna.Framework; using System.IO; +using CalamityMod.Sounds; namespace CalamityMod.NPCs.NormalNPCs { @@ -72,7 +73,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; @@ -197,7 +198,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; @@ -216,12 +217,24 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } + + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumDroneGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumDroneGore2").Type, 1f); + + int randomGoreCount = Main.rand.Next(1, 4); + for (int i = 0; i < randomGoreCount; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumEnemyGore" + Main.rand.Next(1, 11).ToString()).Type, 1f); + } + } } } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 1, 3); + npcLoot.Add(ModContent.ItemType(), 1, 1, 3); npcLoot.Add(ModContent.ItemType(), new Fraction(7, 100)); npcLoot.AddIf(info => info.npc.ModNPC().Supercharged, ModContent.ItemType()); } diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index 321beb7bb4..905ebcc267 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -8,6 +8,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using CalamityMod.Sounds; namespace CalamityMod.NPCs.NormalNPCs { @@ -57,7 +58,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.15f; NPC.value = Item.buyPrice(0, 0, 1, 15); NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; @@ -175,7 +176,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.020f : 0.115f) * pylonMult; @@ -195,13 +196,24 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } + + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumGyratorGore").Type, 1f); + + int randomGoreCount = Main.rand.Next(1, 4); + for (int i = 0; i < randomGoreCount; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumEnemyGore" + Main.rand.Next(1, 11).ToString()).Type, 1f); + } + } } } } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + npcLoot.Add(ModContent.ItemType(), 1, 1, 2); npcLoot.Add(ModContent.ItemType(), new Fraction(7, 100)); npcLoot.AddIf(info => info.npc.ModNPC().Supercharged, ModContent.ItemType()); } diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index 0c3d439589..1e99f1a5c5 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -9,6 +9,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using CalamityMod.Sounds; namespace CalamityMod.NPCs.NormalNPCs { @@ -77,7 +78,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 20; NPC.value = Item.buyPrice(0, 0, 1, 50); NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; NPC.noGravity = true; NPC.noTileCollide = true; Banner = NPC.type; @@ -264,7 +265,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; @@ -285,6 +286,18 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } + + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumHovercraftGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumHovercraftGore2").Type, 1f); + + int randomGoreCount = Main.rand.Next(1, 4); + for (int i = 0; i < randomGoreCount; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumEnemyGore" + Main.rand.Next(1, 11).ToString()).Type, 1f); + } + } } } } @@ -297,7 +310,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 2, 3); + npcLoot.Add(ModContent.ItemType(), 1, 2, 3); npcLoot.Add(ModContent.ItemType(), new Fraction(7, 100)); npcLoot.AddIf(info => info.npc.ModNPC().Supercharged, ModContent.ItemType()); } diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 8341a45320..f311386932 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -9,6 +9,8 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using CalamityMod.Sounds; +using Terraria.Graphics.Effects; namespace CalamityMod.NPCs.NormalNPCs { @@ -56,7 +58,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.15f; NPC.value = Item.buyPrice(0, 0, 1, 15); NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; @@ -135,7 +137,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.010f : 0.135f) * pylonMult; @@ -155,6 +157,18 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 3, hitDirection, -1f, 0, default, 1f); } + + if (!Main.dedServ) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumRoverGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumRoverGore2").Type, 1f); + + int randomGoreCount = Main.rand.Next(1, 4); + for (int i = 0; i < randomGoreCount; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WulfrumEnemyGore" + Main.rand.Next(1, 11).ToString()).Type, 1f); + } + } } } } @@ -163,6 +177,8 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Supercharged) { + //old + /* Texture2D shieldTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/WulfrumRoverShield").Value; Rectangle frame = shieldTexture.Frame(1, 11, 0, (int)(Main.GlobalTimeWrappedHourly * 8) % 11); spriteBatch.Draw(shieldTexture, @@ -174,12 +190,49 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.scale + (float)Math.Cos(Main.GlobalTimeWrappedHourly) * 0.1f, SpriteEffects.None, 0f); + */ + + //0.6 : The noise upscale + //0.15 the scale its drawn at + float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + NPC.whoAmI * 0.2f)); + float noiseScale = 0.6f; + + Effect shieldEffect = Terraria.Graphics.Effects.Filters.Scene["RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f); + shieldEffect.Parameters["blowUpPower"].SetValue(2.5f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.5f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f); + shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + Color blueTint = new Color(51, 102, 255); + Color cyanTint = new Color(71, 202, 255); + Color wulfGreen = new Color(194, 255, 67) * 0.8f; + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen); + shieldEffect.Parameters["shieldColor"].SetValue(blueTint.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + + if (RoverDrive.NoiseTex == null) + RoverDrive.NoiseTex = ModContent.Request("CalamityMod/ExtraTextures/TechyNoise"); + + Texture2D tex = RoverDrive.NoiseTex.Value; + Vector2 pos = NPC.Center + NPC.gfxOffY * Vector2.UnitY - Main.screenPosition; + Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + } } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + npcLoot.Add(ModContent.ItemType(), 1, 1, 2); npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType(), new Fraction(7, 100)); npcLoot.AddIf(info => info.npc.ModNPC().Supercharged, ModContent.ItemType()); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 0e8bd30d55..482cb14763 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -77,7 +77,6 @@ namespace CalamityMod.NPCs.OldDuke NPC.boss = true; NPC.netAlways = true; NPC.timeLeft = NPC.activeTime * 30; - Music = CalamityMod.Instance.GetMusicFromMusicMod("BoomerDuke") ?? MusicID.DukeFishron; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; @@ -432,14 +431,14 @@ namespace CalamityMod.NPCs.OldDuke ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); normalOnly.Add(ModContent.ItemType(), 10); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -448,21 +447,22 @@ namespace CalamityMod.NPCs.OldDuke npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBoomerDuke, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBoomerDuke, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 3d4c531943..444aabb43a 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -181,12 +181,9 @@ namespace CalamityMod.NPCs.OldDuke public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -196,13 +193,14 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return NPC.alpha == 0; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240); } public override bool CheckDead() diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index 1930f5e353..9e3fdf3d02 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -208,12 +208,9 @@ namespace CalamityMod.NPCs.OldDuke public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -261,13 +258,14 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return NPC.alpha == 0; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240); } public override bool CheckDead() diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index c273204b07..088dd734ac 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -189,7 +189,8 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 1bc3701abf..48e81dd963 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -195,12 +195,9 @@ namespace CalamityMod.NPCs.Perforator public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void HitEffect(int hitDirection, double damage) @@ -225,7 +222,8 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index ea12831490..8479ef52bb 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -187,7 +187,8 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 90, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 90, true); } } } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 53b06b9821..12f97db502 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -108,8 +108,18 @@ namespace CalamityMod.NPCs.Perforator bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + // Enrage - if ((!Main.player[NPC.target].ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) + if ((!player.ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -120,7 +130,7 @@ namespace CalamityMod.NPCs.Perforator bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!Main.player[NPC.target].ZoneCrimson || bossRush)) + if (biomeEnraged && (!player.ZoneCrimson || bossRush)) enrageScale += 1f; if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || bossRush)) enrageScale += 1f; @@ -152,21 +162,14 @@ namespace CalamityMod.NPCs.Perforator { speed *= 1.25f; turnSpeed *= 1.5f; + + if (NPC.Calamity().newAI[2] == 0f) + NPC.Calamity().newAI[2] = player.Center.Y - 600f; } if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - // Get a target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - NPC.TargetClosest(); - - Player player = Main.player[NPC.target]; - NPC.alpha -= 42; if (NPC.alpha < 0) NPC.alpha = 0; @@ -302,7 +305,7 @@ namespace CalamityMod.NPCs.Perforator float num19 = turnSpeed; float burrowDistance = bossRush ? 500f : 800f; float burrowTarget = player.Center.Y + burrowDistance; - float lungeTarget = player.Center.Y - 600f; + float lungeTarget = NPC.Calamity().newAI[2]; Vector2 vector3 = NPC.Center; float num20 = player.Center.X; float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; @@ -319,7 +322,7 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().newAI[1] = 1f; // Quickly fall back down once above target - if (lungeUpward && NPC.Center.Y <= player.Center.Y - 420f) + if (lungeUpward && NPC.Center.Y <= NPC.Calamity().newAI[2] + 600f - 420f) { NPC.TargetClosest(); NPC.Calamity().newAI[1] = 2f; @@ -329,10 +332,11 @@ namespace CalamityMod.NPCs.Perforator if (quickFall) { NPC.velocity.Y += 0.5f; - if (NPC.Center.Y >= player.Center.Y) + if (NPC.Center.Y >= NPC.Calamity().newAI[2] + 600f) { NPC.Calamity().newAI[0] = 0f; NPC.Calamity().newAI[1] = 0f; + NPC.Calamity().newAI[2] = 0f; } } @@ -603,17 +607,15 @@ namespace CalamityMod.NPCs.Perforator public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index f6306132a2..64d3519743 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -465,12 +465,9 @@ namespace CalamityMod.NPCs.Perforator public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); for (int i = 0; i < Main.maxNPCs; i++) { @@ -497,7 +494,8 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 9c19b19c80..8fe9f753f2 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -544,17 +544,15 @@ namespace CalamityMod.NPCs.Perforator public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 0036fb261e..9707361803 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -46,6 +46,7 @@ namespace CalamityMod.NPCs.Perforator NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -68,7 +69,6 @@ namespace CalamityMod.NPCs.Perforator NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath19; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Perforators") ?? MusicID.Boss2; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; @@ -511,27 +511,26 @@ namespace CalamityMod.NPCs.Perforator var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { // Weapons and such - int[] items = new int[] - { + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, new WeightedItemStack[] + { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - }; - normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); - normalOnly.Add(ModContent.ItemType(), 1, 30, 50); + new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), + })); // Materials - normalOnly.Add(ItemID.CrimtaneBar, 1, 12, 15); - normalOnly.Add(ItemID.Vertebrae, 1, 12, 15); - normalOnly.Add(ItemID.CrimsonSeeds, 1, 12, 15); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 35, 45)); - normalOnly.Add(ItemDropRule.ByCondition(new Conditions.IsHardmode(), ItemID.Ichor, 1, 10, 20)); + normalOnly.Add(ItemID.CrimtaneBar, 1, 10, 15); + normalOnly.Add(ItemID.Vertebrae, 1, 10, 15); + normalOnly.Add(ItemID.CrimsonSeeds, 1, 10, 15); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); + normalOnly.Add(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.Ichor, 1, 10, 20)); // Equipment + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity @@ -542,15 +541,16 @@ namespace CalamityMod.NPCs.Perforator npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPerforator, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPerforator, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index ef0c0deeff..4938a574e9 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -188,7 +188,8 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 90, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 90, true); } } } diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index ae6a6624f4..0b97787ed1 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -186,17 +186,15 @@ namespace CalamityMod.NPCs.Perforator public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 60, true); } } } diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 56fb0878b2..b7665bf37a 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -187,7 +187,8 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 60, true); } } } diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index 79a1c9c96d..7bfb6436e6 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -64,7 +64,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index bb93a7023a..ba3ec2df9a 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -149,7 +149,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 5c06966b1d..c748d9c36f 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -130,7 +130,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index 1304bec80a..63630cc804 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -130,7 +130,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index aa05f1fa73..28edae4408 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -646,12 +646,9 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -664,7 +661,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 45a92dd9a1..47d5f9d3c6 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -80,7 +80,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 3, 4); diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index 3d2dceef9c..f543c2cebf 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -177,7 +177,8 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 9e6324b219..0c85500cb8 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -245,7 +245,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index ae646fe37e..b862944858 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -130,7 +130,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override bool CheckDead() diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index cd69619650..b42c8ab37c 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -67,6 +67,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath }; value.Position.X -= 48f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -90,7 +91,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; - Music = CalamityMod.Instance.GetMusicFromMusicMod("PlaguebringerGoliath") ?? MusicID.Boss3; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; } @@ -1248,13 +1248,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Weapons int[] weapons = new int[] { - ModContent.ItemType(), // Virulence + ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), // Pandemic + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), // Blight Spewer + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1265,8 +1265,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Materials normalOnly.Add(ItemID.Stinger, 1, 3, 5); - normalOnly.Add(ModContent.ItemType(), 1, 10, 14); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 13, 17)); + normalOnly.Add(ModContent.ItemType(), 1, 15, 20); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); @@ -1279,10 +1279,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPlaguebringer, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPlaguebringer, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -1293,7 +1293,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480, true); } } } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 5df145daed..05780000ca 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -518,12 +518,13 @@ namespace CalamityMod.NPCs.Polterghast public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.MoonLeech, 360, true); + if (damage > 0) + player.AddBuff(BuffID.MoonLeech, 360, true); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 0bc0d0fa1d..f4f55cfaa1 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -50,6 +50,11 @@ namespace CalamityMod.NPCs.Polterghast private int despawnTimer = 600; private bool reachedChargingPoint = false; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PolterghastHit"); + public static readonly SoundStyle P2Sound = new("CalamityMod/Sounds/Custom/PolterghastP2Transition"); + public static readonly SoundStyle P3Sound = new("CalamityMod/Sounds/Custom/PolterghastP3Transition"); + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/PolterghastSpawn"); + public static readonly SoundStyle PhantomSound = new("CalamityMod/Sounds/Custom/PolterghastPhantomSpawn"); public override void SetStaticDefaults() { @@ -57,6 +62,7 @@ namespace CalamityMod.NPCs.Polterghast Main.npcFrameCount[NPC.type] = 12; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -79,8 +85,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.noGravity = true; NPC.noTileCollide = true; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Polterghast") ?? MusicID.Plantera; - NPC.HitSound = SoundID.NPCHit7; + NPC.HitSound = HitSound; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; } @@ -725,7 +730,7 @@ namespace CalamityMod.NPCs.Polterghast calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - SoundEngine.PlaySound(SoundID.Item122, NPC.Center); + SoundEngine.PlaySound(P2Sound, NPC.Center); if (Main.netMode != NetmodeID.Server) { @@ -876,7 +881,7 @@ namespace CalamityMod.NPCs.Polterghast } } - SoundEngine.PlaySound(SoundID.Item122, NPC.Center); + SoundEngine.PlaySound(P3Sound, NPC.Center); if (Main.netMode != NetmodeID.Server) { @@ -968,6 +973,7 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { + SoundEngine.PlaySound(PhantomSound, NPC.Center); int num762 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); Main.npc[num762].velocity.X = num758; Main.npc[num762].velocity.Y = num760; @@ -1048,10 +1054,10 @@ namespace CalamityMod.NPCs.Polterghast npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -1187,12 +1193,13 @@ namespace CalamityMod.NPCs.Polterghast public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.MoonLeech, 900, true); + if (damage > 0) + player.AddBuff(BuffID.MoonLeech, 900, true); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index ced8a722ed..380d2e1f26 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -466,7 +466,7 @@ namespace CalamityMod.NPCs.Polterghast public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 454fb809fa..da7ada0293 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -45,6 +45,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians value.Position.X += 25; value.Position.Y += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -65,7 +66,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.noTileCollide = true; AIType = -1; NPC.boss = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Guardians") ?? MusicID.Boss1; NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; @@ -512,10 +512,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians npcLoot.Add(ModContent.ItemType()); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedGuardians, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedGuardians, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -529,7 +529,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 300, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index dc68d26d55..723f492023 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -400,7 +400,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index e940b47be9..af56ad0379 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -238,7 +238,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 443ad283d5..88a96a17a3 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -154,12 +154,9 @@ namespace CalamityMod.NPCs.Providence public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CheckActive() => false; diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index d3f8b0bba3..35e7daf209 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -163,12 +163,9 @@ namespace CalamityMod.NPCs.Providence public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CheckActive() => false; diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index f84307e4de..e8ea84dde7 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -156,12 +156,9 @@ namespace CalamityMod.NPCs.Providence public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CheckActive() => false; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 2485815df7..122ad8c14f 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -101,6 +101,7 @@ namespace CalamityMod.NPCs.Providence }; value.Position.Y += 6f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -123,7 +124,6 @@ namespace CalamityMod.NPCs.Providence NPC.noGravity = true; NPC.noTileCollide = true; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Providence") ?? MusicID.LunarBoss; NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; @@ -315,7 +315,7 @@ namespace CalamityMod.NPCs.Providence float maxDistance = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) ? shorterDistance : baseDistance; if (Vector2.Distance(player.Center, vector) > maxDistance) { - if (!player.dead && player.active) + if (!player.dead && player.active && !player.creativeGodMode) player.AddBuff(ModContent.BuffType(), 2); } @@ -897,7 +897,7 @@ namespace CalamityMod.NPCs.Providence { NPC.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, NPC.position.Y + NPC.height - 14f * NPC.scale); + Vector2 vector113 = new Vector2(vector.X, NPC.position.Y + NPC.height - 64f * NPC.scale); float num865 = NPC.velocity.Y; if (num865 < 0f) @@ -1514,8 +1514,6 @@ namespace CalamityMod.NPCs.Providence { CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedProvidence); - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.Top.Y >= (Main.maxTilesY - 240f) * 16f) SpawnLootBox(); @@ -1551,28 +1549,28 @@ namespace CalamityMod.NPCs.Providence npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Drops Rune of Cos on first kill - npcLoot.AddIf(() => !DownedBossSystem.downedProvidence, ModContent.ItemType()); + npcLoot.AddIf(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); return prov.biomeType != 2 || !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType()); + }, ModContent.ItemType(), desc: DropHelper.ProvidenceHallowText); npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); return prov.biomeType == 2 || !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType()); - npcLoot.AddIf(info => + }, ModContent.ItemType(), desc: DropHelper.ProvidenceUnderworldText); + npcLoot.DefineConditionalDropSet(DropHelper.If((info) => { Providence prov = info.npc.ModNPC(); return prov.challenge; - }, ModContent.ItemType()); + }, () => Main.expertMode, DropHelper.ProvidenceChallengeText)).Add(ModContent.ItemType()); npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); return !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), 1, 3, 4); + }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceNightText); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -1595,7 +1593,8 @@ namespace CalamityMod.NPCs.Providence normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials - normalOnly.Add(ModContent.ItemType(), 1, 15, 20); + normalOnly.Add(ModContent.ItemType(), 1, 25, 30); + normalOnly.Add(ModContent.ItemType(), 1, 20, 30); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -1604,10 +1603,10 @@ namespace CalamityMod.NPCs.Providence npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); } private void SpawnLootBox() @@ -1898,8 +1897,8 @@ namespace CalamityMod.NPCs.Providence ModContent.ProjectileType() }; - bool allowedClass = projectile.IsSummon() || (!projectile.CountsAsClass() && !projectile.CountsAsClass() && - !projectile.CountsAsClass() && !projectile.CountsAsClass()); + bool allowedClass = projectile.CountsAsClass() || (!projectile.CountsAsClass() && !projectile.CountsAsClass() && + !projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass()); bool allowedDamage = allowedClass && damage <= 75; //Flat 75 regardless of difficulty. //Absorber on-hit effects likely won't proc this but Deific Amulet and Astral Bulwark stars will proc this. bool allowedBabs = Main.player[projectile.owner].Calamity().pArtifact && !Main.player[projectile.owner].Calamity().profanedCrystalBuffs; @@ -1999,7 +1998,7 @@ namespace CalamityMod.NPCs.Providence { if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-50, 50) / 100; + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence3").Type, NPC.scale); diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index a6faf94975..9783e06b28 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -4,6 +4,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +13,7 @@ namespace CalamityMod.NPCs.Ravager { public class FlamePillar : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -33,7 +35,7 @@ namespace CalamityMod.NPCs.Ravager NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.HitSound = SoundID.NPCHit41; + NPC.HitSound = HitSound; NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index a2eeed31df..438c5f7ee8 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -30,6 +31,14 @@ namespace CalamityMod.NPCs.Ravager public class RavagerBody : ModNPC { private float velocityY = -16f; + public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerJump", 2); + public static readonly SoundStyle StompSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2); + public static readonly SoundStyle FistSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerPunch", 2); + public static readonly SoundStyle LimbLossSound = new("CalamityMod/Sounds/NPCKilled/RavagerLimbLoss", 4); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/RavagerHurt", 4); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/RavagerDeath", 2); + public static readonly SoundStyle PillarSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); + public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); public override void SetStaticDefaults() { @@ -44,6 +53,7 @@ namespace CalamityMod.NPCs.Ravager }; value.Position.Y -= 50f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -74,9 +84,8 @@ namespace CalamityMod.NPCs.Ravager NPC.boss = true; NPC.netAlways = true; NPC.alpha = 255; - NPC.HitSound = SoundID.NPCHit41; - NPC.DeathSound = SoundID.NPCDeath14; - Music = CalamityMod.Instance.GetMusicFromMusicMod("Ravager") ?? MusicID.Boss4; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; } @@ -345,7 +354,6 @@ namespace CalamityMod.NPCs.Ravager if (NPC.velocity.Y == 0f) { NPC.velocity.X *= 0.8f; - NPC.ai[1] += 1f; if (NPC.ai[1] > 0f) { @@ -380,6 +388,11 @@ namespace CalamityMod.NPCs.Ravager bool shouldFall = player.position.Y >= NPC.Bottom.Y; float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float velocityX = 4f + velocityXBoost; + + if (velocityY != 16) + { + SoundEngine.PlaySound(JumpSound, NPC.position); + } velocityY = -16f; float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); @@ -434,13 +447,15 @@ namespace CalamityMod.NPCs.Ravager // Don't run custom gravity when starting a jump if (NPC.ai[0] != 1f) + { CustomGravity(); + } } else if (NPC.ai[0] >= 1f) { if (NPC.velocity.Y == 0f && (NPC.ai[1] == 31f || NPC.ai[0] == 1f)) { - SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 1.25f, Pitch = SoundID.Item14.Pitch - 0.25f }, NPC.position); + SoundEngine.PlaySound(StompSound, NPC.position); NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -461,13 +476,19 @@ namespace CalamityMod.NPCs.Ravager } int spawnDistance = 360; + bool anyrockpillars = NPC.AnyNPCs(ModContent.NPCType()); + bool anyflamepillars = NPC.AnyNPCs(ModContent.NPCType()); - if (!NPC.AnyNPCs(ModContent.NPCType()) || Main.getGoodWorld) + if (!anyrockpillars || !anyflamepillars) + { + SoundEngine.PlaySound(PillarSound, NPC.position); + } + if (!anyrockpillars || Main.getGoodWorld) { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); } - else if (!NPC.AnyNPCs(ModContent.NPCType()) || Main.getGoodWorld) + else if (!anyflamepillars || Main.getGoodWorld) { float distanceMultiplier = finalPhase ? 2.5f : 2f; NPC.NewNPC(NPC.GetSource_FromAI(), (int)player.Center.X - (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); @@ -508,6 +529,10 @@ namespace CalamityMod.NPCs.Ravager if (phase2 && NPC.ai[1] == 0f) { + if (calamityGlobalNPC.newAI[3] == 0) + { + SoundEngine.PlaySound(JumpSound, NPC.position); + } NPC.noTileCollide = true; calamityGlobalNPC.newAI[3] += 1f; @@ -669,7 +694,6 @@ namespace CalamityMod.NPCs.Ravager } } - //Possibly just use an assembled sprite sheet for the bestiary portrait? public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); @@ -825,7 +849,8 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480, true); } public override void BossLoot(ref string name, ref int potionType) @@ -865,13 +890,13 @@ namespace CalamityMod.NPCs.Ravager normalOnly.Add(ModContent.ItemType(), 20); // Materials - normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedProvidence), ModContent.ItemType())); - normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedProvidence), ModContent.ItemType())); + normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedProvidence), ModContent.ItemType()), hideLootReport: DownedBossSystem.downedProvidence); + normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedProvidence), ModContent.ItemType()), hideLootReport: !DownedBossSystem.downedProvidence); // Equipment normalOnly.Add(ModContent.ItemType(), 3); normalOnly.Add(ModContent.ItemType(), 3); - normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedProvidence), ModContent.ItemType())); + normalOnly.Add(ItemDropRule.ByCondition(DropHelper.PostProv(), ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -880,10 +905,10 @@ namespace CalamityMod.NPCs.Ravager npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedRavager, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedRavager, ModContent.ItemType(), desc: DropHelper.FirstKillText); } } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 8e97005578..df280a9896 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -35,8 +36,8 @@ namespace CalamityMod.NPCs.Ravager NPC.canGhostHeal = false; NPC.alpha = 255; NPC.netAlways = true; - NPC.HitSound = SoundID.NPCHit41; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.HitSound = RavagerBody.HitSound; + NPC.DeathSound = RavagerBody.LimbLossSound; if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage = (int)(NPC.damage * 1.5); @@ -132,6 +133,7 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 1f) { + SoundEngine.PlaySound(RavagerBody.FistSound, NPC.position); NPC.noTileCollide = true; NPC.collideX = false; NPC.collideY = false; @@ -290,7 +292,8 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 2df0fbec92..134b1038f2 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -35,8 +36,8 @@ namespace CalamityMod.NPCs.Ravager NPC.noGravity = true; NPC.canGhostHeal = false; NPC.alpha = 255; - NPC.HitSound = SoundID.NPCHit41; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.HitSound = RavagerBody.HitSound; + NPC.DeathSound = RavagerBody.LimbLossSound; if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage = (int)(NPC.damage * 1.5); @@ -55,6 +56,7 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { + //Main.NewText(NPC.ai[0]); if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { NPC.active = false; @@ -132,6 +134,7 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 1f) { + SoundEngine.PlaySound(RavagerBody.FistSound, NPC.position); NPC.noTileCollide = true; NPC.collideX = false; NPC.collideY = false; @@ -290,7 +293,8 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 240, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 3fb158daa5..00f7b1b1a8 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -11,6 +11,7 @@ namespace CalamityMod.NPCs.Ravager { public class RavagerHead : ModNPC { + public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -33,7 +34,7 @@ namespace CalamityMod.NPCs.Ravager NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; - NPC.HitSound = SoundID.NPCHit41; + NPC.HitSound = RavagerBody.HitSound; NPC.DeathSound = null; if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { @@ -80,7 +81,7 @@ namespace CalamityMod.NPCs.Ravager NPC.ai[1] += 1f; if (NPC.ai[1] >= (death ? 420f : 480f)) { - SoundEngine.PlaySound(SoundID.Item62, NPC.position); + SoundEngine.PlaySound(MissileSound, NPC.position); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 60c553fa76..f8ebf25983 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -33,8 +33,8 @@ namespace CalamityMod.NPCs.Ravager NPC.noGravity = true; NPC.canGhostHeal = false; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit41; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.HitSound = RavagerBody.HitSound; + NPC.DeathSound = RavagerBody.LimbLossSound; if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item62, NPC.position); + SoundEngine.PlaySound(RavagerHead.MissileSound, NPC.position); type = ModContent.ProjectileType(); damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity * 0.25f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 55e72a4155..ee3c379be5 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -30,8 +30,8 @@ namespace CalamityMod.NPCs.Ravager NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; - NPC.HitSound = SoundID.NPCHit41; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.HitSound = RavagerBody.HitSound; + NPC.DeathSound = RavagerBody.LimbLossSound; if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index ef772a373b..c87140be3f 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -30,8 +30,8 @@ namespace CalamityMod.NPCs.Ravager NPC.canGhostHeal = false; NPC.noTileCollide = true; NPC.alpha = 255; - NPC.HitSound = SoundID.NPCHit41; - NPC.DeathSound = SoundID.NPCDeath14; + NPC.HitSound = RavagerBody.HitSound; + NPC.DeathSound = RavagerBody.LimbLossSound; if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index b2b95b13d5..e9f2e7b205 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -11,6 +11,7 @@ namespace CalamityMod.NPCs.Ravager { public class RockPillar : ModNPC { + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -32,7 +33,7 @@ namespace CalamityMod.NPCs.Ravager NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.HitSound = SoundID.NPCHit41; + NPC.HitSound = RavagerBody.PillarSound; NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; @@ -127,6 +128,8 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { + if (damage <= 0) + return; player.AddBuff(ModContent.BuffType(), 240, true); SoundEngine.PlaySound(SoundID.Item14, NPC.position); NPC.ai[0] = 0f; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 11de13c8cd..b5e1448c26 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -49,6 +49,7 @@ namespace CalamityMod.NPCs.Signus value.Position.X += 6f; value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -61,7 +62,6 @@ namespace CalamityMod.NPCs.Signus NPC.defense = 60; NPC.LifeMaxNERB(297000, 356400, 240000); NPC.value = Item.buyPrice(2, 0, 0, 0); - Music = CalamityMod.Instance.GetMusicFromMusicMod("Signus") ?? MusicID.Boss4; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; @@ -790,25 +790,26 @@ namespace CalamityMod.NPCs.Signus normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 2, 3)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); - normalOnly.Add(ItemDropRule.Common(ModContent.ItemType(), 20). - OnSuccess(ItemDropRule.Common(ModContent.ItemType())). - OnSuccess(ItemDropRule.Common(ModContent.ItemType()))); + var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(godSlayerVanity); } npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -851,7 +852,7 @@ namespace CalamityMod.NPCs.Signus } if (Main.netMode != NetmodeID.Server) { - float randomSpread = Main.rand.Next(-200, 200) / 100; + float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Signus").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Signus2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Signus3").Type, 1f); @@ -884,7 +885,8 @@ namespace CalamityMod.NPCs.Signus public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 420, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 420, true); } } } diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 0bc908cb14..7f1fb6e646 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SlimeGod } NPC.knockBackResist = 0f; AnimationType = 121; - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -62,15 +62,24 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 spawnAt = NPC.Center + new Vector2(0f, (float)NPC.height / 2f); NPC.NewNPC(NPC.GetSource_Loot(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); } + + Color dustColor = Color.Lavender; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Lavender, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 90, true); + if (damage > 0) + player.AddBuff(BuffID.Weak, 90, true); + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, 255, 255, drawColor.A) * NPC.Opacity; } } } diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 5777d1d283..d8d0fd12fa 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SlimeGod } NPC.knockBackResist = 0f; AnimationType = NPCID.CorruptSlime; - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -43,34 +43,39 @@ namespace CalamityMod.NPCs.SlimeGod public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Lavender; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Lavender, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Lavender, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } } public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Vitamins, 50); public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 90, true); + if (damage > 0) + player.AddBuff(BuffID.Weak, 90, true); + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, 255, 255, drawColor.A) * NPC.Opacity; } } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index b01df7473c..02bf1ead0c 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.SlimeGod } NPC.knockBackResist = 0f; AnimationType = NPCID.CorruptSlime; - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -58,34 +58,39 @@ namespace CalamityMod.NPCs.SlimeGod public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Crimson; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Crimson, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Crimson, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } } public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Blindfold, 50); public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 90, true); + if (damage > 0) + player.AddBuff(BuffID.Darkness, 90, true); + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, 255, 255, drawColor.A) * NPC.Opacity; } } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 6458d0dc94..1c01a0b8e1 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = 12000; } NPC.knockBackResist = 0f; - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -146,34 +146,39 @@ namespace CalamityMod.NPCs.SlimeGod public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Crimson; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Crimson, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Crimson, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } } public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Blindfold, 50); public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 90, true); + if (damage > 0) + player.AddBuff(BuffID.Darkness, 90, true); + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, 255, 255, drawColor.A) * NPC.Opacity; } } } diff --git a/NPCs/SlimeGod/CrimulanSlimeGod.cs b/NPCs/SlimeGod/CrimulanSlimeGod.cs index 22e5ea70c1..94084708be 100644 --- a/NPCs/SlimeGod/CrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/CrimulanSlimeGod.cs @@ -32,19 +32,18 @@ namespace CalamityMod.NPCs.SlimeGod NPC.height = 92; NPC.scale = 1.1f; NPC.defense = 12; - NPC.LifeMaxNERB(4750, 5700, 160000); + NPC.LifeMaxNERB(7200, 8640, 160000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; AnimationType = NPCID.KingSlime; NPC.value = 0f; - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; NPC.aiStyle = -1; AIType = -1; NPC.Calamity().VulnerableToHeat = true; @@ -53,16 +52,28 @@ namespace CalamityMod.NPCs.SlimeGod public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { + NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; @@ -79,6 +90,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = NPC.defDamage + 25; } + float scale = Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -103,6 +115,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; NPC.netUpdate = true; } } @@ -128,11 +141,6 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - NPC.localAI[1] = 0f; - enraged = true; - } if (bossRush) { enraged = true; @@ -144,6 +152,71 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = NPC.defDefense * 2; } + // Teleport + float teleportGateValue = 720f; + if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[0] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.netUpdate = true; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 960f; + Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num5 = 5; + int num8 = 0; + while (num8 < 100) + { + num8++; + int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); + int num10 = Main.rand.Next(point2.Y - num5, point2.Y); + if (Main.tile[num9, num10].HasUnactuatedTile) + continue; + + bool flag4 = true; + if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) + flag4 = false; + if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + flag4 = false; + + if (flag4) + { + NPC.localAI[0] = num9 * 16 + 8; + NPC.localAI[3] = num10 * 16 + 16; + calamityGlobalNPC.newAI[0] = 0f; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (num8 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + NPC.localAI[0] = bottom.X; + NPC.localAI[3] = bottom.Y; + calamityGlobalNPC.newAI[0] = 0f; + } + } + } + + // Get ready to teleport by increasing ai[3] + if (calamityGlobalNPC.newAI[0] < teleportGateValue) + { + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + calamityGlobalNPC.newAI[0] += death ? 3f : 2f; + else + calamityGlobalNPC.newAI[0] += 1f; + } + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); if (NPC.ai[0] == 0f) @@ -198,6 +271,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.velocity.Y -= velocityY * speedMult; NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; NPC.netUpdate = true; } else if (NPC.ai[1] >= jumpGateValue - 30f) @@ -210,6 +284,16 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X = -1f; if (NPC.direction > 0 && NPC.velocity.X < 1f) NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } } NPC.ai[2] += 1f; @@ -219,7 +303,8 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { float phaseSwitchGateValue = 360f; - if (NPC.ai[2] >= phaseSwitchGateValue) + bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; + if (switchPhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -312,7 +397,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { // Eruption of slime balls that fall down @@ -425,13 +510,13 @@ namespace CalamityMod.NPCs.SlimeGod else if (NPC.ai[0] == 3f) { NPC.noTileCollide = true; - NPC.alpha += 7; + NPC.Opacity -= 0.03f; if (NPC.timeLeft > 10) NPC.timeLeft = 10; - if (NPC.alpha > 255) - NPC.alpha = 255; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; NPC.velocity.X *= 0.98f; } @@ -466,16 +551,83 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; } + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.aiAction = 1; + NPC.ai[1] += 1f; + float teleportTime = bossRush ? 20f : death ? 30f : 40f; + scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) + { + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + } + + // Emit teleport dust + Color dustColor = Color.Crimson; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[1] += 1f; + float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + NPC.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.TargetClosest(); + } + + // Emit teleport dust + Color dustColor = Color.Crimson; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; - float num644 = Main.getGoodWorld ? 0.8f : 1f; if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; - num659 *= num644; + num659 *= scale; if (num659 != NPC.scale) { @@ -517,39 +669,19 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); - Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; - return newColor; + Color newColor = NPC.localAI[1] == 1f ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } - - public override void OnKill() - { - if (SlimeGodCore.LastSlimeGodStanding()) - SlimeGodCore.RealOnKill(NPC); - } - - // If the un-split Crimulan Slime God gets one-shotted last, it should drop the boss loot - public override void ModifyNPCLoot(NPCLoot npcLoot) => SlimeGodCore.DefineSlimeGodLoot(npcLoot); - - public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } + public override bool CheckActive() => false; public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Crimson; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Crimson, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } @@ -560,7 +692,8 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 300, true); + if (damage > 0) + player.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/NPCs/SlimeGod/EbonianSlimeGod.cs b/NPCs/SlimeGod/EbonianSlimeGod.cs index 382cc4fabd..f8141d7539 100644 --- a/NPCs/SlimeGod/EbonianSlimeGod.cs +++ b/NPCs/SlimeGod/EbonianSlimeGod.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.height = 92; NPC.scale = 1.1f; NPC.defense = 10; - NPC.LifeMaxNERB(5350, 6400, 220000); + NPC.LifeMaxNERB(8000, 9600, 220000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -40,26 +40,37 @@ namespace CalamityMod.NPCs.SlimeGod NPC.knockBackResist = 0f; AnimationType = NPCID.KingSlime; NPC.value = 0f; - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; } public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { + NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; @@ -76,6 +87,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = NPC.defDamage + 22; } + float scale = Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -100,6 +112,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + NPC.netUpdate = true; } } else if (NPC.timeLeft < 1800) @@ -125,18 +139,77 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - NPC.localAI[1] = 0f; - enraged = true; - hyperMode = true; - } if (bossRush) { enraged = true; hyperMode = true; } + // Teleport + float teleportGateValue = 720f; + if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[0] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.netUpdate = true; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 960f; + Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num5 = 5; + int num8 = 0; + while (num8 < 100) + { + num8++; + int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); + int num10 = Main.rand.Next(point2.Y - num5, point2.Y); + if (Main.tile[num9, num10].HasUnactuatedTile) + continue; + + bool flag4 = true; + if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) + flag4 = false; + if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + flag4 = false; + + if (flag4) + { + NPC.localAI[0] = num9 * 16 + 8; + NPC.localAI[3] = num10 * 16 + 16; + calamityGlobalNPC.newAI[0] = 0f; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (num8 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + NPC.localAI[0] = bottom.X; + NPC.localAI[3] = bottom.Y; + calamityGlobalNPC.newAI[0] = 0f; + } + } + } + + // Get ready to teleport by increasing ai[3] + if (calamityGlobalNPC.newAI[0] < teleportGateValue) + { + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + calamityGlobalNPC.newAI[0] += death ? 3f : 2f; + else + calamityGlobalNPC.newAI[0] += 1f; + } + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); if (NPC.ai[0] == 0f) @@ -191,6 +264,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.velocity.Y -= velocityY * speedMult; NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; NPC.netUpdate = true; } else if (NPC.ai[1] >= jumpGateValue - 30f) @@ -203,6 +277,16 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X = -1f; if (NPC.direction > 0 && NPC.velocity.X < 1f) NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } } NPC.ai[2] += 1f; @@ -212,7 +296,8 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { float phaseSwitchGateValue = 420f; - if (NPC.ai[2] >= phaseSwitchGateValue) + bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; + if (switchPhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -321,7 +406,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { // Eruption of slime balls @@ -339,7 +424,7 @@ namespace CalamityMod.NPCs.SlimeGod if (i < 4 || i > 6) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } @@ -438,13 +523,13 @@ namespace CalamityMod.NPCs.SlimeGod else if (NPC.ai[0] == 4f) { NPC.noTileCollide = true; - NPC.alpha += 7; + NPC.Opacity -= 0.03f; if (NPC.timeLeft > 10) NPC.timeLeft = 10; - if (NPC.alpha > 255) - NPC.alpha = 255; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; NPC.velocity.X *= 0.98f; } @@ -479,16 +564,83 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; } + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.aiAction = 1; + NPC.ai[1] += 1f; + float teleportTime = bossRush ? 20f : death ? 30f : 40f; + scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) + { + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + } + + // Emit teleport dust + Color dustColor = Color.Lavender; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } + else if (NPC.ai[0] == 7f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[1] += 1f; + float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + NPC.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.TargetClosest(); + } + + // Emit teleport dust + Color dustColor = Color.Lavender; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; - float num644 = Main.getGoodWorld ? 0.8f : 1f; if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; - num659 *= num644; + num659 *= scale; if (num659 != NPC.scale) { @@ -530,39 +682,19 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); - Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; - return newColor; + Color newColor = NPC.localAI[1] == 1f ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } - - public override void OnKill() - { - if (SlimeGodCore.LastSlimeGodStanding()) - SlimeGodCore.RealOnKill(NPC); - } - - // If the un-split Ebonian Slime God gets one-shotted last, it should drop the boss loot - public override void ModifyNPCLoot(NPCLoot npcLoot) => SlimeGodCore.DefineSlimeGodLoot(npcLoot); - - public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } + public override bool CheckActive() => false; public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Lavender; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Lavender, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } @@ -573,7 +705,8 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 300, true); + if (damage > 0) + player.AddBuff(BuffID.Weak, 300, true); } } } diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index a37a10aa2e..4acce04613 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -38,11 +38,14 @@ namespace CalamityMod.NPCs.SlimeGod public static readonly SoundStyle PossessionSound = new("CalamityMod/Sounds/Custom/SlimeGodPossession"); public static readonly SoundStyle ExitSound = new("CalamityMod/Sounds/Custom/SlimeGodExit"); + public static readonly SoundStyle ShotSound = new("CalamityMod/Sounds/Custom/SlimeGodShot", 2); + public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2); public override void SetStaticDefaults() { DisplayName.SetDefault("The Slime God"); NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -53,7 +56,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.width = 44; NPC.height = 44; NPC.defense = 6; - NPC.LifeMaxNERB(2100, 2500, 250000); + NPC.LifeMaxNERB(420); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPCID.Sets.TrailCacheLength[NPC.type] = 8; @@ -66,9 +69,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.boss = true; NPC.noGravity = true; NPC.noTileCollide = true; + NPC.dontTakeDamage = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; } @@ -86,24 +89,16 @@ namespace CalamityMod.NPCs.SlimeGod public override void SendExtraAI(BinaryWriter writer) { - writer.Write(NPC.dontTakeDamage); - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); writer.Write(buffedSlime); + writer.Write(NPC.Opacity); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - NPC.dontTakeDamage = reader.ReadBoolean(); - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); buffedSlime = reader.ReadInt32(); + NPC.Opacity = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -119,9 +114,6 @@ namespace CalamityMod.NPCs.SlimeGod bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -139,14 +131,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); } - NPC.dontTakeDamage = false; - // Set damage NPC.damage = NPC.defDamage; // Enrage based on large slimes - bool phase2 = lifeRatio < 0.4f || bossRush; - bool hyperMode = true; bool purpleSlimeAlive = false; bool redSlimeAlive = false; @@ -163,8 +151,6 @@ namespace CalamityMod.NPCs.SlimeGod calamityGlobalNPC.newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; purpleSlimeAlive = true; - phase2 = lifeRatio < 0.2f; - hyperMode = false; } } @@ -177,15 +163,103 @@ namespace CalamityMod.NPCs.SlimeGod else Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; - NPC.localAI[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; - NPC.localAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; + NPC.ai[1] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; + NPC.ai[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; redSlimeAlive = true; - phase2 = lifeRatio < 0.2f; - hyperMode = false; } } + // Start shooting blobs more often, move faster and buff large slimes more often if one type of large slime is dead + bool phase2 = !purpleSlimeAlive || !redSlimeAlive; + + // Vanish phase + if (!purpleSlimeAlive && !redSlimeAlive) + { + // Make sure Opacity is set to 0.8f if it's below that when the vanish phase starts + if (NPC.ai[3] == 0f) + { + if (!NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) + { + NPC.ai[3] = 1f; + NPC.Opacity = 0.8f; + } + } + + // Emit dust + for (int k = 0; k < 5; k++) + { + Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 1f); + } + + // Slow down + NPC.velocity *= 0.97f; + + // Rotate + NPC.rotation += NPC.direction * 0.3f; + + // Gradually turn invisible + NPC.Opacity -= 0.005f; + + // Drop loot, explode into dust and vanish once invisible + if (NPC.Opacity <= 0f) + { + NPC.Opacity = 0f; + SoundEngine.PlaySound(PossessionSound, NPC.position); + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 40; + NPC.height = 40; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + Main.dust[num624].velocity *= 2f; + } + + // Let the player know that the Slime God isn't dead fr + if (!DownedBossSystem.downedSlimeGod) + { + string key = "Mods.CalamityMod.SlimeGodRun"; + Color messageColor = Color.Magenta; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + + // Set Slime God to have interacted with all players + for (int i = 0; i < Main.maxPlayers; i++) + { + NPC.ApplyInteraction(i); + } + NPC.active = false; + NPC.HitEffect(); + NPC.NPCLoot(); + NPC.netUpdate = true; + } + + return; + } + // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > (bossRush ? CalamityGlobalNPC.CatchUpDistance350Tiles : CalamityGlobalNPC.CatchUpDistance200Tiles)) { @@ -214,285 +288,139 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } - if (NPC.ai[0] != 0f || NPC.ai[1] != 0f) - { - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.localAI[0] = 0f; - NPC.localAI[1] = 0f; - NPC.netUpdate = true; - } + NPC.Opacity = 0.8f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.netUpdate = true; return; } } else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - float ai1 = bossRush ? 210f : hyperMode ? 270f : 360f; - // Hide inside large slime - if (!hyperMode && NPC.ai[1] < ai1) + float hideInsideLargeSlimePhaseGateValue = phase2 ? 300f : 900f; + float hideInsideLargeSlimePhaseDuration = 600f; + float exitLargeSlimeGateValue = hideInsideLargeSlimePhaseGateValue + hideInsideLargeSlimePhaseDuration; + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= hideInsideLargeSlimePhaseGateValue) { - if (calamityGlobalNPC.newAI[2] == 0f && NPC.life > 0) + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.rotation += NPC.direction * 0.3f; + + if (buffedSlime == 0) { - calamityGlobalNPC.newAI[2] = NPC.lifeMax; - } - if (NPC.life > 0) - { - int num660 = (int)(NPC.lifeMax * 0.05); - if ((NPC.life + num660) < calamityGlobalNPC.newAI[2]) - { - calamityGlobalNPC.newAI[2] = NPC.life; - calamityGlobalNPC.newAI[3] = 1f; - SoundEngine.PlaySound(PossessionSound, NPC.position); - } + SoundEngine.PlaySound(PossessionSound, NPC.position); + + if (purpleSlimeAlive && redSlimeAlive) + buffedSlime = Main.rand.Next(2) + 1; + else if (purpleSlimeAlive) + buffedSlime = 1; + else if (redSlimeAlive) + buffedSlime = 2; } - if (calamityGlobalNPC.newAI[3] == 1f) + Vector2 purpleSlimeVector = new Vector2(calamityGlobalNPC.newAI[0], calamityGlobalNPC.newAI[1]); + Vector2 redSlimeVector = new Vector2(NPC.ai[1], NPC.ai[2]); + Vector2 goToVector = buffedSlime == 1 ? purpleSlimeVector : redSlimeVector; + + Vector2 goToPosition = goToVector - NPC.Center; + NPC.velocity = Vector2.Normalize(goToPosition) * 24f; + + // Reduce velocity to 0 to avoid spastic movement when inside big slime. + if (Vector2.Distance(NPC.Center, goToVector) < 24f) { - // Avoid cheap bullshit - NPC.damage = 0; + NPC.velocity = Vector2.Zero; - NPC.dontTakeDamage = true; + NPC.Opacity -= 0.2f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; + } - NPC.rotation = NPC.velocity.X * 0.1f; + bool slimeDead; + if (goToVector == purpleSlimeVector) + slimeDead = CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active; + else + slimeDead = CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active; - if (buffedSlime == 0) + if (calamityGlobalNPC.newAI[2] >= exitLargeSlimeGateValue || slimeDead) + { + NPC.TargetClosest(); + calamityGlobalNPC.newAI[2] = 0f; + NPC.velocity = Vector2.UnitY * -12f; + SoundEngine.PlaySound(ExitSound, NPC.position); + for (int i = 0; i < 20; i++) { - if (purpleSlimeAlive && redSlimeAlive) - buffedSlime = Main.rand.Next(2) + 1; - else if (purpleSlimeAlive) - buffedSlime = 1; - else if (redSlimeAlive) - buffedSlime = 2; - } - - Vector2 purpleSlimeVector = new Vector2(calamityGlobalNPC.newAI[0], calamityGlobalNPC.newAI[1]); - Vector2 redSlimeVector = new Vector2(NPC.localAI[2], NPC.localAI[3]); - Vector2 goToVector = buffedSlime == 1 ? purpleSlimeVector : redSlimeVector; - - Vector2 goToPosition = goToVector - NPC.Center; - NPC.velocity = Vector2.Normalize(goToPosition) * 24f; - - // Reduce velocity to 0 to avoid spastic movement when inside big slime. - if (Vector2.Distance(NPC.Center, goToVector) < 24f) - { - NPC.velocity = Vector2.Zero; - - NPC.Opacity -= 0.2f; - if (NPC.Opacity < 0f) - NPC.Opacity = 0f; - } - - bool slimeDead = false; - if (goToVector == purpleSlimeVector) - slimeDead = CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active; - else - slimeDead = CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active; - - NPC.ai[2] += 1f; - if (NPC.ai[2] >= 600f || slimeDead) - { - NPC.TargetClosest(); - NPC.ai[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - NPC.velocity = Vector2.UnitY * -12f; - SoundEngine.PlaySound(ExitSound, NPC.position); - for (int i = 0; i < 20; i++) + Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; + int dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + Main.dust[dust2].velocity *= 3f; + if (Main.rand.NextBool(2)) { - Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; - int dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); - Main.dust[dust2].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[dust2].scale = 0.5f; - Main.dust[dust2].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 30; j++) - { - Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; - int dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); - Main.dust[dust2].velocity *= 2f; + Main.dust[dust2].scale = 0.5f; + Main.dust[dust2].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - - return; + for (int j = 0; j < 30; j++) + { + Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; + int dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); + Main.dust[dust2].velocity *= 2f; + } } - NPC.Opacity += 0.2f; - if (NPC.Opacity > 0.8f) - NPC.Opacity = 0.8f; - - buffedSlime = 0; + return; } - else if (NPC.ai[1] < ai1) + else if (expertMode) { - NPC.Opacity += 0.2f; - if (NPC.Opacity > 0.8f) - NPC.Opacity = 0.8f; - } + float divisor = bossRush ? 90f : death ? 180f : revenge ? 240f : 300f; + if (phase2) + divisor /= 2; - // Spin and shoot orbs - if (phase2) - { - NPC.ai[1] += 1f; - if (revenge) + if (calamityGlobalNPC.newAI[2] % divisor == 0f) { - if (NPC.ai[1] >= ai1) + SoundEngine.PlaySound(ShotSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (NPC.localAI[1] == 0f) + if (Main.rand.NextBool()) { - // Avoid cheap bullshit - NPC.damage = 0; - - // Slow down, rotation - NPC.rotation = NPC.velocity.X * 0.1f; - - // Set teleport location, turn invisible, spin direction - NPC.Opacity -= 0.2f; - if (NPC.Opacity <= 0f) - { - NPC.Opacity = 0f; - NPC.velocity.Normalize(); - - int teleportX = player.velocity.X < 0f ? -40 : 40; - int teleportY = player.velocity.Y < 0f ? -20 : 20; - int playerPosX = (int)player.Center.X / 16 + teleportX; - int playerPosY = (int)player.Center.Y / 16 - teleportY; - - NPC.ai[2] = playerPosX; - NPC.ai[3] = playerPosY; - NPC.localAI[1] = 1f; - NPC.netUpdate = true; - } - } - else if (NPC.localAI[1] == 1f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - // Rotation - NPC.rotation = NPC.velocity.X * 0.1f; - - // Teleport to location - if (NPC.Opacity == 0f) - { - Vector2 position = new Vector2(NPC.ai[2] * 16f - (NPC.width / 2), NPC.ai[3] * 16f - (NPC.height / 2)); - NPC.position = position; - } - - // Turn visible - NPC.Opacity += 0.2f; - if (NPC.Opacity >= 0.8f) - { - NPC.Opacity = 0.8f; - NPC.localAI[0] = NPC.Center.X - player.Center.X < 0 ? 1f : -1f; - NPC.localAI[1] = 2f; - } - NPC.netUpdate = true; + float projectileVelocity = 4f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } else { - // No damage while spinning - NPC.damage = 0; - - // Rotation - NPC.rotation += NPC.direction * 0.3f; - - // Velocity boost - if (NPC.localAI[1] == 2f) - { - NPC.localAI[1] = 3f; - NPC.velocity *= 12f; - } - - // Spin velocity - float velocity = MathHelper.TwoPi / (180f - (NPC.ai[1] - ai1)); - NPC.velocity = NPC.velocity.RotatedBy(-(double)velocity * NPC.localAI[0]); - - // Reset and charge at target - if (NPC.ai[1] >= ai1 + 100f) - { - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.localAI[0] = 0f; - NPC.localAI[1] = 0f; - float chargeVelocity = death ? 12f : 9f; - if (Main.getGoodWorld) - chargeVelocity *= 1.25f; - - NPC.velocity = Vector2.Normalize(player.Center + (bossRush ? player.velocity * 20f : Vector2.Zero) - NPC.Center) * chargeVelocity; - NPC.TargetClosest(); - return; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float divisor = bossRush ? 10f : 15f; - if (NPC.ai[1] % divisor == 0f && Vector2.Distance(player.Center, NPC.Center) > 160f) - { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - float slimeVelocity = expertMode ? 9f : 7.5f; - int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * slimeVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - return; - } - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient && Vector2.Distance(player.Center, NPC.Center) > 160f) - { - if (NPC.ai[1] % 40f == 0f) - { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - float num179 = expertMode ? 12f : 10f; - Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num180 = player.position.X + player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + float projectileVelocity = 8f; + int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - value9.X += num180; - value9.Y += num182; - int totalProjectiles = expertMode ? 3 : 2; - int spread = expertMode ? 45 : 30; - for (int num186 = 0; num186 < totalProjectiles; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num179 / num183; - num180 += Main.rand.Next(-spread, spread + 1); - num182 += Main.rand.Next(-spread, spread + 1); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(NPC.GetSource_FromAI(), value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer); - } + Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } } } } - float flySpeed = death ? 14f : revenge ? 11f : expertMode ? 8.5f : 6f; + NPC.Opacity += 0.2f; + if (NPC.Opacity > 0.8f) + NPC.Opacity = 0.8f; + + buffedSlime = 0; + + float flySpeed = death ? 15f : revenge ? 13.5f : expertMode ? 12f : 9f; if (phase2) - flySpeed = revenge ? 18f : expertMode ? 16f : 14f; - if (hyperMode || bossRush) + flySpeed *= 1.25f; + if (bossRush) flySpeed *= 1.25f; if (Main.getGoodWorld) flySpeed *= 1.25f; @@ -507,18 +435,15 @@ namespace CalamityMod.NPCs.SlimeGod if (distanceFromFlyDestination < 200f || NPC.ai[0] > 0f) { if (distanceFromFlyDestination < 200f) - { NPC.ai[0] = 20f; - } + if (NPC.velocity.X < 0f) - { NPC.direction = -1; - } else - { NPC.direction = 1; - } + NPC.rotation += NPC.direction * 0.3f; + return; } @@ -531,6 +456,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity = (NPC.velocity * 10f + idealVelocity) / 11f; if (distanceFromFlyDestination < 300f) NPC.velocity = (NPC.velocity * 7f + idealVelocity) / 8f; + NPC.rotation = NPC.velocity.X * 0.1f; } @@ -591,6 +517,12 @@ namespace CalamityMod.NPCs.SlimeGod return generalSlimeArea; } + public override Color? GetAlpha(Color drawColor) + { + Color newColor = buffedSlime == 0 ? new Color(255, 255, 255, drawColor.A) : drawColor; + return newColor * NPC.Opacity; + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -640,9 +572,9 @@ namespace CalamityMod.NPCs.SlimeGod potionType = ItemID.HealingPotion; } - public static void RealOnKill(NPC npc) + public override void OnKill() { - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(NPC); CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedSlimeGod); @@ -651,34 +583,16 @@ namespace CalamityMod.NPCs.SlimeGod CalamityNetcode.SyncWorld(); } - public override void OnKill() - { - if (LastSlimeGodStanding()) - RealOnKill(NPC); - } - - public static bool LastSlimeGodStanding() - { - int slimeGodCount = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - - return slimeGodCount <= 1; - } - - public static void DefineSlimeGodLoot(NPCLoot npcLoot) + public override void ModifyNPCLoot(NPCLoot npcLoot) { // Every Slime God piece drops Gel, even if it's not the last one. npcLoot.Add(ItemID.Gel, 1, 32, 48); - var mainDrops = npcLoot.DefineConditionalDropSet(LastSlimeGodStanding); - mainDrops.Add(ItemDropRule.BossBag(ModContent.ItemType())); + npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Normal drops: Everything that would otherwise be in the bag LeadingConditionRule normalOnly = new LeadingConditionRule(new Conditions.NotExpert()); - mainDrops.Add(normalOnly); + npcLoot.Add(normalOnly); { // Weapons int[] weapons = new int[] @@ -703,65 +617,33 @@ namespace CalamityMod.NPCs.SlimeGod normalOnly.Add(ModContent.ItemType()); } - mainDrops.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => (Main.masterMode || CalamityWorld.revenge) && LastSlimeGodStanding(), ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => LastSlimeGodStanding() && !DownedBossSystem.downedSlimeGod, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSlimeGod, ModContent.ItemType(), desc: DropHelper.FirstKillText); } - public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSlimeGodLoot(npcLoot); - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, color, 1f); } - if (NPC.life <= 0) - { - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 40; - NPC.height = 40; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Slow, 180, true); - player.AddBuff(BuffID.Weak, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); + if (damage > 0) + { + player.AddBuff(BuffID.Slow, 180, true); + player.AddBuff(BuffID.Weak, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } } } } diff --git a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs index 2f7d59a446..1bdcd41370 100644 --- a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.LifeMaxNERB(1005, 1205, 80000); + NPC.LifeMaxNERB(1800, 2160, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.GetNPCDamage(); @@ -47,13 +47,12 @@ namespace CalamityMod.NPCs.SlimeGod NPC.knockBackResist = 0f; AnimationType = NPCID.KingSlime; NPC.value = Item.buyPrice(0, 1, 0, 0); - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; NPC.aiStyle = -1; AIType = -1; NPC.Calamity().VulnerableToHeat = true; @@ -73,12 +72,18 @@ namespace CalamityMod.NPCs.SlimeGod public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { + NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void AI() @@ -101,6 +106,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = NPC.defDamage + 22; } + float scale = Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -124,6 +130,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[0] = 3f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; + NPC.ai[3] = 0f; NPC.netUpdate = true; } } @@ -138,11 +145,6 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - NPC.localAI[1] = 0f; - enraged = true; - } if (bossRush) { enraged = true; @@ -154,6 +156,72 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = NPC.defDefense * 2; } + // Teleport + float teleportGateValue = 720f; + if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.netUpdate = true; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1120f; + Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num5 = 5; + int num8 = 0; + while (num8 < 100) + { + num8++; + int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); + int num10 = Main.rand.Next(point2.Y - num5, point2.Y); + if (Main.tile[num9, num10].HasUnactuatedTile) + continue; + + bool flag4 = true; + if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) + flag4 = false; + if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + flag4 = false; + + if (flag4) + { + NPC.localAI[0] = num9 * 16 + 8; + NPC.localAI[3] = num10 * 16 + 16; + NPC.ai[3] = 0f; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (num8 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + NPC.localAI[0] = bottom.X; + NPC.localAI[3] = bottom.Y; + NPC.ai[3] = 0f; + } + } + } + + // Get ready to teleport by increasing ai[3] + // This only occurs in Rev and Death for the split Slime Gods + if (NPC.ai[3] < teleportGateValue && revenge) + { + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + NPC.ai[3] += death ? 3f : 2f; + else + NPC.ai[3] += 1f; + } + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); if (NPC.ai[0] == 0f) @@ -201,6 +269,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.velocity.Y -= velocityY * speedMult; NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; NPC.netUpdate = true; } else if (NPC.ai[1] >= jumpGateValue - 30f) @@ -213,6 +282,16 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X = -1f; if (NPC.direction > 0 && NPC.velocity.X < 1f) NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } } NPC.ai[2] += 1f; @@ -222,7 +301,8 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { float phaseSwitchGateValue = 180f; - if (NPC.ai[2] >= phaseSwitchGateValue) + bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; + if (switchPhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -313,7 +393,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { // Eruption of slime balls that fall down @@ -424,13 +504,13 @@ namespace CalamityMod.NPCs.SlimeGod else if (NPC.ai[0] == 3f) { NPC.noTileCollide = true; - NPC.alpha += 7; + NPC.Opacity -= 0.03f; if (NPC.timeLeft > 10) NPC.timeLeft = 10; - if (NPC.alpha > 255) - NPC.alpha = 255; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; NPC.velocity.X *= 0.98f; } @@ -464,16 +544,83 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; } + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.aiAction = 1; + NPC.ai[1] += 1f; + float teleportTime = bossRush ? 20f : death ? 30f : 40f; + scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) + { + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + } + + // Emit teleport dust + Color dustColor = Color.Crimson; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[1] += 1f; + float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + NPC.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.TargetClosest(); + } + + // Emit teleport dust + Color dustColor = Color.Crimson; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; - float num644 = Main.getGoodWorld ? 0.8f : 1f; if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; - num659 *= num644; + num659 *= scale; if (num659 != NPC.scale) { @@ -515,40 +662,32 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); - Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; - return newColor; + Color newColor = NPC.localAI[1] == 1f ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; } public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } - - if (SlimeGodCore.LastSlimeGodStanding()) - SlimeGodCore.RealOnKill(NPC); + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - public override void ModifyNPCLoot(NPCLoot npcLoot) => SlimeGodCore.DefineSlimeGodLoot(npcLoot); - - public override bool CheckActive() + public override void ModifyNPCLoot(NPCLoot npcLoot) { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; + // Every Slime God piece drops Gel, even if it's not the last one. + npcLoot.Add(ItemID.Gel, 1, 32, 48); } + public override bool CheckActive() => false; + public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Crimson; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Crimson, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { @@ -560,7 +699,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, Color.Crimson, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -570,10 +709,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, Color.Crimson, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, Color.Crimson, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[num624].velocity *= 2f; } } @@ -586,7 +725,8 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Darkness, 240, true); } } } diff --git a/NPCs/SlimeGod/SplitEbonianSlimeGod.cs b/NPCs/SlimeGod/SplitEbonianSlimeGod.cs index 55eb20cb62..642b429664 100644 --- a/NPCs/SlimeGod/SplitEbonianSlimeGod.cs +++ b/NPCs/SlimeGod/SplitEbonianSlimeGod.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.LifeMaxNERB(1500, 1800, 110000); + NPC.LifeMaxNERB(2000, 2400, 110000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.GetNPCDamage(); @@ -49,13 +49,12 @@ namespace CalamityMod.NPCs.SlimeGod NPC.knockBackResist = 0f; AnimationType = NPCID.KingSlime; NPC.value = Item.buyPrice(0, 1, 0, 0); - NPC.alpha = 55; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; } @@ -73,12 +72,18 @@ namespace CalamityMod.NPCs.SlimeGod public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { + NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void AI() @@ -101,6 +106,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = NPC.defDamage + 20; } + float scale = Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -124,6 +130,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[0] = 4f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; + NPC.ai[3] = 0f; NPC.netUpdate = true; } } @@ -139,18 +146,78 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - NPC.localAI[1] = 0f; - hyperMode = true; - enraged = true; - } if (bossRush) { enraged = true; hyperMode = true; } + // Teleport + float teleportGateValue = 720f; + if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.netUpdate = true; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1120f; + Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num5 = 5; + int num8 = 0; + while (num8 < 100) + { + num8++; + int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); + int num10 = Main.rand.Next(point2.Y - num5, point2.Y); + if (Main.tile[num9, num10].HasUnactuatedTile) + continue; + + bool flag4 = true; + if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) + flag4 = false; + if (flag4 && !Collision.CanHitLine(NPC.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) + flag4 = false; + + if (flag4) + { + NPC.localAI[0] = num9 * 16 + 8; + NPC.localAI[3] = num10 * 16 + 16; + NPC.ai[3] = 0f; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (num8 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + NPC.localAI[0] = bottom.X; + NPC.localAI[3] = bottom.Y; + NPC.ai[3] = 0f; + } + } + } + + // Get ready to teleport by increasing ai[3] + // This only occurs in Rev and Death for the split Slime Gods + if (NPC.ai[3] < teleportGateValue && revenge) + { + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + NPC.ai[3] += death ? 3f : 2f; + else + NPC.ai[3] += 1f; + } + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); if (NPC.ai[0] == 0f) @@ -198,6 +265,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.velocity.Y -= velocityY * speedMult; NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; NPC.netUpdate = true; } else if (NPC.ai[1] >= jumpGateValue - 30f) @@ -210,6 +278,16 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X = -1f; if (NPC.direction > 0 && NPC.velocity.X < 1f) NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } } NPC.ai[2] += 1f; @@ -219,7 +297,8 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y == 0f) { float phaseSwitchGateValue = 210f; - if (NPC.ai[2] >= phaseSwitchGateValue) + bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; + if (switchPhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -327,7 +406,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += 1f; if (NPC.ai[1] > 10f) { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { // Eruption of slime balls @@ -345,7 +424,7 @@ namespace CalamityMod.NPCs.SlimeGod if (i < 3 || i > 5) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } @@ -442,13 +521,13 @@ namespace CalamityMod.NPCs.SlimeGod else if (NPC.ai[0] == 4f) { NPC.noTileCollide = true; - NPC.alpha += 7; + NPC.Opacity -= 0.03f; if (NPC.timeLeft > 10) NPC.timeLeft = 10; - if (NPC.alpha > 255) - NPC.alpha = 255; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; NPC.velocity.X *= 0.98f; } @@ -482,16 +561,83 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; } + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.aiAction = 1; + NPC.ai[1] += 1f; + float teleportTime = bossRush ? 20f : death ? 30f : 40f; + scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) + { + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + } + + // Emit teleport dust + Color dustColor = Color.Lavender; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } + else if (NPC.ai[0] == 7f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[1] += 1f; + float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + NPC.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.TargetClosest(); + } + + // Emit teleport dust + Color dustColor = Color.Lavender; + dustColor.A = 150; + for (int num245 = 0; num245 < 10; num245++) + { + int num246 = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, 4, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + Main.dust[num246].noGravity = true; + Main.dust[num246].velocity *= 0.5f; + } + } if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; - float num644 = Main.getGoodWorld ? 0.8f : 1f; if (NPC.life > 0) { float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; - num659 *= num644; + num659 *= scale; if (num659 != NPC.scale) { @@ -529,40 +675,32 @@ namespace CalamityMod.NPCs.SlimeGod public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); - Color newColor = NPC.localAI[1] == 1f ? lightColor : drawColor; - return newColor; + Color newColor = NPC.localAI[1] == 1f ? lightColor : new Color(255, 255, 255, drawColor.A); + return newColor * NPC.Opacity; } public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } - - if (SlimeGodCore.LastSlimeGodStanding()) - SlimeGodCore.RealOnKill(NPC); + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } - public override void ModifyNPCLoot(NPCLoot npcLoot) => SlimeGodCore.DefineSlimeGodLoot(npcLoot); - - public override bool CheckActive() + public override void ModifyNPCLoot(NPCLoot npcLoot) { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; + // Every Slime God piece drops Gel, even if it's not the last one. + npcLoot.Add(ItemID.Gel, 1, 32, 48); } + public override bool CheckActive() => false; + public override void HitEffect(int hitDirection, double damage) { + Color dustColor = Color.Lavender; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, Color.Lavender, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } if (NPC.life <= 0) { @@ -574,7 +712,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, Color.Lavender, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -584,10 +722,10 @@ namespace CalamityMod.NPCs.SlimeGod } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, Color.Lavender, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, Color.Lavender, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[num624].velocity *= 2f; } } @@ -600,7 +738,8 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 240, true); + if (damage > 0) + player.AddBuff(BuffID.Weak, 240, true); } } } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index b838cff4d2..4e7f00b67e 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -29,7 +29,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.height = 40; NPC.lifeMax = 825500; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); - Music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; // Phase one settings CalamityGlobalNPC global = NPC.Calamity(); @@ -253,15 +252,12 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; Texture2D texture2D15 = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked").Value : TextureAssets.Npc[NPC.type].Value; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); @@ -316,18 +312,16 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; int buffDuration = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= chargePhaseGateValue ? 240 : 120; - player.AddBuff(BuffID.Electrified, buffDuration, true); + if (damage > 0) + player.AddBuff(BuffID.Electrified, buffDuration, true); } public override bool CheckActive() diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 0a3ea05188..e98e304529 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -69,6 +69,7 @@ namespace CalamityMod.NPCs.StormWeaver value.Position.X += 70; value.Position.Y += 55; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -81,7 +82,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.lifeMax = 825500; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); NPC.value = Item.buyPrice(2, 0, 0, 0); - Music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; // Phase one settings CalamityGlobalNPC global = NPC.Calamity(); @@ -174,11 +174,11 @@ namespace CalamityMod.NPCs.StormWeaver // Shed armor and start charging at the target bool phase2 = lifeRatio < 0.8f; - // Start calling down frost waves from the sky in sheets - bool phase3 = lifeRatio < 0.65f; + // Start calling down frost waves from the sky in sheets and stop firing lightning during the charge + bool phase3 = lifeRatio < 0.55f; - // Lightning strike flash phase and start summoning tornadoes - bool phase4 = lifeRatio < 0.5f; + // Lightning strike flash phase, stop charging and start summoning tornadoes + bool phase4 = lifeRatio < 0.3f; // Update armored settings to naked settings if (phase2) @@ -318,7 +318,19 @@ namespace CalamityMod.NPCs.StormWeaver // Start charging at the player when in phase 2 if (phase2) { - calamityGlobalNPC.newAI[0] += 1f; + if (!phase4) + { + calamityGlobalNPC.newAI[0] += 1f; + } + else + { + NPC.localAI[1] = 0f; + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + + calamityGlobalNPC.newAI[0] = 0f; + } + calamityGlobalNPC.newAI[2] += 1f; // Only use tornadoes in phase 4 and swap between using them or the frost waves @@ -505,64 +517,67 @@ namespace CalamityMod.NPCs.StormWeaver } // Charge - if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue) + if (!phase4) { - NPC.localAI[3] = 60f; - - if (NPC.localAI[1] == 0f) - NPC.localAI[1] = 1f; - - if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue + 100f) + if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue) { - NPC.TargetClosest(); - NPC.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } + NPC.localAI[3] = 60f; - if (NPC.localAI[1] == 2f) - { - velocity += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.01f * (1f - (lifeRatio / 0.8f)); - acceleration += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.0001f * (1f - (lifeRatio / 0.8f)); - velocity *= 2f; - acceleration *= 0.85f; + if (NPC.localAI[1] == 0f) + NPC.localAI[1] = 1f; - float stopChargeDistance = 800f * NPC.localAI[2]; - if (stopChargeDistance < 0) + if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue + 100f) { - if (NPC.Center.X < Main.player[NPC.target].Center.X + stopChargeDistance) + NPC.TargetClosest(); + NPC.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + + if (NPC.localAI[1] == 2f) + { + velocity += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.01f * (1f - (lifeRatio / 0.8f)); + acceleration += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.0001f * (1f - (lifeRatio / 0.8f)); + velocity *= 2f; + acceleration *= 0.85f; + + float stopChargeDistance = 800f * NPC.localAI[2]; + if (stopChargeDistance < 0) { - NPC.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; + if (NPC.Center.X < Main.player[NPC.target].Center.X + stopChargeDistance) + { + NPC.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + else + { + if (NPC.Center.X > Main.player[NPC.target].Center.X + stopChargeDistance) + { + NPC.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } } } - else + + int dustAmt = 5; + for (int num1474 = 0; num1474 < dustAmt; num1474++) { - if (NPC.Center.X > Main.player[NPC.target].Center.X + stopChargeDistance) - { - NPC.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } + Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 206, value18.X, value18.Y, 100, default, 3f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= NPC.velocity; } } - - int dustAmt = 5; - for (int num1474 = 0; num1474 < dustAmt; num1474++) + else { - Vector2 vector171 = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 206, value18.X, value18.Y, 100, default, 3f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= NPC.velocity; + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; } } - else - { - if (NPC.localAI[3] > 0f) - NPC.localAI[3] -= 1f; - } } if (Main.getGoodWorld) @@ -588,59 +603,41 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (phase2) + if (phase2 && !phase4) { if (NPC.localAI[1] == 1f) { - // Play lightning sound on the target if not in phase 3 + // Play lightning sound on the target Vector2 soundCenter = Main.player[NPC.target].Center; - - // Play lightning sound on all nearby players if in phase 3 - if (phase4) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) - { - soundCenter = Main.player[Main.myPlayer].Center; - - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, soundCenter); - - if (Main.netMode != NetmodeID.Server) - { - // Set how quickly the lightning flash dissipates - lightningDecay = Main.rand.NextFloat() * 0.05f + 0.008f; - - // Set how quickly the lightning flash intensifies - lightningSpeed = Main.rand.NextFloat() * 0.05f + 0.05f; - } - } - } - else - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, soundCenter); + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, soundCenter); NPC.localAI[1] = 2f; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (!phase3) { - int speed2 = revenge ? 8 : 7; - float spawnX2 = NPC.Center.X > Main.player[NPC.target].Center.X ? 1000f : -1000f; - float spawnY2 = -1000f + Main.player[NPC.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2 + Main.player[NPC.target].Center.X, spawnY2); - Vector2 baseVelocity = Main.player[NPC.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - - int boltProjectiles = 3; - for (int i = 0; i < boltProjectiles; i++) + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 source = baseSpawn; - source.X += i * 30f - (boltProjectiles * 15f); - Vector2 boltVelocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / boltProjectiles))); - boltVelocity.X = boltVelocity.X + 3f * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[NPC.target].Center - source; - float ai = Main.rand.Next(100); - int type = ProjectileID.CultistBossLightningOrbArc; - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), source, boltVelocity, type, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + int speed2 = revenge ? 8 : 7; + float spawnX2 = NPC.Center.X > Main.player[NPC.target].Center.X ? 1000f : -1000f; + float spawnY2 = -1000f + Main.player[NPC.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2 + Main.player[NPC.target].Center.X, spawnY2); + Vector2 baseVelocity = Main.player[NPC.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed2; + + int boltProjectiles = 3; + for (int i = 0; i < boltProjectiles; i++) + { + Vector2 source = baseSpawn; + source.X += i * 30f - (boltProjectiles * 15f); + Vector2 boltVelocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / boltProjectiles))); + boltVelocity.X = boltVelocity.X + 3f * Main.rand.NextFloat() - 1.5f; + Vector2 vector94 = Main.player[NPC.target].Center - source; + float ai = Main.rand.Next(100); + int type = ProjectileID.CultistBossLightningOrbArc; + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, boltVelocity, type, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + } } } @@ -790,15 +787,12 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; Texture2D texture2D15 = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked").Value : TextureAssets.Npc[NPC.type].Value; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); @@ -853,18 +847,16 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; int buffDuration = NPC.Calamity().newAI[0] >= chargePhaseGateValue ? 480 : 240; - player.AddBuff(BuffID.Electrified, buffDuration, true); + if (damage > 0) + player.AddBuff(BuffID.Electrified, buffDuration, true); } public override bool CheckActive() @@ -967,23 +959,24 @@ namespace CalamityMod.NPCs.StormWeaver normalOnly.Add(ModContent.ItemType(), 10); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 8)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); // Vanity normalOnly.Add(ModContent.ItemType(), 7); normalOnly.Add(ModContent.ItemType(), 10); - normalOnly.Add(ItemDropRule.Common(ModContent.ItemType(), 20). - OnSuccess(ItemDropRule.Common(ModContent.ItemType())). - OnSuccess(ItemDropRule.Common(ModContent.ItemType()))); + var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(godSlayerVanity); } npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index be515cbe57..55b6bb7944 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -30,7 +30,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.height = 80; NPC.lifeMax = 825500; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); - Music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; // Phase one settings NPC.takenDamageMultiplier = 2f; @@ -245,15 +244,12 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; Texture2D texture2D15 = phase2 ? ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked").Value : TextureAssets.Npc[NPC.type].Value; Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); @@ -316,18 +312,16 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; int buffDuration = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= chargePhaseGateValue ? 120 : 60; - player.AddBuff(BuffID.Electrified, buffDuration, true); + if (damage > 0) + player.AddBuff(BuffID.Electrified, buffDuration, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 775f343e7d..9112cb987a 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -216,7 +216,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 8753f3f54c..6230f07b31 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -86,7 +86,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SulphurousSea/Catfish.cs b/NPCs/SulphurousSea/Catfish.cs index 491d5e5210..bb1d23f13d 100644 --- a/NPCs/SulphurousSea/Catfish.cs +++ b/NPCs/SulphurousSea/Catfish.cs @@ -92,7 +92,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/SulphurousSea/Flounder.cs b/NPCs/SulphurousSea/Flounder.cs index 1284102484..509ae7c61e 100644 --- a/NPCs/SulphurousSea/Flounder.cs +++ b/NPCs/SulphurousSea/Flounder.cs @@ -97,7 +97,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120); } public override void FindFrame(int frameHeight) diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index ab761364cb..0160d6320c 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -109,7 +109,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index b3e713408a..c709c764f3 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -324,7 +324,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 180); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 34c2dcffa2..78d168666c 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -167,15 +167,5 @@ namespace CalamityMod.NPCs.SunkenSea } } } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } catch - { - return; - } - } } } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 330ad98ec7..73d9582907 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -7,6 +7,7 @@ using System.IO; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -151,7 +152,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Electrified, 120, true); + if (damage > 0) + player.AddBuff(BuffID.Electrified, 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -172,7 +174,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.JellyfishNecklace, 100); - npcLoot.AddIf(() => DownedBossSystem.downedDesertScourge, ModContent.ItemType(), 5); + LeadingConditionRule postDS = npcLoot.DefineConditionalDropSet(DropHelper.PostDS()); + postDS.Add(ModContent.ItemType(), 5); } } } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index e1444f57a3..d7ff09e973 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -3,8 +3,8 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -68,8 +68,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit4; NPC.knockBackResist = 0f; NPC.rarity = 2; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -452,12 +450,11 @@ namespace CalamityMod.NPCs.SunkenSea public override void ModifyNPCLoot(NPCLoot npcLoot) { - var hardmode = npcLoot.DefineConditionalDropSet(new Conditions.IsHardmode()); - var postDesertScourge = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + var hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); // Materials - npcLoot.Add(ModContent.ItemType(), 1, 25, 35); - hardmode.Add(ModContent.ItemType(), 1, 6, 11); + npcLoot.Add(ModContent.ItemType(), 1, 30, 40); + hardmode.Add(ModContent.ItemType(), 1, 25, 30); // Weapons int[] weapons = new int[] @@ -470,14 +467,14 @@ namespace CalamityMod.NPCs.SunkenSea hardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Equipment - postDesertScourge.Add(ModContent.ItemType(), 3); - postDesertScourge.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 3); + + // Trophy + npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType(), 4); - - npcLoot.Add(postDesertScourge); - npcLoot.Add(hardmode); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); } } } diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 61fd340c05..69f5d6ed2b 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -158,7 +159,11 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.AddIf(() => DownedBossSystem.downedDesertScourge, ModContent.ItemType(), 1, 1, 3); + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + LeadingConditionRule postDS = npcLoot.DefineConditionalDropSet(DropHelper.PostDS()); + postDS.Add(ModContent.ItemType(), 1, 1, 3); + } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 2dc14ff924..9a86ca572f 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -218,15 +218,5 @@ namespace CalamityMod.NPCs.SunkenSea Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - try - { - } catch - { - return; - } - } } } diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index 9d4697736f..48f40cd04e 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -75,12 +75,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public float PrimitiveWidthFunction(float completionRatio) diff --git a/NPCs/SupremeCalamitas/SepulcherBodyAlt.png b/NPCs/SupremeCalamitas/SepulcherBodyAlt.png index 7bddb6f35e..2bbd84fc04 100644 Binary files a/NPCs/SupremeCalamitas/SepulcherBodyAlt.png and b/NPCs/SupremeCalamitas/SepulcherBodyAlt.png differ diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 4d82c35247..f6fba36d7f 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -162,17 +162,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 138b530805..e38e6972e3 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -162,6 +162,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static readonly SoundStyle BrimstoneBigShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneBigShoot"); // DON'T YOU WANNA BE A [BIG SHOT] public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalDash"); public static readonly SoundStyle HellblastSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound"); + public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ShieldHit", 3); // TODO -- This is cumbersome. Change it to be better in 1.4. internal static void LoadHeadIcons() @@ -218,8 +219,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.canGhostHeal = false; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - Music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas1") ?? MusicID.Boss2; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; @@ -355,6 +354,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region StartUp CalamityGlobalNPC.SCal = NPC.whoAmI; + HandleMusicVariables(); bool wormAlive = false; if (CalamityGlobalNPC.SCalWorm != -1) @@ -871,9 +871,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (!startThirdAttack && lifeRatio <= 0.5f) { - // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. - Music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas2") ?? MusicID.Boss3; - if (!bossRush) { string key = "Mods.CalamityMod.SCalBH3Text"; @@ -944,9 +941,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (!startFourthAttack && lifeRatio <= 0.3f) { - // Switch from the Lament section of Stained, Brutal Calamity to the Epiphany section. - Music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas3") ?? MusicID.LunarBoss; - if (!bossRush) { string key = "Mods.CalamityMod.SCalBH4Text"; @@ -1034,15 +1028,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (gettingTired5) { - // Switch from the Epiphany section of Stained, Brutal Calamity to the Acceptance section. - Music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas4") ?? MusicID.Eerie; - if (NPC.velocity.Y < 9f) NPC.velocity.Y += 0.185f; NPC.noTileCollide = false; NPC.noGravity = false; NPC.damage = 0; + // Teleport back to the arena on defeat + if (giveUpCounter == 1200) + { + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); + NPC.Center = initialRitualPosition; + } + if (!canDespawn) NPC.velocity.X *= 0.96f; @@ -2521,6 +2519,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } + public void HandleMusicVariables() + { + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + CalamityGlobalNPC.SCalGrief = -1; + CalamityGlobalNPC.SCalLament = -1; + CalamityGlobalNPC.SCalEpiphany = -1; + CalamityGlobalNPC.SCalAcceptance = -1; + + if (startFifthAttack && gettingTired5) + CalamityGlobalNPC.SCalAcceptance = NPC.whoAmI; + else if (lifeRatio <= 0.3f) + CalamityGlobalNPC.SCalEpiphany = NPC.whoAmI; + else if (lifeRatio <= 0.5f) + CalamityGlobalNPC.SCalLament = NPC.whoAmI; + else + CalamityGlobalNPC.SCalGrief = NPC.whoAmI; + } + #region Loot public override void BossLoot(ref string name, ref int potionType) { @@ -2529,10 +2546,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void OnKill() { - // Create a teleport line effect - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); - NPC.Center = initialRitualPosition; - CalamityGlobalNPC.SetNewBossJustDowned(NPC); // Increase the player's SCal kill count @@ -2568,16 +2581,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 18, 27)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // SCal vanity set (This drops all at once, or not at all) - normalOnly.Add(ItemDropRule.Common(ModContent.ItemType(), 7). - OnSuccess(ItemDropRule.Common(ModContent.ItemType())). - OnSuccess(ItemDropRule.Common(ModContent.ItemType())). - OnSuccess(ItemDropRule.Common(ModContent.ItemType()))); + var scalVanitySet = ItemDropRule.Common(ModContent.ItemType(), 7); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + scalVanitySet.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(scalVanitySet); } // One of the only Death-exclusive drops in the mod, as requested by Leviathan: Levi pet and Gael's Greatsword @@ -2587,10 +2601,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSCal, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSCal, ModContent.ItemType(), desc: DropHelper.FirstKillText); } #endregion @@ -2620,7 +2634,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; Vector2 shieldCenter = NPC.Center + shieldRotation.ToRotationVector2() * 24f; Vector2 shieldTop = shieldCenter - (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 61f; @@ -2828,6 +2842,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } + // hit sound + if (NPC.soundDelay == 0) + { + NPC.soundDelay = Main.rand.Next(5, 8); + SoundEngine.PlaySound(HurtSound, NPC.Center); + } + for (int k = 0; k < 5; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); @@ -2842,7 +2863,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -2852,10 +2873,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -2869,7 +2890,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 600, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 600, true); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 52db1e73b5..92c631187a 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -139,6 +139,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + // Increase DR if the target leaves SCal's arena. NPC.Calamity().DR = SupremeCataclysm.NormalBrothersDR; if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().IsTargetOutsideOfArena) @@ -226,22 +232,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas DartBurstCounter = 0f; SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); - // TODO -- Consider changing this to use RotatedBy or ToRotationVector2. - float speed = 7f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - if (Main.netMode != NetmodeID.MultiplayerClient) + int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 7f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - for (int i = 0; i < 8; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); - } + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); } for (int i = 0; i < 6; i++) @@ -293,12 +293,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 6dd587aee2..4caec51105 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -132,6 +132,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + // Increase DR if the target leaves SCal's arena. NPC.Calamity().DR = SupremeCataclysm.NormalBrothersDR; if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().IsTargetOutsideOfArena) @@ -221,22 +227,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas DartBurstCounter = 0f; SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); - // TODO -- Consider changing this to use RotatedBy or ToRotationVector2. - float speed = 7f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - if (Main.netMode != NetmodeID.MultiplayerClient) + int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 7f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - for (int i = 0; i < 8; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), type, damage, 0f, Main.myPlayer, 0f, 1f); - } + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); } for (int i = 0; i < 6; i++) @@ -288,12 +288,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void OnKill() { - if (!CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index b4b635d28d..c223adce87 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.Wizard, AffectionLevel.Like) .SetNPCAffection(NPCID.Cyborg, AffectionLevel.Dislike) ; + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 3c7d7c8911..0d81cf057a 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Hate) .SetNPCAffection(NPCID.Angler, AffectionLevel.Hate) ; + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() @@ -299,8 +303,6 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original alcohol value { - // All prices are manually set. This means the Discount Card does not work. - // Cirrus doesn't accept your card. shop.item[nextSlot].SetDefaults(ItemID.HeartreachPotion); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); nextSlot++; diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 2e321acea5..2a1b524e19 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.Demolitionist, AffectionLevel.Dislike) .SetNPCAffection(NPCID.Angler, AffectionLevel.Hate) ; + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 8faae34f97..c4012f5560 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -26,6 +26,7 @@ namespace CalamityMod.NPCs.TownNPCs // Patron names "Xplizzy", // <@!98826096237109248> Whitegiraffe#6342 "Freakish", // <@!750363283520749598> Freakish#0001 + "Calder", // <@!601897959176798228> Paltham#8859 // Original names "Laura", "Mie", "Bonnie", @@ -53,6 +54,10 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Like) .SetNPCAffection(NPCID.Dryad, AffectionLevel.Dislike) ; + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() @@ -269,8 +274,6 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) { - // All prices are manually set. This means the Discount Card does not work. - // The Bandit doesn't believe in discounts. shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 9, 0, 0); nextSlot++; @@ -284,7 +287,6 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ItemID.TigerClimbingGear); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; shop.item[nextSlot].SetDefaults(ItemID.InvisibilityPotion); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); @@ -298,7 +300,6 @@ namespace CalamityMod.NPCs.TownNPCs if (DownedBossSystem.downedSlimeGod) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; } if (Main.hardMode) @@ -322,19 +323,15 @@ namespace CalamityMod.NPCs.TownNPCs if (DownedBossSystem.downedCalamitas) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; } if (NPC.downedPlantBoss) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; } if (NPC.downedGolemBoss) @@ -363,7 +360,6 @@ namespace CalamityMod.NPCs.TownNPCs } //:BearWatchingYou: shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; } diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 5ef03936bd..bf3b8ba2df 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.Clothier, AffectionLevel.Like) .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Dislike) ; + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index dacb7e19b6..788298fdd0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -101,9 +101,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on HP - bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.65f; - bool phase4 = lifeRatio < 0.5f; + bool phase3 = lifeRatio < 0.6f; bool spinning = npc.ai[0] == -4f; // KnockBack @@ -183,27 +181,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] >= 180f) { - bool spin = phase3 ? Main.rand.Next(4) > 0 : Main.rand.NextBool(); - if (phase4) - spin = true; - // Velocity and knockback - if (spin) - { - npc.knockBackResist = 0f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - } - else - { - if (npc.knockBackResist == 0f) - npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); - } - - npc.ai[0] = !spin ? -7f : -4f; - npc.ai[1] = !spin ? 0f : (playerLocation < 0 ? 1f : -1f); + npc.knockBackResist = 0f; + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; + npc.ai[0] = -4f; + npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - npc.ai[3] = !spin ? 0f : Main.rand.Next(61); - npc.localAI[1] = !spin ? 120f : 0f; + npc.ai[3] = Main.rand.Next(61); + npc.localAI[1] = 0f; npc.netUpdate = true; } } @@ -242,20 +227,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Complete stop npc.velocity *= 0f; - bool charge = phase3 ? Main.rand.Next(4) > 0 : Main.rand.NextBool(); - if (phase4) - charge = true; - // Adjust knockback - if (charge) - npc.knockBackResist = 0f; - else - { - if (npc.knockBackResist == 0f) - npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); - } + npc.knockBackResist = 0f; - npc.ai[0] = charge ? -6f : -5f; + npc.ai[0] = -6f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -277,7 +252,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { // Go to phase 3 - if (phase2 && npc.ai[0] == -1f) + if (phase3 && npc.ai[0] == -1f) { npc.ai[0] = -5f; npc.ai[1] = 0f; @@ -295,7 +270,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.justHit) npc.localAI[1] -= Main.rand.Next(random); - float num799 = phase2 ? 60f : 90f; + float num799 = 60f; if (npc.localAI[1] >= num799) { npc.localAI[1] = 0f; @@ -383,11 +358,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[3] <= 0f) { - bool spin = phase3 ? (Main.rand.NextBool() && npc.ai[0] == -9f) : false; - if (phase4 && npc.ai[0] == -9f) - spin = true; - - if (spin) + if (npc.ai[0] == -9f) { // Adjust knockback npc.knockBackResist = 0f; @@ -404,7 +375,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] = 0f; npc.ai[2] = 0f; npc.ai[1] = 0f; - npc.ai[0] = npc.ai[0] == -9f ? -5f : -1f; + npc.ai[0] = -1f; } npc.netUpdate = true; npc.netSpam = 0; @@ -586,11 +557,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Creeper count, 0 to 20 int creeperCount = NPC.CountNPCS(NPCID.Creeper); - bool phase2 = creeperCount <= (death ? 12 : 6); - - // Adjust knockback - if (phase2) - npc.knockBackResist = 0f; // Stay near Brain if (npc.ai[0] == 0f) @@ -623,7 +589,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; creeperScale *= (int)enrageScale; npc.ai[1] += (death ? 1f : 0.5f) + (creeperScale * 0.25f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 150f) { npc.ai[1] = 0f; npc.TargetClosest(); @@ -663,7 +629,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float num817 = (float)Math.Sqrt(num815 * num815 + num816 * num816); // Return to Brain - if (num817 > 700f || (npc.justHit && !phase2)) + if (num817 > 700f || npc.justHit) npc.ai[0] = 0f; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs index 4d3ecb4870..f934ecfc1e 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs @@ -451,7 +451,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (num19 != 0) nPC3.direction = nPC3.spriteDirection = num19; - vec = Vector2.Normalize(player.Center - center3 + player.velocity * 20f); + vec = Vector2.Normalize(player.Center - center3); if (vec.HasNaNs()) vec = new Vector2(npc.direction, 0f); @@ -464,7 +464,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - vec = Vector2.Normalize(player.Center - npc.Center + player.velocity * 20f); + vec = Vector2.Normalize(player.Center - npc.Center); if (vec.HasNaNs()) vec = new Vector2(npc.direction, 0f); @@ -516,7 +516,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (num21 != 0) nPC4.direction = nPC4.spriteDirection = num21; - vec2 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f); + vec2 = Vector2.Normalize(player.Center - center4); if (vec2.HasNaNs()) vec2 = new Vector2(npc.direction, 0f); @@ -534,7 +534,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - vec2 = Vector2.Normalize(player.Center - npc.Center + player.velocity * 20f); + vec2 = Vector2.Normalize(player.Center - npc.Center); if (vec2.HasNaNs()) vec2 = new Vector2(npc.direction, 0f); @@ -582,7 +582,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (num26 != 0) nPC5.direction = nPC5.spriteDirection = num26; - Vector2 vec3 = Vector2.Normalize(player.Center - center5 + player.velocity * 20f); + Vector2 vec3 = Vector2.Normalize(player.Center - center5); if (vec3.HasNaNs()) vec3 = new Vector2(npc.direction, 0f); @@ -844,7 +844,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - vec4 = Vector2.Normalize(player.Center - npc.Center + player.velocity * 20f); + vec4 = Vector2.Normalize(player.Center - npc.Center); if (vec4.HasNaNs()) vec4 = new Vector2(npc.direction, 0f); diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 778dfef604..d73f3cb618 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; - float num418 = 12f; + float num418 = 7f + enrageScale * 2f; float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num351 = num418 / num351; num349 *= num351; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs index 44d2eb8336..892bf76d8c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs @@ -370,7 +370,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float ai3 = npc.ai[1] / 60f; Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -10f : -8f).RotatedBy((float)Math.PI / 2f * Main.rand.NextFloatDirection()); if (phase2) - rainbowStreakVelocity = new Vector2(0f, death ? -15f : -12.5f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()); + rainbowStreakVelocity = new Vector2(0f, death ? -12f : -10f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()); if (dayTimeEnrage) rainbowStreakVelocity *= MathHelper.Lerp(0.8f, 1.6f, ai3); @@ -556,6 +556,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float num64 = (float)Math.PI * 2f * Main.rand.NextFloat(); float totalProjectiles = death ? (dayTimeEnrage ? 22f : 15f) : (dayTimeEnrage ? 18f : 13f); int projIndex = 0; + bool inversePhase2SpreadPattern = Main.rand.NextBool(); for (float i = 0f; i < 1f; i += 1f / totalProjectiles) { int projectileType = ProjectileID.HallowBossLastingRainbow; @@ -573,8 +574,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // After inverse: index 0 = 0, index 0.25 = 2, index 0.5 = 0, index 0.75 = 2, index 1 = 0 if (phase2) { - float maxAddedVelocity = initialVelocity * 0.5f; - float addedVelocity = Math.Abs(maxAddedVelocity - Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f))); + float maxAddedVelocity = initialVelocity; + float addedVelocity = inversePhase2SpreadPattern ? Math.Abs(maxAddedVelocity - Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f))) : Math.Abs(MathHelper.Lerp(-maxAddedVelocity, maxAddedVelocity, Math.Abs(i - 0.5f) * 2f)); initialVelocity += addedVelocity; } @@ -586,8 +587,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 34f : 42f) + 28f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 42f + extraPhaseTime) + extraPhaseTime = (dayTimeEnrage ? 36f : 45f) + 30f * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= 72f + extraPhaseTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -605,7 +606,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Increase durability. calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : 0.575f; - int totalSunDances = 3; + int totalSunDances = phase2 ? 2 : 3; float sunDanceGateValue = dayTimeEnrage ? 35f : death ? 40f : 50f; float totalSunDancePhaseTime = totalSunDances * sunDanceGateValue; @@ -671,8 +672,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float totalProjectiles = 13f; - float lanceSpacing = 150f; + float totalProjectiles = 15f; + float lanceSpacing = 175f; float lanceWallSize = totalProjectiles * lanceSpacing; Vector2 center3 = targetData9.Center; @@ -743,7 +744,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (float i = 0f; i <= 1f; i += 1f / totalProjectiles) { - Vector2 spawnLocation = center3 + lanceWallStartingPosition * (i - 0.5f) * (expertAttack ? 1f : 1.8f); + Vector2 spawnLocation = center3 + lanceWallStartingPosition * (i - 0.5f) * (expertAttack ? 1f : 2f); Vector2 v2 = vector6; if (expertAttack) { @@ -822,7 +823,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float ai3 = (npc.ai[1] - chargeGateValue - 1f) / chargeDuration; Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -5f : -4f).RotatedBy((float)Math.PI / 2f * Main.rand.NextFloatDirection()); if (phase2) - rainbowStreakVelocity = new Vector2(0f, death ? -7f : -6f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()); + rainbowStreakVelocity = new Vector2(0f, death ? -6f : -5f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()); rainbowStreakVelocity.X *= 2f; if (!phase2) @@ -1036,7 +1037,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int projectileType = ProjectileID.HallowBossRainbowStreak; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - Vector2 vector = new Vector2(0f, death ? -28f : -24f).RotatedBy((float)Math.PI * 2f * num22); + Vector2 vector = new Vector2(0f, death ? -24f : -22f).RotatedBy((float)Math.PI * 2f * num22); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + value6, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, num22); @@ -1054,7 +1055,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 1f; extraPhaseTime = (dayTimeEnrage ? 36f : 45f) + 30f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 60f + extraPhaseTime) + if (npc.ai[1] >= 120f + extraPhaseTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs index 67faf3c071..06839e291c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs @@ -104,7 +104,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y += bossRush ? 0.1f : death ? 0.05f : 0f; // Activate teleport - if (!Main.player[npc.target].dead && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) + float teleportGateValue = 480f; + if (!Main.player[npc.target].dead && npc.ai[2] >= teleportGateValue && npc.ai[1] < 5f && npc.velocity.Y == 0f) { // Avoid cheap bullshit npc.damage = 0; @@ -119,8 +120,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 160f) { - npc.ai[2] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient) npc.localAI[0] += 1f; } @@ -141,10 +140,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Get closer to activating teleport - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - npc.ai[2] += death ? 2f : 1f; - if (Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) - npc.ai[2] += death ? 2f : 1f; + if (npc.ai[2] < teleportGateValue) + { + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) + npc.ai[2] += death ? 3f : 2f; + else + npc.ai[2] += 1f; + } // Dust variable Dust dust; @@ -236,6 +238,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Don't take damage while teleporting npc.dontTakeDamage = npc.hide = flag9; + npc.noTileCollide = false; + // Jump if (npc.velocity.Y == 0f) { @@ -309,6 +313,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[0] = -120f; npc.ai[1] += 1f; } + + npc.noTileCollide = true; } else if (npc.ai[0] >= -30f) npc.aiAction = 1; @@ -329,6 +335,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f; } + + if (!Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + else + npc.noTileCollide = true; + } } // Spawn dust @@ -409,7 +425,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npcType = NPCID.RainbowSlime; } - if (Main.rand.NextBool(250)) + if (Main.rand.NextBool(100)) npcType = NPCID.Pinky; int num255 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, npcType); @@ -430,60 +446,22 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses public static void GetPlaceToTeleportTo(NPC npc) { npc.TargetClosest(false); - Point point3 = npc.Center.ToTileCoordinates(); - Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector30 = Main.player[npc.target].Center - npc.Center; - - int num235 = 10; - int num236 = 0; - int num237 = 7; + Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 800f; + Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num235 = 5; int num238 = 0; - - bool flag10 = false; - if (npc.localAI[0] >= 360f || vector30.Length() > 2000f) - { - if (npc.localAI[0] >= 360f) - npc.localAI[0] = 360f; - - flag10 = true; - num238 = 100; - } - - while (!flag10 && num238 < 100) + while (num238 < 100) { num238++; int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); - int num240 = Main.rand.Next(point4.Y - num235, point4.Y + 1); + int num240 = Main.rand.Next(point4.Y - num235, point4.Y); - if ((num240 < point4.Y - num237 || num240 > point4.Y + num237 || num239 < point4.X - num237 || num239 > point4.X + num237) && - (num240 < point3.Y - num236 || num240 > point3.Y + num236 || num239 < point3.X - num236 || num239 > point3.X + num236) && - !Main.tile[num239, num240].HasUnactuatedTile) + if (!Main.tile[num239, num240].HasUnactuatedTile) { - int num241 = num240; - int num242 = 0; - - if (Main.tile[num239, num241].HasUnactuatedTile && Main.tileSolid[Main.tile[num239, num241].TileType] && !Main.tileSolidTop[Main.tile[num239, num241].TileType]) - { - num242 = 1; - } - else - { - for (; num242 < 150 && num241 + num242 < Main.maxTilesY; num242++) - { - int y = num241 + num242; - if (Main.tile[num239, y].HasUnactuatedTile && Main.tileSolid[Main.tile[num239, y].TileType] && !Main.tileSolidTop[Main.tile[num239, y].TileType]) - { - num242--; - break; - } - } - } - num240 += num242; - bool flag13 = true; if (flag13 && Main.tile[num239, num240].LiquidType == LiquidID.Lava) flag13 = false; - if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) flag13 = false; if (flag13) @@ -495,6 +473,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } + // Default teleport if the above conditions aren't met in 100 iterations if (num238 >= 100) { Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; diff --git a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs index 3d47668bd2..73112f0e0c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/MoonLordAI.cs @@ -869,7 +869,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - Vector2 v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; + Vector2 v4 = Main.player[npc.target].Center - npc.Center; bool shootFirstBolt = num1207 == num1208 - 14f; bool shootSecondBolt = num1207 == num1208 - 7f; bool shootThirdBolt = num1207 == num1208; @@ -879,19 +879,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 30f - npc.Center; break; case 5: - v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 25f - npc.Center; + v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; break; case 4: break; case 3: - shootSecondBolt = false; - break; case 2: - v4 = Main.player[npc.target].Center - npc.Center; shootSecondBolt = false; break; case 1: - v4 = Main.player[npc.target].Center - npc.Center; shootSecondBolt = false; shootThirdBolt = false; break; @@ -1476,7 +1472,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - Vector2 v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; + Vector2 v = Main.player[npc.target].Center - npc.Center; bool shootFirstBolt = num1178 == num1179 - 14f; bool shootSecondBolt = num1178 == num1179 - 7f; bool shootThirdBolt = num1178 == num1179; @@ -1486,19 +1482,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 30f - npc.Center; break; case 5: - v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 25f - npc.Center; + v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center; break; case 4: break; case 3: - shootSecondBolt = false; - break; case 2: - v = Main.player[npc.target].Center - npc.Center; shootSecondBolt = false; break; case 1: - v = Main.player[npc.target].Center - npc.Center; shootSecondBolt = false; shootThirdBolt = false; break; diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index a9377423f1..a687544ce4 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -550,10 +550,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item17, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) { - float num624 = 12f; + float num624 = 5f; if (phase3) - num624 += 3f; - num624 += 3f * enrageScale; + num624 += 1f; + num624 += 2f * enrageScale; float num625 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector78.X; float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; @@ -561,9 +561,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num627 = num624 / num627; num625 *= num627; num626 *= num627; - int type = ProjectileID.Stinger; - int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), vector78.X, vector78.Y, num625, num626, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].timeLeft = 300; + int type = ProjectileID.QueenBeeStinger; + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), vector78.X, vector78.Y, num625, num626, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Main.projectile[projectile].timeLeft = 600; + Main.projectile[projectile].extraUpdates = 1; } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs index a19484ef9a..2ab38d241d 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs @@ -24,8 +24,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float num3 = 1f; bool flag = false; bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio <= 0.35f; - bool phase4 = lifeRatio <= 0.15f; + bool phase3 = lifeRatio <= 0.4f; + bool phase4 = lifeRatio <= 0.2f; // Reset damage npc.damage = npc.defDamage; @@ -58,7 +58,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Teleport - if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !phase2 && npc.ai[3] >= 300f && npc.ai[0] == 0f && npc.velocity.Y == 0f) + float teleportGateValue = 600f; + if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !phase2 && npc.ai[3] >= teleportGateValue && npc.ai[0] == 0f && npc.velocity.Y == 0f) { // Avoid cheap bullshit npc.damage = 0; @@ -69,66 +70,34 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.netUpdate = true; npc.TargetClosest(faceTarget: false); - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector = Main.player[npc.target].Center - npc.Center; - int num5 = 10; - int num6 = 0; - int num7 = 7; + Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 800f; + Point point2 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num5 = 5; int num8 = 0; - bool flag3 = false; - if (npc.ai[3] >= 360f || vector.Length() > 2000f) - { - if (npc.ai[3] > 360f) - npc.ai[3] = 360f; - - flag3 = true; - num8 = 100; - } - - while (!flag3 && num8 < 100) + while (num8 < 100) { num8++; int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y + 1); - if ((num10 >= point2.Y - num7 && num10 <= point2.Y + num7 && num9 >= point2.X - num7 && num9 <= point2.X + num7) || (num10 >= point.Y - num6 && num10 <= point.Y + num6 && num9 >= point.X - num6 && num9 <= point.X + num6) || Main.tile[num9, num10].HasUnactuatedTile) + int num10 = Main.rand.Next(point2.Y - num5, point2.Y); + if (Main.tile[num9, num10].HasUnactuatedTile) continue; - int num11 = num10; - int i = 0; - if (Main.tile[num9, num11].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num11].TileType] && !Main.tileSolidTop[Main.tile[num9, num11].TileType]) - { - i = 1; - } - else - { - for (; i < 150 && num11 + i < Main.maxTilesY; i++) - { - int num12 = num11 + i; - if (Main.tile[num9, num12].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num12].TileType] && !Main.tileSolidTop[Main.tile[num9, num12].TileType]) - { - i--; - break; - } - } - } - - num10 += i; bool flag4 = true; if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) flag4 = false; - - if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, vectorAimedAheadOfTarget, 0, 0)) flag4 = false; if (flag4) { npc.localAI[1] = num9 * 16 + 8; npc.localAI[2] = num10 * 16 + 16; + npc.ai[3] = 0f; break; } } + // Default teleport if the above conditions aren't met in 100 iterations if (num8 >= 100) { Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; @@ -140,9 +109,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Get ready to teleport by increasing ai[3] - if (!phase2 && (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f)) + if (!phase2) { - npc.ai[3] += death ? 3f : 1.5f; + if (npc.ai[3] < teleportGateValue) + { + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) + npc.ai[3] += death ? 3f : 2f; + else + npc.ai[3] += 1f; + } } else { @@ -419,6 +394,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] = -40f; npc.ai[2] += 1f; } + + npc.noTileCollide = true; } else { @@ -436,6 +413,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else npc.velocity.X *= bossRush ? 0.88f : death ? 0.9f : 0.91f; } + + if (!Main.player[npc.target].dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + else + npc.noTileCollide = true; + } } break; @@ -481,7 +468,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses destination.Normalize(); destination *= projectileVelocity; int numProj = 20; - float rotation = MathHelper.ToRadians(numProj * 5); + float rotation = MathHelper.ToRadians(100); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); @@ -664,7 +651,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Vector2 spinningpoint = new Vector2(projectileVelocity, 0f); spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -1f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; } } @@ -681,9 +669,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses foreach (int t in targets) { Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - npc.Center) * projectileVelocity; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, phase2 ? -2f : -1f); - if (phase2) - Main.projectile[proj].timeLeft = 900; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; } } @@ -771,7 +758,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - int num28 = (int)(npc.lifeMax * 0.04f); + int num28 = (int)(npc.lifeMax * (phase3 ? 0.04f : phase2 ? 0.03f : 0.025f)); if (!((npc.life + num28) < npc.localAI[0])) return false; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 6d992b2045..f72d43547e 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -563,7 +563,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.94f; - npc.velocity.Y -= 0.08f; + npc.velocity.Y -= 0.2f; if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } @@ -571,7 +571,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.94f; - npc.velocity.Y += 0.08f; + npc.velocity.Y += 0.2f; if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -580,7 +580,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.X > 0f) npc.velocity.X *= 0.94f; - npc.velocity.X -= 0.12f; + npc.velocity.X -= 0.2f; if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -589,7 +589,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.X < 0f) npc.velocity.X *= 0.94f; - npc.velocity.X += 0.12f; + npc.velocity.X += 0.2f; if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -611,7 +611,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.92f; - npc.velocity.Y -= 0.1f; + npc.velocity.Y -= 0.2f; if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } @@ -619,7 +619,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.92f; - npc.velocity.Y += 0.1f; + npc.velocity.Y += 0.2f; if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -628,7 +628,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.X > 0f) npc.velocity.X *= 0.92f; - npc.velocity.X -= 0.18f; + npc.velocity.X -= 0.2f; if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -637,7 +637,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.velocity.X < 0f) npc.velocity.X *= 0.92f; - npc.velocity.X += 0.18f; + npc.velocity.X += 0.2f; if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 986ec98c26..7e2150cc59 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -172,12 +172,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Float near player if (npc.ai[1] == 0f || npc.ai[1] == 4f) { - // Start other phases if arms are dead, start with spinning phase + // Start other phases if arms are dead, start with spin phase if (allArmsDead) { - // Start spin phase after 5 seconds - npc.ai[2] += phase3 ? 1.25f : 1f; - if (npc.ai[2] >= (300f - (death ? 100f * (1f - lifeRatio) : 0f))) + // Start spin phase after 1.5 seconds + npc.ai[2] += phase3 ? 1.5f : 1f; + if (npc.ai[2] >= (90f - (death ? 60f * (1f - lifeRatio) : 0f))) { bool shouldSpinAroundTarget = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 400f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (shouldSpinAroundTarget || npc.ai[1] != 4f) { if (shouldSpinAroundTarget) - npc.ai[3] = Vector2.Distance(Main.player[npc.target].Center, npc.Center); + npc.ai[3] = 300f; npc.ai[2] = 0f; npc.ai[1] = shouldSpinAroundTarget ? 5f : 1f; @@ -195,61 +195,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Ring of lasers and rocket spread if all arms are dead - if (allArmsDead) - { - npc.localAI[1] += 1f; - if (phase3) - npc.localAI[1] += 0.5f; - - if (npc.localAI[1] >= 240f) - { - npc.localAI[1] = 0f; - - int totalProjectiles = bossRush ? 24 : 12; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - float velocity = 4f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, vector255, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 480; - } - calamityGlobalNPC.newAI[3] += 1f; - } - - npc.localAI[2] += 1f; - if (phase3) - npc.localAI[2] += 0.25f; - - if (npc.localAI[2] >= 200f) - { - npc.localAI[2] = 0f; - float num502 = 0.5f; - int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num502; - int numProj = bossRush ? 5 : 3; - float rotation = MathHelper.ToRadians(bossRush ? 8 : 5); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - } - } - npc.rotation = npc.velocity.X / 15f; float velocityY = 3f - (death ? 1f - lifeRatio : 0f); @@ -350,7 +295,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); - float velocity = 5f; + float velocity = 3f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -358,8 +303,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, vector255, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 480; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 900; } calamityGlobalNPC.newAI[3] += 1f; } @@ -379,6 +324,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.TargetClosest(); npc.ai[2] = 0f; npc.ai[1] = 4f; + npc.localAI[1] = 0f; } npc.rotation += npc.direction * 0.3f; @@ -480,10 +426,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.ai[2] += 1f; - npc.rotation = npc.velocity.X / 30f; + npc.rotation = npc.velocity.X / 50f; - // Spin for 3 seconds - float spinVelocity = 45f; + float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round(5f * (1f - lifeRatio)) : 15f; + float totalSkulls = 12f; + int skullSpread = bossRush ? 250 : death ? 150 : 100; + + // Spin for about 3 seconds + float spinVelocity = 30f; if (npc.ai[2] == 2f) { // Play angry noise @@ -504,10 +454,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Maintain velocity and spit skulls - else + else if (npc.ai[2] > 2f) { npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); - float skullSpawnDivisor = bossRush ? 15f : death ? 30f - (float)Math.Round(10f * (1f - lifeRatio)) : 30f; + if (npc.ai[2] == 3f) + npc.velocity *= 0.6f; + if (npc.ai[2] % skullSpawnDivisor == 0f) { calamityGlobalNPC.newAI[1] += 1f; @@ -525,7 +477,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num160 *= num162; num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); + Vector2 value = new Vector2(num160 + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f, num161 + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f); value.Normalize(); value *= num159; num160 = value.X; @@ -541,7 +493,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Go to floating phase, or spinning phase if in phase 2 - if (calamityGlobalNPC.newAI[1] >= 6f) + if (calamityGlobalNPC.newAI[1] >= totalSkulls) { npc.velocity.Normalize(); @@ -585,14 +537,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); - velocity *= 5f; - int type = ProjectileID.SaucerMissile; + velocity *= 0.25f; + int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); - float delayBeforeHoming = bossRush ? 25f : 45f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, 0f, delayBeforeHoming); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, npc.target, 1f); + Main.projectile[proj].timeLeft = 540; } - SoundEngine.PlaySound(SoundID.Item39, npc.Center); + SoundEngine.PlaySound(SoundID.Item62, npc.Center); if (calamityGlobalNPC.newAI[1] >= 10f) { @@ -601,8 +553,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] = 0f; calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; - npc.localAI[1] = -90f; - npc.localAI[2] = -90f; npc.TargetClosest(); npc.netUpdate = true; } @@ -676,6 +626,53 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool normalLaserRotation = npc.localAI[1] % 2f == 0f; + // Movement + float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; + float velocityX = bossRush ? 1f : death ? 5f : 7f; + float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; + } + + if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.9f; + + npc.velocity.X -= acceleration; + + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; + } + if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.9f; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; + } + // Phase 1 if (npc.ai[2] == 0f) { @@ -701,51 +698,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; - float velocityX = bossRush ? 1f : death ? 5f : 7f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= bossRush ? 0.3f : death ? 0.16f : 0.14f; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += bossRush ? 0.3f : death ? 0.16f : 0.14f; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - Vector2 vector62 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num506 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector62.X; float num507 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector62.Y; @@ -767,15 +719,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[0] = 0f; npc.TargetClosest(); - float num509 = bossRush ? 10f : 8f; + float num509 = bossRush ? 5f : 4f; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); num508 = num509 / num508; num506 *= num508; num507 *= num508; - vector62.X += num506 * 8f; - vector62.Y += num507 * 8f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector62.X, vector62.Y, num506, num507, type, damage, 0f, Main.myPlayer, 0f, 0f); + vector62.X += num506 * 30f; + vector62.Y += num507 * 30f; + Projectile.NewProjectile(npc.GetSource_FromAI(), vector62.X, vector62.Y, num506, num507, type, damage, 0f, Main.myPlayer, 1f, 0f); } } } @@ -805,41 +757,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } Vector2 vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 320f - vector63.X; - float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 320f - vector63.Y; - float num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); - num515 = 9f / num515; - num513 *= num515; - num514 *= num515; - - if (npc.velocity.X > num513) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X -= bossRush ? 0.3f : death ? 0.12f : 0.1f; - } - if (npc.velocity.X < num513) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X += bossRush ? 0.3f : death ? 0.12f : 0.1f; - } - if (npc.velocity.Y > num514) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y -= bossRush ? 0.3f : death ? 0.08f : 0.06f; - } - if (npc.velocity.Y < num514) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y += bossRush ? 0.3f : death ? 0.08f : 0.06f; - } - - vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X; - num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y; + float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X; + float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y; npc.rotation = (float)Math.Atan2(num514, num513) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) @@ -861,16 +780,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); - float velocity = 5f; + float velocity = 3f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + float laserVelocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-laserVelocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, vector255, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 480; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 900; } npc.localAI[1] += 1f; } @@ -996,56 +915,58 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } + // Movement + float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; + float velocityX = bossRush ? 1f : death ? 5f : 7f; + float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; + } + else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.9f; + + npc.velocity.Y += acceleration; + + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; + } + + if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f) + { + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.9f; + + npc.velocity.X -= acceleration; + + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; + } + if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f) + { + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.9f; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; + } + if (fireSlower) { if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; - float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; - float velocityX = bossRush ? 1f : death ? 5f : 7f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y -= bossRush ? 0.275f : death ? 0.1f : 0.08f; - - if (npc.velocity.Y > velocityY) - npc.velocity.Y = velocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - - npc.velocity.Y += bossRush ? 0.275f : death ? 0.1f : 0.08f; - - if (npc.velocity.Y < -velocityY) - npc.velocity.Y = -velocityY; - } - - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X -= bossRush ? 0.275f : death ? 0.22f : 0.2f; - - if (npc.velocity.X > velocityX) - npc.velocity.X = velocityX; - } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - - npc.velocity.X += bossRush ? 0.275f : death ? 0.22f : 0.2f; - - if (npc.velocity.X < -velocityX) - npc.velocity.X = -velocityX; - } - Vector2 vector60 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num492 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector60.X; float num493 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector60.Y; @@ -1065,59 +986,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[0] >= 120f) { + SoundEngine.PlaySound(SoundID.Item62, npc.Center); npc.localAI[0] = 0f; npc.TargetClosest(); - float num495 = 1f; + float num495 = 0.5f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); num494 = num495 / num494; num492 *= num494; num493 *= num494; - vector60.X += num492 * 5f; - vector60.Y += num493 * 5f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector60.X, vector60.Y, num492, num493, type, damage, 0f, Main.myPlayer, 0f, 1f); + vector60.X += num492 * 30f; + vector60.Y += num493 * 30f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vector60.X, vector60.Y, num492, num493, type, damage, 0f, Main.myPlayer, npc.target, 1f); + Main.projectile[proj].timeLeft = 600; } } } - else { Vector2 vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num499 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector61.X; - float num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 320f - vector61.Y; - float num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); - num501 = 9f / num501; - num499 *= num501; - num500 *= num501; - - if (npc.velocity.X > num499) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X -= bossRush ? 0.275f : death ? 0.1f : 0.08f; - } - if (npc.velocity.X < num499) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.9f; - npc.velocity.X += bossRush ? 0.275f : death ? 0.1f : 0.08f; - } - if (npc.velocity.Y > num500) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y -= bossRush ? 0.275f : death ? 0.1f : 0.08f; - } - if (npc.velocity.Y < num500) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.9f; - npc.velocity.Y += bossRush ? 0.275f : death ? 0.1f : 0.08f; - } - - vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X; - num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y; + float num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X; + float num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y; npc.rotation = (float)Math.Atan2(num500, num499) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) @@ -1133,9 +1022,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.localAI[0] >= 180f) { + SoundEngine.PlaySound(SoundID.Item62, npc.Center); npc.localAI[0] = 0f; npc.TargetClosest(); - float num502 = 1f; + float num502 = 0.5f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); Vector2 value19 = Main.player[npc.target].Center - npc.Center; @@ -1146,7 +1036,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 30f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 1f); + Main.projectile[proj].timeLeft = 600; } } } @@ -1234,13 +1125,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { float velocityY = bossRush ? 1f : death ? 5f : 7f; float velocityX = bossRush ? 1.5f : death ? 8f : 10f; + float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocityY) npc.velocity.Y = velocityY; @@ -1250,7 +1142,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocityY) npc.velocity.Y = -velocityY; @@ -1261,7 +1153,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; - npc.velocity.X -= bossRush ? 1f : death ? 0.55f : 0.5f; + npc.velocity.X -= acceleration * 2f; if (npc.velocity.X > velocityX) npc.velocity.X = velocityX; @@ -1271,7 +1163,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; - npc.velocity.X += bossRush ? 1f : death ? 0.55f : 0.5f; + npc.velocity.X += acceleration * 2f; if (npc.velocity.X < -velocityX) npc.velocity.X = -velocityX; @@ -1308,13 +1200,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; float velocityX = bossRush ? 1.5f : death ? 7f : 8f; float velocityX2 = bossRush ? 1.25f : death ? 6f : 7f; + float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocityY) npc.velocity.Y = velocityY; @@ -1324,7 +1217,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocityY) npc.velocity.Y = -velocityY; @@ -1335,7 +1228,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; - npc.velocity.X -= bossRush ? 0.8f : death ? 0.33f : 0.3f; + npc.velocity.X -= acceleration; if (npc.velocity.X > velocityX) npc.velocity.X = velocityX; @@ -1345,7 +1238,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; - npc.velocity.X += bossRush ? 0.8f : death ? 0.22f : 0.2f; + npc.velocity.X += acceleration; if (npc.velocity.X < -velocityX2) npc.velocity.X = -velocityX2; @@ -1565,13 +1458,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { float velocityY = bossRush ? 1f : death ? 6f : 7f; float velocityX = bossRush ? 1.5f : death ? 8f : 10f; + float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocityY) npc.velocity.Y = velocityY; @@ -1581,7 +1475,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocityY) npc.velocity.Y = -velocityY; @@ -1592,7 +1486,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; - npc.velocity.X -= bossRush ? 1.2f : death ? 0.55f : 0.5f; + npc.velocity.X -= acceleration * 2f; if (npc.velocity.X > velocityX) npc.velocity.X = velocityX; @@ -1602,7 +1496,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; - npc.velocity.X += bossRush ? 1.2f : death ? 0.55f : 0.5f; + npc.velocity.X += acceleration * 2f; if (npc.velocity.X < -velocityX) npc.velocity.X = -velocityX; @@ -1634,13 +1528,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f; float velocityX = bossRush ? 1.5f : death ? 8f : 10f; + float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y -= bossRush ? 0.15f : death ? 0.05f : 0.04f; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocityY) npc.velocity.Y = velocityY; @@ -1650,7 +1545,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y += bossRush ? 0.15f : death ? 0.05f : 0.04f; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocityY) npc.velocity.Y = -velocityY; @@ -1661,7 +1556,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; - npc.velocity.X -= bossRush ? 0.8f : death ? 0.33f : 0.3f; + npc.velocity.X -= acceleration * 1.5f; if (npc.velocity.X > velocityX) npc.velocity.X = velocityX; @@ -1671,7 +1566,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; - npc.velocity.X += bossRush ? 0.8f : death ? 0.33f : 0.3f; + npc.velocity.X += acceleration * 1.5f; if (npc.velocity.X < -velocityX) npc.velocity.X = -velocityX; @@ -1745,29 +1640,33 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num474 *= num476; num475 *= num476; - float acceleration = bossRush ? 0.15f : death ? 0.06f : 0.05f; + float acceleration = bossRush ? 0.3f : death ? 0.1f : 0.08f; if (npc.velocity.X > num474) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; + npc.velocity.X -= acceleration; } if (npc.velocity.X < num474) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; + npc.velocity.X += acceleration; } if (npc.velocity.Y > num475) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; + npc.velocity.Y -= acceleration; } if (npc.velocity.Y < num475) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; + npc.velocity.Y += acceleration; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index 699dac6114..f957b819e0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -169,15 +169,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.wofDrawAreaTop = num336 * 16; } - // Set Y velocity and position + // Set Y position float num339 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; - - if (npc.position.Y > num339 + 1f) - npc.velocity.Y = -1f; - else if (npc.position.Y < num339 - 1f) - npc.velocity.Y = 1f; - npc.velocity.Y = 0f; - int num340 = (Main.maxTilesY - 180) * 16; if (num339 < num340) num339 = num340; @@ -480,28 +473,33 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.direction = Main.npc[Main.wofNPCIndex].direction; npc.spriteDirection = npc.direction; - float num356 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; + float expectedPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; if (npc.ai[0] > 0f) - num356 = (num356 + Main.wofDrawAreaTop) / 2f; + expectedPosition = (expectedPosition + Main.wofDrawAreaTop) / 2f; else - num356 = (num356 + Main.wofDrawAreaBottom) / 2f; - num356 -= npc.height / 2; + expectedPosition = (expectedPosition + Main.wofDrawAreaBottom) / 2f; + expectedPosition -= npc.height / 2; - if (npc.position.Y > num356 + 1f) - npc.velocity.Y = -1f; - else if (npc.position.Y < num356 - 1f) - npc.velocity.Y = 1f; + bool belowExpectedPosition = npc.position.Y > expectedPosition + 1f; + bool aboveExpectedPosition = npc.position.Y < expectedPosition - 1f; + if (belowExpectedPosition) + { + float distanceBelowExpectedPosition = npc.position.Y - expectedPosition + 1f; + float movementVelocity = MathHelper.Clamp(distanceBelowExpectedPosition * 0.03125f, 1f, 5f); + npc.velocity.Y = -movementVelocity; + } + else if (aboveExpectedPosition) + { + float distanceAboveExpectedPosition = expectedPosition - 1f - npc.position.Y; + float movementVelocity = MathHelper.Clamp(distanceAboveExpectedPosition * 0.03125f, 1f, 5f); + npc.velocity.Y = movementVelocity; + } else { npc.velocity.Y = 0f; - npc.position.Y = num356; + npc.position.Y = expectedPosition; } - if (npc.velocity.Y > 5f) - npc.velocity.Y = 5f; - if (npc.velocity.Y < -5f) - npc.velocity.Y = -5f; - Vector2 vector38 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num357 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector38.X; float num358 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector38.Y; @@ -514,7 +512,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.direction > 0) { if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) + { npc.rotation = (float)Math.Atan2(-num358, -num357) + MathHelper.Pi; + } else { npc.rotation = 0f; @@ -522,7 +522,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } else if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) + { npc.rotation = (float)Math.Atan2(num358, num357) + MathHelper.Pi; + } else { npc.rotation = 0f; @@ -542,7 +544,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (charging) npc.localAI[3] = enragedLaserTimer; - bool fireAcceleratingLasers = npc.localAI[3] > 0f && npc.localAI[3] < enragedLaserTimer; + bool fireEnragedLasers = npc.localAI[3] > 0f && npc.localAI[3] < enragedLaserTimer; // Decrement the enraged laser timer if (npc.localAI[3] > 0f) @@ -554,21 +556,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.localAI[1] = 0f; } - float shootBoost = fireAcceleratingLasers ? (death ? 1.5f : 1.5f * (1f - lifeRatio)) : (death ? 3f : 4f * (1f - lifeRatio)); + float shootBoost = fireEnragedLasers ? (death ? 1.5f : 1.5f * (1f - lifeRatio)) : (death ? 3f : 3f * (1f - lifeRatio)); npc.localAI[1] += 1f + shootBoost; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (npc.localAI[2] == 0f) { - if (npc.localAI[1] > 400f || fireAcceleratingLasers) + if (npc.localAI[1] > 400f || fireEnragedLasers) { npc.localAI[2] = 1f; npc.localAI[1] = 0f; npc.TargetClosest(); } } - else if (npc.localAI[1] > 45f && (canHit || fireAcceleratingLasers) && !charging) + else if (npc.localAI[1] > 45f && (canHit || fireEnragedLasers) && !charging) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; @@ -578,16 +580,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (flag30) { bool phase2 = lifeRatio < 0.5 || bossRush; - float velocity = (fireAcceleratingLasers ? 3f : 9f) + shootBoost; + float velocity = (fireEnragedLasers ? 3f : 4f) + shootBoost; int projectileType = phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser; int damage = npc.GetProjectileDamage(projectileType); - float laserSpawnDistance = fireAcceleratingLasers ? 30f : 10f; - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center + (fireAcceleratingLasers ? Main.player[npc.target].velocity * 40f : Vector2.Zero) - npc.Center) * velocity; + float laserSpawnDistance = fireEnragedLasers ? 30f : 22.5f; + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * velocity; Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, fireAcceleratingLasers ? 1f : 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; if (!canHit) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 92e711120c..43a625df79 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -58,9 +58,12 @@ namespace CalamityMod.NPCs.Yharon public static float normalDR = 0.22f; public static float EnragedDR = 0.9f; - public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/YharonRoar"); - public static readonly SoundStyle ShortRoarSound = new("CalamityMod/Sounds/Custom/YharonRoarShort"); - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Custom/YharonFire"); + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/Yharon/YharonRoar"); + public static readonly SoundStyle ShortRoarSound = new("CalamityMod/Sounds/Custom/Yharon/YharonRoarShort"); + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Custom/Yharon/YharonFire"); + public static readonly SoundStyle OrbSound = new("CalamityMod/Sounds/Custom/Yharon/YharonFireOrb"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/YharonHurt"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/YharonDeath"); public SlotId RoarSoundSlot; @@ -80,6 +83,7 @@ namespace CalamityMod.NPCs.Yharon value.Position.X += 26f; value.Position.Y -= 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -104,10 +108,7 @@ namespace CalamityMod.NPCs.Yharon NPC.noTileCollide = true; NPC.netAlways = true; - Music = CalamityMod.Instance.GetMusicFromMusicMod("YharonP1") ?? MusicID.Boss3; - - NPC.HitSound = SoundID.NPCHit56; - NPC.DeathSound = SoundID.NPCDeath60; + NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; @@ -188,6 +189,9 @@ namespace CalamityMod.NPCs.Yharon float pie = (float)Math.PI; + CalamityGlobalNPC.yharon = NPC.whoAmI; + CalamityGlobalNPC.yharonP2 = -1; + // Start phase 2 or not if (startSecondAI) { @@ -986,7 +990,10 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 8f) { if (NPC.ai[2] == 0f) + { RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(OrbSound, NPC.position); + } NPC.ai[2] += 1f; @@ -1336,7 +1343,10 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 15f) { if (NPC.ai[2] == 0f) + { RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(OrbSound, NPC.position); + } NPC.ai[2] += 1f; if (NPC.ai[2] % flareDustSpawnDivisor3 == 0f) @@ -1515,6 +1525,8 @@ namespace CalamityMod.NPCs.Yharon #region AI2 public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC) { + CalamityGlobalNPC.yharonP2 = NPC.whoAmI; + float phase2GateValue = revenge ? 0.44f : expertMode ? 0.385f : 0.275f; bool phase2 = death || lifeRatio <= phase2GateValue; float phase3GateValue = death ? 0.358f : revenge ? 0.275f : expertMode ? 0.22f : 0.138f; @@ -1531,9 +1543,6 @@ namespace CalamityMod.NPCs.Yharon if (!moveCloser) { - // When Yharon begins Phase 2, switch music to Roar of the Jungle Dragon. - Music = CalamityMod.Instance.GetMusicFromMusicMod("YharonP2") ?? MusicID.LunarBoss; - moveCloser = true; string key = "Mods.CalamityMod.FlameText"; @@ -1679,16 +1688,6 @@ namespace CalamityMod.NPCs.Yharon chargeSpeed *= velocityMult; } - // Increase aggressiveness while invincible. - if (invincible) - { - phaseSwitchTimer *= 0.5f; - acceleration *= 1.1f; - velocity *= 1.1f; - chargeTime -= 4f; - chargeSpeed *= 1.1f; - } - if (Main.getGoodWorld) phaseSwitchTimer *= 0.5f; @@ -2190,7 +2189,10 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 5f) { if (NPC.ai[1] == 1f) + { RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + SoundEngine.PlaySound(OrbSound, NPC.position); + } NPC.ai[1] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2828,7 +2830,7 @@ namespace CalamityMod.NPCs.Yharon normalOnly.Add(ModContent.ItemType(), 10); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 15, 22)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); @@ -2839,10 +2841,10 @@ namespace CalamityMod.NPCs.Yharon npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.AddIf(() => Main.masterMode || CalamityWorld.revenge, ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedYharon, ModContent.ItemType()); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedYharon, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void BossLoot(ref string name, ref int potionType) @@ -2878,7 +2880,8 @@ namespace CalamityMod.NPCs.Yharon #region On Hit Player public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 480, true); + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 480, true); } #endregion @@ -2903,7 +2906,7 @@ namespace CalamityMod.NPCs.Yharon public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = ImmunityCooldownID.Bosses; return true; } @@ -3042,6 +3045,13 @@ namespace CalamityMod.NPCs.Yharon #region Hit Effect public override void HitEffect(int hitDirection, double damage) { + // hit sound + if (NPC.soundDelay == 0) + { + NPC.soundDelay = Main.rand.Next(16, 20); + SoundEngine.PlaySound(HitSound, NPC.Center); + } + for (int k = 0; k < 5; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); diff --git a/Particles/AresSummonCrate.png b/Particles/AresSummonCrate.png new file mode 100644 index 0000000000..18e45a6672 Binary files /dev/null and b/Particles/AresSummonCrate.png differ diff --git a/Particles/AresSummonCrateParticle.cs b/Particles/AresSummonCrateParticle.cs new file mode 100644 index 0000000000..d79e48fd8f --- /dev/null +++ b/Particles/AresSummonCrateParticle.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using Terraria; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class AresSummonCrateParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/AresSummonCrate"; + public override bool UseCustomDraw => true; + + public AresSummonCrateParticle(Player owner, Vector2 velocity, int lifetime) + { + Position = owner.Center - Vector2.UnitY * 4f; + Scale = 1f; + Color = Color.White; + Velocity = velocity; + Rotation = 0f; + Lifetime = lifetime; + } + + public override void Update() + { + Rotation += Math.Sign(Velocity.X) * 0.05f; + Velocity.X *= 0.95f; + Velocity.Y += 0.24f; + if (Collision.SolidCollision(Position - Vector2.One * Scale * 19f, (int)(Scale * 38f), (int)(Scale * 38f), true)) + { + Velocity.X *= 0.8f; + Rotation = 0f; + Velocity.Y = 0f; + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + Color lightColor = Lighting.GetColor(Position.ToTileCoordinates()); + + int frameY = (int)Math.Round(MathHelper.Lerp(0f, 2f, (float)Math.Pow(LifetimeCompletion, 0.16f))); + Rectangle frame = texture.Frame(1, 3, 0, frameY); + float opacity = MathHelper.Clamp(1f - (float)Math.Pow(LifetimeCompletion, 7f), 0f, 1f); + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, lightColor * opacity, Rotation, frame.Size() * 0.5f, Scale, 0, 0); + } + } +} + + + + diff --git a/Particles/DesertProwlerSkull.png b/Particles/DesertProwlerSkull.png new file mode 100644 index 0000000000..b5b9d0fada Binary files /dev/null and b/Particles/DesertProwlerSkull.png differ diff --git a/Particles/DesertProwlerSkullParticle.cs b/Particles/DesertProwlerSkullParticle.cs new file mode 100644 index 0000000000..67a7da4384 --- /dev/null +++ b/Particles/DesertProwlerSkullParticle.cs @@ -0,0 +1,68 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class DesertProwlerSkullParticle : Particle + { + public override string Texture => "CalamityMod/Particles/DesertProwlerSkull"; + public override bool UseCustomDraw => true; + public override bool UseHalfTransparency => true; + + private float Opacity; + private Color ColorStart; + private Color ColorFade; + private float BaseOpacity; + + public DesertProwlerSkullParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity) + { + Position = position; + Velocity = velocity; + ColorStart = colorStart; + ColorFade = colorFade; + Scale = scale; + Opacity = opacity; + BaseOpacity = opacity; + Rotation = Main.rand.NextFloat(MathHelper.PiOver4 * 0.5f) - MathHelper.PiOver4 * 0.25f; + } + + public override void Update() + { + + Velocity *= 0.97f; + + if (Opacity > 90) + { + Lighting.AddLight(Position, Color.ToVector3() * 0.1f); + Scale += 0.01f; + Opacity -= 3; + } + else + { + Scale *= 1.01f; + Opacity -= 2f; + } + if (Opacity < 0) + Kill(); + + Color = Color.Lerp(ColorStart, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + } + + public CurveSegment UpsquashSegment = new CurveSegment(PolyOutEasing, 0f, 1f, 0.2f, 2); + public CurveSegment DownsquashSegment = new CurveSegment(PolyInEasing, 0.2f, 1.2f, -0.3f, 2); + public CurveSegment BumpSquashSegment = new CurveSegment(SineOutEasing, 0.3f, 0.9f, -0.05f); + public CurveSegment BumpSquash2Segment = new CurveSegment(SineInEasing, 0.6f, 0.85f, 0.15f); + public CurveSegment BumpSquash3Segment = new CurveSegment(SineBumpEasing, 0.76f, 1f, 0.05f); + public CurveSegment StaySegment = new CurveSegment(LinearEasing, 0.9f, 1f, 0f); + internal float Squash => PiecewiseAnimation(1 - Opacity / BaseOpacity, new CurveSegment[] { UpsquashSegment, DownsquashSegment, BumpSquashSegment, BumpSquash2Segment, BumpSquash3Segment, StaySegment }); + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D sprite = GeneralParticleHandler.GetTexture(Type); + Vector2 size = Scale * new Vector2(1 - (Squash - 1) * 0.8f, 1 + (Squash - 1) * 0.8f); + spriteBatch.Draw(sprite, Position - Main.screenPosition, null, Color, Rotation, sprite.Size() / 2f, size, 0, 0); + } + } +} diff --git a/Particles/DrainLine.png b/Particles/DrainLine.png new file mode 100644 index 0000000000..430443c614 Binary files /dev/null and b/Particles/DrainLine.png differ diff --git a/Particles/DrainLineBloom.png b/Particles/DrainLineBloom.png new file mode 100644 index 0000000000..ab1147d488 Binary files /dev/null and b/Particles/DrainLineBloom.png differ diff --git a/Particles/FusableParticleRenderLayer.cs b/Particles/FusableParticleRenderLayer.cs deleted file mode 100644 index 7f89e6258f..0000000000 --- a/Particles/FusableParticleRenderLayer.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace CalamityMod.Particles -{ - // The order of entries in this enumeration are in line with draw order - // e.g. the first entry is the first drawn thing, the last entry is the last drawn thing. - public enum FusableParticleRenderLayer - { - OverNPCsBeforeProjectiles, - OverPlayers, - OverWater - } -} diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 827da34280..1c8907b360 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -114,6 +114,11 @@ namespace CalamityMod.Particles public static void DrawAllParticles(SpriteBatch sb) { + if (particles.Count == 0) + return; + + sb.End(); + //Batch the particles to avoid constant restarting of the spritebatch foreach (Particle particle in particles) { @@ -183,6 +188,8 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles.Clear(); batchedNonPremultipliedParticles.Clear(); batchedAdditiveBlendParticles.Clear(); + + sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } /// diff --git a/Particles/HalfStar.png b/Particles/HalfStar.png index 758e4e84c6..7b968e3bab 100644 Binary files a/Particles/HalfStar.png and b/Particles/HalfStar.png differ diff --git a/Particles/ManaDrainBlobs.cs b/Particles/ManaDrainBlobs.cs new file mode 100644 index 0000000000..92384644fc --- /dev/null +++ b/Particles/ManaDrainBlobs.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Particles +{ + public class ManaDrainBlob : Particle + { + public override bool SetLifetime => false; + public override string Texture => "CalamityMod/Particles/MicroBloom"; + public override bool UseAdditiveBlend => true; + public override int FrameVariants => 2; + + public Player Owner; + + public ManaDrainBlob(Player owner, Vector2 position, Vector2 speed, float scale, Color color) + { + Owner = owner; + Position = position; + Scale = Math.Min(scale, 1f); + Color = color; + Velocity = speed; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Variant = Main.rand.Next(2); + } + + public override void Update() + { + Scale -= 0.02f; + if (Scale < 0.1f) + Kill(); + + Scale += 0.007f; + + if (Owner != null && Owner.active) + { + Vector2 speedDirection = Position - Owner.Center; + float distanceToOwner = speedDirection.Length(); + float distanceToOwnerTwisted = 100f - distanceToOwner; + + if (distanceToOwnerTwisted > 0f) + Scale -= distanceToOwnerTwisted * 0.0015f; + + speedDirection.Normalize(); + + float dustAcceleration = (1f - Scale) * -20f; + speedDirection *= dustAcceleration; + Velocity = (Velocity * 4f + speedDirection) / 5f; + + + if (distanceToOwner > 16) + { + + + if (Main.rand.NextBool(7)) + { + float velocityMultiplier = MathHelper.Lerp(0.05f, 1f, MathHelper.Clamp((distanceToOwner - 10f) / 40f, 0f, 1f)); + Dust chust = Dust.NewDustPerfect(Position, 15, Velocity * Main.rand.NextFloat(0.7f, 1.2f) * velocityMultiplier, Alpha: 100, Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + chust.noLight = true; + } + } + } + + Rotation += 0.04f * ((Velocity.X > 0) ? 1f : -1f); + } + } +} diff --git a/Particles/ManaDrainStreak.cs b/Particles/ManaDrainStreak.cs new file mode 100644 index 0000000000..e282a0713c --- /dev/null +++ b/Particles/ManaDrainStreak.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Particles +{ + public class ManaDrainStreak : Particle + { + public override string Texture => "CalamityMod/Particles/DrainLineBloom"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + public Player Owner; + public float StartDistanceFromPlayer; + public float FinalDistanceFromPlayer; + public Color StartColor; + public Color EndColor; + + public ManaDrainStreak(Player owner, float thickness, Vector2 startVector, float finalDistance, Color colorStart, Color colorEnd, int lifetime) + { + Owner = owner; + Scale = thickness; + Velocity = Vector2.Zero; + Rotation = startVector.ToRotation(); + StartDistanceFromPlayer = startVector.Length(); + FinalDistanceFromPlayer = finalDistance; + StartColor = colorStart; + EndColor = colorEnd; + Color = colorStart; + Lifetime = lifetime; + } + + public override void Update() + { + if (Owner == null || !Owner.active || Owner.dead) + return; + + Position = Owner.MountedCenter + Rotation.ToRotationVector2() * MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(LifetimeCompletion, 2)); + Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion); + Lighting.AddLight(Position, Color.ToVector3() * 0.2f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + + float currentDisplace = MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(LifetimeCompletion, 2)); + float earlierDisplace = MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(Math.Clamp(LifetimeCompletion - 0.2f, 0f, 1f), 2)); + + float lenght = (currentDisplace - earlierDisplace) / tex.Height; + Vector2 scale = new Vector2(Scale, lenght); + + Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); + + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation - MathHelper.PiOver2, origin, scale, SpriteEffects.None, 0); + + } + } +} diff --git a/Particles/BaseFusableParticleSet.cs b/Particles/Metaballs/BaseFusableParticleSet.cs similarity index 88% rename from Particles/BaseFusableParticleSet.cs rename to Particles/Metaballs/BaseFusableParticleSet.cs index 0f551a4a99..e1c43e51dc 100644 --- a/Particles/BaseFusableParticleSet.cs +++ b/Particles/Metaballs/BaseFusableParticleSet.cs @@ -3,9 +3,10 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; using Terraria.ID; -namespace CalamityMod.Particles +namespace CalamityMod.Particles.Metaballs { public abstract class BaseFusableParticleSet { @@ -48,17 +49,19 @@ namespace CalamityMod.Particles } } + internal List DrawDataBuffer = new(); + public List Particles = new(); public FusableParticleRenderCollection RenderCollection => FusableParticleManager.GetParticleRenderCollectionByType(GetType()); public List GetBackgroundTargets => RenderCollection.BackgroundTargets; + public void PrepareSpecialDrawingForNextFrame(params DrawData[] drawContents) => DrawDataBuffer.AddRange(drawContents); public virtual float BorderSize => 0f; public virtual bool BorderShouldBeSolid => false; public virtual Color BorderColor => Color.Transparent; public virtual void PrepareOptionalShaderData(Effect effect, int index) { } - public abstract FusableParticleRenderLayer RenderLayer { get; } public abstract List BackgroundShaders { get; } public abstract List BackgroundTextures { get; } public abstract FusableParticle SpawnParticle(Vector2 center, float sizeStrength); @@ -93,9 +96,16 @@ namespace CalamityMod.Particles // Draw the surviving particles. DrawParticles(); + // Draw all special contents in the draw buffer before clearing it. + foreach (DrawData drawData in DrawDataBuffer) + drawData.Draw(Main.spriteBatch); + Main.spriteBatch.End(); } + // Clear the special draw data buffer. + DrawDataBuffer.Clear(); + // Return to using the backbuffer after done drawing everything to the background targets. Main.instance.GraphicsDevice.SetRenderTarget(null); } diff --git a/Particles/FusableParticleManager.cs b/Particles/Metaballs/FusableParticleManager.cs similarity index 82% rename from Particles/FusableParticleManager.cs rename to Particles/Metaballs/FusableParticleManager.cs index 50989324a8..1ac9e5e85b 100644 --- a/Particles/FusableParticleManager.cs +++ b/Particles/Metaballs/FusableParticleManager.cs @@ -3,12 +3,13 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using Terraria; using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Particles.Metaballs.BaseFusableParticleSet; -using static CalamityMod.Particles.BaseFusableParticleSet; - -namespace CalamityMod.Particles +namespace CalamityMod.Particles.Metaballs { // NOTE: A lot of the functionalities within this system cannot under really any circumstance be used serverside. // This system is entirely visual. However, servers do not have drawing capabilities, nor even a proper GraphicsDevice @@ -20,7 +21,8 @@ namespace CalamityMod.Particles // TODO -- This can be made into a ModSystem. Its main thread load dependency with render targets is safe to put in OnModLoad. public static class FusableParticleManager { - internal static List ParticleSets = new List(); + internal static List ParticleSets = new(); + internal static List ExtraModsToLoadSetsFrom = new(); internal static bool HasBeenFormallyDefined = false; /// @@ -48,36 +50,50 @@ namespace CalamityMod.Particles // This does not happen during reloads, as that would delete particles outside of load-time. if (!reload) { - ParticleSets = new List(); + ParticleSets = new(); + ExtraModsToLoadSetsFrom = new(); HasBeenFormallyDefined = true; } + RegisterParticleSetsInMod(CalamityMod.Instance, width, height); + foreach (Mod m in ExtraModsToLoadSetsFrom) + RegisterParticleSetsInMod(m, width, height); + } + + internal static void RegisterParticleSetsInMod(Mod mod, int width, int height) + { // Look through every type in the mod, and check if it's derived from BaseFusableParticleSet. // If it is, create a default instance of said particle, save it, and create a RenderTarget2D for each individual texture/shader. - foreach (Type type in typeof(CalamityMod).Assembly.GetTypes()) + foreach (Type type in mod.Code.GetTypes()) { // Don't load abstract classes; they cannot have instances. if (type.IsAbstract) continue; if (type.IsSubclassOf(typeof(BaseFusableParticleSet))) - { - BaseFusableParticleSet instance = Activator.CreateInstance(type) as BaseFusableParticleSet; - List backgroundTargets = new List(); - - // Only generate render targets to use if this isn't called serverside. - if (Main.netMode != NetmodeID.Server) - { - for (int i = 0; i < instance.LayerCount; i++) - backgroundTargets.Add(new RenderTarget2D(Main.instance.GraphicsDevice, width, height, false, default, default, 0, RenderTargetUsage.PreserveContents)); - } - - FusableParticleRenderCollection particleRenderCollection = new FusableParticleRenderCollection(instance, backgroundTargets); - ParticleSets.Add(particleRenderCollection); - } + RegisterParticleSet(type, width, height); } } + internal static void RegisterParticleSet(Type t, int width, int height) + { + BaseFusableParticleSet instance = Activator.CreateInstance(t) as BaseFusableParticleSet; + List backgroundTargets = new List(); + + // Only generate render targets to use if this isn't called serverside. + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < instance.LayerCount; i++) + backgroundTargets.Add(new RenderTarget2D(Main.instance.GraphicsDevice, width, height, false, default, default, 0, RenderTargetUsage.PreserveContents)); + } + + FusableParticleRenderCollection particleRenderCollection = new FusableParticleRenderCollection(instance, backgroundTargets); + ParticleSets.Add(particleRenderCollection); + } + + internal static void RegisterParticleSet(int width, int height) where T : BaseFusableParticleSet => + RegisterParticleSet(typeof(T), width, height); + /// /// Unloads all render sets, disposing any created s in the process. /// @@ -92,6 +108,7 @@ namespace CalamityMod.Particles } HasBeenFormallyDefined = false; ParticleSets = null; + ExtraModsToLoadSetsFrom = null; } /// diff --git a/Particles/GruesomeEminenceParticleSet.cs b/Particles/Metaballs/GruesomeEminenceParticleSet.cs similarity index 95% rename from Particles/GruesomeEminenceParticleSet.cs rename to Particles/Metaballs/GruesomeEminenceParticleSet.cs index 9ca5e57928..16cb469ca1 100644 --- a/Particles/GruesomeEminenceParticleSet.cs +++ b/Particles/Metaballs/GruesomeEminenceParticleSet.cs @@ -7,16 +7,15 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.Particles +namespace CalamityMod.Particles.Metaballs { public class GruesomeEminenceParticleSet : BaseFusableParticleSet { public override float BorderSize => 3f; public override bool BorderShouldBeSolid => false; public override Color BorderColor => Color.Lerp(Color.Fuchsia, Color.Black, 0.55f) * 0.85f; - public override FusableParticleRenderLayer RenderLayer => FusableParticleRenderLayer.OverNPCsBeforeProjectiles; - public override List BackgroundShaders => new List() + public override List BackgroundShaders => new() { GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, @@ -24,7 +23,7 @@ namespace CalamityMod.Particles GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, }; - public override List BackgroundTextures => new List() + public override List BackgroundTextures => new() { ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer1").Value, ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer2").Value, diff --git a/Particles/RancorGroundLavaParticleSet.cs b/Particles/Metaballs/RancorGroundLavaParticleSet.cs similarity index 89% rename from Particles/RancorGroundLavaParticleSet.cs rename to Particles/Metaballs/RancorGroundLavaParticleSet.cs index 374877195c..0912a4141d 100644 --- a/Particles/RancorGroundLavaParticleSet.cs +++ b/Particles/Metaballs/RancorGroundLavaParticleSet.cs @@ -6,20 +6,19 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.Particles +namespace CalamityMod.Particles.Metaballs { public class RancorGroundLavaParticleSet : BaseFusableParticleSet { public override float BorderSize => 18f; public override bool BorderShouldBeSolid => false; public override Color BorderColor => Color.Lerp(Color.Yellow, Color.Red, 0.85f) * 0.85f; - public override FusableParticleRenderLayer RenderLayer => FusableParticleRenderLayer.OverWater; - public override List BackgroundShaders => new List() + public override List BackgroundShaders => new() { GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"].Shader, }; - public override List BackgroundTextures => new List() + public override List BackgroundTextures => new() { ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value, }; diff --git a/Particles/RancorLavaParticleSet.cs b/Particles/Metaballs/RancorLavaParticleSet.cs similarity index 88% rename from Particles/RancorLavaParticleSet.cs rename to Particles/Metaballs/RancorLavaParticleSet.cs index 91e3f923cc..1f42cdaec8 100644 --- a/Particles/RancorLavaParticleSet.cs +++ b/Particles/Metaballs/RancorLavaParticleSet.cs @@ -6,20 +6,19 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.Particles +namespace CalamityMod.Particles.Metaballs { public class RancorLavaParticleSet : BaseFusableParticleSet { public override float BorderSize => 18f; public override bool BorderShouldBeSolid => false; public override Color BorderColor => Color.Lerp(Color.Yellow, Color.Red, 0.85f) * 0.85f; - public override FusableParticleRenderLayer RenderLayer => FusableParticleRenderLayer.OverNPCsBeforeProjectiles; - public override List BackgroundShaders => new List() + public override List BackgroundShaders => new() { GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"].Shader, }; - public override List BackgroundTextures => new List() + public override List BackgroundTextures => new() { ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value, }; diff --git a/Particles/StreamGougeParticleSet.cs b/Particles/Metaballs/StreamGougeParticleSet.cs similarity index 90% rename from Particles/StreamGougeParticleSet.cs rename to Particles/Metaballs/StreamGougeParticleSet.cs index adde86fde7..be4a80e8a9 100644 --- a/Particles/StreamGougeParticleSet.cs +++ b/Particles/Metaballs/StreamGougeParticleSet.cs @@ -6,20 +6,19 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.Particles +namespace CalamityMod.Particles.Metaballs { public class StreamGougeParticleSet : BaseFusableParticleSet { public override float BorderSize => 3f; public override bool BorderShouldBeSolid => false; public override Color BorderColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f) * 0.85f; - public override FusableParticleRenderLayer RenderLayer => FusableParticleRenderLayer.OverNPCsBeforeProjectiles; - public override List BackgroundShaders => new List() + public override List BackgroundShaders => new() { GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, }; - public override List BackgroundTextures => new List() + public override List BackgroundTextures => new() { ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/StreamGougeLayer").Value, }; diff --git a/Particles/Metaballs/VoidGeneratorParticleSet.cs b/Particles/Metaballs/VoidGeneratorParticleSet.cs new file mode 100644 index 0000000000..fef4abab19 --- /dev/null +++ b/Particles/Metaballs/VoidGeneratorParticleSet.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Particles.Metaballs +{ + //This is basically just the Stream Gouge set but purple + public class VoidGeneratorParticleSet : BaseFusableParticleSet + { + public override float BorderSize => 3f; + public override bool BorderShouldBeSolid => false; + public override Color BorderColor => Color.Lerp(Color.Purple, Color.Black, 0.75f) * 0.85f; + + public override List BackgroundShaders => new List() + { + GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, + }; + public override List BackgroundTextures => new List() + { + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/StreamGougeLayer").Value, + }; + public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) + { + Particles.Add(new FusableParticle(center, sizeStrength)); + return Particles.Last(); + } + + public override void UpdateBehavior(FusableParticle particle) + { + particle.Size = MathHelper.Clamp(particle.Size - 1f, 0f, 200f) * 0.98f; + } + + public override void PrepareOptionalShaderData(Effect effect, int index) + { + switch (index) + { + // Background. + case 0: + Vector2 offset = Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.045f; + effect.Parameters["generalBackgroundOffset"].SetValue(offset); + effect.Parameters["upscaleFactor"].SetValue(Vector2.One * -0.3f); + break; + } + } + + public override void DrawParticles() + { + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/ExtraTextures/FusableParticleBase").Value; + foreach (FusableParticle particle in Particles) + { + Vector2 drawPosition = particle.Center - Main.screenPosition; + Vector2 origin = fusableParticleBase.Size() * 0.5f; + Vector2 scale = Vector2.One * particle.Size / fusableParticleBase.Size(); + Main.spriteBatch.Draw(fusableParticleBase, drawPosition, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Particles/MicroBloom.png b/Particles/MicroBloom.png new file mode 100644 index 0000000000..d3aff074d0 Binary files /dev/null and b/Particles/MicroBloom.png differ diff --git a/Particles/MiniSmoke.png b/Particles/MiniSmoke.png new file mode 100644 index 0000000000..ea65dcf059 Binary files /dev/null and b/Particles/MiniSmoke.png differ diff --git a/Particles/SandyDust.png b/Particles/SandyDust.png new file mode 100644 index 0000000000..61aa9036aa Binary files /dev/null and b/Particles/SandyDust.png differ diff --git a/Particles/SandyDustParticle.cs b/Particles/SandyDustParticle.cs new file mode 100644 index 0000000000..06b561e5cc --- /dev/null +++ b/Particles/SandyDustParticle.cs @@ -0,0 +1,51 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class SandyDustParticle : Particle + { + public override string Texture => "CalamityMod/Particles/SandyDust"; + public override bool UseHalfTransparency => false; //Doesn't actually use half transparency, but guarantees that it gets drawn above the bigger smoke clouds + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private float Spin; + private float opacity; + private Vector2 Gravity; + public Rectangle Frame; + + public SandyDustParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifeTime, float rotationSpeed = 1f, Vector2? gravity = null) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifeTime; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Spin = rotationSpeed; + Gravity = (Vector2)(gravity == null ? Vector2.Zero : gravity); + Variant = Main.rand.Next(12); + Frame = new Rectangle(Variant % 6 * 12, 12 + Variant / 6 * 12, 10, 10); + } + + public override void Update() + { + Velocity += Gravity; + opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.PiOver2 + MathHelper.PiOver2); + + Velocity *= 0.95f; + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + Scale *= 0.98f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D dustTexture = GeneralParticleHandler.GetTexture(Type); + spriteBatch.Draw(dustTexture, Position - Main.screenPosition, Frame, Color * opacity, Rotation, Frame.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/SlashSmear.png b/Particles/SlashSmear.png new file mode 100644 index 0000000000..2daf015434 Binary files /dev/null and b/Particles/SlashSmear.png differ diff --git a/Particles/SparkParticle.cs b/Particles/SparkParticle.cs index 0d60907f21..6ce225db8e 100644 --- a/Particles/SparkParticle.cs +++ b/Particles/SparkParticle.cs @@ -41,10 +41,11 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Vector2 scale = new Vector2(0.35f, 1.6f) * Scale; + Vector2 scale = new Vector2(0.5f, 1.6f) * Scale; Texture2D texture = ModContent.Request(Texture).Value; spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); } } } diff --git a/Particles/TechyHolosquare.png b/Particles/TechyHolosquare.png new file mode 100644 index 0000000000..8811f6eb9e Binary files /dev/null and b/Particles/TechyHolosquare.png differ diff --git a/Particles/TechyHolosquareParticle.cs b/Particles/TechyHolosquareParticle.cs new file mode 100644 index 0000000000..6a2562b249 --- /dev/null +++ b/Particles/TechyHolosquareParticle.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class TechyHoloysquareParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/TechyHolosquare"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + + internal Rectangle Frame; + public float Opacity; + public float OpacityMult; + + public TechyHoloysquareParticle(Vector2 position, Vector2 speed, float scale, Color color, int lifetime, float opacity = 1f) + { + Position = position; + Scale = scale; + Color = color; + Velocity = speed; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Opacity = opacity; + OpacityMult = opacity; + Variant = Main.rand.Next(6); + Lifetime = lifetime; + + switch (Variant) + { + case 0: + Frame = new Rectangle(8, 0, 6, 6); + break; + case 1: + Frame = new Rectangle(6, 8, 10, 6); + break; + case 2: + Frame = new Rectangle(4, 16, 14, 8); + break; + case 3: + Frame = new Rectangle(2, 26, 18, 10); + break; + case 4: + Frame = new Rectangle(2, 38, 18, 8); + break; + case 5: + Frame = new Rectangle(6, 48, 12, 12); + break; + } + } + + public override void Update() + { + Opacity = (float)Math.Pow(LifetimeCompletion, 0.5f) * OpacityMult; + Lighting.AddLight(Position, Color.ToVector3() * Opacity); + Rotation = Velocity.ToRotation(); + + Velocity *= 0.875f; + Scale *= 0.96f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D baseTex = GeneralParticleHandler.GetTexture(Type); + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX.RotatedBy(Rotation), 1.5f, delegate (Vector2 offset, Color colorMod) + { + spriteBatch.Draw(baseTex, Position + offset - Main.screenPosition, Frame, Color.MultiplyRGB(colorMod) * Opacity, Rotation, Frame.Size() / 2, Scale / 2f, SpriteEffects.None, 0); + }); + } + } +} diff --git a/Particles/TimedSmokeParticle.cs b/Particles/TimedSmokeParticle.cs new file mode 100644 index 0000000000..445bbcbdf6 --- /dev/null +++ b/Particles/TimedSmokeParticle.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Terraria; +using System; + +namespace CalamityMod.Particles +{ + public class TimedSmokeParticle : Particle + { + public override string Texture => "CalamityMod/Particles/MediumSmoke"; + public override bool SetLifetime => true; + public override int FrameVariants => 3; + + + private float Opacity; + private Color ColorStart; + private Color ColorFade; + private float Spin; + + public TimedSmokeParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity, int timeleft, float rotationSpeed = 0f) + { + Position = position; + Velocity = velocity; + ColorStart = colorStart; + ColorFade = colorFade; + Scale = scale; + Opacity = opacity; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Spin = rotationSpeed; + Lifetime = timeleft; + + Variant = Main.rand.Next(3); + } + + public override void Update() + { + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + Velocity *= 0.85f; + + if (LifetimeCompletion < 0.84f) + { + Scale += 0.01f; + } + else + { + Scale *= 0.975f; + } + + Velocity -= Vector2.UnitY * 0.08f; + + float opacityMult = 1 - (float)Math.Pow(LifetimeCompletion, 2); + Color = Color.Lerp(ColorStart, ColorFade, opacityMult) * (Opacity * opacityMult); + } + } +} diff --git a/Particles/WulfrumBastionParts.png b/Particles/WulfrumBastionParts.png new file mode 100644 index 0000000000..1ef46a52d2 Binary files /dev/null and b/Particles/WulfrumBastionParts.png differ diff --git a/Particles/WulfrumBastionPartsParticle.cs b/Particles/WulfrumBastionPartsParticle.cs new file mode 100644 index 0000000000..a96dc95a37 --- /dev/null +++ b/Particles/WulfrumBastionPartsParticle.cs @@ -0,0 +1,126 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class WulfrumBastionPartsParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/WulfrumBastionParts"; + public override bool UseCustomDraw => true; + + internal Rectangle Frame; + internal Vector2 DestinationOffset; + public Vector2 Offset; + public float RotationOffset; + public Player Owner; + public float TimeOffset; + public int AnimationTime; + public float LifetimeCompletionAdjusted => Math.Clamp((Time - Lifetime * TimeOffset) / (float)AnimationTime, 0, 1f); + + public WulfrumBastionPartsParticle(Player owner, int variant, int lifetime) + { + Offset = (-Vector2.UnitY * (40f + Main.rand.NextFloat(34f))).RotatedByRandom(MathHelper.PiOver4 * 0.04f); + Owner = owner; + Position = Owner.Center; + Scale = 1f; + Color = Color.White; + Velocity = Vector2.Zero; + Rotation = 0f; + RotationOffset = Main.rand.NextFloat(MathHelper.PiOver4 * 0f) * (Main.rand.NextBool() ? -1f : 1f); + Lifetime = lifetime; + AnimationTime = (int)(lifetime * 0.44f); + + switch (variant) + { + case 0: //Back leg + Frame = new Rectangle(46, 4, 10, 14); + DestinationOffset = new Vector2(7f, 16f); //1f? + TimeOffset = 0; + break; + case 1: //Front leg + Frame = new Rectangle(30, 4, 12, 14); + DestinationOffset = new Vector2(-4f, 16f); + TimeOffset = 0; + break; + case 2: //Bottom torso + Frame = new Rectangle(4, 30, 22, 12); + DestinationOffset = new Vector2(1f, 5f); + TimeOffset = 0.15f; + break; + case 3: //Torso + Frame = new Rectangle(30, 24, 30, 16); + DestinationOffset = new Vector2(1f, -3f); + TimeOffset = 0.35f; + break; + case 4: //Helmet + Frame = new Rectangle(2, 2, 22, 24); + DestinationOffset = new Vector2(-1f, -15f); + TimeOffset = 0.43f; + break; + case 5: //Fusion Cannon + Frame = new Rectangle(14, 46, 38, 18); + DestinationOffset = new Vector2(-2f, -2f); + TimeOffset = 0.6f; + break; + } + + Origin = Frame.Size() / 2; + + //Fusion Cannon rotates around the shoulder + if (variant == 5) + Origin.X -= 12f; + + } + + public override void Update() + { + Rotation = MathHelper.Lerp(RotationOffset, 0f, (float)Math.Pow(LifetimeCompletionAdjusted, 0.8f)); + + //The gun + if (TimeOffset == 0.6f) + Rotation = (Owner.Calamity().mouseWorld - Owner.Center).ToRotation() + (Owner.direction < 0 ? MathHelper.Pi : 0f); + + + if (Owner.dead || !Owner.active) + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + if (Owner.dead || !Owner.active) + return; + + Texture2D baseTex = GeneralParticleHandler.GetTexture(Type); + Vector2 center = new Vector2((int)Owner.MountedCenter.X, (int)(Owner.MountedCenter.Y + Owner.gfxOffY)); + Vector2 currentOffset = Vector2.Lerp(Offset, Vector2.Zero, (float)Math.Pow(LifetimeCompletionAdjusted, 0.8f)); + //Vector2 currentOffset = Vector2.Lerp(Offset, Vector2.Zero, 1f); + Color lightColor = Lighting.GetColor(Owner.Center.ToTileCoordinates()); + + Vector2 realDestinationOffset = new Vector2(DestinationOffset.X * Owner.direction, DestinationOffset.Y * Owner.gravDir); + Vector2 realCurrentOffset = new Vector2(currentOffset.X * Owner.direction, currentOffset.Y * Owner.gravDir); + + + SpriteEffects spriteEffect = SpriteEffects.None; + Vector2 origin = Origin; + + if (Owner.direction < 0) + { + spriteEffect = SpriteEffects.FlipHorizontally; + origin.X = Frame.Width - Origin.X; + } + + + float opacity = Math.Clamp(LifetimeCompletionAdjusted * 4f ,0f, 1f); + + spriteBatch.Draw(baseTex, center + realDestinationOffset + realCurrentOffset - Main.screenPosition, Frame, lightColor * opacity, Rotation, origin, Scale, spriteEffect, 0); + } + } +} + + + + diff --git a/Particles/WulfrumDroidEmote.cs b/Particles/WulfrumDroidEmote.cs new file mode 100644 index 0000000000..e4548ed528 --- /dev/null +++ b/Particles/WulfrumDroidEmote.cs @@ -0,0 +1,50 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class WulfrumDroidEmote : Particle + { + public override string Texture => "CalamityMod/Particles/WulfrumDroidEmotes"; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + public Rectangle Frame; + + public WulfrumDroidEmote(Vector2 position, Vector2 velocity, int lifeTime, float scale = 1f, int variant = -1) + { + Position = position; + Velocity = velocity; + Color = Color.White; + Scale = scale; + Lifetime = lifeTime; + Rotation = velocity.ToRotation() + MathHelper.PiOver2; + + if (variant == -1) + variant = Main.rand.Next(15); + + Frame = new Rectangle(16 * (variant % 8), 16 * (variant / 8), 16, 16); + } + + public override void Update() + { + Velocity *= 0.96f; + Scale *= 0.97f; + + Color lightColor = Frame.Y > 0 ? new Color(112, 244, 244) : new Color(194, 255, 62); + Lighting.AddLight(Position, lightColor.ToVector3()); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D emoteTexture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(Frame.Width / 2f, Frame.Height); + float opacity = 1 - (float)Math.Pow(LifetimeCompletion, 4f); + + spriteBatch.Draw(emoteTexture, Position - Main.screenPosition, Frame, Color * opacity, Rotation, origin, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/WulfrumDroidEmotes.png b/Particles/WulfrumDroidEmotes.png new file mode 100644 index 0000000000..8528061bbb Binary files /dev/null and b/Particles/WulfrumDroidEmotes.png differ diff --git a/Particles/WulfrumDroidSweatEmote.cs b/Particles/WulfrumDroidSweatEmote.cs new file mode 100644 index 0000000000..1b6ecbc941 --- /dev/null +++ b/Particles/WulfrumDroidSweatEmote.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class WulfrumDroidSweatEmote : Particle + { + public override string Texture => "CalamityMod/Particles/WulfrumDroidSweatEmote"; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + public WulfrumDroidSweatEmote(Vector2 position, Vector2 velocity, int lifeTime, float scale = 1f) + { + Position = position; + Velocity = velocity; + Color = Color.White; + Scale = scale; + Lifetime = lifeTime; + Rotation = velocity.ToRotation() + MathHelper.PiOver2; + + } + + public override void Update() + { + Velocity *= 0.96f; + Scale *= 0.97f; + Velocity.Y += 0.06f; + + Lighting.AddLight(Position, new Color(194, 255, 62).ToVector3()); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D emoteTexture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(emoteTexture.Width / 2f, emoteTexture.Height / 2f); + float opacity = 1 - (float)Math.Pow(LifetimeCompletion, 4f); + + SpriteEffects effect = Velocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(emoteTexture, Position - Main.screenPosition, null, Color * opacity, Rotation, origin, Scale, effect, 0); + } + } +} diff --git a/Particles/WulfrumDroidSweatEmote.png b/Particles/WulfrumDroidSweatEmote.png new file mode 100644 index 0000000000..8cb5164da2 Binary files /dev/null and b/Particles/WulfrumDroidSweatEmote.png differ diff --git a/Particles/WulfrumHat.png b/Particles/WulfrumHat.png new file mode 100644 index 0000000000..1a11e8e9ef Binary files /dev/null and b/Particles/WulfrumHat.png differ diff --git a/Particles/WulfrumHatParticle.cs b/Particles/WulfrumHatParticle.cs new file mode 100644 index 0000000000..e41b619957 --- /dev/null +++ b/Particles/WulfrumHatParticle.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Terraria; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class WulfrumHatParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/WulfrumHat"; + public override bool UseCustomDraw => true; + + public int Direction; + + public WulfrumHatParticle(Player owner, Vector2 velocity, int lifetime) + { + Position = owner.Center - Vector2.UnitY * 20f; + Direction = owner.direction; + Scale = 1f; + Color = Color.White; + Velocity = velocity; + Rotation = 0f; + Lifetime = lifetime; + } + + public override void Update() + { + Rotation += 0.05f * Math.Sign(Velocity.X); + + Velocity *= 0.95f; + Velocity.Y += 0.22f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D baseTex = GeneralParticleHandler.GetTexture(Type); + Color lightColor = Lighting.GetColor(Position.ToTileCoordinates()); + + SpriteEffects spriteEffect = SpriteEffects.None; + if (Direction < 0) + { + spriteEffect = SpriteEffects.FlipHorizontally; + } + + float opacity = Math.Clamp(1 - (float)Math.Pow(LifetimeCompletion , 3f), 0f, 1f); + spriteBatch.Draw(baseTex, Position - Main.screenPosition, null, lightColor * opacity, Rotation, baseTex.Size()/2f, Scale, spriteEffect, 0); + } + } +} + + + + diff --git a/Prefixes/RogueWeaponPrefix.cs b/Prefixes/RogueWeaponPrefix.cs index 344b611d79..6c6788a843 100644 --- a/Prefixes/RogueWeaponPrefix.cs +++ b/Prefixes/RogueWeaponPrefix.cs @@ -152,7 +152,7 @@ namespace CalamityMod.Prefixes valueMult *= extraValue; } - public override bool CanRoll(Item item) => item.CountsAsClass() && item.maxStack == 1 && GetType() != typeof(RogueWeaponPrefix); + public override bool CanRoll(Item item) => item.CanGetRoguePrefix() && GetType() != typeof(RogueWeaponPrefix); 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) { diff --git a/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs b/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs new file mode 100644 index 0000000000..7f0e3de2ce --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs @@ -0,0 +1,129 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + public abstract class BaseShortswordProjectile : ModProjectile + { + public enum ShortswordType + { + TypicalShortsword + } + + + #region Virtual Values + // Typical shortsword virtual values + public virtual float FadeInDuration => 7f; + public virtual float FadeOutDuration => 4f; + public virtual float TotalDuration => 16f; + public virtual Action EffectBeforePullback => null; + public virtual ShortswordType ShortswordAIType => ShortswordType.TypicalShortsword; + #endregion + + public float CollisionWidth => 4f * Projectile.scale; + public float FullUse => Timer / 14f; + public Player Owner => Main.player[Projectile.owner]; + + + public int Timer + { + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; + } + public virtual void Behavior() + { + Player player = Main.player[Projectile.owner]; + + if (ShortswordAIType == ShortswordType.TypicalShortsword && !player.frozen) + { + player.direction = Projectile.direction; + player.heldProj = Projectile.whoAmI; + player.itemTime = player.itemAnimation; + + + Timer += 1; + if (Timer >= TotalDuration) + { + Projectile.Kill(); + return; + } + else + { + player.heldProj = Projectile.whoAmI; + } + + // Fade in and out + Projectile.Opacity = Utils.GetLerpValue(0f, FadeInDuration, Timer, clamped: true) * Utils.GetLerpValue(TotalDuration, TotalDuration - FadeOutDuration, Timer, clamped: true); + + // If we haven't done the special effect yet (assuming there is one), do it. + // Note : Null Coalescing does not work in this case because we are invoking a method, not setting a value. + if (Projectile.localAI[0] == 0f && EffectBeforePullback != null && Main.myPlayer == Projectile.owner) + { + Projectile.localAI[0] = 1f; + EffectBeforePullback.Invoke(Projectile); + } + + // Keep locked onto the player, but extend further based on the given velocity (Requires ShouldUpdatePosition returning false to work) + Vector2 playerCenter = player.RotatedRelativePoint(player.MountedCenter, reverseRotation: false, addGfxOffY: false); + Projectile.Center = playerCenter + Projectile.velocity * (Timer - 1f); + + // Rotate the sprite + Projectile.Center = Owner.MountedCenter + OffsetFromPlayer; + Projectile.scale = 1f + (float)Math.Sin(FullUse * MathHelper.Pi) * 0.2f; + + // Set spriteDirection based on moving left or right. Left -1, right 1 + Projectile.spriteDirection = (Vector2.Dot(Projectile.velocity, Vector2.UnitX) >= 0f).ToDirectionInt(); + + // Point towards where it is moving, applied offset for top right of the sprite respecting spriteDirection + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 - MathHelper.PiOver4 * Projectile.spriteDirection; + + // The code in this method is important to align the sprite with the hitbox how we want it to + SetVisualOffsets(); + } + } + + public virtual void SetVisualOffsets() // Intentionally blank + { + + } + + public virtual void ExtraBehavior() // Intentionally blank + { + + } + + public override void AI() + { + Behavior(); + ExtraBehavior(); + } + + public override bool ShouldUpdatePosition() => false; + public CurveSegment ThrustSegment = new CurveSegment(LinearEasing, 0f, 0f, 1f, 3); + public CurveSegment HoldSegment = new CurveSegment(SineBumpEasing, 0.2f, 1f, 0.2f); + public CurveSegment RetractSegment = new CurveSegment(PolyOutEasing, 0.76f, 1f, -0.8f, 3); + public CurveSegment BumpSegment = new CurveSegment(SineBumpEasing, 0.9f, 0.2f, 0.15f); + internal float DistanceFromPlayer => PiecewiseAnimation(FullUse, new CurveSegment[] { ThrustSegment, HoldSegment, RetractSegment, BumpSegment }); + public Vector2 OffsetFromPlayer => Projectile.velocity * DistanceFromPlayer * 12f; + + public override void CutTiles() + { + // "cutting tiles" refers to breaking pots, grass, queen bee larva, etc. + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 start = Projectile.Center; + Vector2 end = start + Projectile.velocity.SafeNormalize(-Vector2.UnitY) * 10f; + Utils.PlotTileLine(start, end, CollisionWidth, DelegateMethods.CutTiles); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float collisionPoint = 0f; + float bladeLenght = 12f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + } + } +} diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index 5567bd7f86..8bf294bc78 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = BossRushEvent.BossRushActive ? 48 : timeLeft; } @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 360); @@ -228,10 +228,5 @@ namespace CalamityMod.Projectiles.Boss dust.noGravity = true; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 5566ee7a99..8d09fd1387 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = 600; } @@ -181,6 +181,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.OnFire, 360); target.AddBuff(BuffID.CursedInferno, 180); } @@ -276,10 +279,5 @@ namespace CalamityMod.Projectiles.Boss } } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index fbbf88a6af..821d89afe3 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -34,10 +34,12 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - // Ares' eight-pointed-star laser beams - DisplayName.SetDefault("Exo Overload Beam"); + // Ares' eight-pointed-star (more on higher difficulties) laser beams + DisplayName.SetDefault("Blenderbeam"); Main.projFrames[Projectile.type] = 5; ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + // This is its serious name + // DisplayName.SetDefault("Exo Overload Beam"); } public override void SetDefaults() @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -233,15 +235,13 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.OnFire, 360); target.AddBuff(BuffID.Frostburn, 360); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 05f680ce81..54fd5d092b 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = timeLeft; if (Main.getGoodWorld) @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.EnterShaderRegion(); Texture2D telegraphBase = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.4f * MathHelper.Clamp((1 - Projectile.timeLeft / (float)timeLeft) * 8f, 0, 1)); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.2f * MathHelper.Clamp((1 - Projectile.timeLeft / (float)timeLeft) * 8f, 0, 1)); GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(Color.Lerp(Color.Goldenrod, Color.Gold, 0.7f * (float)Math.Pow(0.5 + 0.5 * Math.Sin(Main.GlobalTimeWrappedHourly), 3))); GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Lerp(Color.Yellow, Color.White, 0.5f)); GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(1 - Projectile.timeLeft / (float)timeLeft); @@ -158,11 +158,11 @@ namespace CalamityMod.Projectiles.Boss GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply(); Vector2 drawPosition = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, 1070f, 0, 0); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, 1480f, 0, 0); Main.spriteBatch.ExitShaderRegion(); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; } @@ -209,10 +209,5 @@ namespace CalamityMod.Projectiles.Boss } } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs index 249b0644a5..7e4fbff6e0 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss //It only fades out near the end else - opacity = (float)Math.Cos(((completion - 0.8f) / 0.2f * MathHelper.Pi) / 2f); ; + opacity = (float)Math.Cos((completion - 0.8f) / 0.2f * MathHelper.Pi / 2f); return opacity * 0.85f; } @@ -42,15 +42,18 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = Lifetime; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void PostAI() => Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius * Projectile.scale * 0.4f, target.Hitbox) && Projectile.timeLeft > 6; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => target.Calamity().lastProjectileHit = Projectile; - - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(BuffID.OnFire, 480); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + target.AddBuff(BuffID.OnFire, 480); + } } } diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs index 25f8f4dd8f..e5f34497f7 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.penetrate = -1; Projectile.timeLeft = timeLeft; } @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 180); @@ -93,10 +93,5 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.png b/Projectiles/Boss/AresGaussNukeProjectileSpark.png index 7424a71ed9..593e2629cb 100644 Binary files a/Projectiles/Boss/AresGaussNukeProjectileSpark.png and b/Projectiles/Boss/AresGaussNukeProjectileSpark.png differ diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index 25f202d246..e358187a83 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -231,14 +231,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index 3522bd73f3..a53f0b4dfb 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Boss { private const int timeLeft = 360; - private const float maxVelocity = 12f; + private const float maxVelocity = 10f; public override void SetStaticDefaults() { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.penetrate = -1; Projectile.extraUpdates = 1; Projectile.timeLeft = timeLeft; @@ -37,11 +37,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // 22 frames starting at 0.5 - // 17 frames starting at 1 if (Projectile.velocity.Length() < maxVelocity) { - Projectile.velocity *= 1.075f; + Projectile.velocity *= 1.025f; if (Projectile.velocity.Length() > maxVelocity) { Projectile.velocity.Normalize(); @@ -74,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 180); @@ -89,10 +87,5 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index c721d21a57..cfc6df15e0 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = BossRushEvent.BossRushActive ? 96 : timeLeft; } @@ -94,7 +94,6 @@ namespace CalamityMod.Projectiles.Boss Dust dust = Main.dust[num54]; dust.velocity *= 3f; - dust = Main.dust[num54]; num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; @@ -105,8 +104,6 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num54].noGravity = true; Main.dust[num54].fadeIn = 1f; Main.dust[num54].color = Color.Green * 0.5f; - - dust = Main.dust[num54]; } for (int num55 = 0; num55 < 20; num55++) { @@ -122,7 +119,6 @@ namespace CalamityMod.Projectiles.Boss Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; - dust = Main.dust[num56]; } } } @@ -131,7 +127,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.OnFire, 360); @@ -236,10 +232,5 @@ namespace CalamityMod.Projectiles.Boss dust.noGravity = true; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 7944b5ff13..18aee9c68b 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = timeLeft; } @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Electrified, 240); @@ -258,10 +258,5 @@ namespace CalamityMod.Projectiles.Boss return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index c640513dad..07e401693d 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -47,12 +47,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; - CooldownSlot = 1; + Projectile.timeLeft = 1200; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) { + writer.Write(Projectile.extraUpdates); writer.Write(TelegraphDelay); writer.WriteVector2(Destination); writer.WriteVector2(Velocity); @@ -60,6 +61,7 @@ namespace CalamityMod.Projectiles.Boss public override void ReceiveExtraAI(BinaryReader reader) { + Projectile.extraUpdates = reader.ReadInt32(); TelegraphDelay = reader.ReadSingle(); Destination = reader.ReadVector2(); Velocity = reader.ReadVector2(); @@ -110,6 +112,17 @@ namespace CalamityMod.Projectiles.Boss Projectile.netUpdate = true; } + // Accelerate to max velocity. + if (Projectile.velocity.Length() < LaserVelocity) + { + Projectile.velocity *= 1.0125f; + if (Projectile.velocity.Length() > LaserVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= LaserVelocity; + } + } + // Direction and rotation. if (Projectile.velocity.X < 0f) { @@ -134,7 +147,7 @@ namespace CalamityMod.Projectiles.Boss // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; - Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + Velocity = Vector2.Normalize(projectileDestination); // Set velocity to zero. Projectile.velocity = Vector2.Zero; @@ -161,7 +174,7 @@ namespace CalamityMod.Projectiles.Boss // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; - Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + Velocity = Vector2.Normalize(projectileDestination); // Direction and rotation. if (Projectile.velocity.X < 0f) @@ -183,13 +196,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (TelegraphDelay > TelegraphTotalTime) - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0 || TelegraphDelay <= TelegraphTotalTime) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/ArtemisSpinLaserbeam.cs b/Projectiles/Boss/ArtemisSpinLaserbeam.cs index 7996fa9d3e..c7f5a73125 100644 --- a/Projectiles/Boss/ArtemisSpinLaserbeam.cs +++ b/Projectiles/Boss/ArtemisSpinLaserbeam.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -155,14 +155,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 72cca5d43e..c68c8300f7 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -106,6 +106,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Boss/AstralGodRay.cs b/Projectiles/Boss/AstralGodRay.cs index 57527d9fce..9796292e82 100644 --- a/Projectiles/Boss/AstralGodRay.cs +++ b/Projectiles/Boss/AstralGodRay.cs @@ -105,6 +105,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index b9e2f0489a..2e2a48ce2f 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -82,6 +82,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.timeLeft >= 85) target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 9bffd81d5b..063ab4f2bd 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -74,6 +74,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index eae72c917c..eb8670e4f8 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss { public class BigFlare : ModProjectile { + public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { DisplayName.SetDefault("Big Flare"); @@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 9ed09750f0..d823342575 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss { public class BigFlare2 : ModProjectile { + public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { DisplayName.SetDefault("Big Flare"); @@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 9385b65900..7f984af964 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class BloodGeyser : ModProjectile @@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Geyser"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() @@ -19,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 12; Projectile.hostile = true; Projectile.tileCollide = false; - Projectile.timeLeft = 420; + Projectile.timeLeft = 600; Projectile.penetrate = 1; } @@ -34,18 +37,27 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - Projectile.velocity.Y += 0.06f; + if (Projectile.velocity.Y < 12f) + Projectile.velocity.Y += 0.06f; + Projectile.velocity.X *= 0.995f; } public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(ref Color lightColor) { - return new Color(250, 50, 50, Projectile.alpha); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; } } } diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 4a2a11a233..e3ed3f7d34 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -19,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss for (int num468 = 0; num468 < 2; num468++) { Vector2 dspeed = -Projectile.velocity * 0.7f; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.1f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 150, default, 1.1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } @@ -39,6 +40,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index aab3922b27..e180fb8247 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 690; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; if (Projectile.ai[0] == 0f || Main.getGoodWorld) @@ -108,10 +108,5 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index cbc39c8866..ce21bd9057 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -22,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.extraUpdates = 3; Projectile.timeLeft = 90; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -70,6 +71,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index af5dfe7fd9..6a1d6a2fa1 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 255; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.timeLeft < 51) + if (damage <= 0 || Projectile.timeLeft < 51) return; if (Projectile.ai[0] == 0f || Main.getGoodWorld) @@ -97,10 +97,5 @@ namespace CalamityMod.Projectiles.Boss Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index af629558c0..2f95c3d692 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 1500; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -37,8 +38,8 @@ namespace CalamityMod.Projectiles.Boss // Cal Clone bullet hell projectiles accelerate after a certain time has passed if (Projectile.ai[0] == 2f && Main.expertMode && Projectile.timeLeft < 1260) { - if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 10f : 8f)) - Projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 15f : 10f)) + Projectile.velocity *= 1.005f; } Projectile.frameCounter++; @@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; if (Projectile.ai[0] == 0f || Main.getGoodWorld) @@ -92,10 +93,5 @@ namespace CalamityMod.Projectiles.Boss else target.AddBuff(ModContent.BuffType(), 180); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 6c73872a6b..3bd2bb7d17 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -28,11 +28,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.alpha = 255; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() { + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) + Projectile.tileCollide = true; + // Animation Projectile.frameCounter++; if (Projectile.frameCounter > 9) @@ -83,6 +86,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 9b9d36e557..784abd6ed0 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -8,9 +8,9 @@ using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using System.IO; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; - +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 36000; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 300, true); @@ -189,10 +189,5 @@ namespace CalamityMod.Projectiles.Boss behindProjectiles.Add(index); behindNPCs.Add(index); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 38af2dc2fe..d641130912 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -227,14 +227,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 841994110f..11e1bf2c17 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -174,10 +174,5 @@ namespace CalamityMod.Projectiles.Boss } return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index bee535ca58..e968379b58 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 1200; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -82,15 +83,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 120, true); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 45af5bac7d..6083e367ff 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -82,6 +82,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.Opacity == 1f) target.AddBuff(BuffID.VortexDebuff, 60); } @@ -109,10 +112,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num624].velocity *= 2f; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index c7dc8a6559..67d765f674 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -84,6 +84,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.Opacity == 1f) target.AddBuff(BuffID.VortexDebuff, 60); } @@ -111,10 +114,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num624].velocity *= 2f; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 1305081977..2cc7d60747 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 3600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -548,6 +548,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); //target.AddBuff(ModContent.BuffType(), 300, true); } @@ -557,10 +560,5 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index 7076446e6f..4b8f94cd19 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -60,6 +60,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.CursedInferno, 120); } } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 33cbb0ec04..44ddb8e286 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -60,6 +60,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Electrified, 60); } } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index b61cf42fb1..0efb77de77 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.timeLeft > MaxTimeLeft - FadeTime || (Projectile.timeLeft < FadeTime && Projectile.ai[0] == 0f)) + if (damage <= 0 || Projectile.timeLeft > MaxTimeLeft - FadeTime || (Projectile.timeLeft < FadeTime && Projectile.ai[0] == 0f)) return; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index dd21a9aecf..b60268f169 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -82,10 +82,5 @@ namespace CalamityMod.Projectiles.Boss } return new Color(255, 255, 255, 100); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 7e547bb705..f179c759eb 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -143,10 +143,5 @@ namespace CalamityMod.Projectiles.Boss } return new Color(255, 255, 255, 100); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index c77708ddca..2eea89e07f 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.extraUpdates = 3; Projectile.timeLeft = 780; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -98,6 +98,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (TelegraphDelay > TelegraphTotalTime) target.AddBuff(ModContent.BuffType(), 180); } @@ -107,11 +110,6 @@ namespace CalamityMod.Projectiles.Boss return new Color(255, 255, 255, Projectile.alpha); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } - public override bool PreDraw(ref Color lightColor) { if (TelegraphDelay >= TelegraphTotalTime) diff --git a/Projectiles/Boss/DoGDeathBoom.cs b/Projectiles/Boss/DoGDeathBoom.cs index 87257fc292..2c6d9186f6 100644 --- a/Projectiles/Boss/DoGDeathBoom.cs +++ b/Projectiles/Boss/DoGDeathBoom.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = Lifetime; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void PostAI() diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 61098a51b3..70f82a2d52 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.extraUpdates = 1; Projectile.penetrate = -1; Projectile.timeLeft = 480; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -74,6 +74,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 240); } @@ -104,10 +107,5 @@ namespace CalamityMod.Projectiles.Boss } Projectile.Damage(); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 577839a889..7ac2b9d552 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -66,12 +66,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 77b1b95753..68e0374128 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Boss { public class Flare : ModProjectile { + public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 9b0790e9bd..94b6ddd164 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.alpha = 50; Projectile.timeLeft = 180; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -189,12 +189,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 989142de27..14130e79d0 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 680; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -213,15 +213,13 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.ai[0] == 3f) target.AddBuff(ModContent.BuffType(), 240); else target.AddBuff(ModContent.BuffType(), 240); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index e4f8741248..7a1c7b5c8b 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 840; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -133,12 +133,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 2f4276b6e2..210f68e79c 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -140,13 +141,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.timeLeft <= 480) target.AddBuff(ModContent.BuffType(), 360); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 53e8e130d2..b6e1e3b277 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Frostburn, 180, true); diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 954e6ecd55..45cb75b101 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; } @@ -80,6 +80,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.velocity *= 0.5f; } diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index 4fdcf7dc4b..eaecada6ab 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 180; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -107,6 +107,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 337bcb2d31..2b2a3e6945 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -165,6 +165,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 240); } } diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 76be09e805..6f9aebdcd8 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.timeLeft = 120; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -97,23 +97,20 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.owner == Main.myPlayer) { - Vector2 shootFromVector = new Vector2(Projectile.Center.X, Projectile.Center.Y); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - float velocity = 5f; - int totalProjectiles = (!Main.dayTime || BossRushEvent.BossRushActive) ? 5 : 4; + int totalProjectiles = (!Main.dayTime || BossRushEvent.BossRushActive) ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = (int)Math.Round(Projectile.damage * 0.75); - for (int i = 0; i < totalProjectiles; i++) + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), type, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), type, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + Projectile.velocity * 0.25f, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); } } + SoundEngine.PlaySound(ImpactSound, Projectile.Center); + int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num193 = 0; num193 < 4; num193++) { @@ -132,13 +129,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 480); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 62e36bf661..733ae10a1f 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 250; Projectile.penetrate = -1; Projectile.tileCollide = false; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -122,13 +122,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 240); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index b3ccac3aad..92d07da91a 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.alpha = 255; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; Projectile.penetrate = 1; Projectile.timeLeft = 200; Projectile.Calamity().DealsDefenseDamage = true; @@ -114,14 +114,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 180); Projectile.Kill(); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/HolyExplosionBoom.cs b/Projectiles/Boss/HolyExplosionBoom.cs index ed44ce58cf..81951fb456 100644 --- a/Projectiles/Boss/HolyExplosionBoom.cs +++ b/Projectiles/Boss/HolyExplosionBoom.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = Lifetime; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void PostAI() diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 021e6df9ea..5ea56be1cc 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.alpha = 255; Projectile.penetrate = -1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.tileCollide = false; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -116,13 +116,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 120); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 2a49923ad2..fba0d50008 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -111,13 +111,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 120); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 130834534c..88662a6a85 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.extraUpdates = 1; Projectile.timeLeft = 840; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -115,13 +115,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 180); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 2e6c6c530b..b5d35d1447 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 200; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -173,13 +173,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 180); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 1a550e5092..0aed6497c4 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class IceBlast : ModProjectile { + private const int TimeLeft = 600; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Blast"); @@ -19,14 +21,38 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 10; Projectile.height = 10; + Projectile.scale = 1.2f; Projectile.penetrate = -1; Projectile.hostile = true; Projectile.coldDamage = true; - Projectile.timeLeft = 300; + Projectile.timeLeft = TimeLeft; } public override void AI() { + if (Projectile.ai[1] == 1f) + { + float spreadOutCutoffTime = TimeLeft - 90; + float homeInCutoffTime = TimeLeft - 165; + float minAcceleration = 0.05f; + float maxAcceleration = 0.1f; + float homingVelocity = 20f; + + if (Projectile.timeLeft > homeInCutoffTime && Projectile.timeLeft <= spreadOutCutoffTime) + { + int playerIndex = (int)Projectile.ai[0]; + Vector2 velocity = Projectile.velocity; + if (Main.player.IndexInRange(playerIndex)) + { + Player player = Main.player[playerIndex]; + velocity = Projectile.DirectionTo(player.Center) * homingVelocity; + } + + float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, Projectile.timeLeft, clamped: true)); + Projectile.velocity = Vector2.SmoothStep(Projectile.velocity, velocity, amount); + } + } + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -38,40 +64,18 @@ namespace CalamityMod.Projectiles.Boss Dust dust = Main.dust[num323]; dust.velocity *= 0.3f; } - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale += 0.01f; - Projectile.alpha -= 50; - if (Projectile.alpha <= 0) - { - Projectile.localAI[0] = 1f; - Projectile.alpha = 0; - } - } - else - { - Projectile.scale -= 0.01f; - Projectile.alpha += 50; - if (Projectile.alpha >= 255) - { - Projectile.localAI[0] = 0f; - Projectile.alpha = 255; - } - } } public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) { int num497 = 5; SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - int num3; - for (int num498 = 0; num498 < num497; num498 = num3 + 1) + for (int num498 = 0; num498 < num497; num498++) { int num499 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); if (Main.rand.Next(3) != 0) @@ -87,12 +91,14 @@ namespace CalamityMod.Projectiles.Boss Dust dust = Main.dust[num499]; dust.scale *= 0.5f; } - num3 = num498; } } public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Frostburn, 120, true); target.AddBuff(BuffID.Chilled, 60, true); } diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index be196f9359..b2fa2e62d0 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 30; Projectile.height = 30; - Projectile.scale = 0.5f; + Projectile.scale = 0.6f; Projectile.hostile = true; Projectile.coldDamage = true; Projectile.penetrate = 1; @@ -33,27 +33,6 @@ namespace CalamityMod.Projectiles.Boss { Projectile.velocity *= 0.98f; - if (Projectile.localAI[0] == 0f) - { - Projectile.scale += 0.01f; - Projectile.alpha -= 50; - if (Projectile.alpha <= 0) - { - Projectile.localAI[0] = 1f; - Projectile.alpha = 0; - } - } - else - { - Projectile.scale -= 0.01f; - Projectile.alpha += 50; - if (Projectile.alpha >= 255) - { - Projectile.localAI[0] = 0f; - Projectile.alpha = 255; - } - } - if (Projectile.ai[0] < 120f) { Projectile.ai[0] += 1f; @@ -78,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num624].velocity *= 2f; } - Projectile.scale = 1f; + Projectile.scale = 1.2f; Projectile.ExpandHitboxBy((int)(30f * Projectile.scale)); SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); } @@ -87,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) @@ -115,6 +94,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.ai[0] >= 120f) { target.AddBuff(BuffID.Frostburn, 180, true); diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index b86f0f0068..d4016bce7a 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 10; Projectile.height = 10; + Projectile.scale = 1.2f; Projectile.hostile = true; Projectile.coldDamage = true; Projectile.penetrate = -1; @@ -80,32 +81,11 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Y > 6f) Projectile.velocity.Y = 6f; } - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale += 0.01f; - Projectile.alpha -= 50; - if (Projectile.alpha <= 0) - { - Projectile.localAI[0] = 1f; - Projectile.alpha = 0; - } - } - else - { - Projectile.scale -= 0.01f; - Projectile.alpha += 50; - if (Projectile.alpha >= 255) - { - Projectile.localAI[0] = 0f; - Projectile.alpha = 255; - } - } } public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + return new Color(255, 255, 255, Projectile.alpha); } public override void Kill(int timeLeft) @@ -122,6 +102,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Frostburn, 120, true); target.AddBuff(BuffID.Chilled, 60, true); } diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index af5baa4841..4fcc9588ed 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -194,6 +194,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.localAI[1] <= 900f && Projectile.localAI[1] > 120f) target.AddBuff(BuffID.Ichor, 240); } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 224c6e89f8..cea2b94a31 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Boss { DisplayName.SetDefault("Ichor Shot"); Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() @@ -20,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 12; Projectile.hostile = true; Projectile.tileCollide = false; - Projectile.timeLeft = 420; + Projectile.timeLeft = 600; Projectile.penetrate = 1; } @@ -44,18 +46,27 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - Projectile.velocity.Y += 0.06f; + if (Projectile.velocity.Y < 12f) + Projectile.velocity.Y += 0.06f; + Projectile.velocity.X *= 0.995f; } public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Ichor, 180); } - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(ref Color lightColor) { - return new Color(200, 200, 50, Projectile.alpha); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; } } } diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index a7eeed3d50..6d1aeeaf5a 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.timeLeft = 720; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -142,13 +143,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.timeLeft <= 600) target.AddBuff(ModContent.BuffType(), 600); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 08f2d8e567..a0f7fe6664 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.timeLeft = 840; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -142,13 +143,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.timeLeft <= 720) target.AddBuff(ModContent.BuffType(), 600); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index 57e66810a0..e91c7196a0 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.timeLeft = 360000; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -106,12 +106,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 600); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 600); } } } diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index b0f22d76af..dd1ae9dc62 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -35,8 +35,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color drawColor) => new Color(255, 50, 50, 0); - public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Dig, Projectile.position); @@ -52,6 +50,9 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index ef4d6b675a..cc8c1d7494 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -66,6 +66,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } diff --git a/Projectiles/Boss/LeviathanSpawner.cs b/Projectiles/Boss/LeviathanSpawner.cs index 7879443426..ba998753ec 100644 --- a/Projectiles/Boss/LeviathanSpawner.cs +++ b/Projectiles/Boss/LeviathanSpawner.cs @@ -2,13 +2,13 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Shaders; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; using LeviathanNPC = CalamityMod.NPCs.Leviathan.Leviathan; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -16,6 +16,8 @@ namespace CalamityMod.Projectiles.Boss { internal ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static readonly SoundStyle RumbleSound = new("CalamityMod/Sounds/Custom/LeviathanRumble"); public override void SetStaticDefaults() { DisplayName.SetDefault("Spawner"); @@ -41,9 +43,13 @@ namespace CalamityMod.Projectiles.Boss Main.LocalPlayer.Calamity().GeneralScreenShakePower = (float)Math.Pow(Utils.GetLerpValue(180f, 290f, Time, true), 0.3D) * 6f; Main.LocalPlayer.Calamity().GeneralScreenShakePower += CalamityUtils.Convert01To010((float)Math.Pow(Utils.GetLerpValue(300f, 440f, Time, true), 0.5D)) * 10f; + if (Projectile.timeLeft % 180 == 0) + { + SoundEngine.PlaySound(RumbleSound, Projectile.Center); + } + if (Projectile.timeLeft == 45) { - SoundEngine.PlaySound(LeviathanNPC.RoarChargeSound, Projectile.Center); if (Main.netMode != NetmodeID.Server) { WaterShaderData ripple = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index c60cf8dadf..cea5938296 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.timeLeft = 90; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -141,13 +141,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 240); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 1222c06862..09923d8aee 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 900; Projectile.scale = 1.5f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -105,13 +105,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 120); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 9f44f76561..a9f4540872 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 480; - Projectile.aiStyle = 1; + Projectile.timeLeft = 600; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.WoodenArrowFriendly; } @@ -35,15 +35,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; } if (Projectile.frame > 3) - { Projectile.frame = 0; - } - if (Projectile.timeLeft < 90) - { + + if (Projectile.position.Y > Projectile.ai[1]) Projectile.tileCollide = true; - } + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - Projectile.velocity.X *= 0.99f; + + Projectile.velocity.X *= 0.995f; } public override bool PreDraw(ref Color lightColor) @@ -78,23 +77,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 20; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) + for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + Main.dust[num622].velocity *= 1.5f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 20; num623++) + for (int num623 = 0; num623 < 12; num623++) { int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index feff60000b..9c00e8435b 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -25,9 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 480; - Projectile.aiStyle = 1; - AIType = ProjectileID.WoodenArrowFriendly; + Projectile.timeLeft = 600; } public override void AI() @@ -41,19 +39,24 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.timeLeft < 90) + if (Projectile.position.Y > Projectile.ai[1]) Projectile.tileCollide = true; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - if (Math.Abs(Projectile.velocity.X) > 2f) - Projectile.velocity.X *= 0.99f; + float velocityYLimit = BossRushEvent.BossRushActive ? 12f : CalamityWorld.death ? 6f : 5f; + float velocityYIncrement = BossRushEvent.BossRushActive ? 0.24f : CalamityWorld.death ? 0.12f : 0.1f; + if (Projectile.velocity.Y < velocityYLimit) + Projectile.velocity.Y += velocityYIncrement; - float velocityYLimit = BossRushEvent.BossRushActive ? 10f : CalamityWorld.death ? 6f : 5f; - if (Projectile.velocity.Y > velocityYLimit) - Projectile.velocity.Y = velocityYLimit; + if (Math.Abs(Projectile.velocity.X) > 2f) + Projectile.velocity.X *= 0.995f; } + public override bool CanHitPlayer(Player target) => Projectile.velocity.Y >= 0f; + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; @@ -86,23 +89,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 20; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) + for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + Main.dust[num622].velocity *= 1.5f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 20; num623++) + for (int num623 = 0; num623 < 12; num623++) { int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); } } } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index a74823c733..5d3d053249 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.alpha = 255; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -88,12 +88,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs index 02ffc5c644..903949181b 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Main.rand.NextBool(2)) { // 1 to 3 seconds of poisoned diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index e1b729951e..e893324ded 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 1800; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss } float distanceRequired = 800f * Projectile.scale; - float succPower = 0.4f; + float succPower = 0.5f; for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[i]; @@ -118,11 +118,6 @@ namespace CalamityMod.Projectiles.Boss player.velocity.X += succPower * multiplier; else player.velocity.X -= succPower * multiplier; - - if (player.Center.Y < Projectile.Center.Y) - player.velocity.Y += succPower * multiplier; - else - player.velocity.Y -= succPower * multiplier; } } } @@ -141,13 +136,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.timeLeft <= 1680 && Projectile.timeLeft > 85) target.AddBuff(ModContent.BuffType(), 600); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index 5254177d1c..2f2e0b30b5 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -207,6 +207,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 420); } } diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 10e1314144..ba381585c7 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -118,12 +118,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index 246c1bda48..919dae087f 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -118,12 +118,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index ef74fd2787..6668664d6e 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -72,6 +72,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } @@ -79,10 +82,5 @@ namespace CalamityMod.Projectiles.Boss { return new Color(100, 250, 250, Projectile.alpha); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 9ef7533dbe..61dafcf82d 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -72,6 +72,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } @@ -79,10 +82,5 @@ namespace CalamityMod.Projectiles.Boss { return new Color(100, 250, 250, Projectile.alpha); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index 69727f966a..1f155c2266 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.timeLeft = 480; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -83,16 +83,14 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.velocity.Length() >= Projectile.ai[0]) { target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index f0ccf2375c..d7aa02ddaf 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.alpha = 255; Projectile.penetrate = -1; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -75,12 +75,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index c582453912..efe702b61f 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.ignoreWater = true; Projectile.alpha = 255; Projectile.penetrate = -1; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -75,12 +75,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index b6bccfd496..558c34d979 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -65,6 +65,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index eb87e0b5de..078e3e73a8 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -88,12 +88,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index c9b8942cd6..95f13b11e5 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.penetrate = -1; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -142,10 +142,5 @@ namespace CalamityMod.Projectiles.Boss } return false; } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 639ab934d1..8e20c1d772 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -203,10 +203,5 @@ namespace CalamityMod.Projectiles.Boss { return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 14a95a76e3..5d809207f4 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -210,15 +210,13 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 600); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 1cb41c2c66..a02985c451 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.extraUpdates = BossRushEvent.BossRushActive ? 2 : 1; } @@ -48,6 +48,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Frostburn, 180); } } diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index 0919fb2642..296ae12246 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -171,12 +171,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Electrified, 120); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(BuffID.Electrified, 120); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 67b96d1278..d636e11651 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -125,15 +125,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Electrified, 60); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index c149b0cfd4..287df1e445 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.Opacity = 0f; Projectile.timeLeft = 150; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 180, true); @@ -108,19 +108,25 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(ImpactSound, Projectile.Center); + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + if (Projectile.ai[1] == 0f) { - float spread = 45f * MathHelper.PiOver2 * 0.01f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 8; i++) + int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 7f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 1f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 1f); + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 1f); } } } @@ -136,10 +142,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[redFire].noGravity = true; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index bc04564d18..b78ba96b91 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 120; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -83,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 180, true); @@ -93,19 +95,25 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(ImpactSound, Projectile.Center); + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + if (Projectile.ai[1] == 0f) { - float spread = 12f * MathHelper.PiOver2 * 0.01f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 30f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 30; i++) + int totalProjectiles = bossRush ? 44 : death ? 36 : revenge ? 32 : expertMode ? 28 : 20; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 1f); } } } @@ -124,10 +132,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[redFire].noGravity = true; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 647a03e86f..c3a47086fc 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -80,6 +80,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.Opacity >= 0.9f) target.AddBuff(ModContent.BuffType(), 240, true); } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index c23a0eea60..5b919a9365 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 1800; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -82,13 +82,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.Opacity >= 0.9f) target.AddBuff(ModContent.BuffType(), 240, true); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 8a1ed054ff..72496fb97a 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -48,8 +48,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 21aa35a30e..667cbb0ff7 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -165,6 +165,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.OnFire, 180); } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index de30b23676..14d3a21cbc 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Boss { public class ScavengerNuke : ModProjectile { + public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion"); public override void SetStaticDefaults() { DisplayName.SetDefault("Homing Nuke"); @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(ExplosionSound, Projectile.position); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 160; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index ec860f475d..53bea6185f 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (Main.getGoodWorld ? 10f : 45f)) + if (Projectile.ai[0] >= (Main.getGoodWorld ? 10f : 36f)) { Projectile.ai[0] = 0f; int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); @@ -60,6 +60,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index 0b22dfb283..d64689d61c 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -46,6 +46,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index ae57acad33..e26dedd352 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -89,6 +89,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180, true); } diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 1790a214b2..e86ffd2036 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -70,6 +70,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300, true); } } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 31217f453f..7626b778fa 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -86,6 +86,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } @@ -111,10 +114,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num624].velocity *= 2f; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index e93db8f583..e0cc8614c8 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(BuffID.Confused, 120); diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index ec882abc6d..3dd79bc2d6 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Boss { public int blowTimer = 0; + public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Flare"); @@ -24,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 30; Projectile.hostile = true; Projectile.penetrate = 1; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -122,10 +123,5 @@ namespace CalamityMod.Projectiles.Boss } } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 57d34a52be..e54277cd74 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Boss { public override string Texture => "CalamityMod/Projectiles/Boss/SkyFlare"; + public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); + public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Flare"); @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.penetrate = 1; Projectile.timeLeft = 10; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.position); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -79,10 +81,5 @@ namespace CalamityMod.Projectiles.Boss Main.projectile[nado].netUpdate = true; } } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 639751f8e7..318ca92bb3 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -98,6 +98,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.ai[1] <= 1800f && Projectile.ai[1] > 120f) target.AddBuff(BuffID.Poisoned, 480); } diff --git a/Projectiles/Boss/SupremeCataclysmFist.cs b/Projectiles/Boss/SupremeCataclysmFist.cs index dbde9f541a..02827ae069 100644 --- a/Projectiles/Boss/SupremeCataclysmFist.cs +++ b/Projectiles/Boss/SupremeCataclysmFist.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 1200; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -67,15 +68,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 120, true); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SupremeCatastropheSlash.cs b/Projectiles/Boss/SupremeCatastropheSlash.cs index e39a523726..9e4ee85349 100644 --- a/Projectiles/Boss/SupremeCatastropheSlash.cs +++ b/Projectiles/Boss/SupremeCatastropheSlash.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 1500; Projectile.Opacity = 0f; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -74,15 +75,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.Opacity != 1f) + if (damage <= 0 || Projectile.Opacity != 1f) return; target.AddBuff(ModContent.BuffType(), 120, true); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index a9dda98cea..6ee43cd99b 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 180; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index f47dd116eb..3127513e75 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.Calamity().DealsDefenseDamage = true; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -240,14 +240,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 360); } public override bool CanHitPlayer(Player target) => OwnerIsValid && Projectile.scale >= 0.5f; - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index 983c3f3bea..5dab5fc1b9 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Projectiles.Boss public Vector2 Destination; public Vector2 Velocity; - public const float TelegraphTotalTime = 30f; - public const float TelegraphFadeTime = 15f; + public const float TelegraphTotalTime = 60f; + public const float TelegraphFadeTime = 30f; public const float TelegraphWidth = 4200f; - public const float LaserVelocity = 10f; + public const float LaserVelocity = 7.5f; public override void SetStaticDefaults() { @@ -47,18 +47,20 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; - CooldownSlot = 1; + Projectile.timeLeft = 1200; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) { + writer.Write(Projectile.extraUpdates); writer.WriteVector2(Destination); writer.WriteVector2(Velocity); } public override void ReceiveExtraAI(BinaryReader reader) { + Projectile.extraUpdates = reader.ReadInt32(); Destination = reader.ReadVector2(); Velocity = reader.ReadVector2(); } @@ -242,13 +244,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (TelegraphDelay > TelegraphTotalTime) - target.AddBuff(ModContent.BuffType(), 180); - } + if (damage <= 0 || TelegraphDelay <= TelegraphTotalTime) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 180); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/ToxicCloud.cs b/Projectiles/Boss/ToxicCloud.cs index 3bca09e3fd..2a1ef6061b 100644 --- a/Projectiles/Boss/ToxicCloud.cs +++ b/Projectiles/Boss/ToxicCloud.cs @@ -87,6 +87,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.Opacity >= 0.9f) { target.AddBuff(BuffID.Poisoned, 240); diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index 68c0645a65..e2a26affa5 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -61,7 +61,9 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool()) { - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 4, 0f, 0f, Projectile.alpha, Color.Crimson); + Color dustColor = Color.Crimson; + dustColor.A = 150; + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 4, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } @@ -74,10 +76,19 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.timeLeft < 60) + if (damage <= 0 || Projectile.timeLeft < 60) return; target.AddBuff(BuffID.Darkness, 180); } + + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } } } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 4b8befc7aa..ed7ca7d832 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -43,7 +43,9 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool()) { - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 4, 0f, 0f, Projectile.alpha, Color.Lavender); + Color dustColor = Color.Lavender; + dustColor.A = 150; + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 4, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } @@ -56,10 +58,19 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.timeLeft < 60) + if (damage <= 0 || Projectile.timeLeft < 60) return; target.AddBuff(BuffID.Weak, 180); } + + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } } } diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index ed0b43784c..15a40dbcf7 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -32,6 +32,9 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } + if (Projectile.velocity.Length() < 12f) + Projectile.velocity *= 1.01f; + int num104 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 100, default, 1.5f); Main.dust[num104].noGravity = true; @@ -41,6 +44,9 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.CursedInferno, 60); } diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 4b50ac4011..a57701283a 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 120; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.DD2BetsyFireball; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() @@ -122,12 +122,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); - } + if (damage <= 0) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index ecc88fa136..97a6b49d5c 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Boss { public override string Texture => "CalamityMod/Projectiles/Boss/YharonFireball"; + public static readonly SoundStyle FireballSound = new("CalamityMod/Sounds/Custom/Yharon/YharonFireball", 3); + public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Fireball"); @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 3600; - CooldownSlot = 1; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.Center); + SoundEngine.PlaySound(FireballSound, Projectile.Center); } if (Projectile.ai[0] >= 2f) @@ -123,13 +125,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.velocity.Y >= -16f) target.AddBuff(ModContent.BuffType(), 240); } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = Projectile; - } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index daa5fe0709..b3d2eb1f35 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.NPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -45,15 +46,17 @@ namespace CalamityMod.Projectiles // Damage Adjusters public const float PierceResistHarshness = 0.12f; public const float PierceResistCap = 0.8f; - // TODO -- Remove this. Vanilla originalDamage now applies to all projectiles. - public int defDamage = 0; + + // defDamage was being used for frame1 hacks. this stands in as the replacement for that logic. + private bool frameOneHacksExecuted = false; // Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit". // For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage. // They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits). // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. // These are currently only enabled for Soma Prime, but any bullet fired from that gun can supercrit. - public bool canSupercrit = false; + //Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times + public int supercritHits = 0; // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; @@ -80,6 +83,9 @@ namespace CalamityMod.Projectiles /// public bool DealsDefenseDamage = false; + // Nihility Quiver + public bool nihilicArrow = false; + // Rogue Stuff public bool stealthStrike = false; public int stealthStrikeHitCount = 0; @@ -128,6 +134,13 @@ namespace CalamityMod.Projectiles public override void OnSpawn(Projectile projectile, IEntitySource source) { CreatedByPlayerDash = source is ProjectileSource_PlayerDashHit; + + IEntitySource sourceItem = source as EntitySource_ItemUse_WithAmmo; + if (sourceItem != null) + extorterBoost = true; + + // TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile + // which is way too early, the projectile's own initialization isn't even done yet } #endregion On Spawn @@ -158,9 +171,7 @@ namespace CalamityMod.Projectiles if (projectile.minion && ExplosiveEnchantCountdown > 0) { ExplosiveEnchantCountdown--; - if (defDamage == 0) - defDamage = projectile.damage; - projectile.damage = (int)(defDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime)); + projectile.damage = (int)(projectile.originalDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime)); // Make fizzle sounds and fire dust to indicate the impending explosion. if (ExplosiveEnchantCountdown <= 300) @@ -934,13 +945,25 @@ namespace CalamityMod.Projectiles projectile.ai[0] += 1f; if (projectile.velocity.Length() < projectile.ai[1]) { - if (!(projectile.ai[0] < 30f)) - { - if (projectile.ai[0] < 100f) - projectile.velocity *= 1.06f; - else - projectile.ai[0] = 200f; - } + if (projectile.ai[0] >= 30f) + projectile.velocity *= 1.06f; + } + + Vector2 vector11 = Main.player[Main.npc[Main.wofNPCIndex].target].Center - projectile.Center; + if (vector11.Length() < 10f) + { + projectile.Kill(); + return false; + } + + if (projectile.ai[0] < 210f) + { + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 30f + vector11) / 31f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; } for (int i = 0; i < 2; i++) @@ -969,7 +992,7 @@ namespace CalamityMod.Projectiles projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 12f) projectile.velocity *= 1.0025f; return false; @@ -977,7 +1000,7 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.QueenSlimeGelAttack) { - // Phase 1 and 2 projectiles do not bounce and phase 2 projectiles do not have gravity. + // Phase 1 and 2 projectiles do not bounce and do not have gravity. if (projectile.ai[1] == -2f) { if (projectile.alpha == 0 && Main.rand.Next(3) == 0) @@ -1045,7 +1068,9 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) { - if (defDamage == 0) + // Unlikely that vanilla sets originalDamage for hostile projectiles. + // TODO -- this might not work and mech boss projectiles might deal too much damage again. + if (projectile.originalDamage == 0) { // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -1056,7 +1081,7 @@ namespace CalamityMod.Projectiles projectile.damage = (int)(projectile.damage * 0.9); } - defDamage = projectile.damage; + projectile.originalDamage = projectile.damage; } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; @@ -1080,6 +1105,78 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] == 1f) + { + bool homeIn = false; + float spreadOutCutoffTime = 510f; + float homeInCutoffTime = 420f; + float minAcceleration = 0.05f; + float maxAcceleration = 0.1f; + float homingVelocity = 25f; + + if (projectile.timeLeft > homeInCutoffTime && projectile.timeLeft <= spreadOutCutoffTime) + homeIn = true; + else if (projectile.velocity.Length() < 15f) + projectile.velocity *= 1.1f; + + if (homeIn) + { + int playerIndex = (int)projectile.ai[0]; + Vector2 velocity = projectile.velocity; + if (Main.player.IndexInRange(playerIndex)) + { + Player player = Main.player[playerIndex]; + velocity = projectile.DirectionTo(player.Center) * homingVelocity; + } + + float amount = MathHelper.Lerp(minAcceleration, maxAcceleration, Utils.GetLerpValue(spreadOutCutoffTime, 30f, projectile.timeLeft, clamped: true)); + projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); + } + + if (projectile.timeLeft <= 3) + { + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.width = 128; + projectile.height = 128; + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + } + + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.alpha = 255; + } + else + { + for (int n = 0; n < 2; n++) + { + float num22 = 0f; + float num23 = 0f; + if (n == 1) + { + num22 = projectile.velocity.X * 0.5f; + num23 = projectile.velocity.Y * 0.5f; + } + + int num24 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num22, projectile.position.Y + 3f + num23) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100); + Main.dust[num24].scale *= 2f + Main.rand.Next(10) * 0.1f; + Main.dust[num24].velocity *= 0.2f; + Main.dust[num24].noGravity = true; + + num24 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num22, projectile.position.Y + 3f + num23) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num24].fadeIn = 1f + Main.rand.Next(5) * 0.1f; + Main.dust[num24].velocity *= 0.05f; + } + } + + if (projectile.velocity != Vector2.Zero) + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + else if (projectile.type == ProjectileID.PoisonSeedPlantera) { projectile.frameCounter++; @@ -1854,7 +1951,7 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (defDamage == 0) + if (!frameOneHacksExecuted) { if (projectile.hostile) { @@ -1893,61 +1990,69 @@ namespace CalamityMod.Projectiles else { if (modPlayer.deadshotBrooch && projectile.CountsAsClass() && player.heldProj != projectile.whoAmI) - projectile.extraUpdates += 1; + { + if (projectile.type != ProjectileType()) + projectile.extraUpdates += 1; + } if (modPlayer.camper && !player.StandingStill()) projectile.damage = (int)(projectile.damage * 0.1); - } - defDamage = projectile.damage; - } - - // Setting this in SetDefaults didn't work - switch (projectile.type) - { - case ProjectileID.Bee: - case ProjectileID.Wasp: - case ProjectileID.TinyEater: - case ProjectileID.GiantBee: - case ProjectileID.Bat: - projectile.extraUpdates = 1; - break; - } - - if (NPC.downedMoonlord) - { - if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) - { - //Prevents them being buffed in Skeletron, Skeletron Prime, or Golem fights - if (((projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] == 1f) || - (NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast))) + if (projectile.CountsAsClass() && stealthStrike) { - projectile.damage = defDamage; - } - else - projectile.damage = defDamage + 30; - } - } - - if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) - { - if (CalamityLists.eventProjectileBuffList.Contains(projectile.type)) - projectile.damage = defDamage + 15; - } - - if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) - { - if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 - { - if (player.ActiveItem().type == ItemID.BeesKnees) - { - // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - projectile.DamageType = DamageClass.Ranged; + if (modPlayer.filthyGlove || modPlayer.bloodyGlove) + projectile.ArmorPenetration += 10; + if (modPlayer.nanotech) + projectile.ArmorPenetration += 10; // 20 total } } + + if (NPC.downedMoonlord) + { + if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) + { + // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights + bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] == 1f; + + // These projectiles will not be buffed if Golem is alive + bool isGolemBossProjectile = NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast); + + if (!isSkeletronBossProjectile && !isGolemBossProjectile) + projectile.damage += 30; + } + } + + if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) + { + if (CalamityLists.eventProjectileBuffList.Contains(projectile.type)) + projectile.damage += 15; + } + + // Setting this in SetDefaults didn't work + switch (projectile.type) + { + case ProjectileID.Bee: + case ProjectileID.Wasp: + case ProjectileID.TinyEater: + case ProjectileID.GiantBee: + case ProjectileID.Bat: + projectile.extraUpdates = 1; + break; + } + + if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) + { + if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 + { + if (player.ActiveItem().type == ItemID.BeesKnees) + projectile.DamageType = DamageClass.Ranged; + } + } + else if (projectile.type == ProjectileID.SoulDrain) + projectile.DamageType = DamageClass.Magic; + + frameOneHacksExecuted = true; } - else if (projectile.type == ProjectileID.SoulDrain) - projectile.DamageType = DamageClass.Magic; // Accelerate for 1.5 seconds to full velocity if (projectile.type == ProjectileID.HallowBossLastingRainbow && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) @@ -2213,6 +2318,8 @@ namespace CalamityMod.Projectiles // optimization to remove conversion X/Y loop for irrelevant projectiles bool isConversionProjectile = projectile.type == ProjectileID.PurificationPowder + || projectile.type == ProjectileID.VilePowder + || projectile.type == ProjectileID.ViciousPowder || projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.CorruptSpray || projectile.type == ProjectileID.CrimsonSpray @@ -2225,8 +2332,7 @@ namespace CalamityMod.Projectiles int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); - bool isPowder = projectile.type == ProjectileID.PurificationPowder; - /* || projectile.type == ProjectileID.VilePowder || projectile.type == ProjectileID.ViciousPowder */ + bool isPowder = projectile.type == ProjectileID.PurificationPowder || projectile.type == ProjectileID.VilePowder || projectile.type == ProjectileID.ViciousPowder; for (int i = x - 1; i <= x + 1; i++) { @@ -2236,12 +2342,11 @@ namespace CalamityMod.Projectiles { AstralBiome.ConvertFromAstral(i, j, ConvertType.Pure, !isPowder); } - //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson - if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) + if (projectile.type == ProjectileID.CorruptSpray || projectile.type == ProjectileID.VilePowder) { AstralBiome.ConvertFromAstral(i, j, ConvertType.Corrupt, !isPowder); } - if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) + if (projectile.type == ProjectileID.CrimsonSpray || projectile.type == ProjectileID.ViciousPowder) { AstralBiome.ConvertFromAstral(i, j, ConvertType.Crimson, !isPowder); } @@ -2296,9 +2401,6 @@ namespace CalamityMod.Projectiles damage = (int)Math.Ceiling(damage * proximityDamageFactor); } - if (!projectile.npcProj && !projectile.trap && projectile.CountsAsClass() && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) - crit = true; - // Aerial Bane does 50% damage to "airborne" enemies. This is just simple math to revert that as it is a very unbalanced mechanic. if (projectile.type == ProjectileID.DD2BetsyArrow) { @@ -2363,6 +2465,15 @@ namespace CalamityMod.Projectiles } } + if (projectile.type == ProjectileID.Stinger) + return new Color(200, 200, 0, projectile.alpha); + + if (projectile.type == ProjectileID.QueenBeeStinger) + return new Color(250, 250, 0, projectile.alpha); + + if (projectile.type == ProjectileID.QueenSlimeGelAttack || projectile.type == ProjectileID.QueenSlimeMinionBlueSpike || projectile.type == ProjectileID.QueenSlimeMinionPinkBall) + return new Color(255, 255, 255, projectile.alpha); + if (projectile.type == ProjectileID.PinkLaser) { if (projectile.alpha < 200) @@ -2459,7 +2570,7 @@ namespace CalamityMod.Projectiles { if (projectile.CountsAsClass()) { - if (modPlayer.etherealExtorter && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) + if (modPlayer.etherealExtorter && extorterBoost && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) { for (int i = 0; i < 2; i++) { @@ -2472,13 +2583,14 @@ namespace CalamityMod.Projectiles } } - if (modPlayer.scuttlersJewel && stealthStrike) + if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0) { - int damage = (int)player.GetTotalDamage().ApplyTo(15); + int damage = (int)player.GetTotalDamage().ApplyTo(20); 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; } } diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 1867493dbf..9753a1dd85 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles { ProjectileID.BoneArrow, pointBlank }, { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, { ProjectileID.Bullet, standardBulletTweaks }, - { ProjectileID.BulletHighVelocity, pointBlank }, + { ProjectileID.BulletHighVelocity, Do(PointBlank, LocalIFrames(-1)) }, { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ScaleExact(1.5f)) }, { ProjectileID.CandyCorn, pointBlank }, { ProjectileID.CannonballHostile, defenseDamage }, @@ -60,6 +60,7 @@ namespace CalamityMod.Projectiles { ProjectileID.CobaltNaginata, trueMelee }, { ProjectileID.Code1, Do(YoyoRange(240f), ExtraUpdatesExact(1), LocalIFrames(20)) }, { ProjectileID.Code2, Do(LocalIFrames(10)) }, + { ProjectileID.CopperShortswordStab, trueMelee }, { ProjectileID.CorruptYoyo, Do(YoyoRange(190f), LocalIFrames(10)) }, // Malaise { ProjectileID.CrimsandBallGun, pointBlank }, { ProjectileID.CrimsonYoyo, Do(LocalIFrames(10)) }, // Artery @@ -84,6 +85,7 @@ namespace CalamityMod.Projectiles { ProjectileID.DemonSickle, defenseDamage }, { ProjectileID.EbonsandBallGun, pointBlank }, { ProjectileID.EmeraldBolt, Do(NoPiercing) }, + { ProjectileID.EmpressBlade, Do(LocalIFrames(30)) }, // Terraprisma { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1)) }, { ProjectileID.ExplosiveBullet, standardBulletTweaks }, { ProjectileID.FairyQueenLance, defenseDamage }, // Empress of Light's lance walls @@ -102,7 +104,9 @@ namespace CalamityMod.Projectiles { ProjectileID.FrostWave, defenseDamage }, // Ice Queen frost waves { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1)) }, { ProjectileID.GiantBee, Do(PiercingExact(2)) }, + { ProjectileID.GladiusStab, trueMelee }, { ProjectileID.GoldenBullet, standardBulletTweaks }, + { ProjectileID.GoldShortswordStab, trueMelee }, { ProjectileID.Gradient, Do(LocalIFrames(10)) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Gungnir, trueMelee }, @@ -118,11 +122,13 @@ namespace CalamityMod.Projectiles { ProjectileID.IchorArrow, pointBlank }, { ProjectileID.IchorBullet, standardBulletTweaks }, { ProjectileID.InfernoHostileBlast, defenseDamage }, // Diabolist inferno fork explosions + { ProjectileID.IronShortswordStab, trueMelee }, { ProjectileID.JavelinHostile, defenseDamage }, { ProjectileID.JestersArrow, pointBlank }, { ProjectileID.JoustingLance, trueMelee }, { ProjectileID.JungleYoyo, Do(YoyoTopSpeed(14f), LocalIFrames(10)) }, // Amazon { ProjectileID.Kraken, Do(LocalIFrames(10)) }, + { ProjectileID.LeadShortswordStab, trueMelee }, { ProjectileID.LightBeam, Do(PiercingExact(2)) }, { ProjectileID.LightDisc, Do(MaxUpdatesExact(6)) }, { ProjectileID.LostSoulFriendly, pointBlank }, // TODO -- why does LostSoulFriendly have point blank enabled @@ -156,6 +162,8 @@ namespace CalamityMod.Projectiles { ProjectileID.PhantasmalDeathray, defenseDamage }, { ProjectileID.PhantasmalSphere, defenseDamage }, { ProjectileID.PhantasmArrow, pointBlank }, + { ProjectileID.PiercingStarlight, trueMelee }, + { ProjectileID.PlatinumShortswordStab, trueMelee }, { ProjectileID.PoisonDartBlowgun, pointBlank }, { ProjectileID.PoisonFang, Do(LocalIFrames(10)) }, { ProjectileID.Present, defenseDamage }, // Falling present bombs in Frost Moon @@ -169,6 +177,7 @@ namespace CalamityMod.Projectiles { ProjectileID.Retanimini, Do(LocalIFrames(10)) }, // Optic Staff (Mini Retinazer) { ProjectileID.RocketSkeleton, defenseDamage }, // Skeleton Commando rockets { ProjectileID.RockGolemRock, defenseDamage }, + { ProjectileID.RulerStab, trueMelee }, { ProjectileID.RuneBlast, defenseDamage }, // Rune Wizard shots { ProjectileID.SandBallGun, pointBlank }, { ProjectileID.SaucerDeathray, defenseDamage }, @@ -179,6 +188,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ShadowFlameArrow, pointBlank }, { ProjectileID.ShadowJoustingLance, trueMelee }, { ProjectileID.Sharknado, defenseDamage }, + { ProjectileID.SilverShortswordStab, trueMelee }, { ProjectileID.Skull, defenseDamage }, // Skeletron Expert+ skulls { ProjectileID.SniperBullet, defenseDamage }, // Skeleton Sniper bullets { ProjectileID.SnowBallFriendly, pointBlank }, @@ -199,10 +209,12 @@ namespace CalamityMod.Projectiles { ProjectileID.TheEyeOfCthulhu, Do(LocalIFrames(10)) }, // this is the yoyo { ProjectileID.TheRottedFork, trueMelee }, { ProjectileID.ThornBall, defenseDamage }, // Plantera bouncing thorn balls + { ProjectileID.TinShortswordStab, trueMelee }, { ProjectileID.TitaniumChainsaw, trueMeleeNoSpeed }, { ProjectileID.TitaniumDrill, trueMeleeNoSpeed }, { ProjectileID.TitaniumTrident, trueMelee }, { ProjectileID.Trident, trueMelee }, + { ProjectileID.TungstenShortswordStab, trueMelee }, { ProjectileID.UnholyArrow, pointBlank }, { ProjectileID.UnholyTridentHostile, defenseDamage }, { ProjectileID.ValkyrieYoyo, Do(LocalIFrames(10)) }, diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs new file mode 100644 index 0000000000..054875eb7f --- /dev/null +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs @@ -0,0 +1,219 @@ +using System; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AnomalysNanogunHoldout : ModProjectile + { + #region Properties + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static Texture2D ScopeTexture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/AnomalysNanogunScope", ReLogic.Content.AssetRequestMode.ImmediateLoad).Value; + public ref float AITimer => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public Vector2 MouseDistance => Owner.Calamity().mouseWorld - Owner.MountedCenter; + public ref float ScopeRotation => ref Projectile.localAI[0]; + public ref float ScopeScale => ref Projectile.localAI[1]; + public ref float TargetRecoil => ref Projectile.localAI[0]; + public bool UseMPFBAI { get => Projectile.ai[0] == MPFBAIType; } + #endregion + + #region Weapon Attributes + public const float GunLength = 64f; + public const float MPFBAIType = 2f; + + public const int MPFBFireTimer = 59; + public const float MPFBRecoil = MathHelper.Pi - MathHelper.PiOver4; + public const float MPFBScreenShakePower = 5f; + public const float MPFBPushback = 15f; + public const float MaxMPFBPropellableSpeed = 14f; + + public const int PlasmaChargeupTimer = 40; + public const int PlasmaCooldownTimer = 20; + public const int PlasmaShotCooldown = 16; + public const int PlasmaShotCount = 5; + public static int PlasmaFireTimer + { + get => PlasmaChargeupTimer + PlasmaCooldownTimer + (PlasmaShotCooldown * PlasmaShotCount); + } + #endregion + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Anomaly's Nanogun"); + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + } + + public override void AI() + { + // Reset the holdout rotation and position + Owner.Calamity().mouseWorldListener = true; + Projectile.rotation = (Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation(); + Projectile.Center = Owner.MountedCenter; + Owner.heldProj = Projectile.whoAmI; + + if (UseMPFBAI) + UpdateMPFB(); + else + UpdatePlasmaBeam(); + + AITimer++; + } + + // AI for the right click + public void UpdateMPFB() + { + // Make sure the player faces the right way + if (Projectile.velocity.X != 0f) + Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); + else + Owner.ChangeDir(1); + + if (AITimer == 0) + { + SoundEngine.PlaySound(TheAnomalysNanogun.MPFBShotSFX, Projectile.Center); + + // Shoot 3 MPFBs with varying speeds and randomized animation starting placement + for (int i = 0; i < 3; i++) + { + int proj = Projectile.NewProjectile(new EntitySource_ItemUse_WithAmmo(Owner, Owner.HeldItem, -1), + Projectile.Center + Projectile.rotation.ToRotationVector2() * GunLength, + Projectile.velocity * (1f - i * 0.18f), + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + + if (Main.projectile.IndexInRange(proj)) + { + Main.projectile[proj].frame = Main.rand.Next(0, 4); + Main.projectile[proj].frameCounter = Main.rand.Next(0, 3); + } + } + + // Make it POWERFUL + Owner.Calamity().GeneralScreenShakePower = MPFBScreenShakePower; + float playerSpeed = Owner.velocity.Length(); + Vector2 pushback = Projectile.velocity.SafeNormalize(Vector2.UnitX) * -MPFBPushback; + Vector2 newPlayerVelocity = Owner.velocity + pushback; + float newPlayerSpeed = newPlayerVelocity.Length(); + + if (playerSpeed < MaxMPFBPropellableSpeed || newPlayerSpeed < playerSpeed) + Owner.velocity = newPlayerVelocity; + else + Owner.velocity = newPlayerVelocity.SafeNormalize(Vector2.UnitX) * playerSpeed; + + // Assign target recoil + Vector2 direction = MouseDistance.SafeNormalize(Vector2.UnitX); + float recoil = direction.RotatedBy(-MathHelper.PiOver2 * 1.3f * Owner.direction).ToRotation(); + TargetRecoil = recoil; + + // Shooty ring + Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * GunLength, Vector2.Zero, Color.DeepSkyBlue, new Vector2(0.5f, 1f), direction.ToRotation(), 0.2f, 1f, 30); + GeneralParticleHandler.SpawnParticle(pulse); + return; + } + + // Apply recoil for the first 22 frames + if (AITimer < 22) + { + float newRotation = UpdateAimPostShotRecoil(TargetRecoil.ToRotationVector2()); + Owner.itemRotation = newRotation; + } + + // Then play a reload sound + else if (AITimer == 22) + { + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + } + + // And finally move the gun back down as the reload sound plays + else if (MPFBFireTimer - AITimer < 30) + { + float newRotation = UpdateAimPostShotRecoil((TargetRecoil + MathHelper.PiOver2 * 1.3f * Owner.direction).ToRotationVector2()); + Owner.itemRotation = newRotation; + } + + if (AITimer >= MPFBFireTimer) + { + Projectile.Kill(); + } + } + + // VIOLENTLY adjusts the aim vector of the cannon to point towards the target recoil + // Then point back down as it reloads + private float UpdateAimPostShotRecoil(Vector2 target) => Vector2.Lerp(target * Owner.direction, Owner.itemRotation.ToRotationVector2(), 0.795f).ToRotation(); + + // AI for the left click + public void UpdatePlasmaBeam() + { + // Randomize the scope starting rotation + if (AITimer == 0) + { + SoundEngine.PlaySound(TheAnomalysNanogun.PlasmaChargeSFX, Projectile.Center); + ScopeRotation = Main.rand.NextFloat(MathHelper.Pi * 0.5f, MathHelper.Pi * 0.75f) * Main.rand.NextBool().ToDirectionInt(); + ScopeScale = 2.5f; + } + + // Set rotation and player direction + Owner.itemRotation = Projectile.rotation; + int dir = Math.Sign(Projectile.rotation.ToRotationVector2().X); + Owner.ChangeDir(dir == 0 ? 1 : dir); + Owner.itemRotation = ((Owner.Calamity().mouseWorld - Owner.MountedCenter) * Owner.direction).ToRotation(); + + if (AITimer - PlasmaChargeupTimer > 0) + { + // Fire a laser at the correct moments + if (AITimer % PlasmaShotCooldown == 0 && (AITimer - PlasmaChargeupTimer) / PlasmaShotCooldown <= PlasmaShotCount) + { + Projectile.NewProjectile(new EntitySource_ItemUse_WithAmmo(Owner, Owner.HeldItem, -1), + Projectile.Center + Projectile.rotation.ToRotationVector2() * GunLength, + Projectile.rotation.ToRotationVector2(), + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + + SoundEngine.PlaySound(TheAnomalysNanogun.PlasmaShotSFX, Projectile.Center); + } + } + + // Shrink the scope + else + { + ScopeRotation = MathHelper.Lerp(ScopeRotation, 0f, 0.08f); + ScopeScale -= 0.0625f; + } + + if (AITimer >= PlasmaFireTimer) + Projectile.Kill(); + } + + public override void PostDraw(Color lightColor) + { + if (!UseMPFBAI && AITimer - PlasmaChargeupTimer <= 0) + { + Vector2 drawCenter = (Projectile.Center + Projectile.rotation.ToRotationVector2() * GunLength) - Main.screenPosition; + Main.EntitySpriteDraw(ScopeTexture, drawCenter, null, Color.White, ScopeRotation, ScopeTexture.Bounds.Size() / 2f, ScopeScale, SpriteEffects.None, 0); + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => false; + } +} diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs new file mode 100644 index 0000000000..e7450ff8c6 --- /dev/null +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBBoom.cs @@ -0,0 +1,32 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AnomalysNanogunMPFBBoom : BaseMassiveExplosionProjectile + { + public static readonly SoundStyle MPFBExplosion = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBExplosion"); + public override int Lifetime => 40; + public override bool UsesScreenshake => true; + public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 3f; + public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Blue, Color.CornflowerBlue, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); + public override void SetStaticDefaults() => DisplayName.SetDefault("MPFB Explosion"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 35; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void PostAI() => Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.7f / 255f, Projectile.Opacity); + } +} diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs new file mode 100644 index 0000000000..2f76acf7cc --- /dev/null +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.cs @@ -0,0 +1,90 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Weapons.DraedonsArsenal; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AnomalysNanogunMPFBDevastator : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("MPFB Devastator"); + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 42; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ignoreWater = true; + } + + public override void AI() + { + // All of AI is visual + if (Main.dedServ) + return; + + // Spawn dusts in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.375f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 267, Vector2.Zero); + dust.color = Color.Cyan; + dust.noGravity = true; + + dust = Dust.NewDustPerfect(Projectile.Center - offset, 267, Vector2.Zero); + dust.color = Color.Cyan; + dust.noGravity = true; + + // Add light + Lighting.AddLight(Projectile.Center, 0, Projectile.Opacity * 0.7f / 255f, Projectile.Opacity); + + // Animate the projectile + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Projectile.type]; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + int yPos = texture.Height / Main.projFrames[Type] * Projectile.frame; + Main.EntitySpriteDraw(texture, + Projectile.position - Main.screenPosition, + new Rectangle(0, yPos, texture.Width, texture.Height / Main.projFrames[Type]), + lightColor, + 0f, + Vector2.Zero, + 1f, + SpriteEffects.None, + 0); + + return false; + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(AnomalysNanogunMPFBBoom.MPFBExplosion, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < 5; i++) + { + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + explosion.ai[1] = Main.rand.NextFloat(110f, 200f) + i * 20f; // Randomize the maximum radius. + explosion.localAI[1] = Main.rand.NextFloat(0.18f, 0.3f); // And the interpolation step. + explosion.netUpdate = true; + } + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.png b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.png new file mode 100644 index 0000000000..da3fb1f2fa Binary files /dev/null and b/Projectiles/DraedonsArsenal/AnomalysNanogunMPFBDevastator.png differ diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs new file mode 100644 index 0000000000..214c5ba2a2 --- /dev/null +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs @@ -0,0 +1,167 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; +using CalamityMod.Particles; +using System; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AnomalysNanogunPlasmaBeam : BaseLaserbeamProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/YharimsCrystalBeam"; + + // All 3 point to the same so that BaseLaserbeamProjectile can still be used with an animated laser + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserMiddleTexture => LaserBeginTexture; + public override Texture2D LaserEndTexture => LaserBeginTexture; + + public override float MaxScale => 1f; + public override float Lifetime => 12f; + public override float MaxLaserLength => 5500f; + public override Color LaserOverlayColor => Color.White; + public override Color LightCastColor => Color.OrangeRed; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Beam"); + } + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.scale = MaxScale; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 12; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Main.projFrames[Projectile.type] = 18; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + base.AI(); + } + + public override void ExtraBehavior() + { + if (Projectile.timeLeft == 12) + { + Vector2 beamVector = Projectile.velocity; + float beamLength = DetermineLaserLength_CollideWithTiles(12); + + //Rapid dust + int dustCount = Main.rand.Next(10, 30); + for (int i = 0; i < dustCount; i++) + { + float dustProgressAlongBeam = beamLength * Main.rand.NextFloat(0f, 0.8f); + Vector2 dustPosition = Projectile.Center + dustProgressAlongBeam * beamVector + beamVector.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-6f, 6f) * Projectile.scale; + + Dust dust = Dust.NewDustPerfect(dustPosition, 187, beamVector * Main.rand.NextFloat(5f, 26f), 0, Color.OrangeRed, 2.2f); + dust.noGravity = true; + } + + // Energy rings around the laser + int step = 10; + while (step < LaserLength) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.Red, new Vector2(0.5f, 1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 1f, 12); + GeneralParticleHandler.SpawnParticle(pulse); + step += 100; + } + } + + else + Projectile.frameCounter++; + } + + public override void DetermineScale() => Projectile.scale = 1f; + + public override float DetermineLaserLength() => DetermineLaserLength_CollideWithTiles(5); + + public override bool ShouldUpdatePosition() => false; + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * LaserLength, Projectile.width + 16, DelegateMethods.CutTiles); + } + + // Animated laser + public override bool PreDraw(ref Color lightColor) + { + int frame = Projectile.frameCounter / 2; + DrawPlasmaBeam(Color.White, 1f, frame + 12, frame + 6, frame); + return false; + } + + private void DrawPlasmaBeam(Color beamColor, float scale, int startFrame = 0, int middleFrame = 0, int endFrame = 0) + { + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, startFrame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, middleFrame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, endFrame); + + // Start texture drawing. + Main.EntitySpriteDraw(LaserBeginTexture, + Projectile.Center - Main.screenPosition, + startFrameArea, + beamColor, + MathHelper.WrapAngle(Projectile.rotation + MathHelper.Pi), + startFrameArea.Size() / 2f, + scale, + SpriteEffects.None, + 0); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength; + laserBodyLength -= (startFrameArea.Height / 2 + endFrameArea.Height) * scale; + Vector2 centerOnLaser = Projectile.Center; + centerOnLaser += Projectile.velocity * scale * startFrameArea.Height / 2f; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = middleFrameArea.Height * scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + Main.EntitySpriteDraw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + middleFrameArea, + beamColor, + Projectile.rotation, + LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, + scale, + SpriteEffects.None, + 0); + incrementalBodyLength += laserOffset; + centerOnLaser += Projectile.velocity * laserOffset; + } + } + + // End texture drawing. + if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) + { + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + Main.EntitySpriteDraw(LaserEndTexture, + laserEndCenter, + endFrameArea, + beamColor, + MathHelper.WrapAngle(Projectile.rotation + MathHelper.Pi), + endFrameArea.Size() / 2f, + scale, + SpriteEffects.None, + 0); + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.png b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.png new file mode 100644 index 0000000000..7763672e3c Binary files /dev/null and b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.png differ diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunScope.png b/Projectiles/DraedonsArsenal/AnomalysNanogunScope.png new file mode 100644 index 0000000000..685fc59c6a Binary files /dev/null and b/Projectiles/DraedonsArsenal/AnomalysNanogunScope.png differ diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs index 20fa6573b4..16c7fbd311 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.alpha = 255; Projectile.localNPCHitCooldown = 15; Projectile.usesLocalNPCImmunity = true; + Projectile.DamageType = DamageClass.Summon; } public override float DetermineLaserLength() { diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index b7f154ffa8..b3f0f5ef11 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; } public override void AI() { diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs index 6a5ab503e5..7487000aeb 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.friendly = true; Projectile.penetrate = 3; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.timeLeft = Lifetime; diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 13192df24d..98e50a9f65 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.width = 46; // Collision logic is done manually. Projectile.height = 46; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; Projectile.ignoreWater = true; diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 2831f9fa62..dfe5a0acbc 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; + Projectile.DamageType = DamageClass.Summon; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs index 57564a8188..3d10eefd8d 100644 --- a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 4; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile field = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileID.Electrosphere, Projectile.damage, Projectile.knockBack, Projectile.owner); if (field.whoAmI.WithinBounds(Main.maxProjectiles)) { - field.DamageType = DamageClass.Melee; + field.DamageType = DamageClass.MeleeNoSpeed; field.usesLocalNPCImmunity = true; field.localNPCHitCooldown = 3; field.timeLeft = 12; diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index 723ddf7adc..f97f24052b 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.sentry = true; Projectile.timeLeft = Projectile.SentryLifeTime; Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Summon; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.cs b/Projectiles/DraedonsArsenal/PulseTurretShot.cs index f3a2830389..4e2d272e31 100644 --- a/Projectiles/DraedonsArsenal/PulseTurretShot.cs +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Summon; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index 6741f6307d..650db8d15e 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs index 898b574352..653f3d673d 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.alpha = 255; Projectile.minion = true; Projectile.minionSlots = 0f; + Projectile.DamageType = DamageClass.Summon; } public override void AI() { diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 5a923ef765..c699975d84 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.minion = true; Projectile.timeLeft *= 5; Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Summon; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index 0cef97f335..5cfa90af45 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 4f, ModContent.ProjectileType(), - damage, + (int)(damage * 0.6f), Projectile.knockBack, Projectile.owner, 1f); diff --git a/Projectiles/Enemy/AstralMeteorProj.cs b/Projectiles/Enemy/AstralMeteorProj.cs index 93c7dabfdb..55f7b60695 100644 --- a/Projectiles/Enemy/AstralMeteorProj.cs +++ b/Projectiles/Enemy/AstralMeteorProj.cs @@ -105,6 +105,11 @@ namespace CalamityMod.Projectiles.Enemy } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); + } } } diff --git a/Projectiles/Enemy/CragmawAcidDrop.cs b/Projectiles/Enemy/CragmawAcidDrop.cs index e5bafd290a..7527cbeea5 100644 --- a/Projectiles/Enemy/CragmawAcidDrop.cs +++ b/Projectiles/Enemy/CragmawAcidDrop.cs @@ -35,6 +35,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 60); } diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs index e2132b741d..5ffabada89 100644 --- a/Projectiles/Enemy/CragmawBeam.cs +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -214,8 +214,12 @@ namespace CalamityMod.Projectiles.Enemy } return false; } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Enemy/CragmawExplosion.cs b/Projectiles/Enemy/CragmawExplosion.cs index 0ccfbe989d..42cc0c5ac8 100644 --- a/Projectiles/Enemy/CragmawExplosion.cs +++ b/Projectiles/Enemy/CragmawExplosion.cs @@ -49,6 +49,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } diff --git a/Projectiles/Enemy/CragmawSpike.cs b/Projectiles/Enemy/CragmawSpike.cs index f778218e3d..f301e6c4ee 100644 --- a/Projectiles/Enemy/CragmawSpike.cs +++ b/Projectiles/Enemy/CragmawSpike.cs @@ -34,6 +34,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index ad5040ab6c..3e49f88545 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,30 +18,33 @@ namespace CalamityMod.Projectiles.Enemy Projectile.width = 6; Projectile.height = 6; Projectile.hostile = true; - Projectile.alpha = 255; - Projectile.aiStyle = 1; + Projectile.Opacity = 0f; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = -1; } public override void AI() { - if (Projectile.alpha == 0 && Main.rand.NextBool(3)) + if (Projectile.Opacity == 1f && Main.rand.NextBool(3)) { - int num67 = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); + Color dustColor = Color.Crimson; + dustColor.A = 150; + int num67 = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, 260, 0f, 0f, 50, dustColor, 1.2f); Main.dust[num67].velocity *= 0.3f; Main.dust[num67].velocity += Projectile.velocity * 0.3f; Main.dust[num67].noGravity = true; } - Projectile.alpha -= 50; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } + + Projectile.Opacity += 0.2f; + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; + if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item17, Projectile.position); } + Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 5f) { @@ -52,15 +55,29 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Darkness, 90); } public override void Kill(int timeLeft) { + Color dustColor = Color.Crimson; + dustColor.A = 150; for (int k = 0; k < 5; k++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 260, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 260, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, dustColor, 1f); } } + + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } } } diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 9bd732ea39..bbe0695c3f 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -127,6 +127,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 9de4ad78eb..26472d491d 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -105,6 +105,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index eab1b66b4c..fc2b6e4c10 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -47,8 +47,12 @@ namespace CalamityMod.Projectiles.Enemy Projectile.Kill(); } } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index 8d4257bd36..1c7deb820a 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -90,6 +90,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index d029975cb7..56eec97d6f 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -34,8 +34,12 @@ namespace CalamityMod.Projectiles.Enemy } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index 904f769d25..8de289b3df 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -209,8 +209,12 @@ namespace CalamityMod.Projectiles.Enemy } return false; } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 600); } } diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 40a8b1cdfd..800082cc02 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -80,6 +80,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Wet, 300); } } diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 44f9df61b7..8d18129c61 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -88,6 +88,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Darkness, 300, true); Projectile.Kill(); } diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index d8ef02ecae..cb5e8b0362 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -64,6 +64,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.alpha == 80) target.AddBuff(BuffID.Darkness, 300, true); } diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs index ff72476209..d1898f425b 100644 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ b/Projectiles/Enemy/InkPoisonCloud2.cs @@ -64,6 +64,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.alpha == 80) target.AddBuff(BuffID.Darkness, 300, true); } diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs index 4aa05d5e04..95b5fa26e5 100644 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ b/Projectiles/Enemy/InkPoisonCloud3.cs @@ -64,6 +64,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.alpha == 80) target.AddBuff(BuffID.Darkness, 300, true); } diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index e99dc45206..5621a1839b 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -73,6 +73,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Enemy/MaulerAcidBubble.cs b/Projectiles/Enemy/MaulerAcidBubble.cs index 73081df14f..3897c6e046 100644 --- a/Projectiles/Enemy/MaulerAcidBubble.cs +++ b/Projectiles/Enemy/MaulerAcidBubble.cs @@ -64,10 +64,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.localAI[1] < 1f) - { + if (damage <= 0 || Projectile.localAI[1] < 1f) return; - } + target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Enemy/MaulerAcidDrop.cs b/Projectiles/Enemy/MaulerAcidDrop.cs index e117db71f4..5f42c0f664 100644 --- a/Projectiles/Enemy/MaulerAcidDrop.cs +++ b/Projectiles/Enemy/MaulerAcidDrop.cs @@ -35,6 +35,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 60); } diff --git a/Projectiles/Enemy/NuclearBulletLarge.cs b/Projectiles/Enemy/NuclearBulletLarge.cs index a6097de975..7504866b7c 100644 --- a/Projectiles/Enemy/NuclearBulletLarge.cs +++ b/Projectiles/Enemy/NuclearBulletLarge.cs @@ -26,8 +26,12 @@ namespace CalamityMod.Projectiles.Enemy Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.25f); Projectile.rotation = Projectile.velocity.ToRotation(); } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 300); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs index 0f726a5cad..309270ff75 100644 --- a/Projectiles/Enemy/NuclearBulletMedium.cs +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -49,8 +49,12 @@ namespace CalamityMod.Projectiles.Enemy Projectile.tileCollide = false; } } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs index 188ba43111..0e500cb842 100644 --- a/Projectiles/Enemy/NuclearToadGoo.cs +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -31,8 +31,12 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.velocity.Y < 10f) Projectile.velocity.Y += 0.175f; } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/OrthoceraStream.cs b/Projectiles/Enemy/OrthoceraStream.cs index 3d830adf5b..48f92982f2 100644 --- a/Projectiles/Enemy/OrthoceraStream.cs +++ b/Projectiles/Enemy/OrthoceraStream.cs @@ -65,6 +65,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index 4c63341533..71757fc8e4 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - if (Projectile.localAI[1] < 1f) + if (damage <= 0 || Projectile.localAI[1] < 1f) return; target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index 2ac503ea55..8472546bd6 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -89,6 +89,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.Opacity >= 0.9f) target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index d3700f8851..4c9824076b 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -72,6 +72,9 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Projectile.alpha == 80) target.AddBuff(BuffID.Poisoned, 240); } diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs index 2c4ce7105f..377ddb75d4 100644 --- a/Projectiles/Enemy/TrilobiteSpike.cs +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -2,7 +2,9 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Enemy { public class TrilobiteSpike : ModProjectile @@ -31,9 +33,21 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 120); } + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(200 * Projectile.Opacity); + lightColor.G = (byte)(150 * Projectile.Opacity); + lightColor.B = (byte)(100 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + public override void Kill(int timeLeft) { for (int i = 0; i <= 2; i++) diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index 42fde6a38a..c0e5fe5ff9 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -48,6 +48,9 @@ namespace CalamityMod.Projectiles.Environment public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Main.rand.NextBool(2)) { // 1 to 3 seconds of poisoned diff --git a/Projectiles/Environment/BrimstoneGeyser.cs b/Projectiles/Environment/BrimstoneGeyser.cs index 57b8b08a70..be8ef3ef1a 100644 --- a/Projectiles/Environment/BrimstoneGeyser.cs +++ b/Projectiles/Environment/BrimstoneGeyser.cs @@ -169,6 +169,9 @@ namespace CalamityMod.Projectiles.Environment public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs index a1d65ea77a..4ede545e53 100644 --- a/Projectiles/Environment/HotSteam.cs +++ b/Projectiles/Environment/HotSteam.cs @@ -32,8 +32,12 @@ namespace CalamityMod.Projectiles.Environment dust.alpha = 127; } } + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (damage <= 0) + return; + target.AddBuff(BuffID.Poisoned, 180); } } diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs deleted file mode 100644 index fce5b675b4..0000000000 --- a/Projectiles/Environment/LightningMark.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; - -namespace CalamityMod.Projectiles.Environment -{ - public class LightningMark : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lightning Mark"); - } - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 12; - Projectile.hostile = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 1800; - Projectile.extraUpdates = 10; - } - - public override void AI() - { - if (Projectile.timeLeft <= 600) - { - if (Projectile.ai[0] == 0f && Projectile.owner == Main.myPlayer) - { - Projectile.ai[0] = 1f; - - Vector2 fireFrom = new Vector2(Projectile.Center.X, Projectile.Center.Y - 900f); - int tries = 0; - while (CalamityUtils.ParanoidTileRetrieval((int)(fireFrom.X / 16f), (int)(fireFrom.Y / 16f)).HasTile) - { - fireFrom.Y += 16f; - - tries += 1; - if (tries > 25) - return; - } - - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.Center); - Vector2 ai0 = Projectile.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - - int damage = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; - - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), fireFrom, velocity, ProjectileID.CultistBossLightningOrbArc, damage, 0f, Projectile.owner, ai0.ToRotation(), ai); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].extraUpdates += 11; - Main.projectile[proj].friendly = true; - Main.projectile[proj].Calamity().lineColor = 1; - } - } - } - else if (Projectile.velocity.Y == 0f) - { - Lighting.AddLight(Projectile.Center, 0.6f, 0.9f, 1f); - - if (Main.rand.NextBool(3)) - { - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, default, 1f); - Main.dust[num199].position.X -= 2f; - Main.dust[num199].position.Y += 2f; - Main.dust[num199].scale = 0.7f; - Main.dust[num199].noGravity = true; - Main.dust[num199].velocity.Y -= 2f; - } - - if (Main.rand.NextBool(15)) - { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1f); - Main.dust[num200].position.X -= 2f; - Main.dust[num200].position.Y += 2f; - Main.dust[num200].scale = 0.7f; - Main.dust[num200].noGravity = true; - Main.dust[num200].velocity *= 0.1f; - } - } - - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - Projectile.velocity.Y *= -0.5f; - - Projectile.velocity.Y += 0.2f; - - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) - { - fallThrough = false; - return true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Healing/AuricOrb.cs b/Projectiles/Healing/AuricOrb.cs index 0433b50d4c..4b56e2b9ec 100644 --- a/Projectiles/Healing/AuricOrb.cs +++ b/Projectiles/Healing/AuricOrb.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.penetrate = 1; Projectile.timeLeft = 360; Projectile.extraUpdates = 3; + Projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 53d71423f8..f647127517 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 6e180208a9..d49e4fe27b 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Healing/DemonHeal.cs b/Projectiles/Healing/DemonHeal.cs index 5330fb44e6..e0964af119 100644 --- a/Projectiles/Healing/DemonHeal.cs +++ b/Projectiles/Healing/DemonHeal.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 640; + Projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index f464d1a4cd..f00044fb24 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -18,21 +18,11 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.extraUpdates = 10; - Projectile.timeLeft = 300; + Projectile.timeLeft = 600; } public override void AI() { - if (Projectile.localAI[0] == 0f) - { - Player player = Main.player[Projectile.owner]; - Item item = player.ActiveItem(); - bool summonNotWhip = item.CountsAsClass() && !item.CountsAsClass(); - if (summonNotWhip || item.hammer > 0 || item.pick > 0 || item.axe > 0) - Projectile.timeLeft = 600; - Projectile.localAI[0] += 1f; - } - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); float num494 = Projectile.velocity.X * 0.334f; float num495 = -(Projectile.velocity.Y * 0.334f); diff --git a/Projectiles/Healing/PhantomicHeart.cs b/Projectiles/Healing/PhantomicHeart.cs index 7db8ea4932..1b64469de1 100644 --- a/Projectiles/Healing/PhantomicHeart.cs +++ b/Projectiles/Healing/PhantomicHeart.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Projectiles.Healing { DisplayName.SetDefault("Phantomic Heart"); Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -26,8 +28,6 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 20; Projectile.penetrate = -1; Projectile.timeLeft = 600; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index ee06354060..c5d289b9b4 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; } public override void AI() @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Healing float num498 = Projectile.velocity.X * 0.2f; float num499 = -(Projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + int num500 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Dust dust = Main.dust[num500]; dust.noGravity = true; dust.position.X -= num498; diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index 3723325429..6e693ed318 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.extraUpdates = 3; + Projectile.tileCollide = false; } public override void AI() diff --git a/Projectiles/Magic/AetherBeam.cs b/Projectiles/Magic/AetherBeam.cs index e15a2a0d9b..8a9efb3bb5 100644 --- a/Projectiles/Magic/AetherBeam.cs +++ b/Projectiles/Magic/AetherBeam.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[1] = 0f; } - Projectile.damage += Projectile.Calamity().defDamage / 200; + Projectile.damage += Projectile.originalDamage / 200; Projectile.alpha = Utils.Clamp(Projectile.alpha - 25, 0, 255); Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f, 0f, 0.7f); diff --git a/Projectiles/Magic/ArcticBearPawProj.cs b/Projectiles/Magic/ArcticBearPawProj.cs index 630ad0fcdc..7a539e3532 100644 --- a/Projectiles/Magic/ArcticBearPawProj.cs +++ b/Projectiles/Magic/ArcticBearPawProj.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { Projectile.width = Projectile.height = 40; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; diff --git a/Projectiles/Magic/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 2fba5b04fb..3f827286dd 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 70; Projectile.height = 70; Projectile.friendly = false; - // projectile.magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 90000; diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index 1b92eb405b..a9890bb482 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -1,15 +1,14 @@ using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Linq; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -204,9 +203,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.myPlayer == Projectile.owner) { - int strike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.npc[i].Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, i); - if (Main.projectile.IndexInRange(strike)) - Main.projectile[strike].DamageType = DamageClass.Melee; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.npc[i].Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, i); } } } diff --git a/Projectiles/Magic/ArtAttackStrike.cs b/Projectiles/Magic/ArtAttackStrike.cs new file mode 100644 index 0000000000..284d184b32 --- /dev/null +++ b/Projectiles/Magic/ArtAttackStrike.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ArtAttackStrike : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Art Attack"); + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = 2; + Projectile.DamageType = DamageClass.Magic; + } + + // If the AI parameter isn't a valid NPC slot, it can hit anything. Otherwise it can only hit one NPC. + public override bool? CanHitNPC(NPC target) + { + if (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f || Projectile.ai[0] == target.whoAmI) + return null; + return (bool?)false; + } + } +} diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index 76bf1b6b91..d21cf3468d 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -51,28 +51,28 @@ namespace CalamityMod.Projectiles.Magic } } Projectile.alpha -= 15; - int num58 = 150; + int opacity = 150; if (Projectile.Center.Y >= Projectile.ai[1]) { - num58 = 0; + opacity = 0; } - if (Projectile.alpha < num58) + if (Projectile.alpha < opacity) { - Projectile.alpha = num58; + Projectile.alpha = opacity; } Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = Projectile.Center + value3 * 12f; + Vector2 velocity = Vector2.UnitX.RotatedByRandom(Math.PI / 2D).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[idx].velocity = velocity * 0.66f; + Main.dust[idx].position = Projectile.Center + velocity * 12f; } if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) { - int num60 = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += Projectile.velocity * 0.3f; + int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[idx].velocity *= 0.66f; + Main.gore[idx].velocity += Projectile.velocity * 0.3f; } if (Projectile.ai[1] == 1f) { @@ -86,6 +86,8 @@ namespace CalamityMod.Projectiles.Magic Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } + if (Projectile.ai[0] == 1f) + CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 500f, 15f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -93,10 +95,7 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(ModContent.BuffType(), 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 100, 250, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 100, 250, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { @@ -106,33 +105,28 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) + Projectile.ExpandHitboxBy(50); + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); - Main.dust[num622].velocity *= 3f; + int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.2f); + Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 5; num623++) + for (int i = 0; i < 5; i++) { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; + int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1.7f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 5f; + idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[idx].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { - for (int num480 = 0; num480 < 3; num480++) + for (int i = 0; i < 3; i++) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 01735023ef..ec40bd85c2 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 52; Projectile.height = 52; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = -1; diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index 0bec37db83..89c990a897 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 52; Projectile.height = 52; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = -1; diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs index bce1549398..49ea16d656 100644 --- a/Projectiles/Magic/AuraRain.cs +++ b/Projectiles/Magic/AuraRain.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 45; + Projectile.aiStyle = ProjAIStyleID.RainCloud; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = true; diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index 045a106830..b3386989ea 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -82,6 +82,7 @@ namespace CalamityMod.Projectiles.Magic float dmgKBMult = Main.rand.NextFloat(0.25f, 0.75f); Projectile star = CalamityUtils.ProjectileRain(source, Projectile.Center, Projectile.velocity.X, 100f, 500f, 800f, Main.rand.NextFloat(10f, 20f), ModContent.ProjectileType(), (int)(Projectile.damage * dmgKBMult), Projectile.knockBack * dmgKBMult, Projectile.owner); star.timeLeft = 120; + star.ai[0] = 1f; } } diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index 5770977f41..f609670083 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Magic/ClamorNoctusWyvern.cs b/Projectiles/Magic/ClamorNoctusWyvern.cs index 9801f90dd9..62b89e1ed4 100644 --- a/Projectiles/Magic/ClamorNoctusWyvern.cs +++ b/Projectiles/Magic/ClamorNoctusWyvern.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 1; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; Projectile.extraUpdates = 1; } diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index bc9bf3b141..a4839a3e66 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -80,6 +80,8 @@ namespace CalamityMod.Projectiles.Magic } Charge++; + if (Charge % 4 == 0 && Owner.GetModPlayer().Symbiosis) + Charge++; } public override bool PreDraw(ref Color lightColor) @@ -126,11 +128,16 @@ namespace CalamityMod.Projectiles.Magic { float angleOffset = MathHelper.Lerp(Spread * -0.5f, Spread * 0.5f, i / ((float)ShotProjectiles - 1)); Vector2 direction = (mainAngle + angleOffset).ToRotationVector2(); - + + int realDamage = Projectile.damage + (int)(CoralSpout.FullChargeExtraDamage * Math.Pow(ChargeProgress, CoralSpout.ChargeDamageBoostSteepness)); + + if (Owner.GetModPlayer().Symbiosis) + realDamage += CoralSpout.SymbiosisDamageBuff; + if (Owner.whoAmI == Main.myPlayer) { float speed = 10 + 15 * ChargeProgress; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + direction * 30f, direction * speed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, ChargeProgress); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + direction * 30f, direction * speed, ModContent.ProjectileType(), realDamage, Projectile.knockBack, Owner.whoAmI, ChargeProgress); } Color pulseColor = Main.rand.NextBool() ? Color.Coral : Color.DeepSkyBlue; diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 4571c906a3..490d2cb993 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -6,34 +6,30 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Terraria.Graphics.Shaders; +using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Magic; +using System.Collections.Generic; namespace CalamityMod.Projectiles.Magic { public class EnormousConsumingVortex : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + public float Time { get => Projectile.ai[0]; set => Projectile.ai[0] = value; } - public float IdealScale - { - get => Projectile.ai[1]; - set => Projectile.ai[1] = value; - } - - public const int TentacleSpawnRate = 20; - public const int PulseInterval = 18; - public const float PulseHitboxExpandRatio = 2.5f; - public const float RadialOffsetVarianceFactor = 0.1f; public const float StartingScale = 0.0004f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Subsuming Vortex"); - ProjectileID.Sets.NeedsUUID[Projectile.type] = true; - } + public const float IdealScale = 2.7f; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Subsuming Vortex"); public override void SetDefaults() { @@ -43,171 +39,141 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.scale = StartingScale; - Projectile.timeLeft = 540; + Projectile.timeLeft = 90000; Projectile.tileCollide = false; + Projectile.netImportant = true; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 7; + Projectile.hide = true; } // Vanilla Terraria does not sync projectile scale by default. public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.scale); + public override void ReceiveExtraAI(BinaryReader reader) => Projectile.scale = reader.ReadSingle(); public override void AI() { - Projectile.rotation += MathHelper.ToRadians(8f); // Spin 2 win. - Projectile.alpha = (int)MathHelper.Lerp(255, 0, Utils.GetLerpValue(0f, 20f, Time, true)); // Fade in completely after 20 frames. - Projectile.scale = MathHelper.Lerp(StartingScale, IdealScale, Utils.GetLerpValue(0f, 30f, Time, true)); // Expand completely after 30 frames. - - // Determine the ideal scale in the first frame. - if (IdealScale == 0f) + // If the player is no longer able to channel the vortex, kill it. + if (!Owner.channel || Owner.noItems || Owner.CCed) { - IdealScale = Main.rand.NextFloat(2.2f, 3f); + Projectile.Kill(); + return; + } + + // Release energy from the book. + if (Time >= SubsumingVortex.VortexShootDelay) + { + Vector2 bookPosition = Owner.Center + Vector2.UnitX * Owner.direction * 22f; + if (Main.rand.NextBool()) + { + Vector2 energyVelocity = Main.rand.NextVector2Circular(3f, 3f); + Color energyColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); + SquishyLightParticle exoEnergy = new(bookPosition, energyVelocity, 0.55f, energyColor, 40, 1f, 1.5f); + GeneralParticleHandler.SpawnParticle(exoEnergy); + } + + // Fire vortices at nearby target. + NPC potentialTarget = Projectile.Center.ClosestNPCAt(SubsumingVortex.SmallVortexTargetRange - 100f); + if (potentialTarget != null && Time % SubsumingVortex.VortexReleaseRate == SubsumingVortex.VortexReleaseRate - 1) + { + // CheckMana returns true if the mana cost can be paid.. + bool allowContinuedUse = Owner.CheckMana(Owner.ActiveItem(), -1, true, false); + bool vortexStillInUse = Owner.channel && allowContinuedUse && !Owner.noItems && !Owner.CCed; + if (vortexStillInUse) + { + SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + float hue = (Time - SubsumingVortex.VortexShootDelay) / 125f; + Vector2 vortexVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 8f; + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, vortexVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, hue); + } + Projectile.netUpdate = true; + } + else if (!vortexStillInUse) + Projectile.Kill(); + } + } + + // Create swirling exo energy. + if (Main.rand.NextBool()) + { + float dustSpawnChance = Utils.Remap(Time, 12f, SubsumingVortex.VortexShootDelay + 8f, 0.25f, 0.7f); + for (int i = 0; i < 3; i++) + { + if (Main.rand.NextFloat() < dustSpawnChance) + { + float spawnOffsetAngle = Main.rand.NextFloat(MathHelper.TwoPi); + float hue = (float)Math.Sin(spawnOffsetAngle + Time / 26f) * 0.5f + 0.5f; + float spawnOffsetFactor = Main.rand.NextFloat(0.3f, 0.95f); + Vector2 energySpawnPosition = Projectile.Center + spawnOffsetAngle.ToRotationVector2() * Projectile.Size * spawnOffsetFactor; + Vector2 energyVelocity = (spawnOffsetAngle - MathHelper.PiOver2).ToRotationVector2() * (Main.rand.NextFloat(5f, 10f) * spawnOffsetFactor) * dustSpawnChance; + Color energyColor = CalamityUtils.MulticolorLerp(hue, CalamityUtils.ExoPalette); + SquishyLightParticle exoEnergy = new(energySpawnPosition, energyVelocity, Projectile.scale * Main.rand.NextFloat(0.18f, 0.3f), energyColor, 32, 1f, 1.5f); + GeneralParticleHandler.SpawnParticle(exoEnergy); + } + } + } + + // Hover above the target. + if (Main.myPlayer == Projectile.owner) + { + // Smoothly approach a sinusoidal offset as time goes on. + float verticalOffset = Utils.Remap(Time, 0f, 90f, -30f, (float)Math.Cos(Projectile.timeLeft / 32f) * 30f - 325f); + Vector2 hoverDestination = Owner.Top + Vector2.UnitY * verticalOffset; + hoverDestination += (Main.MouseWorld - hoverDestination) * SubsumingVortex.GiantVortexMouseDriftFactor; + + Vector2 idealVelocity = Vector2.Zero.MoveTowards(hoverDestination - Projectile.Center, 32f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.04f); + Projectile.netSpam = 0; Projectile.netUpdate = true; } - // Target enemy if possible and idly spawn tentacles. - if (Time < 150) - { - TargetingMovement(); - if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.myPlayer == Projectile.owner) - { - ProduceSubsumingHentai(); - } - } - // Slow down and pulse frequently. - else if (Time < 220) - { - Projectile.velocity *= 0.96f; - if (Time % PulseInterval == 0f) - { - PulseEffect(); - } - } - else if (Time >= 240) - { - ExplodeEffect(); - Projectile.Kill(); - } - Projectile.ExpandHitboxBy((int)(Projectile.scale * 62)); + // Re-determine the hitbox size. + Projectile.Opacity = Utils.GetLerpValue(0f, 20f, Time, true); + Projectile.scale = Utils.Remap(Time, 0f, 45f, StartingScale, IdealScale); + Projectile.ExpandHitboxBy((int)(Projectile.scale * 62f)); + + AdjustPlayerValues(); + Time++; } - public void ProduceSubsumingHentai() + public void AdjustPlayerValues() { - int tentacleDamage = (int)(Projectile.damage * 0.25f); - float xStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); - float yStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); - Projectile subsumingHentai = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), - Projectile.Center, - Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 13f), - ModContent.ProjectileType(), - tentacleDamage, - Projectile.knockBack * 0.5f, - Projectile.owner, - xStartingAcceleration, - yStartingAcceleration - ); - - subsumingHentai.tileCollide = false; + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; } - public void TargetingMovement() + // Draw these vortices behind other projectiles to ensure that they do not obstruct SCal's projectiles. + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, true, true); - if (potentialTarget != null) - Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(potentialTarget.Center) * 7f) / 6f; - } - - public void PulseEffect() - { - Projectile.ExpandHitboxBy(PulseHitboxExpandRatio); - Projectile.Damage(); - if (!Main.dedServ) - { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); - for (int i = 0; (float)i < 85; i++) - { - float angle = i / 85f * MathHelper.TwoPi; - Vector2 spawnPosition = Projectile.Center + angle.ToRotationVector2() * (500f + Main.rand.NextFloat(-8f, 8f)); - Vector2 velocity = (angle - (float)Math.PI).ToRotationVector2() * Main.rand.NextFloat(27f, 38.5f); - Dust dust = Dust.NewDustPerfect(spawnPosition, 264, velocity); - dust.scale = 0.9f; - dust.fadeIn = 1.25f; - dust.color = Main.hslToRgb(i / 85f, 1f, 0.8f); - dust.noGravity = true; - } - } - Projectile.ExpandHitboxBy(1f / PulseHitboxExpandRatio); - } - - public void ExplodeEffect() - { - SoundEngine.PlaySound(SoundID.Zombie104, Projectile.Center); - if (!Main.dedServ) - { - for (int i = 0; i < 200; i++) - { - Vector2 velocity = Main.rand.NextVector2Circular(50f, 50f); - Dust dust = Dust.NewDustPerfect(Projectile.Center, 264, velocity); - dust.color = Main.hslToRgb(i / 100f % 1f, 1f, 0.8f); - dust.fadeIn = 1.25f; - dust.noGravity = true; - } - } - if (Main.myPlayer == Projectile.owner) - { - int vortexDamage = (int)(Projectile.damage * 0.75f); - NPC closestTarget = Projectile.Center.ClosestNPCAt(1600f, true, true); - - for (int i = 0; i < 12; i++) - { - float rotation = Main.rand.NextFloat(MathHelper.TwoPi); - Vector2 velocity = Vector2.UnitY.RotatedBy(rotation); - if (closestTarget != null) - velocity = Projectile.SafeDirectionTo(closestTarget.Center, -Vector2.UnitY).RotatedByRandom(0.4f); - - velocity *= Main.rand.NextFloat(3f, 5f); - - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, - velocity, - ModContent.ProjectileType(), - vortexDamage, - Projectile.knockBack, - Projectile.owner, - 0f, - Main.rand.NextFloat(0.5f, 1.8f)); - } - } + behindProjectiles.Add(index); } public override bool PreDraw(ref Color lightColor) { - int vortexesToDraw = 27; - for (int i = 0; i < vortexesToDraw; i++) + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D worleyNoise = ModContent.Request("CalamityMod/ExtraTextures/BlobbyNoise").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 scale = Projectile.Size / worleyNoise.Size() * 2f; + float spinRotation = Main.GlobalTimeWrappedHourly * 2.4f; + + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); + + // Draw the vortex. + for (int i = 0; i < CalamityUtils.ExoPalette.Length; i++) { - float rotation = MathHelper.TwoPi / i * vortexesToDraw + Projectile.rotation; - float drawScale = Projectile.scale * 0.66f; - - drawScale *= (float)(Math.Cos(Time / 18f + rotation * 2f) + 1f) * 0.3f + 0.7f; // Range of 0.7 to 1. Used to give variance with the scale. - float offsetFactor = (float)(Math.Sin(Time / 18f + rotation * 2f) + 1f) * 0.2f + 0.8f; // Range of 0.8 to 1. - - // Due to the way RotatedBy works, the offset can be negative, giving the projectile a - // dual buzzsaw look. - Vector2 drawOffset = Vector2.UnitX.RotatedBy(rotation) * 30f * offsetFactor * drawScale; - Vector2 drawPosition = Projectile.Center + drawOffset - Main.screenPosition; - Color colorToDraw = Main.hslToRgb((i / (float)vortexesToDraw + Time / 40f) % 1f, 1f, 0.75f); - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, - drawPosition, - null, - colorToDraw * 0.7f, - rotation, - ModContent.Request(Texture).Size() * 0.5f, - drawScale, - SpriteEffects.None, - 0); + float spinDirection = (i % 2f == 0f).ToDirectionInt(); + Vector2 drawOffset = (MathHelper.TwoPi * i / CalamityUtils.ExoPalette.Length + Main.GlobalTimeWrappedHourly * spinDirection * 4f).ToRotationVector2() * Projectile.scale * 15f; + Main.spriteBatch.Draw(worleyNoise, drawPosition + drawOffset, null, CalamityUtils.ExoPalette[i], spinDirection * spinRotation, worleyNoise.Size() * 0.5f, scale, 0, 0f); } + + Main.spriteBatch.ExitShaderRegion(); return false; } } diff --git a/Projectiles/Magic/EnormousConsumingVortex.png b/Projectiles/Magic/EnormousConsumingVortex.png deleted file mode 100644 index 0e1de2dd8f..0000000000 Binary files a/Projectiles/Magic/EnormousConsumingVortex.png and /dev/null differ diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 0fc3d68475..9e320e1bf3 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -28,7 +28,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 12; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 60; + public override bool? CanHitNPC(NPC target) + { + if (Projectile.timeLeft < 60) + return false; + return null; + } public override void AI() { diff --git a/Projectiles/Magic/ExoVortex.cs b/Projectiles/Magic/ExoVortex.cs new file mode 100644 index 0000000000..d049019872 --- /dev/null +++ b/Projectiles/Magic/ExoVortex.cs @@ -0,0 +1,137 @@ +using System.Collections.Generic; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ExoVortex : ModProjectile + { + public PrimitiveTrail EnergyTrail = null; + + public float Hue => Projectile.ai[0]; + + public ref float Time => ref Projectile.ai[1]; + + public const float HueShiftAcrossAfterimages = 0.2f; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Subsuming Vortex"); + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 35; + } + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.alpha = 255; + Projectile.scale = 0.01f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = Projectile.MaxUpdates * 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 18; + Projectile.ignoreWater = true; + Projectile.hide = true; + } + + public override void AI() + { + Time++; + + // Move sharply towards nearby targets. + NPC potentialTarget = Projectile.Center.ClosestNPCAt(SubsumingVortex.SmallVortexTargetRange); + if (potentialTarget != null) + { + float flySpeed = 40f / Projectile.MaxUpdates; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * flySpeed, 0.02f); + } + + // Rotate. + Projectile.rotation += Projectile.velocity.X * 0.04f; + + // Re-determine the hitbox size. + Projectile.Opacity = Utils.GetLerpValue(0f, 20f, Time, true); + Projectile.scale = Utils.Remap(Time, 0f, Projectile.MaxUpdates * 15f, 0.01f, 1.5f) * Utils.GetLerpValue(0f, Projectile.MaxUpdates * 16f, Projectile.timeLeft, true); + Projectile.ExpandHitboxBy((int)(Projectile.scale * 62f)); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + } + + // Draw these vortices behind other projectiles to ensure that they do not obstruct SCal's projectiles. + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindProjectiles.Add(index); + } + + public float PrimitiveWidthFunction(float completionRatio) + { + float width = Projectile.width * 0.6f; + width *= MathHelper.SmoothStep(0.6f, 1f, Utils.GetLerpValue(0f, 0.3f, completionRatio, true)); + return width; + } + + public Color PrimitiveTrailColor(float completionRatio) + { + float hue = Hue % 1f + HueShiftAcrossAfterimages; + if (hue >= 0.99f) + hue = 0.99f; + + float velocityOpacityFadeout = Utils.GetLerpValue(2f, 5f, Projectile.velocity.Length(), true); + Color c = CalamityUtils.MulticolorLerp(hue, CalamityUtils.ExoPalette) * Projectile.Opacity * (1f - completionRatio); + return c * Utils.GetLerpValue(0.04f, 0.2f, completionRatio, true) * velocityOpacityFadeout; + } + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D worleyNoise = ModContent.Request("CalamityMod/ExtraTextures/BlobbyNoise").Value; + float spinRotation = Main.GlobalTimeWrappedHourly * 5.2f; + + Main.spriteBatch.EnterShaderRegion(); + + // Draw the streak trail. + EnergyTrail ??= new(PrimitiveWidthFunction, PrimitiveTrailColor, null, GameShaders.Misc["CalamityMod:SideStreakTrail"]); + + GameShaders.Misc["CalamityMod:SideStreakTrail"].UseImage1("Images/Misc/Perlin"); + EnergyTrail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.Zero) * Projectile.scale * 2f, 51); + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); + + // Draw the vortex, along with some afterimages. + for (int i = 0; i < 5; i++) + { + float hue = Hue % 1f + i / 4f * HueShiftAcrossAfterimages; + Vector2 scale = MathHelper.Lerp(1f, 0.6f, i / 4f) * Projectile.Size / worleyNoise.Size() * 2f; + Vector2 drawOffset = Vector2.UnitY * Projectile.scale * 6f; + Color c = CalamityUtils.MulticolorLerp(hue, CalamityUtils.ExoPalette) * Projectile.Opacity; + Vector2 drawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.spriteBatch.Draw(worleyNoise, drawPosition - drawOffset, null, c, -spinRotation, worleyNoise.Size() * 0.5f, scale, 0, 0f); + Main.spriteBatch.Draw(worleyNoise, drawPosition + drawOffset, null, c, spinRotation, worleyNoise.Size() * 0.5f, scale, 0, 0f); + } + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Magic/FlamingPumpkin.cs b/Projectiles/Magic/FlamingPumpkin.cs index 7123196e4e..eaec07738c 100644 --- a/Projectiles/Magic/FlamingPumpkin.cs +++ b/Projectiles/Magic/FlamingPumpkin.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -13,7 +14,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.penetrate = 2; Projectile.timeLeft = 200; Projectile.DamageType = DamageClass.Magic; diff --git a/Projectiles/Magic/HadalUrnHoldout.cs b/Projectiles/Magic/HadalUrnHoldout.cs new file mode 100644 index 0000000000..1ec1bd6086 --- /dev/null +++ b/Projectiles/Magic/HadalUrnHoldout.cs @@ -0,0 +1,140 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HadalUrnHoldout : ModProjectile + { + public static readonly SoundStyle UrnSound = new("CalamityMod/Sounds/Item/HadalUrnClose"); + + public int manatimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hadal Urn"); + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + float rotoffset = MathHelper.PiOver2; + Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); + bool shouldBeHeld = player.channel && !player.noItems && !player.CCed; + Projectile.damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem()?.damage ?? 0); + if (Projectile.ai[0] > 0f) + { + Projectile.ai[0] -= 1f; + } + if (Main.myPlayer == Projectile.owner) + { + if (shouldBeHeld) + { + float holdscale = player.ActiveItem().shootSpeed * Projectile.scale; + Vector2 playerpos2 = playerpos; + Vector2 going = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerpos2; + if (player.gravDir == -1f) + { + going.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerpos2.Y; + } + Vector2 normalizedgoing = Vector2.Normalize(going); + if (float.IsNaN(normalizedgoing.X) || float.IsNaN(normalizedgoing.Y)) + { + normalizedgoing = -Vector2.UnitY; + } + normalizedgoing *= holdscale; + if (normalizedgoing.X != Projectile.velocity.X || normalizedgoing.Y != Projectile.velocity.Y) + { + Projectile.netUpdate = true; + } + Projectile.velocity = normalizedgoing * 0.55f; + + if (Projectile.ai[0] <= 0) + { + bool manaCostPaid = player.CheckMana(player.ActiveItem(), -1, true, false); + if (manaCostPaid) + { + SoundEngine.PlaySound(SoundID.Item111, Projectile.position); + int projcount = 3; + for (int i = 0; i < projcount; ++i) + { + int projType = Main.rand.Next(6); + int projDamage = Projectile.damage; + int spreadfactor = 45; //Spread of the storm + int ai = 0; //Solely used for the jellyfish to make it hop quicker, otherwise 0 + float speedscale = 18f; //How fast the projectiles should move. This is modified for cerain projectile types + + switch (projType) + { + case 0: + case 1: + projType = ModContent.ProjectileType(); + break; + case 2: + case 3: + projType = ModContent.ProjectileType(); + break; + //Jellyfish and Isopods clog up the screen in higher numbers, so they have half the chance to appear + case 4: + projType = ModContent.ProjectileType(); + speedscale = speedscale * 0.5f; + ai = 30; //Initial "hop" is performed quicker than subsequent hops + break; + default: + projType = ModContent.ProjectileType(); + projDamage = (int)(projDamage * 1.5f); + speedscale = speedscale * 1.5f; + break; + } + Vector2 shotSpeed = Vector2.Normalize(Projectile.velocity) * speedscale; + shotSpeed.X = shotSpeed.X + (float)Main.rand.Next(-spreadfactor, spreadfactor + 1) * 0.05f; + shotSpeed.Y = shotSpeed.Y + (float)Main.rand.Next(-spreadfactor, spreadfactor + 1) * 0.05f; + if (float.IsNaN(shotSpeed.X) || float.IsNaN(shotSpeed.Y)) + { + shotSpeed = -Vector2.UnitY; + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shotSpeed, projType, projDamage, Projectile.knockBack, player.whoAmI, ai); + } + Projectile.ai[0] = 12; + } + else + { + SoundEngine.PlaySound(UrnSound, Projectile.position); + Projectile.Kill(); + } + } + } + else + { + SoundEngine.PlaySound(UrnSound, Projectile.position); + Projectile.Kill(); + } + } + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + rotoffset; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Magic/HadalUrnHoldout.png b/Projectiles/Magic/HadalUrnHoldout.png new file mode 100644 index 0000000000..594f60cd99 Binary files /dev/null and b/Projectiles/Magic/HadalUrnHoldout.png differ diff --git a/Projectiles/Magic/HadalUrnIsopod.cs b/Projectiles/Magic/HadalUrnIsopod.cs new file mode 100644 index 0000000000..8f86b9e6a5 --- /dev/null +++ b/Projectiles/Magic/HadalUrnIsopod.cs @@ -0,0 +1,80 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Magic +{ + public class HadalUrnIsopod : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Isopod"); //Calvan reference!? + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 28; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 4; + Projectile.timeLeft = 240; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Projectile.rotation += 0.3f * (float)Projectile.direction; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.penetrate--; + if (Projectile.penetrate <= 0) + { + Projectile.Kill(); + } + else + { + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + //Donor requested each bounce deal less damage + Projectile.damage = (int)(0.8f * Projectile.damage); + } + return false; + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + //Black Anurian bubble dust + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = Projectile.alpha; + num3 = num246; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + } +} diff --git a/Projectiles/Magic/HadalUrnIsopod.png b/Projectiles/Magic/HadalUrnIsopod.png new file mode 100644 index 0000000000..0a7a2ceabe Binary files /dev/null and b/Projectiles/Magic/HadalUrnIsopod.png differ diff --git a/Projectiles/Magic/HadalUrnJellyfish.cs b/Projectiles/Magic/HadalUrnJellyfish.cs new file mode 100644 index 0000000000..3fa6e27a82 --- /dev/null +++ b/Projectiles/Magic/HadalUrnJellyfish.cs @@ -0,0 +1,140 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HadalUrnJellyfish : ModProjectile + { + bool neartarget = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mirage Jelly"); + Main.projFrames[Projectile.type] = 5; + } + + public override void SetDefaults() + { + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.timeLeft = 600; + Projectile.penetrate = 3; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.ai[0]++; //Timer for the jellyfish's hopping + Projectile.ai[1]--; //Handles the existence of the aura and what happens afterwards + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + + if (Projectile.timeLeft > 60) + { + if (Projectile.alpha > 0) + { + Projectile.alpha -= 25; + } + if (Projectile.alpha < 0) + { + Projectile.alpha = 0; + } + } + else + { + Projectile.alpha += 4; + if (Projectile.alpha >= 255) + { + Projectile.active = false; + } + } + //Hop towards target every 1.5 seconds. Does not occur after aura + if (Projectile.ai[0] % 90 == 0 && Projectile.ai[1] <= 0) + CalamityUtils.HomeInOnNPC(Projectile, true, 1200f, 50f, 20f); + else + Projectile.velocity *= 0.985f; + + //Detect if any enemies are very close + int maxDistance = 10; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile, false)) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + + if (Projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance) && canHit) + { + neartarget = true; + } + } + } + //If an enemy is close, spawn an aura which also expands the hitbox of the jelly + if (neartarget && Projectile.ai[1] <= 0) + { + Projectile.ExpandHitboxBy(Projectile.width * 2, Projectile.height * 2); + Projectile.ai[1] = 120; + } + //While the aura is alive, pierce infinitely and stop in place + if (Projectile.ai[1] > 80) + { + Projectile.velocity *= 0.7f; + //Only spawn the aura once the jellies have fully stopped to prevent offcentered memes + if (Projectile.ai[1] == 110) + { + BloomRing blom = new BloomRing(Projectile.Center, Vector2.Zero, Color.Aqua * 0.5f, Projectile.scale / 2, 40); + GeneralParticleHandler.SpawnParticle(blom); + blom.Position = Projectile.Center; + + Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Color.Aqua * 0.3f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)) / 2, 40); + GeneralParticleHandler.SpawnParticle(Bloom); + Bloom.Position = Projectile.Center; + + Projectile.penetrate = -1; + Projectile.localNPCHitCooldown = 6; + } + } + //Once the aura dies, shrink back to normal size and disappear (it ran out of juice) + if (Projectile.ai[1] == 80) + { + Projectile.ExpandHitboxBy(Projectile.width / 2, Projectile.height / 2); + Projectile.localNPCHitCooldown = 16; + Projectile.timeLeft = 60; + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + int textureheight = tex.Height / Main.projFrames[Projectile.type]; + int y = textureheight * Projectile.frame; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, tex.Width, textureheight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)tex.Width / 2f, (float)textureheight / 2f), Projectile.scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Magic/HadalUrnJellyfish.png b/Projectiles/Magic/HadalUrnJellyfish.png new file mode 100644 index 0000000000..f9fac4979d Binary files /dev/null and b/Projectiles/Magic/HadalUrnJellyfish.png differ diff --git a/Projectiles/Magic/HadalUrnLamprey.cs b/Projectiles/Magic/HadalUrnLamprey.cs new file mode 100644 index 0000000000..649b0eb541 --- /dev/null +++ b/Projectiles/Magic/HadalUrnLamprey.cs @@ -0,0 +1,145 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HadalUrnLamprey : ModProjectile + { + int invistimer = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Lamprey"); + Main.projFrames[Projectile.type] = 8; + } + + public override void SetDefaults() + { + Projectile.width = 18; + Projectile.height = 18; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 45; + } + + public override void AI() + { + //Briefly invisible then quickly fades in after 4 frames so it doesn't appear out of your back + invistimer++; + if (invistimer > 4) + { + if (Projectile.alpha > 0) + { + Projectile.alpha -= 50; + } + } + if (Projectile.alpha < 0) + { + Projectile.alpha = 0; + } + if (Projectile.ai[0] == 0f) + { + Projectile.rotation = Projectile.velocity.ToRotation(); + } + //Sticky Behaviour + Projectile.StickyProjAI(15); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + //AI exclusive to when it isn't sticking + if (Projectile.ai[0] == 0) + { + if (Projectile.frame >= Main.projFrames[Projectile.type] / 2) + { + Projectile.frame = 0; + } + + //The lamprey dies sooner without any food (very sad) + if (Projectile.timeLeft <= 420) + { + Projectile.velocity *= 0.98f; + } + + if (Projectile.timeLeft <= 390) + { + Projectile.Kill(); + } + } + //If it IS sticking + else + { + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = Main.projFrames[Projectile.type] / 2; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Projectile.ModifyHitNPCSticky(5, true); + } + + 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) + { + Texture2D tex = ModContent.Request(Texture).Value; + int textureheight = tex.Height / Main.projFrames[Projectile.type]; + int y = textureheight * Projectile.frame; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, tex.Width, textureheight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(tex.Width, tex.Height / 16f), Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override void Kill(int timeLeft) + { + //Black Anurian bubble dust + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + Projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = Projectile.alpha; + num3 = num246; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + + public override bool? CanHitNPC(NPC target) + { + return null; + } + + public override bool CanHitPvp(Player target) => Projectile.ai[0] == 0f; + } +} diff --git a/Projectiles/Magic/HadalUrnLamprey.png b/Projectiles/Magic/HadalUrnLamprey.png new file mode 100644 index 0000000000..bc264d61af Binary files /dev/null and b/Projectiles/Magic/HadalUrnLamprey.png differ diff --git a/Projectiles/Magic/HadalUrnStarfish.cs b/Projectiles/Magic/HadalUrnStarfish.cs new file mode 100644 index 0000000000..9738306575 --- /dev/null +++ b/Projectiles/Magic/HadalUrnStarfish.cs @@ -0,0 +1,85 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Magic +{ + public class HadalUrnStarfish : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marianan Starfish"); + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.timeLeft = 200; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; + Projectile.ai[0]++; + if (Projectile.ai[0] >= 60) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + Shards(); + SoundEngine.PlaySound(SoundID.Item42, Projectile.position); + Projectile.ai[1]++; + Projectile.ai[0] = 0; + } + } + else + { + Projectile.frame = 0; + } + if (Projectile.timeLeft <= 60) + { + Projectile.velocity *= 0.98f; + } + } + + public override void Kill(int timeLeft) + { + if (Projectile.ai[1] < 2) //Do not shoot more spikes if two rounds have already been shot + Shards(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + + public void Shards() + { + float variance = MathHelper.TwoPi / 5; + for (int i = 0; i < 5; i++) + { + Vector2 velocity = new Vector2(0f, 10f); + velocity = velocity.RotatedBy(variance * i + Projectile.rotation); + int p = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(0.33f * Projectile.damage), 0, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + } + } + } +} diff --git a/Projectiles/Magic/HadalUrnStarfish.png b/Projectiles/Magic/HadalUrnStarfish.png new file mode 100644 index 0000000000..ee92cd87a6 Binary files /dev/null and b/Projectiles/Magic/HadalUrnStarfish.png differ diff --git a/Projectiles/Magic/HadalUrnStarfishShard.cs b/Projectiles/Magic/HadalUrnStarfishShard.cs new file mode 100644 index 0000000000..db7bac89e1 --- /dev/null +++ b/Projectiles/Magic/HadalUrnStarfishShard.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HadalUrnStarfishShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starfish Shard"); + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.timeLeft = 60; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + if (Projectile.timeLeft <= 50) + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 20f, 20f); + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 360); + } + } +} diff --git a/Projectiles/Magic/HadalUrnStarfishShard.png b/Projectiles/Magic/HadalUrnStarfishShard.png new file mode 100644 index 0000000000..36a2e01506 Binary files /dev/null and b/Projectiles/Magic/HadalUrnStarfishShard.png differ diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index db130eaa45..e190e35f2a 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Magic/Icicle.cs b/Projectiles/Magic/Icicle.cs index 8c9ac77d97..d6b31956ca 100644 --- a/Projectiles/Magic/Icicle.cs +++ b/Projectiles/Magic/Icicle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 10; Projectile.height = 10; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 869d70e08f..a3cc420297 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); @@ -95,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs deleted file mode 100644 index 0755aef63b..0000000000 --- a/Projectiles/Magic/MagnusBeam.cs +++ /dev/null @@ -1,287 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Magic -{ - public class MagnusBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 2; - Projectile.alpha = 0; - } - - public override void AI() - { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - float num29 = 5f; - float num30 = 150f; - float scaleFactor = 6f; - Vector2 value7 = new Vector2(10f, 20f); - float num31 = 1f; - int num32 = 3 * Projectile.MaxUpdates; - int num33 = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int num34 = 261; - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); - } - else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) - { - int num35 = -1; - float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) - { - if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(Projectile, false)) - { - Vector2 center3 = Main.npc[num37].Center; - float num38 = Vector2.Distance(center3, Projectile.Center); - if (num38 < num36 && num35 == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, center3, 1, 1)) - { - num36 = num38; - num35 = num37; - } - } - } - if (num36 < 8f) - { - Projectile.Kill(); - return; - } - if (num35 != -1) - { - Projectile.ai[1] = num29 + 1f; - Projectile.ai[0] = (float)num35; - Projectile.netUpdate = true; - } - } - else if (Projectile.ai[1] > num29) - { - Projectile.ai[1] += 1f; - int num39 = (int)Projectile.ai[0]; - if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(Projectile, false)) - { - Projectile.ai[1] = 1f; - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - else - { - Projectile.velocity.ToRotation(); - Vector2 vector6 = Main.npc[num39].Center - Projectile.Center; - if (vector6.Length() < 20f) - { - Projectile.Kill(); - return; - } - if (vector6 != Vector2.Zero) - { - vector6.Normalize(); - vector6 *= scaleFactor; - } - float num40 = 30f; - Projectile.velocity = (Projectile.velocity * (num40 - 1f) + vector6) / num40; - } - } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < num29) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] == num29) - { - Projectile.ai[1] = 1f; - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) - { - Projectile.localAI[0] = 0f; - } - else if (Projectile.alpha == 0) - { - for (int num41 = 0; num41 < 2; num41++) - { - Vector2 value8 = Vector2.UnitX * -30f; - value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7 - Projectile.rotation.ToRotationVector2() * 10f; - int num42 = Dust.NewDust(Projectile.Center, 0, 0, num34, 0f, 0f, 160, default, 1f); - Main.dust[num42].scale = num31; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = Projectile.Center + value8 + Projectile.velocity * 2f; - Main.dust[num42].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + Projectile.velocity * 2f; - } - } - if (Main.rand.NextBool(12)) - { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 100, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = Projectile.Center + value9 * (float)Projectile.width / 2f + Projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; - } - if (Main.rand.NextBool(64)) - { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.4).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = Projectile.Center + value10 * (float)Projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num46].fadeIn = 1.4f; - } - } - if (Main.rand.NextBool(4)) - { - for (int num47 = 0; num47 < 2; num47++) - { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.8).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num48 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num33, 0f, 0f, 0, default, 1.2f); - Main.dust[num48].velocity *= 0.3f; - Main.dust[num48].noGravity = true; - Main.dust[num48].position = Projectile.Center + value11 * (float)Projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num48].fadeIn = 1.4f; - } - } - } - if (Main.rand.NextBool(3)) - { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int num50 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, num34, 0f, 0f, 100, default, 1f); - Main.dust[num50].velocity *= 0.3f; - Main.dust[num50].position = Projectile.Center + value13 * (float)Projectile.width / 2f; - Main.dust[num50].fadeIn = 1.2f; - Main.dust[num50].scale = 1.5f; - Main.dust[num50].noGravity = true; - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - for (int num151 = 0; num151 < 2; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 263, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 263, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 480); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 480); - - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) - return; - - Player player = Main.player[Projectile.owner]; - player.statLife += 1; - player.statMana += 25; - player.HealEffect(1); - player.ManaEffect(25); - } - - public override void Kill(int timeLeft) - { - int num47 = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int num48 = 263; - int num49 = 263; - int height = 50; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = height; - Projectile.Center = Projectile.position; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - for (int num53 = 0; num53 < 40; num53++) - { - num47 = Utils.SelectRandom(Main.rand, new int[] - { - 56, - 92, - 229, - 206, - 181 - }); - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num47, 0f, 0f, 200, default, num50); - Dust dust = Main.dust[num54]; - dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust.noGravity = true; - dust.velocity *= 3f; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num48, 0f, 0f, 100, default, num51); - dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += value4 * Main.rand.NextFloat(); - } - for (int num55 = 0; num55 < 20; num55++) - { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num49, 0f, 0f, 0, default, num52); - Dust dust = Main.dust[num56]; - dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - dust.noGravity = true; - dust.velocity *= 0.5f; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - } - } - } -} diff --git a/Projectiles/Magic/ManaChargedCoral.cs b/Projectiles/Magic/ManaChargedCoral.cs index 77bc571a9a..51a0c050cd 100644 --- a/Projectiles/Magic/ManaChargedCoral.cs +++ b/Projectiles/Magic/ManaChargedCoral.cs @@ -6,6 +6,8 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.Projectiles.Magic { @@ -171,7 +173,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item28 with { Volume = SoundID.Item28.Volume * 0.8f }, Projectile.Center); //To reach full mana, it needs to have stayed at least half the time needed. If you just one shot an enemy with it, you'll only get 10 mana - int manaGained = Math.Max(10, (int)Math.Floor(100 * Math.Clamp(ManaCharge * 2f / FullMana, 0f, 1f))); + int manaGained = Math.Max(10, (int)Math.Floor(150 * Math.Clamp(ManaCharge * 2f / FullMana, 0f, 1f))); Owner.statMana += manaGained; if (Main.myPlayer == Owner.whoAmI) Owner.ManaEffect(manaGained); @@ -179,6 +181,8 @@ namespace CalamityMod.Projectiles.Magic if (Owner.statMana > Owner.statManaMax2) Owner.statMana = Owner.statManaMax2; + Owner.AddBuff(ModContent.BuffType(), CoralSpout.SymbiosisTime); + return; } diff --git a/Projectiles/Magic/MeteorStarExplosion.cs b/Projectiles/Magic/MeteorStarExplosion.cs index 369ca04e12..c8d10b4533 100644 --- a/Projectiles/Magic/MeteorStarExplosion.cs +++ b/Projectiles/Magic/MeteorStarExplosion.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Weapons.Magic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -23,6 +24,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.localNPCHitCooldown = 35; Projectile.tileCollide = false; Projectile.hostile = true; + CooldownSlot = ImmunityCooldownID.TileContactDamage; } public override void AI() @@ -34,8 +36,6 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { damage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); - if (Main.expertMode) - damage /= 2; if (Projectile.ai[0] == 1f) damage /= 2; } @@ -45,16 +45,9 @@ namespace CalamityMod.Projectiles.Magic if (target.townNPC) { damage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); - if (Main.expertMode) - damage /= 2; if (Projectile.ai[0] == 1f) damage /= 2; } } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.GiveIFrames(target.longInvince ? 100 : 60, true); - } } } diff --git a/Projectiles/Magic/NettleRight.cs b/Projectiles/Magic/NettleRight.cs index 967854d41c..bd3657449d 100644 --- a/Projectiles/Magic/NettleRight.cs +++ b/Projectiles/Magic/NettleRight.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; } public override void AI() diff --git a/Projectiles/Magic/NettleTip.cs b/Projectiles/Magic/NettleTip.cs index b61e86e6a4..269dbf8c98 100644 --- a/Projectiles/Magic/NettleTip.cs +++ b/Projectiles/Magic/NettleTip.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 0c3fadd2aa..7895e4c047 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.1f, 0.4f, 0.6f); } Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.rotation += Projectile.velocity.Y * 0.1f; int num1 = -1; Vector2 targetVec = Projectile.Center; float maxDistance = 500f; diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index fe3c9aa0f9..9863bc7332 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -1,4 +1,5 @@ using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index 29e922bb8a..7b895f2b6d 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs; using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using CalamityMod.World; using Microsoft.Xna.Framework; using System; diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 920e109c1c..5472869bdb 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.ShadowFlame, 60); } public override void OnHitPvp(Player target, int damage, bool crit) diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index 4a412d0f34..26ba6aa70d 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using Microsoft.Xna.Framework; using System; using Terraria; diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index edf52fafbd..bfd7df20ad 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 16; Projectile.height = 16; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index eb120a8576..60c08a4997 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 9; + Projectile.aiStyle = ProjAIStyleID.MagicMissile; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.alpha = 70; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 7ccf0dc46a..aaf27ee79e 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -8,6 +8,8 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Particles.Metaballs; +using Terraria.DataStructures; namespace CalamityMod.Projectiles.Magic { @@ -260,65 +262,26 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { int maxFrame = CurrentPower <= LargeMouthPowerLowerBound ? 6 : 9; - Vector2 backgroundOffset = Vector2.UnitX * Main.GlobalTimeWrappedHourly * maxFrame * 0.03f; Texture2D texture = ModContent.Request(Texture).Value; Texture2D backTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBack").Value; Texture2D auraTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationAura").Value; - Texture2D backgroundTexture = ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/GruesomeEminence_Ghost_Layer1").Value; if (CurrentPower > LargeMouthPowerLowerBound) { texture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBig").Value; backTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationBackBig").Value; auraTexture = ModContent.Request("CalamityMod/Projectiles/Magic/SpiritCongregationAuraBig").Value; } - - Effect shader = GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader; - + float offsetFactor = Projectile.scale * ((CongregationDiameter - 54f) / 90f + 1.5f); offsetFactor *= texture.Width / 90f; Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.rotation.ToRotationVector2() * offsetFactor * 15f; Rectangle frame = texture.Frame(1, maxFrame, 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - Color auraColor = Color.Lerp(Color.Fuchsia, Color.Black, 0.55f); SpriteEffects direction = Math.Cos(Projectile.rotation) > 0f ? SpriteEffects.None : SpriteEffects.FlipVertically; - // Draw the outline aura below everything else. - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); ; - - for (int i = 0; i < 3; i++) - Main.EntitySpriteDraw(auraTexture, drawPosition, frame, auraColor, Projectile.rotation, origin, Projectile.scale, direction, 0); - - Main.spriteBatch.ExitShaderRegion(); - - // Draw the back with the specified shader. - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - shader.Parameters["edgeBorderSize"].SetValue(0f); - shader.Parameters["borderShouldBeSolid"].SetValue(FusableParticleManager.GetParticleSetByType().BorderShouldBeSolid); - shader.Parameters["edgeBorderColor"].SetValue(FusableParticleManager.GetParticleSetByType().BorderColor.ToVector3()); - shader.Parameters["screenArea"].SetValue(backTexture.Size() / Main.GameViewMatrix.Zoom); - shader.Parameters["screenMoveOffset"].SetValue(Vector2.Zero); - shader.Parameters["uWorldPosition"].SetValue(Main.screenPosition); - shader.Parameters["renderTargetArea"].SetValue(backTexture.Size()); - shader.Parameters["invertedScreen"].SetValue(Main.LocalPlayer.gravDir == -1f); - shader.Parameters["generalBackgroundOffset"].SetValue(backgroundOffset); - shader.Parameters["uWorldPosition"].SetValue(Projectile.position); - shader.Parameters["uRotation"].SetValue(Projectile.rotation); - shader.Parameters["uTime"].SetValue(Main.GlobalTimeWrappedHourly); - shader.Parameters["upscaleFactor"].SetValue(new Vector2(Main.screenWidth, Main.screenHeight) / backTexture.Size() / maxFrame); - - // Prepare the background texture for loading. - Main.graphics.GraphicsDevice.Textures[1] = backgroundTexture; - shader.Parameters["uImageSize1"].SetValue(backgroundTexture.Size()); - - shader.CurrentTechnique.Passes[0].Apply(); - - // Draw the normal texture. - Main.EntitySpriteDraw(backTexture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); - Main.spriteBatch.ExitShaderRegion(); - + DrawData backTextureDraw = new(backTexture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); + DrawData auraTextureDraw = new(auraTexture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); + FusableParticleManager.GetParticleSetByType()?.PrepareSpecialDrawingForNextFrame(backTextureDraw, auraTextureDraw); Main.EntitySpriteDraw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } diff --git a/Projectiles/Magic/SpiritDust.cs b/Projectiles/Magic/SpiritDust.cs index ff2235a91b..59a7785d14 100644 --- a/Projectiles/Magic/SpiritDust.cs +++ b/Projectiles/Magic/SpiritDust.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index cc4d76d7e0..d293e62cac 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 3; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; } diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs deleted file mode 100644 index 839a710f94..0000000000 --- a/Projectiles/Magic/SubsumingTentacle.cs +++ /dev/null @@ -1,159 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class SubsumingTentacle : ModProjectile - { - public int AlphaFade - { - get => (int)Projectile.localAI[0]; - set => Projectile.localAI[0] = value; - } - public Vector2 OffsetAcceleration - { - get => new Vector2(Projectile.ai[0], Projectile.ai[1]); - set - { - Projectile.ai[0] = value.X; - Projectile.ai[1] = value.Y; - } - } - public const float SegmentOffset = 5f; - public const float MaxArcingSpeed = 16f; - public const float MaxHomingSpeed = 18f; - public const float MaxEnemyDistance = 1450f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exo Tentacle"); - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 75; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.MaxUpdates = 2; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; - } - - public override void AI() - { - if (!Projectile.tileCollide) - { - AlphaFade++; - Projectile.alpha = AlphaFade; - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - return; - } - } - // Here, the old positions act more like "control points" than old postions, and will be referred as such henceforth. - // Each control point should have a set offset, to give a "chain" effect. - for (int i = 1; i < Projectile.oldPos.Length; i++) - { - Projectile.oldPos[i] = Projectile.oldPos[i - 1] + Vector2.Normalize(Projectile.oldPos[i] - Projectile.oldPos[i - 1]) * SegmentOffset; - } - Projectile.ExpandHitboxBy((int)(20f * Projectile.scale)); - if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height) && Projectile.tileCollide) - { - Projectile.tileCollide = false; - } - - NPC closestTarget = Projectile.Center.ClosestNPCAt(MaxEnemyDistance, true, true); - if (closestTarget != null) - { - HomingMovement(closestTarget); - } - else - { - ArcingMovement(); - } - Projectile.scale -= closestTarget is null ? 0.007f : 0.004f; - if (Projectile.scale <= 0.05f) - { - Projectile.Kill(); - } - } - public void ArcingMovement() - { - // Cause the tentacle to arc around at an increasingly fast rate. - Projectile.velocity += OffsetAcceleration; - if (Projectile.velocity.Length() > MaxArcingSpeed) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= MaxArcingSpeed; - } - - // Accelerate the arc. - OffsetAcceleration *= 1.035f; - } - public void HomingMovement(NPC closestTarget) - { - float angleOffset = MathHelper.WrapAngle(Projectile.AngleTo(closestTarget.Center) - Projectile.velocity.ToRotation()); - angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); - - if (Projectile.Distance(closestTarget.Center) > 65f) - { - Projectile.velocity = Projectile.velocity.RotatedBy(angleOffset); - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * MaxHomingSpeed; - } - } - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - if (Projectile.scale < 1f) - { - for (int i = 10; i < Projectile.oldPos.Length; i++) - { - var tentacleShader = GameShaders.Misc["CalamityMod:SubsumingTentacle"]; - tentacleShader.UseImage1("Images/Misc/Perlin"); - - Vector2 drawPos = Projectile.oldPos[i] + ModContent.Request(Texture).Size() / 2f - Main.screenPosition + Projectile.gfxOffY * Vector2.UnitY; - float scale = MathHelper.Lerp(0.05f, 1.3f, i / (float)Projectile.oldPos.Length) * Projectile.scale; - scale = MathHelper.Clamp(scale, 0f, 2f); - Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, drawPos, null, color, Projectile.rotation, ModContent.Request(Texture).Size() / 2f, scale, SpriteEffects.None, 0); - tentacleShader.UseSaturation(i / (float)Projectile.oldPos.Length); // A "completion ratio" for the shader. Used to make the entire tentacle appear multi-colored. - tentacleShader.UseOpacity(1f / Projectile.oldPos.Length); // A "step value" for the shader. Used to give variance in color at each individual segment. - tentacleShader.Apply(null); - } - } - return false; - } - public override void PostDraw(Color drawColor) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - for (int i = 1; i < Projectile.oldPos.Length; i++) - { - float scale = MathHelper.Lerp(0.05f, 1f, i / (float)Projectile.oldPos.Length) * Projectile.scale * 0.85f; - if (targetHitbox.Intersects(new Rectangle((int)Projectile.oldPos[i].X, (int)Projectile.oldPos[i].Y, (int)(Projectile.width * scale), (int)(Projectile.height * scale)))) - return true; - } - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.velocity = oldVelocity; - return false; - } - } -} diff --git a/Projectiles/Magic/SubsumingTentacle.png b/Projectiles/Magic/SubsumingTentacle.png deleted file mode 100644 index c6b3592c9f..0000000000 Binary files a/Projectiles/Magic/SubsumingTentacle.png and /dev/null differ diff --git a/Projectiles/Magic/TacticiansTrumpCardProj.cs b/Projectiles/Magic/TacticiansTrumpCardProj.cs index 22d3734abd..afeddec795 100644 --- a/Projectiles/Magic/TacticiansTrumpCardProj.cs +++ b/Projectiles/Magic/TacticiansTrumpCardProj.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 3; diff --git a/Projectiles/Magic/TridentIcicle.cs b/Projectiles/Magic/TridentIcicle.cs index 74cf870e4a..15f04916fa 100644 --- a/Projectiles/Magic/TridentIcicle.cs +++ b/Projectiles/Magic/TridentIcicle.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 18; Projectile.height = 18; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.friendly = true; Projectile.coldDamage = true; diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs deleted file mode 100644 index b8ae55ba76..0000000000 --- a/Projectiles/Magic/Vortex.cs +++ /dev/null @@ -1,163 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class Vortex : ModProjectile - { - public float TargetCheckCooldown - { - get => Projectile.localAI[0]; - set => Projectile.localAI[0] = value; - } - public float Time - { - get => Projectile.localAI[1]; - set => Projectile.localAI[1] = value; - } - public int TargetIndex - { - get => (int)Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - - public const float AngularMovementSpeed = 0.1f; - public const float Acceleration = 0.0025f; - public const float TargetCheckInterval = 30f; - public const float MaximumTargetDistance = 600f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Subsuming Vortex"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 60; - Projectile.height = 60; - Projectile.alpha = 255; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.tileCollide = true; - Projectile.extraUpdates = 4; - Projectile.timeLeft = 115 * Projectile.extraUpdates; - Projectile.ignoreWater = true; - } - - public override void AI() - { - // At the very beginning, start without a target. - if (Time == 0f) - { - TargetIndex = -1; - } - Time++; - if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) - { - VisualEffects(); - } - Movement(HandleTargeting()); - Projectile.rotation += Projectile.velocity.X * 0.1f; - } - - public bool HandleTargeting() - { - float targetCheckDistance = 350f * Projectile.ai[1]; - - // Reduce a cooldown. Nothing special here. - if (TargetCheckCooldown > 0f) - { - TargetCheckCooldown--; - } - - // Attempt to find a target if the projectile has none. - if (TargetIndex == -1 && TargetCheckCooldown <= 0f) - { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(targetCheckDistance, true, true); - if (potentialTarget != null) - TargetIndex = potentialTarget.whoAmI; - Projectile.netUpdate = true; - } - if (TargetCheckCooldown <= 0f && TargetIndex == -1) - { - TargetCheckCooldown = TargetCheckInterval; - } - bool stillCanReachTarget = false; - // Ensure that the target is still in reach if there is indeed a target. - if (TargetIndex != -1) - { - stillCanReachTarget = Projectile.Distance(Main.npc[TargetIndex].Center) < MaximumTargetDistance; - if (!stillCanReachTarget) - { - TargetIndex = -1; - Projectile.netUpdate = true; - } - } - return stillCanReachTarget; - } - - public void VisualEffects() - { - // Generate idle circular dust and light after 10 frames. - if (!Main.dedServ) - { - int dustCount = 5; - for (int i = 0; i < dustCount; i++) - { - Vector2 spawnPosition = Projectile.Center + Projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.333f; - Vector2 velocity = Main.rand.NextFloat(MathHelper.TwoPi).ToRotationVector2() * Main.rand.NextFloat(6f, 16f); - Dust dust = Dust.NewDustPerfect(spawnPosition, 66, velocity, 0, Main.DiscoColor, 0.7f); - dust.noGravity = true; - dust.noLight = true; - dust.velocity = -Projectile.velocity; - } - } - // Fade in. - Projectile.alpha -= 5; - if (Projectile.alpha < 50) - { - Projectile.alpha = 50; - } - // And make rainbow light. - Lighting.AddLight(Projectile.Center / 16, Main.DiscoColor.ToVector3()); - } - - public void Movement(bool stillCanReachTarget) - { - // Homing sharply towards the target in a circular fashion. - // The way this type of homing is by determining the offset between the angle to the target and the velocity's angle. - // This offset can be thought of as how much, in radians, the velocity would need to rotate to move towards the target. - // Then, the velocity is rotated by that offset (which, as established, would give perfect homing) multiplied by a <1 factor. - // This causes the velocity to constantly rotate sharply towards the target. - if (stillCanReachTarget) - { - float angleOffsetToTarget = Projectile.AngleTo(Main.npc[TargetIndex].Center) - Projectile.velocity.ToRotation(); - angleOffsetToTarget = MathHelper.WrapAngle(angleOffsetToTarget); // Ensure the offset is in the range of -pi to pi. - Projectile.velocity = Projectile.velocity.RotatedBy(angleOffsetToTarget * AngularMovementSpeed); - } - // Accelerate constantly with time. - float oldSpeed = Projectile.velocity.Length(); - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * (oldSpeed + Acceleration); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.ExoDebuffs(); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.ExoDebuffs(); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Magic/Vortex.png b/Projectiles/Magic/Vortex.png deleted file mode 100644 index fd7e0bf39c..0000000000 Binary files a/Projectiles/Magic/Vortex.png and /dev/null differ diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index d64fbaf61b..006b461854 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -1,16 +1,53 @@ +using System; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Particles; + namespace CalamityMod.Projectiles.Magic { public class WulfrumBolt : ModProjectile { + public ref float OriginalRotation => ref Projectile.ai[0]; + public NPC Target + { + get + { + if (Projectile.ai[1] < 0 || Projectile.ai[1] > Main.maxNPCs) + return null; + + return Main.npc[(int)Projectile.ai[1]]; + } + set + { + if (value == null) + Projectile.ai[1] = -1; + else + Projectile.ai[1] = value.whoAmI; + } + } + + public static float MaxDeviationAngle = MathHelper.PiOver4; + public static float HomingRange = 250; + public static float HomingAngle = MathHelper.PiOver4 * 1.65f; + + internal PrimitiveTrail TrailDrawer; + internal Color PrimColorMult = Color.White; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); + + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() @@ -19,38 +56,181 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 8; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 2; + Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 140; + Projectile.extraUpdates = 2; + } + + public NPC FindTarget() + { + float bestScore = 0; + NPC bestTarget = null; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC potentialTarget = Main.npc[i]; + + if (!potentialTarget.CanBeChasedBy(null, false)) + continue; + + float distance = potentialTarget.Distance(Projectile.Center); + float angle = Projectile.velocity.AngleBetween((potentialTarget.Center - Projectile.Center)); + + float extraDistance = potentialTarget.width / 2 + potentialTarget.height / 2; + + if (distance - extraDistance < HomingRange && angle < HomingAngle / 2f) + { + if (!Collision.CanHit(Projectile.Center, 1, 1, potentialTarget.Center, 1, 1) && extraDistance < distance) + continue; + + float attemptedScore = EvaluatePotentialTarget(distance - extraDistance, angle / 2f); + if (attemptedScore > bestScore) + { + bestTarget = potentialTarget; + bestScore = attemptedScore; + } + } + } + return bestTarget; + + } + + public float EvaluatePotentialTarget(float distance, float angle) + { + float score = 1 - distance / HomingRange * 0.5f; + + score += (1 - Math.Abs(angle) / (HomingAngle / 2f)) * 0.5f; + + return score; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.1f / 255f, 0f); - for (int num151 = 0; num151 < 3; num151++) + if (Projectile.timeLeft == 140) { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); - Main.dust[num155].noGravity = true; - Main.dust[num155].noLight = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; + if (OriginalRotation == 0) + { + OriginalRotation = Projectile.velocity.ToRotation(); + Projectile.rotation = OriginalRotation; + } + Target = null; } - if (Main.rand.NextBool(8)) + else { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noLight = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; - return; + Target = FindTarget(); } + + Lighting.AddLight(Projectile.Center, (Color.GreenYellow * 0.8f).ToVector3() * 0.5f); + + if (Target != null) + { + float distanceFromTarget = (Target.Center - Projectile.Center).Length(); + + Projectile.rotation = Projectile.rotation.AngleTowards((Target.Center - Projectile.Center).ToRotation(), 0.07f * (float)Math.Pow(( 1 - distanceFromTarget / HomingRange), 2)); + } + + Projectile.velocity *= 0.983f; + Projectile.velocity = Projectile.rotation.ToRotationVector2() * Projectile.velocity.Length(); + + //Blast off. + if (Projectile.timeLeft == 140) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity * 1f; + + for (int i = 0; i < 5; i++) + { + Dust chust = Dust.NewDustPerfect(dustCenter, 15, Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.2f, 0.5f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + } + } + + if (Projectile.timeLeft <= 137) + { + if (Main.rand.NextBool()) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + } + + if (Main.rand.NextBool(4)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust largeDust = Dust.NewDustPerfect(dustCenter, 257, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.4f), Scale: Main.rand.NextFloat(0.4f, 1f)); + largeDust.noGravity = true; + largeDust.noLight = true; + } + + if (Main.rand.NextBool(5)) + { + Vector2 center = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(4, 10); + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(center, velocity, Main.rand.NextFloat(1f, 2f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25)); + + } + } + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Sqrt(1 - completionRatio); + return Color.DeepSkyBlue.MultiplyRGB(PrimColorMult) * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return 9.4f; } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 3.5f, delegate (Vector2 offset, Color colorMod) + { + PrimColorMult = colorMod; + + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + offset, 30); + }); + + + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + return false; } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(WulfrumProsthesis.HitSound, Projectile.Center); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + + return base.OnTileCollide(oldVelocity); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int numParticles = Main.rand.Next(4, 7); + for (int i = 0; i < numParticles; i++) + { + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(3, 14); + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(target.Center, velocity, Main.rand.NextFloat(2.5f, 3f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25)); + } + } } } diff --git a/Projectiles/Magic/WulfrumManaDrain.cs b/Projectiles/Magic/WulfrumManaDrain.cs new file mode 100644 index 0000000000..253f020e3c --- /dev/null +++ b/Projectiles/Magic/WulfrumManaDrain.cs @@ -0,0 +1,159 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WulfrumManaDrain : ModProjectile + { + private SlotId SuccSoundSlot; + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Drain"); + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 2; + } + public override bool ShouldUpdatePosition() => false; + public override bool? CanDamage() => false; + + + + public override void AI() + { + Owner.itemTime = 2; + Owner.itemAnimation = 2; + + if (!Owner.Calamity().mouseRight || Owner.dead || Owner.frozen || !Owner.active || Owner.statMana == Owner.statManaMax2) + return; + + //Once again the sound volume scaling does NOT work for whatever reason? Help. + + if (!SoundEngine.TryGetActiveSound(SuccSoundSlot, out var idleSoundOut) || !idleSoundOut.IsPlaying) + { + SuccSoundSlot = SoundEngine.PlaySound(WulfrumProsthesis.SuckSound with { Volume = WulfrumProsthesis.SuckSound.Volume * 0.01f ,IsLooped = true }, Owner.Center); + + } + + else if (idleSoundOut != null) + { + idleSoundOut.Position = Owner.Center; + idleSoundOut.Volume = Math.Clamp((Timer / 30f) + 0.001f, 0f, 1f) * 100f; + } + + + Projectile.timeLeft = 2; + Projectile.Center = Owner.MountedCenter; + Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.One); + + if (Main.rand.NextBool(6)) + { + Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.2f, 0.5f), Projectile.velocity.RotatedByRandom(MathHelper.PiOver2 * 0.6f) * Main.rand.NextFloat(70f, 150f), Main.rand.NextFloat(30f, 44f), Color.GreenYellow, Color.DeepSkyBlue, Main.rand.Next(13, 20)); + GeneralParticleHandler.SpawnParticle(streak); + } + + NPC target = GetSuccTarget(); + + if (target != null) + { + Owner.GetModPlayer().ManaDrainActive = true; + + if (!Main.rand.NextBool(3)) + { + Vector2 center = target.Center; + center.X += (float)Main.rand.Next(-100, 100) * 0.1f; + center.Y += (float)Main.rand.Next(-100, 100) * 0.1f; + + center += target.velocity; + //Drain ganggg + + Particle bloom = new ManaDrainBlob(Owner, center, Main.rand.NextVector2Circular(4f, 4f), Main.rand.NextFloat(0.7f, 0.9f), Color.DeepSkyBlue); + GeneralParticleHandler.SpawnParticle(bloom); + } + } + + Timer++; + } + + public NPC GetSuccTarget() + { + float collisionPoint = 0f; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC struckNPC = Main.npc[i]; + + if (!struckNPC.active || struckNPC.townNPC || struckNPC.friendly) + continue; + + float distance = struckNPC.Distance(Projectile.Center); + float extraDistance = struckNPC.width / 2 + struckNPC.height / 2; + + if (distance - extraDistance < 400f) + { + if (!Collision.CheckAABBvLineCollision(struckNPC.Hitbox.TopLeft(), struckNPC.Hitbox.Size(), Owner.MountedCenter, Owner.MountedCenter + Projectile.velocity * 400f, 110f, ref collisionPoint)) + continue; + + if (!Collision.CanHit(Projectile.Center, 1, 1, struckNPC.Center, 1, 1) && extraDistance < distance) + continue; + + return struckNPC; + } + } + + return null; + } + + public override void Kill(int timeLeft) + { + if (Timer > 2) + { + NPC target = GetSuccTarget(); + + if (target != null) + { + int particlesCount = Main.rand.Next(5, 10); + for (int i = 0; i < particlesCount; i++) + { + Vector2 center = target.Center; + center.X += (float)Main.rand.Next(-100, 100) * 0.1f; + center.Y += (float)Main.rand.Next(-100, 100) * 0.1f; + + center += target.velocity; + //Drain ganggg + + Particle bloom = new ManaDrainBlob(Owner, center, Main.rand.NextVector2Circular(4f, 4f), Main.rand.NextFloat(0.76f, 1f), Color.DeepSkyBlue); + GeneralParticleHandler.SpawnParticle(bloom); + } + } + } + + if (SoundEngine.TryGetActiveSound(SuccSoundSlot, out var soundOut)) + { + soundOut.Stop(); + + SoundEngine.PlaySound(WulfrumProsthesis.SuckStopSound with { Volume = WulfrumProsthesis.SuckStopSound.Volume * Timer / 30f}, Projectile.Center); + + } + } + } +} diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index fa82b14a4e..cf73901228 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.extraUpdates = 1; } diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index 1f1cdec7c0..6809d8635b 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; } diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index 2bb673ea3c..60efa2e47a 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; } diff --git a/Projectiles/Magic/WyvernProjectile.cs b/Projectiles/Magic/WyvernProjectile.cs index 08f4a547e9..bc8b5c64b9 100644 --- a/Projectiles/Magic/WyvernProjectile.cs +++ b/Projectiles/Magic/WyvernProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 1; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Magic; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; } public override void AI() diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs index bed94110d2..3aacbac77b 100644 --- a/Projectiles/Melee/AftershockRock.cs +++ b/Projectiles/Melee/AftershockRock.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 32; Projectile.height = 34; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.friendly = true; Projectile.penetrate = 6; Projectile.extraUpdates = 1; diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs index c18d64c4bc..9a057eb259 100644 --- a/Projectiles/Melee/AquaStream.cs +++ b/Projectiles/Melee/AquaStream.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 150; Projectile.penetrate = 1; Projectile.timeLeft = 14; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index ea5743a470..9902bb6acf 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 75; Projectile.width = Projectile.height = 75; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index 7d74641fa2..9e36f276d6 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 60; Projectile.width = Projectile.height = 60; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index b8c8ec23f0..4fa1f38d2b 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 300; Projectile.width = Projectile.height = 300; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index ae60324fed..a769e66486 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 75; Projectile.width = Projectile.height = 75; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index f96aa9cdea..7b6f906dc4 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 60; Projectile.width = Projectile.height = 60; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index d4ce24ed6b..5c0ebed0a2 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 75; Projectile.width = Projectile.height = 75; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs index 779f1ebf55..170a089cc2 100644 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 300; Projectile.width = Projectile.height = 300; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index bdeb43fd11..5c4dd557ff 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 60; Projectile.width = Projectile.height = 60; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/AtaraxiaMain.cs b/Projectiles/Melee/AtaraxiaMain.cs index 39ce8bd410..b26d2f6b5a 100644 --- a/Projectiles/Melee/AtaraxiaMain.cs +++ b/Projectiles/Melee/AtaraxiaMain.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 3; Projectile.timeLeft = 180; } diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index 3a22a40676..4286d421a6 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 3; Projectile.timeLeft = 180; } diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs index 308bdc5b92..673a3eba7e 100644 --- a/Projectiles/Melee/BallOFuguProj.cs +++ b/Projectiles/Melee/BallOFuguProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; } diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index cc2455a3ed..abb32dd4f3 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 38; Projectile.height = 38; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; AIType = ProjectileID.DeathSickle; Projectile.alpha = 100; diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 78c852d143..0c78671c0c 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 100; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index 3a0fdbc45b..988a29f211 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 4; Projectile.height = 4; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; Projectile.timeLeft = 150; } diff --git a/Projectiles/Melee/BloodExplosion.cs b/Projectiles/Melee/BloodExplosion.cs index 06f30e9013..fc6e323ffb 100644 --- a/Projectiles/Melee/BloodExplosion.cs +++ b/Projectiles/Melee/BloodExplosion.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 5; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index f6b59e9d76..84b31ec938 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 48; Projectile.height = 48; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/BonebreakerFragment1.cs b/Projectiles/Melee/BonebreakerFragment1.cs index d2f58f7697..95272efe40 100644 --- a/Projectiles/Melee/BonebreakerFragment1.cs +++ b/Projectiles/Melee/BonebreakerFragment1.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 6; Projectile.height = 6; - Projectile.aiStyle = 24; + Projectile.aiStyle = ProjAIStyleID.CrystalShard; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.alpha = 50; Projectile.timeLeft = 600; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 3f34725ed4..92362756e4 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.alpha = 255; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -2; diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index 8a2fe8d90f..2cb37afa3f 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index f39ed5d233..c0fd95f2da 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index 66e5bd7914..205f23be0c 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,10 +21,10 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 2; Projectile.height = 2; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.DeathLaser; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.scale = 2f; Projectile.ignoreWater = true; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs index 9b036b5f25..b40e308d2b 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { Projectile.width = Projectile.height = 32; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 510b62b011..94e87d36f9 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index cf5facee68..eb0a67f192 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; Projectile.tileCollide = false; } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index defa51ecb3..e253259568 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 24; Projectile.height = 24; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index 1aa6d98e94..3a2fe5ad5a 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 100; Projectile.friendly = true; Projectile.timeLeft = 180; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index f0c6409d23..a28a636f43 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 489b157f06..f7202aacf8 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 60; Projectile.tileCollide = false; Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; Projectile.coldDamage = true; diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 90606c74ff..2fc0ad1560 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 14; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs index a929ecefac..11446369ce 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 8; diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 33a670fc25..b75205aaf4 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 50; Projectile.alpha = 100; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; Projectile.penetrate = 5; Projectile.timeLeft = 180; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.extraUpdates = 1; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; AIType = ProjectileID.DeathSickle; } diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 3e2e610fd3..5a25fca34b 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; using System; using Terraria; using Terraria.ID; @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = -1; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { - for (int num55 = 0; num55 < 8; num55++) + for (int num55 = 0; num55 < 3; num55++) { int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } } - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(10)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - for (int k = 0; k < 3; k++) + for (int k = 0; k < 1; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[Projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames); + Main.player[Projectile.owner].GiveIFrames(LucreciaProj.OnHitIFrames); target.immune[Projectile.owner] = 5; } } diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index 1f62ff2b5e..90c74dd86c 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; using System; using Terraria; using Terraria.ID; @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = -1; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170) { - for (int num55 = 0; num55 < 8; num55++) + for (int num55 = 0; num55 < 3; num55++) { int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); Main.dust[num56].noGravity = true; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } } - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(10)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - for (int k = 0; k < 3; k++) + for (int k = 0; k < 1; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); } @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[Projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames); + Main.player[Projectile.owner].GiveIFrames(LucreciaProj.OnHitIFrames); target.immune[Projectile.owner] = 5; } } diff --git a/Projectiles/Melee/Dark.cs b/Projectiles/Melee/Dark.cs index 23de463312..1029fe8ea6 100644 --- a/Projectiles/Melee/Dark.cs +++ b/Projectiles/Melee/Dark.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 818342abc2..8736df5813 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 56; - Projectile.height = 56; - Projectile.aiStyle = 18; + Projectile.width = 74; + Projectile.height = 74; + Projectile.aiStyle = ProjAIStyleID.Sickle; AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/DarkBeam.png b/Projectiles/Melee/DarkBeam.png index ba27b2821d..5869f94796 100644 Binary files a/Projectiles/Melee/DarkBeam.png and b/Projectiles/Melee/DarkBeam.png differ diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index e04cbd01a9..805b47e645 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.timeLeft = 600; Projectile.friendly = true; diff --git a/Projectiles/Melee/DeathsAscensionProjectile.cs b/Projectiles/Melee/DeathsAscensionProjectile.cs new file mode 100644 index 0000000000..157b44a6c4 --- /dev/null +++ b/Projectiles/Melee/DeathsAscensionProjectile.cs @@ -0,0 +1,57 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class DeathsAscensionProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = 102; + Projectile.height = 82; + Projectile.aiStyle = ProjAIStyleID.Sickle; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.alpha = 55; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.ignoreWater = true; + AIType = ProjectileID.DeathSickle; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.65f / 255f); + + if (Main.rand.NextBool(3)) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + } + + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 12f, 20f); + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(150, 0, 200, 0); + } + } +} diff --git a/Projectiles/Melee/DeathsAscensionProjectile.png b/Projectiles/Melee/DeathsAscensionProjectile.png new file mode 100644 index 0000000000..9e0b5020a9 Binary files /dev/null and b/Projectiles/Melee/DeathsAscensionProjectile.png differ diff --git a/Projectiles/Melee/DeathsAscensionSwing.cs b/Projectiles/Melee/DeathsAscensionSwing.cs new file mode 100644 index 0000000000..6a5833c5d1 --- /dev/null +++ b/Projectiles/Melee/DeathsAscensionSwing.cs @@ -0,0 +1,132 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DeathsAscensionSwing : ModProjectile + { + public int frameX = 0; + public int frameY = 0; + + public int CurrentFrame + { + get => frameX * 6 + frameY; + set + { + frameX = value / 6; + frameY = value % 6; + } + } + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death's Ascension"); + } + + public override void SetDefaults() + { + Projectile.width = 159; + Projectile.height = 230; + Projectile.scale = 1.15f; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; + Projectile.frameCounter = 0; + } + + public override void AI() + { + //Frames and crap + Projectile.frameCounter++; + if (Projectile.frameCounter % 3 == 0) + { + CurrentFrame++; + if (frameX >= 2) + CurrentFrame = 0; + } + + if (frameX == 0 && frameY == 3 && Projectile.frameCounter % 3 == 0) + { + SoundEngine.PlaySound(SoundID.Item71, Projectile.position); + } + + if ((frameX == 0 && frameY >= 3) || (frameX == 1 && frameY <= 1)) + { + Projectile.idStaticNPCHitCooldown = 8; + } + else if (frameX == 1 && frameY > 1) + { + Projectile.idStaticNPCHitCooldown = 12; + } + + Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + if (Main.myPlayer == Projectile.owner) + { + if (Owner.channel && !Owner.noItems && !Owner.CCed) + HandleChannelMovement(playerRotatedPoint); + else + Projectile.Kill(); + } + + // Rotation and directioning. + Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + + // Sprite and player directioning. + Projectile.spriteDirection = Projectile.direction; + if (Projectile.direction == 1) + Projectile.Left = Owner.Center; + else + Projectile.Right = Owner.Center; + Projectile.position.X += Projectile.spriteDirection == -1 ? 26f : -26f; + Projectile.position.Y -= Projectile.scale * 2f; + Owner.ChangeDir(Projectile.direction); + + // Prevents the projectile from dying + Projectile.timeLeft = 2; + + // Player item-based field manipulation. + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + public void HandleChannelMovement(Vector2 playerRotatedPoint) + { + Vector2 newVelocity = Vector2.UnitX * (Main.MouseWorld.X > playerRotatedPoint.X).ToDirectionInt(); + + // Sync if a velocity component changes. + if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) + Projectile.netUpdate = true; + + Projectile.velocity = newVelocity; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.frameCounter <= 1) + return false; + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 position = Projectile.Center - Main.screenPosition + (Projectile.spriteDirection == -1 ? new Vector2(60, 0) : new Vector2(-60, 0)); + Vector2 origin = texture.Size() / new Vector2(2f, 6f) * 0.5f; + Rectangle frame = texture.Frame(2, 6, frameX, frameY); + SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 170); + + // Deal damage only once it starts swinging down and then going back up + public override bool? CanDamage() => ((frameX == 0 && frameY >= 3) || frameX == 1) && Projectile.frameCounter > 6; + } +} diff --git a/Projectiles/Melee/DeathsAscensionSwing.png b/Projectiles/Melee/DeathsAscensionSwing.png new file mode 100644 index 0000000000..d427a27645 Binary files /dev/null and b/Projectiles/Melee/DeathsAscensionSwing.png differ diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 12e41f0c4b..3a96d8ac8f 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 5fd78f9b53..ddad61e84b 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index a415593ea9..1613469e1b 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -42,12 +42,12 @@ namespace CalamityMod.Projectiles.Melee if (!Main.player[Projectile.owner].channel) { Projectile.ai[1] = -1f; - Projectile.damage = Projectile.Calamity().defDamage; + Projectile.damage = Projectile.originalDamage; } } if (Projectile.ai[1] >= 255f) - Projectile.damage = (int)((double)Projectile.Calamity().defDamage * 2.0); + Projectile.damage = 2 * Projectile.originalDamage; red = 64 + (int)(Projectile.ai[1] * 0.75f); if (red > 255) diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 9c0711df2f..d718726627 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] += 1f; if (Projectile.ai[1] == 255f) - Projectile.damage = (int)((double)Projectile.Calamity().defDamage * 2.0); + Projectile.damage = 2 * Projectile.originalDamage; red = 64 + (int)(Projectile.ai[1] * 0.75f); if (red > 255) diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs index 0b8044eccb..cfd8166652 100644 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ b/Projectiles/Melee/DivineHatchetBoomerang.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = 4; Projectile.timeLeft = Lifetime; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index 5213c420a3..2c7210588a 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index 820d030391..4f4ea18b3f 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index 7738a4334b..ea2752d0f8 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 6; Projectile.height = 6; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.extraUpdates = 1; diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index 4468261513..c6438234e9 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 50; Projectile.height = 50; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.extraUpdates = 2; diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 79e02090a3..d121a5ad62 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -145,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index bab3baa12f..b0a91787f6 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -144,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 180); + target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(target.Center); } @@ -159,7 +160,7 @@ namespace CalamityMod.Projectiles.Melee { CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); modPlayer.dragonRageHits++; - if (modPlayer.dragonRageHits > 10) + if (modPlayer.dragonRageHits > 10 && modPlayer.dragonRageCooldown <= 0) { SpawnFireballs(); modPlayer.dragonRageHits = 0; @@ -183,6 +184,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); } + Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index 468019df6a..2013beb409 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 120; - Projectile.aiStyle = 27; + Projectile.timeLeft = 60; + Projectile.aiStyle = ProjAIStyleID.Beam; } public override void AI() @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 115) + if (Projectile.timeLeft > 50) return false; return true; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - for (int k = 0; k < 4; k++) + for (int k = 0; k < 2; k++) { int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); Main.dust[rainbow].noGravity = true; diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 185bb1b4cc..43f23858c8 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.extraUpdates = 1; diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index 80300b143e..f76abd2061 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 26; Projectile.height = 26; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; AIType = ProjectileID.LightBeam; Projectile.ignoreWater = true; Projectile.friendly = true; diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 06c10e2f7b..35c038866e 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 100; Projectile.height = 78; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 2e8de6ed27..0dc41e9900 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -1,21 +1,39 @@ using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Items.Weapons.Melee; +using Terraria.Graphics.Shaders; +using Terraria.Graphics.Effects; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; +using System; +using Microsoft.Xna.Framework.Graphics; +using System.Linq; +using ReLogic.Content; namespace CalamityMod.Projectiles.Melee { public class Exobeam : ModProjectile { - private int counter = 0; + public int TargetIndex = -1; + + public static float MaxWidth = 30; + public ref float Time => ref Projectile.ai[0]; + public PrimitiveTrail TrailDrawer = null; + public PrimitiveTrail MiniTrailDrawer = null; + + public static Asset BloomTex; + public static Asset SlashTex; + public static Asset TrailTex; public override void SetStaticDefaults() { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + DisplayName.SetDefault("Exobeam"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 30; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -23,119 +41,74 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.alpha = 255; Projectile.timeLeft = 600; - Projectile.light = 1f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; } public override void AI() { - if (Projectile.localAI[1] == 0f) + // Aim very, very quickly at targets. + // This takes a small amount of time to happen, to allow the blade to go in its intended direction before immediately racing + // towards the nearest target. + if (Time >= Exoblade.BeamNoHomeTime) { - SoundEngine.PlaySound(SoundID.Item60, Projectile.position); - Projectile.localAI[1] += 1f; - } - counter++; - if (counter == 12) - { - counter = 0; - for (int l = 0; l < 12; l++) + if (TargetIndex >= 0) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 107, 0f, 0f, 160, new Color(0, 255, 255), 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = Projectile.Center + vector3; - Main.dust[num9].velocity = Projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - Projectile.alpha -= 40; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (Projectile.ai[0] == 0f) - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 90f) - { - Projectile.localAI[0] = 0f; - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - } - else if (Projectile.ai[0] == 1f) - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 60f) - { - Projectile.localAI[0] = 0f; - Projectile.ai[0] = 2f; - Projectile.ai[1] = (float)Player.FindClosest(Projectile.position, Projectile.width, Projectile.height); - Projectile.netUpdate = true; - } - } - else if (Projectile.ai[0] == 2f) - { - Vector2 vector70 = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; - if (vector70.Length() < 30f) - { - Projectile.Kill(); - return; - } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(Projectile.velocity, vector70, 0.6f); - if (vector70.Y < 24f) - { - vector70.Y = 24f; - } - float num804 = 0.4f; - if (Projectile.velocity.X < vector70.X) - { - Projectile.velocity.X = Projectile.velocity.X + num804; - if (Projectile.velocity.X < 0f && vector70.X > 0f) + if (!Main.npc[TargetIndex].active || !Main.npc[TargetIndex].CanBeChasedBy()) + TargetIndex = -1; + + else { - Projectile.velocity.X = Projectile.velocity.X + num804; + Vector2 idealVelocity = Projectile.SafeDirectionTo(Main.npc[TargetIndex].Center) * (Projectile.velocity.Length() + 3.5f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.08f); } } - else if (Projectile.velocity.X > vector70.X) + + if (TargetIndex == -1) { - Projectile.velocity.X = Projectile.velocity.X - num804; - if (Projectile.velocity.X > 0f && vector70.X < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - num804; - } - } - if (Projectile.velocity.Y < vector70.Y) - { - Projectile.velocity.Y = Projectile.velocity.Y + num804; - if (Projectile.velocity.Y < 0f && vector70.Y > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + num804; - } - } - else if (Projectile.velocity.Y > vector70.Y) - { - Projectile.velocity.Y = Projectile.velocity.Y - num804; - if (Projectile.velocity.Y > 0f && vector70.Y < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - num804; - } + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f, false); + if (potentialTarget != null) + TargetIndex = potentialTarget.whoAmI; + + else + Projectile.velocity *= 0.99f; } } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; + + Projectile.rotation = Projectile.velocity.ToRotation(); + + if (Main.rand.NextBool(2)) + { + Color dustColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.9f); + Dust must = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20f, 20f) + Projectile.velocity, 267, Projectile.velocity * -2.6f, 0, dustColor); + must.scale = 0.3f; + must.fadeIn = Main.rand.NextFloat() * 1.2f; + must.noGravity = true; + } + + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + if (Projectile.FinalExtraUpdate()) + Time++; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + SoundEngine.PlaySound(Exoblade.BeamHitSound, target.Center); + if (Main.myPlayer == Projectile.owner) + { + int slash = Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Projectile.velocity * 0.1f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, target.whoAmI, Projectile.velocity.ToRotation()); + if (Main.projectile.IndexInRange(slash)) + Main.projectile[slash].timeLeft = 20; + } + target.ExoDebuffs(); } @@ -144,45 +117,87 @@ namespace CalamityMod.Projectiles.Melee target.ExoDebuffs(); } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => Color.White with { A = 0 } * Projectile.Opacity; + + + public float TrailWidth(float completionRatio) { - return new Color(0, 255, 255, Projectile.alpha); + float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.15f, completionRatio, true))); + + width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + return width * MaxWidth; } + public Color TrailColor(float completionRatio) + { + Color baseColor = Color.Lerp(Color.Cyan, new Color(0, 0, 255), completionRatio); + + return baseColor; + } + + public float MiniTrailWidth(float completionRatio) => TrailWidth(completionRatio) * 0.8f; + public Color MiniTrailColor(float completionRatio) => Color.White; + public override bool PreDraw(ref Color lightColor) { if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + float bladeScale = Utils.GetLerpValue(3f, 13f, Projectile.velocity.Length(), true) * 1.2f; - public override void Kill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } + //Draw the blade. + Main.EntitySpriteDraw(texture, Projectile.oldPos[2] + Projectile.Size / 2f - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation + MathHelper.PiOver4, texture.Size() / 2f, bladeScale * Projectile.scale, 0, 0); + + + + + + if (BloomTex == null) + BloomTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Texture2D bloomTex = BloomTex.Value; + + Color mainColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 0.5f + Projectile.whoAmI * 0.12f) % 1, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange); + Color secondaryColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 0.5f + Projectile.whoAmI * 0.12f + 0.2f) % 1, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange); + + //Draw the bloom unde the trail + Main.EntitySpriteDraw(bloomTex, Projectile.oldPos[2] + Projectile.Size / 2f - Main.screenPosition, null, (mainColor * 0.1f) with { A = 0 }, 0, bloomTex.Size() / 2f, 1.3f * Projectile.scale, 0, 0); + Main.EntitySpriteDraw(bloomTex, Projectile.oldPos[1] + Projectile.Size / 2f - Main.screenPosition, null, (mainColor * 0.5f) with { A = 0 }, 0, bloomTex.Size() / 2f, 0.34f * Projectile.scale, 0, 0); + + + TrailDrawer ??= new(TrailWidth, TrailColor, null, GameShaders.Misc["CalamityMod:ExobladePierce"]); + MiniTrailDrawer ??= new(MiniTrailWidth, MiniTrailColor, null, GameShaders.Misc["CalamityMod:ExobladePierce"]); + + Main.spriteBatch.EnterShaderRegion(); + + if (TrailTex == null) + TrailTex = Request("CalamityMod/ExtraTextures/BasicTrail"); + + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(TrailTex); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); + + GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); + + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30, Projectile.oldRot); + + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(Color.White); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(Color.White); + + MiniTrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30, Projectile.oldRot); + + Main.spriteBatch.ExitShaderRegion(); + + //Draw the bloom above the trail + Main.EntitySpriteDraw(bloomTex, Projectile.oldPos[2] + Projectile.Size / 2f - Main.screenPosition, null, (Color.White * 0.2f) with { A = 0 }, 0, bloomTex.Size() / 2f, 0.78f * Projectile.scale, 0, 0); + Main.EntitySpriteDraw(bloomTex, Projectile.oldPos[1] + Projectile.Size / 2f - Main.screenPosition, null, (Color.White * 0.5f) with { A = 0 }, 0, bloomTex.Size() / 2f, 0.2f * Projectile.scale, 0, 0); + + + + return false; } } } diff --git a/Projectiles/Melee/Exobeam.png b/Projectiles/Melee/Exobeam.png index b35841741b..67c64cdd26 100644 Binary files a/Projectiles/Melee/Exobeam.png and b/Projectiles/Melee/Exobeam.png differ diff --git a/Projectiles/Melee/ExobeamSlash.cs b/Projectiles/Melee/ExobeamSlash.cs new file mode 100644 index 0000000000..d1fc4bc876 --- /dev/null +++ b/Projectiles/Melee/ExobeamSlash.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Projectiles.Melee +{ + public class ExobeamSlash : ModProjectile + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Exobeam Slash"); + + public override void SetDefaults() + { + Projectile.width = 512; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.Opacity = 1f; + Projectile.timeLeft = 35; + Projectile.MaxUpdates = 2; + Projectile.scale = 0.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Opacity = Projectile.timeLeft / 35f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + } + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Cyan, Color.Lime, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > 33) + return false; + + Main.spriteBatch.SetBlendState(BlendState.Additive); + + float progress = (33 - Projectile.timeLeft) / 33f; + + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + Vector2 scale = new Vector2(0.5f + 0.7f * (float)Math.Pow(progress, 0.45), 0.55f - 0.3f * (float)Math.Pow(progress, 0.4)) * Projectile.scale; + + + Vector2 bloomScale = Projectile.Size / bloomTexture.Size() * new Vector2(1f, 2f); + Vector2 bloomOrigin = bloomTexture.Size() * 0.5f; + Main.spriteBatch.Draw(bloomTexture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, bloomOrigin, bloomScale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, origin, scale * new Vector2(1f, 0.6f), 0, 0f); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/Projectiles/Melee/ExobeamSlash.png b/Projectiles/Melee/ExobeamSlash.png new file mode 100644 index 0000000000..ab9cfc8e8f Binary files /dev/null and b/Projectiles/Melee/ExobeamSlash.png differ diff --git a/Projectiles/Melee/ExobeamSlashCreator.cs b/Projectiles/Melee/ExobeamSlashCreator.cs new file mode 100644 index 0000000000..dcb178243d --- /dev/null +++ b/Projectiles/Melee/ExobeamSlashCreator.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ExobeamSlashCreator : ModProjectile + { + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + public float SlashDirection + { + get + { + if (Projectile.ai[1] > MathHelper.Pi) + return Main.rand.NextFloatDirection(); + return Projectile.ai[1] + Main.rand.NextFloatDirection() * 0.2f; + } + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anime Sword Effect"); + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 45; + Projectile.MaxUpdates = 2; + } + + public override void AI() + { + if (Main.myPlayer == Projectile.owner && Projectile.timeLeft % 20 == 19) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + Vector2 baseDirection = Vector2.UnitX; + if (Projectile.timeLeft <= 20) + baseDirection = -Vector2.UnitY; + + Vector2 spawnOffset = SlashDirection.ToRotationVector2(); + spawnOffset *= Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Target.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs new file mode 100644 index 0000000000..7b660bbc52 --- /dev/null +++ b/Projectiles/Melee/ExobladeProj.cs @@ -0,0 +1,635 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Particles; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class ExobladeProj : ModProjectile + { + public Player Owner => Main.player[Projectile.owner]; + + public PrimitiveTrail SlashDrawer = null; + + public PrimitiveTrail PierceAfterimageDrawer = null; + + const float BladeLenght = 180; + + public int GetSwingTime + { + get + { + //Constant duration for the dash + if (State == SwingState.BonkDash) + return Exoblade.DashTime * Projectile.extraUpdates; + else + return 78; + } + } + + public float Timer => SwingTime - Projectile.timeLeft; + public float Progression => Timer / (float)SwingTime; + public float LungeProgression => Progression < (1 - Exoblade.PercentageOfAnimationSpentLunging) ? 0 : (Progression - (1 - Exoblade.PercentageOfAnimationSpentLunging)) / Exoblade.PercentageOfAnimationSpentLunging; + + + public enum SwingState + { + Swinging, + BonkDash + } + public SwingState State + { + get + { + if (Projectile.ai[0] == 1) + return SwingState.BonkDash; + + return SwingState.Swinging; + } + + set + { + Projectile.ai[0] = (int)value; + } + } + + public bool PerformingPowerfulSlash + { + get => Projectile.ai[0] > 1; + } + + public bool InPostBonkStasis + { + get => Projectile.ai[1] > 0; + set => Projectile.ai[1] = value ? 1 : 0; + } + + + public ref float SwingTime => ref Projectile.localAI[0]; + public ref float SquishFactor => ref Projectile.localAI[1]; + + public float IdealSize => PerformingPowerfulSlash ? Exoblade.BigSlashUpscaleFactor : 1f; + + #region A lot of angles + public int Direction => Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1; + public float BaseRotation => Projectile.velocity.ToRotation(); //The rotation of the swing's "main" diretion + public Vector2 SquishVector => new Vector2(1f + (1 - SquishFactor) * 0.6f, SquishFactor); //The vector for the swords squish + + + public static float MaxSwingAngle = MathHelper.PiOver2 * 1.8f; + public CurveSegment SlowStart = new (PolyOutEasing, 0f, -1f, 0.3f, 2); + public CurveSegment SwingFast = new (PolyInEasing, 0.27f, -0.7f, 1.6f, 4); + public CurveSegment EndSwing = new (PolyOutEasing, 0.85f, 0.9f, 0.1f, 2); + public float SwingAngleShiftAtProgress(float progress) => State == SwingState.BonkDash ? 0 : MaxSwingAngle * PiecewiseAnimation(progress, new CurveSegment[] { SlowStart, SwingFast, EndSwing }); + public float SwordRotationAtProgress(float progress) => State == SwingState.BonkDash ? BaseRotation : BaseRotation + SwingAngleShiftAtProgress(progress) * Direction; + public float SquishAtProgress(float progress) => State == SwingState.BonkDash ? 1 : MathHelper.Lerp(SquishVector.X, SquishVector.Y, (float)Math.Abs(Math.Sin(SwingAngleShiftAtProgress(progress)))); + public Vector2 DirectionAtProgress(float progress) => State == SwingState.BonkDash ? Projectile.velocity : SwordRotationAtProgress(progress).ToRotationVector2() * SquishAtProgress(progress); + + + + public float SwingAngleShift => SwingAngleShiftAtProgress(Progression); //The current displacement from the "straigth forward" of swords angle + public float SwordRotation => SwordRotationAtProgress(Progression); //The current rotation of the sword itself + public float CurrentSquish => SquishAtProgress(Progression); //How squished is the sword based on its current rotation + public Vector2 SwordDirection => DirectionAtProgress(Progression); //A "unit" vector that keeps the stretch of the sword in mind + #endregion + + #region Ok so prims + public float TrailEndProgression //What's the progression of the "end point" of the trail + { + get + { + float endProgression; + if (Progression < 0.75f) + endProgression = Progression - 0.5f + 0.1f * (Progression / 0.75f); + + else + endProgression = Progression - 0.4f * (1 - (Progression - 0.75f) / 0.75f); + + return Math.Clamp(endProgression, 0, 1); + } + } + + public float RealProgressionAtTrailCompletion(float completion) => MathHelper.Lerp(Progression, TrailEndProgression, completion); //Gives the "progression" in the swing of the trail at the specified completion + + //Direction at progress except goes a bit harder at the end if the squish is strong to avoid the prim trail cutting off weirdly. + public Vector2 DirectionAtProgressScuffed(float progress) + { + float angleShift = SwingAngleShiftAtProgress(progress); + + //Get the coordinates of the angle shift. + Vector2 anglePoint = angleShift.ToRotationVector2(); + + //Squish the angle point's coordinate + anglePoint.X *= SquishVector.X; + anglePoint.Y *= SquishVector.Y; + + //And back into an angle + angleShift = anglePoint.ToRotation(); + + return (BaseRotation + angleShift * Direction).ToRotationVector2() * SquishAtProgress(progress); + } + #endregion + + public CurveSegment GoBack = new(SineBumpEasing, 0f, -10f, -14f); + public CurveSegment AndThrust => new(PolyOutEasing, 1 - Exoblade.PercentageOfAnimationSpentLunging, -10, 12f, 5); + public float DashDisplace => PiecewiseAnimation(Progression, new CurveSegment[] { GoBack, AndThrust }); + + + public float RiskOfDust + { + get + { + if (Progression > 0.85f) + return 0; + + if (Progression < 0.4f) + return (float)Math.Pow(Progression / 0.3f, 2) * 0.2f; + + if (Progression < 0.5f) + return 0.2f + 0.7f * (Progression - 0.4f) / 0.1f; + + return 0.9f; + } + } + + public override string Texture => "CalamityMod/Items/Weapons/Melee/ExobladeSquare"; //Square because the sword swing shader it uses only works on square textures + public static Asset LensFlare; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exoblade"); + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 120; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 98; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 9999; + Projectile.usesLocalNPCImmunity = true; + Projectile.MaxUpdates = 3; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 8; + Projectile.noEnchantments = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(SwingTime); + writer.Write(SquishFactor); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + SwingTime = reader.ReadSingle(); + SquishFactor = reader.ReadSingle(); + } + + public override bool ShouldUpdatePosition() => State == SwingState.BonkDash && !InPostBonkStasis; + public override bool? CanDamage() + { + if (State != SwingState.BonkDash) + return null; + + //Can't hit in stasis + if (InPostBonkStasis) + return false; + + //Can"t INSTANTLY hit + if (Projectile.timeLeft > SwingTime * Exoblade.PercentageOfAnimationSpentLunging) + return false; + + return null; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + Vector2 start = Projectile.Center; + Vector2 end = start + SwordDirection * BladeLenght * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, Projectile.scale * 30f, ref _); + } + + public void InitializationEffects(bool startInitialization) + { + //recalcualte the direction of the swing + Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); + //Give the sword slash a random squouish + SquishFactor = Main.rand.NextFloat(0.67f, 1f); //Note higher squishes make the trail look wonky + + //If youre doing a slash and this is the first slash you do, you start small so it grows big + if (startInitialization && State != SwingState.BonkDash) + Projectile.scale = 0.02f; + + //Regular size. + else + { + Projectile.scale = 1f; + + //If youre not in the first slash, reset the powerful slash + if (PerformingPowerfulSlash) + State = SwingState.Swinging; + } + + //Powerful slashes are forced to be quite squished. + if (PerformingPowerfulSlash) + SquishFactor = 0.7f; + + SwingTime = GetSwingTime; + Projectile.timeLeft = (int)SwingTime; + + + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + + public override void AI() + { + if (InPostBonkStasis || Projectile.timeLeft == 0) + return; + + if (Projectile.timeLeft >= 9999 || (Projectile.timeLeft == 1 && Owner.channel && State != SwingState.BonkDash)) + InitializationEffects(Projectile.timeLeft >= 9999); + + switch (State) + { + case SwingState.Swinging: + DoBehavior_Swinging(); + break; + case SwingState.BonkDash: + DoBehavior_BonkDash(); + break; + } + + // Glue the sword to its owner. + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Owner.heldProj = Projectile.whoAmI; + Owner.SetDummyItemTime(2); + Owner.direction = Direction; + + // Decide the arm rotation for the owner. + float armRotation = SwordRotation - MathHelper.PiOver2; + Owner.SetCompositeArmFront(Math.Abs(armRotation) > 0.01f, Player.CompositeArmStretchAmount.Full, armRotation); + + //Freeze the projectile on its last frame, so it can act as a ghost "cooldown" + if (Projectile.timeLeft == 1 && State == SwingState.BonkDash && !InPostBonkStasis) + { + Projectile.timeLeft = Exoblade.LungeCooldown; + InPostBonkStasis = true; + + Owner.fullRotation = 0f; + Owner.Calamity().LungingDown = false; + } + } + + public void DoBehavior_Swinging() + { + if (Projectile.timeLeft == (int)(SwingTime / 5)) + SoundEngine.PlaySound(PerformingPowerfulSlash ? Exoblade.BigSwingSound : Exoblade.SwingSound, Projectile.Center); + + Lighting.AddLight(Owner.MountedCenter + SwordDirection * 100, Color.Lerp(Color.GreenYellow, Color.DeepPink, (float)Math.Pow(Progression, 3)).ToVector3() * 1.6f * (float)Math.Sin(Progression * MathHelper.Pi)); + + // Decide the scale of the sword. + if (Projectile.scale < IdealSize) + Projectile.scale = MathHelper.Lerp(Projectile.scale, IdealSize, 0.08f); + + //Make the sword get smaller near the end of the slash + if (!Owner.channel && Progression > 0.7f) + Projectile.scale = (0.5f + 0.5f * (float)Math.Pow(1 - (Progression - 0.7f) / 0.3f, 0.5)) * IdealSize; + + + if (Main.rand.NextFloat() * 3f < RiskOfDust) + { + Dust auricDust = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLenght * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.5f, 1f), 0.5f), ModContent.DustType(), SwordDirection.RotatedBy(-MathHelper.PiOver2 * Direction) * 2f); + auricDust.noGravity = true; + auricDust.alpha = 10; + auricDust.scale = 0.5f; + } + + if (Main.rand.NextFloat() < RiskOfDust) + { + Color dustColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.9f); + Dust must = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLenght * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.2f, 1f), 0.5f), 267, SwordDirection.RotatedBy(MathHelper.PiOver2 * Direction) * 2.6f, 0, dustColor); + + must.scale = 0.3f; + must.fadeIn = Main.rand.NextFloat() * 1.2f; + must.noGravity = true; + } + + // Create a bunch of homing beams. + int beamShootStart = (int)(SwingTime * 0.6f); + int beamShootPeriod = (int)(SwingTime * 0.35f); + int beamShootEnd = beamShootStart + beamShootPeriod; + beamShootPeriod /= (Exoblade.BeamsPerSwing - 1); + + if (Main.myPlayer == Projectile.owner && Timer >= beamShootStart && Timer < beamShootEnd && (Timer - beamShootStart) % beamShootPeriod == 0) + { + float rotationAngle = MathHelper.PiOver4 * 0.3f * ((Timer - beamShootStart) / beamShootPeriod); + int boltDamage = (int)(Projectile.damage * Exoblade.NotTrueMeleeDamagePenalty); + Vector2 boltVelocity = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.3); + boltVelocity *= Owner.ActiveItem().shootSpeed; + + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + boltVelocity * 5f, boltVelocity, ModContent.ProjectileType(), boltDamage, Projectile.knockBack / 3f, Projectile.owner); + } + } + + public void DoBehavior_BonkDash() + { + Owner.mount?.Dismount(Owner); + Owner.RemoveAllGrapplingHooks(); + + if (LungeProgression == 0) + { + // Play a charge sound right before the dash. + if (Projectile.timeLeft == 1 + (int)(SwingTime * (Exoblade.PercentageOfAnimationSpentLunging))) + SoundEngine.PlaySound(Exoblade.DashSound, Projectile.Center); + + Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld); + Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; + } + + // Do the dash. + else + { + float rotationStrenght = MathHelper.PiOver4 * 0.05f * (float)Math.Pow(LungeProgression, 3); + float currentRotation = Projectile.velocity.ToRotation(); + float idealRotation = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(); + + Projectile.velocity = currentRotation.AngleTowards(idealRotation, rotationStrenght).ToRotationVector2(); + + Owner.fallStart = (int)(Owner.position.Y / 16f); + + float velocityPower = (float)Math.Sin(MathHelper.Pi * LungeProgression); + //Because of floating point imprecision, Math.Sin(MathHelper.Pi) gives us a microscopic number. That is negative. Leading to the Pow(, 0.6) to fail and giving out NaNs + velocityPower = (float)Math.Pow(Math.Abs(velocityPower), 0.6f); + Vector2 newVelocity = Projectile.velocity * Exoblade.LungeSpeed * (0.24f + 0.76f * velocityPower); + Owner.velocity = newVelocity; + Owner.Calamity().LungingDown = true; + + if (Main.rand.NextBool()) + { + Color dustColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.9f); + Dust must = Dust.NewDustPerfect(Owner.MountedCenter + Main.rand.NextVector2Circular(20f, 20f), 267, SwordDirection * -2.6f, 0, dustColor); + must.scale = 0.3f; + must.fadeIn = Main.rand.NextFloat() * 1.2f; + must.noGravity = true; + } + + //Streaks during the dash + if (Main.rand.NextBool(6) && LungeProgression < 0.8f) + { + Vector2 particleSpeed = SwordDirection * -1 * Main.rand.NextFloat(6f, 10f); + Particle energyLeak = new SquishyLightParticle(Owner.MountedCenter + Main.rand.NextVector2Circular(20f, 20f) + Owner.velocity * 5, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.GreenYellow, 30, 3.4f, 4.5f, hueShift: 0.02f); + GeneralParticleHandler.SpawnParticle(energyLeak); + } + + //Streaks after the dash (a lot more spread out) + if (Main.rand.NextBool(5) && LungeProgression >= 0.8f) + { + Vector2 particleSpeed = SwordDirection * -1 * Main.rand.NextFloat(6f, 10f); + Particle energyLeak = new SquishyLightParticle(Owner.MountedCenter + Main.rand.NextVector2Circular(50f, 50f) + Owner.velocity * 4, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.GreenYellow, 30, 3.4f, 4.5f, hueShift: 0.02f); + GeneralParticleHandler.SpawnParticle(energyLeak); + } + } + + // Stop the dash on the last frame. + if (Projectile.timeLeft == 1) + { + Owner.velocity *= 0.2f; + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4 * Direction; + } + + + + public float SlashWidthFunction(float completionRatio) => SquishAtProgress(RealProgressionAtTrailCompletion(completionRatio)) * Projectile.scale * 36.5f; + public Color SlashColorFunction(float completionRatio) => Color.Lime * Utils.GetLerpValue(0.9f, 0.4f, completionRatio, true) * Projectile.Opacity; + + public float PierceWidthFunction(float completionRatio) + { + float width = Utils.GetLerpValue(0f, 0.2f, completionRatio, true) * Projectile.scale * 50f; + //Fade it out starkly near the end of the lunge + width *= (1 - (float)Math.Pow(LungeProgression, 5)); + return width; + } + + public Color PierceColorFunction(float completionRatio) => Color.Lime * Projectile.Opacity; //The trail color doesnt matter here + + public IEnumerable GenerateSlashPoints() + { + List result = new(); + + for (int i = 0; i < 40; i++) + { + float progress = MathHelper.Lerp(Progression, TrailEndProgression, i / 40f); + + result.Add(DirectionAtProgressScuffed(progress) * (BladeLenght - 50f) * Projectile.scale); + } + + return result; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.Opacity <= 0f || InPostBonkStasis) + return false; + + // Initialize the primitives drawers. + SlashDrawer ??= new(SlashWidthFunction, SlashColorFunction, null, GameShaders.Misc["CalamityMod:ExobladeSlash"]); + PierceAfterimageDrawer ??= new(PierceWidthFunction, PierceColorFunction, null, GameShaders.Misc["CalamityMod:ExobladePierce"]); + + DrawSlash(); + DrawPierceTrail(); + DrawBlade(); + return false; + } + + public void DrawSlash() + { + if (State != SwingState.Swinging || Progression < 0.45f) + return; + + // Draw the zany slash effect. + Main.spriteBatch.EnterShaderRegion(); + GameShaders.Misc["CalamityMod:ExobladeSlash"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/VoronoiShapes")); + GameShaders.Misc["CalamityMod:ExobladeSlash"].UseColor(new Color(105, 240, 220)); + GameShaders.Misc["CalamityMod:ExobladeSlash"].UseSecondaryColor(new Color(57, 46, 115)); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["fireColor"].SetValue(new Color(242, 112, 72).ToVector3()); + + // What the heck? XORs? In MY exoblade code????? + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue(Direction == 1); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); + + SlashDrawer.Draw(GenerateSlashPoints(), Projectile.Center - Main.screenPosition, 95); + + Main.spriteBatch.ExitShaderRegion(); + } + + public void DrawPierceTrail() + { + if (State != SwingState.BonkDash) + return; + + Main.spriteBatch.EnterShaderRegion(); + + + Color mainColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f) % 1, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange); + Color secondaryColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f + 0.2f) % 1, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange); + + mainColor = Color.Lerp(Color.White, mainColor, 0.4f + 0.6f * (float)Math.Pow(LungeProgression, 0.5f)); + secondaryColor = Color.Lerp(Color.White, secondaryColor, 0.4f + 0.6f * (float)Math.Pow(LungeProgression, 0.5f)); + + Vector2 trailOffset = (Projectile.rotation - Direction * MathHelper.PiOver4).ToRotationVector2() * 98f + Projectile.Size * 0.5f - Main.screenPosition; + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/EternityStreak")); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); + PierceAfterimageDrawer.Draw(Projectile.oldPos.Take(51), trailOffset, 53); + + Main.spriteBatch.ExitShaderRegion(); + } + + public void DrawBlade() + { + var texture = ModContent.Request(Texture).Value; + SpriteEffects direction = Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (State == SwingState.Swinging) + { + Effect swingFX = Filters.Scene["SwingSprite"].GetShader().Shader; + swingFX.Parameters["rotation"].SetValue(SwingAngleShift + MathHelper.PiOver4 + (Direction == -1 ? MathHelper.Pi : 0f)); + swingFX.Parameters["pommelToOriginPercent"].SetValue(0.05f); + swingFX.Parameters["color"].SetValue(Color.White.ToVector4()); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, swingFX, Main.GameViewMatrix.TransformationMatrix); + + Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition, null, Color.White, BaseRotation, texture.Size() / 2f, SquishVector * 3f * Projectile.scale, direction, 0); + + /* + if (PerformingPowerfulSlash) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, swingFX, Main.GameViewMatrix.TransformationMatrix); + + float bouncyProgression = (float)Math.Sin(Progression * MathHelper.Pi); + swingFX.Parameters["color"].SetValue(Color.MediumSpringGreen.ToVector4() with { W = bouncyProgression * 0.5f }); + + for (int i = 0; i < 4; i++) + { + Vector2 offset = (i / 4f * MathHelper.TwoPi + SwingAngleShift + MathHelper.PiOver4).ToRotationVector2() * 2f * Projectile.scale; + Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition + offset, null, Color.White, BaseRotation, texture.Size() / 2f, SquishVector * 3f * Projectile.scale, direction, 0); + } + } + */ + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + + if (LensFlare == null) + LensFlare = ModContent.Request("CalamityMod/Particles/HalfStar"); + Texture2D shineTex = LensFlare.Value; + Vector2 shineScale = new Vector2(1f, 3f); + + float lensFlareOpacity = (Progression < 0.3f ? 0f : 0.2f + 0.8f * (float)Math.Sin(MathHelper.Pi * (Progression - 0.3f) / 0.7f)) * 0.6f; + Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Plum, (float)Math.Pow(Progression, 3)); + lensFlareColor.A = 0; + Main.EntitySpriteDraw(shineTex, Owner.MountedCenter + DirectionAtProgressScuffed(Progression) * Projectile.scale * BladeLenght - Main.screenPosition, null, lensFlareColor * lensFlareOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, 0, 0); + } + + else + { + float rotation = BaseRotation + MathHelper.PiOver4; + Vector2 origin = new Vector2(0, texture.Height); + Vector2 drawPosition = Projectile.Center + Projectile.velocity * Projectile.scale * DashDisplace - Main.screenPosition; + + if (Direction == -1) + { + rotation += MathHelper.PiOver2; + origin.X = texture.Width; + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White, rotation, origin, Projectile.scale, direction, 0); + + float energyPower = Utils.GetLerpValue(0f, 0.32f, Progression, true) * Utils.GetLerpValue(1f, 0.85f, Progression, true); + for (int i = 0; i < 4; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f + BaseRotation).ToRotationVector2() * energyPower * Projectile.scale * 7f; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, Color.Lerp(Color.Goldenrod, Color.MediumTurquoise, Progression) with { A = 0 } * 0.16f, rotation, origin, Projectile.scale, direction, 0); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit); + NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit); + PlayerLoader.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); + + if (State == SwingState.BonkDash) + { + Owner.itemAnimation = 0; + Owner.velocity = Owner.SafeDirectionTo(target.Center) * -Exoblade.ReboundSpeed; + Projectile.timeLeft = Exoblade.OpportunityForBigSlash + Exoblade.LungeCooldown; + InPostBonkStasis = true; + + Projectile.netUpdate = true; + + SoundEngine.PlaySound(Exoblade.DashHitSound, target.Center); + SoundEngine.PlaySound(Exoblade.BeamHitSound with { Volume = Exoblade.BeamHitSound.Volume * 1.2f}, target.Center); + if (Main.myPlayer == Projectile.owner) + { + int lungeHitDamage = (int)(Projectile.damage * Exoblade.LungeDamageFactor); + for (int i = 0; i < 5; i++) + { + int slash = Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Projectile.velocity * 0.1f, ModContent.ProjectileType(), lungeHitDamage, 0f, Projectile.owner, target.whoAmI, 100); + if (Main.projectile.IndexInRange(slash)) + Main.projectile[slash].timeLeft -= i * 4; + } + } + + // Freeze the target briefly, to allow the player to more easily perform a powerful slash. + target.AddBuff(ModContent.BuffType(), 60); + } + + if (State == SwingState.Swinging && PerformingPowerfulSlash && Owner.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + SoundEngine.PlaySound(Exoblade.BigHitSound, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + int explosionDamage = (int)(Projectile.damage * Exoblade.ExplosionDamageFactor); + Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, 0f, Projectile.owner); + } + } + } + + public override void Kill(int timeLeft) + { + Owner.fullRotation = 0f; + Owner.Calamity().LungingDown = false; + } + } +} diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index d48b6cf218..2083b52dae 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -1,9 +1,8 @@ -using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; +using CalamityMod.Particles; + namespace CalamityMod.Projectiles.Melee { public class Exoboom : ModProjectile @@ -12,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - DisplayName.SetDefault("Explosion"); + DisplayName.SetDefault("Exoplasma Explosion"); } public override void SetDefaults() @@ -24,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 30; + Projectile.MaxUpdates = 2; Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; @@ -31,66 +31,26 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - Projectile.localAI[0] += 1f; + for (int i = 0; i < 16; i++) + { + Vector2 cinderSpawnPosition = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(50f); + Vector2 cinderVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(5f, 18f); + Color cinderColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); + SquishyLightParticle cinder = new(cinderSpawnPosition, cinderVelocity, 1.1f, cinderColor, 32, 1f, 4f); + GeneralParticleHandler.SpawnParticle(cinder); + } + Projectile.localAI[0] = 1f; } - bool flag15 = false; - bool flag16 = false; - if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) + + // Create smoke. + for (int i = 0; i < 2; i++) { - flag15 = true; - } - if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) - { - flag15 = true; - } - if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) - { - flag16 = true; - } - if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - Projectile.Kill(); - } - float num461 = 25f; - if (Projectile.ai[0] > 180f) - { - num461 -= (Projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - Projectile.Kill(); - } - num461 *= 0.7f; - Projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Dust dust = Main.dust[num467]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; + Color smokeColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); + smokeColor = Color.Lerp(smokeColor, Color.Gray, 0.55f); + HeavySmokeParticle smoke = new(Projectile.Center, Main.rand.NextVector2Circular(27f, 27f), smokeColor, 40, 1.8f, 1f, 0.03f, true, 0.075f); + GeneralParticleHandler.SpawnParticle(smoke); } } diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index f2683533c6..8de169ccb2 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 62; Projectile.height = 62; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.extraUpdates = 2; @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee { int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; } } diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index e3f43336e5..08d6867dbd 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -18,10 +19,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; Projectile.timeLeft = 150; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; } public override void AI() diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index b84f900217..b6d489f710 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 46; Projectile.height = 46; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 100; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index e28d9ab862..db54591c0e 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = -1; Projectile.extraUpdates = 5; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index dd4ada5043..00caa17924 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = 1; Projectile.extraUpdates = 5; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index fe2f837d7e..d6e9fcc05d 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = 1; Projectile.extraUpdates = 5; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index b78013aa3d..439db8b656 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 62; Projectile.height = 62; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; @@ -202,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPoint, velocity, laserID, laserDamage, laserKB, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 30; } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 7b40a15f2e..d0a098c327 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 10; Projectile.height = 10; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index 6ebeab7a7e..2d318fb360 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 100; Projectile.friendly = true; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 006c20c367..a8f8276c87 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -1,10 +1,11 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -104,13 +105,13 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (projectile1.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile1].DamageType = DamageClass.Melee; Main.projectile[projectile1].penetrate = 2; } - int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (projectile2.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile2].DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 0040309a2f..0e930aa032 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -22,9 +22,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; Projectile.timeLeft = 300; + Projectile.extraUpdates = 1; } public override void AI() diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index d48f8b3260..933e0ef540 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile1.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile1].DamageType = DamageClass.Melee; - Main.projectile[projectile1].aiStyle = 1; + Main.projectile[projectile1].aiStyle = ProjAIStyleID.Arrow; } } Projectile.localAI[0] = 0f; diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index c56670af6e..982b8253d9 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 62; Projectile.height = 72; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 55; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/Light.cs b/Projectiles/Melee/Light.cs index 8496bdaad2..b9565835d4 100644 --- a/Projectiles/Melee/Light.cs +++ b/Projectiles/Melee/Light.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index 9baf977b90..53324964cf 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 56; - Projectile.height = 56; - Projectile.aiStyle = 18; + Projectile.width = 74; + Projectile.height = 74; + Projectile.aiStyle = ProjAIStyleID.Sickle; AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/LightBeam.png b/Projectiles/Melee/LightBeam.png index 5d95d6961b..ff726ed466 100644 Binary files a/Projectiles/Melee/LightBeam.png and b/Projectiles/Melee/LightBeam.png differ diff --git a/Projectiles/Melee/MarniteDeconstructorProj.cs b/Projectiles/Melee/MarniteDeconstructorProj.cs new file mode 100644 index 0000000000..bdcf9b8663 --- /dev/null +++ b/Projectiles/Melee/MarniteDeconstructorProj.cs @@ -0,0 +1,225 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.GameContent; +using ReLogic.Content; +using Terraria.Graphics.Shaders; +using CalamityMod.Items.Tools; + +namespace CalamityMod.Projectiles.Melee +{ + public class MarniteDeconstructorProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marnite Deconstructor"); + } + + public override string Texture => "CalamityMod/Items/Tools/MarniteDeconstructor"; + public static Asset GlowmaskTex; + public static Asset BloomTex; + public static Asset SelectionTex; + + public Player Owner => Main.player[Projectile.owner]; + public ref float MoveInIntervals => ref Projectile.localAI[0]; + public ref float SpeenBeams => ref Projectile.localAI[1]; + public ref float Timer => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + } + + public override bool ShouldUpdatePosition() => false; + + public override void AI() + { + Timer++; + SpeenBeams += Timer > 140 ? 1 : 1 + 2f * (float)Math.Pow(1 - Timer / 140f, 2); + + + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(MarniteObliterator.UseSound, Projectile.Center); + Projectile.soundDelay = 23; + } + + if ((Owner.Center - Projectile.Center).Length() >= 5f) + { + if ((Owner.MountedCenter - Projectile.Center).Length() >= 30f) + { + DelegateMethods.v3_1 = Color.Blue.ToVector3() * 0.5f; + Utils.PlotTileLine(Owner.MountedCenter + Owner.MountedCenter.DirectionTo(Projectile.Center) * 30f, Projectile.Center, 8f, DelegateMethods.CastLightOpen); + } + + Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.7f); + } + + if (MoveInIntervals > 0f) + MoveInIntervals -= 1f; + + if (!Owner.channel || Owner.noItems || Owner.CCed) + Projectile.Kill(); + + else if (MoveInIntervals <= 0f) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 newVelocity = Owner.Calamity().mouseWorld - Owner.MountedCenter; + + if (Main.tile[Player.tileTargetX, Player.tileTargetY].WallType != 0) + { + newVelocity = new Vector2(Player.tileTargetX, Player.tileTargetY) * 16f + Vector2.One * 8f - Owner.MountedCenter; + MoveInIntervals = 2f; + } + + newVelocity = Vector2.Lerp(newVelocity, Projectile.velocity, 0.7f); + if (float.IsNaN(newVelocity.X) || float.IsNaN(newVelocity.Y)) + newVelocity = -Vector2.UnitY; + + if (newVelocity.Length() < 50f) + newVelocity = newVelocity.SafeNormalize(-Vector2.UnitY) * 50f; + + //Tile reach is a fucking square in terraria. Can you believe that? + int tileBoost = Owner.inventory[Owner.selectedItem].tileBoost; + int fullRangeX = (Player.tileRangeX + tileBoost - 1) * 16 + 11; //Why are those 2 separate variables? Whatever + int fullRangeY = (Player.tileRangeY + tileBoost - 1) * 16 + 11; + + newVelocity.X = Math.Clamp(newVelocity.X, -fullRangeX, fullRangeX); + newVelocity.Y = Math.Clamp(newVelocity.Y, -fullRangeY, fullRangeY); + + if (newVelocity != Projectile.velocity) + Projectile.netUpdate = true; + + Projectile.velocity = newVelocity; + } + } + + //Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); + Owner.heldProj = Projectile.whoAmI; + Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2 - MathHelper.PiOver4 * 0.5f * Owner.direction); + + Owner.SetDummyItemTime(2); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.MountedCenter + Projectile.velocity; + } + + public void DrawBeam(Texture2D beamTex, Vector2 direction, float beamProgress) + { + Vector2 startPos = Owner.MountedCenter + direction * 30f + direction.RotatedBy(MathHelper.PiOver2) * (float)Math.Cos(MathHelper.TwoPi * beamProgress + SpeenBeams * 0.06f) * 8f; + + float squareHeight = (beamProgress + SpeenBeams * 0.02f) % 1; + if (squareHeight < 0.25) + squareHeight = 0; + else if (squareHeight < 0.5) + squareHeight = (squareHeight - 0.25f) / 0.25f; + else if (squareHeight < 0.75) + squareHeight = 1; + else + squareHeight = 1 - (squareHeight - 0.75f) / 0.25f; + + float squareWidth = (beamProgress + SpeenBeams * 0.02f) % 1; + if (squareWidth < 0.25) + squareWidth = squareWidth / 0.25f; + else if (squareWidth < 0.5) + squareWidth = 1; + else if (squareWidth < 0.75) + squareWidth = 1 - (squareWidth - 0.5f) / 0.25f; + else + squareWidth = 0; + + Vector2 endPos = Projectile.Center + new Vector2(squareWidth * 15.5f, squareHeight * 15.5f) - Vector2.One * 7.75f; + + float rotation = (endPos - startPos).ToRotation(); + Vector2 beamOrigin = new Vector2(beamTex.Width / 2f, beamTex.Height); + Vector2 beamScale = new Vector2(5.4f, (startPos - endPos).Length() / (float)beamTex.Height); + + CalamityUtils.DrawChromaticAberration(direction.RotatedBy(MathHelper.PiOver2), 1f, delegate (Vector2 offset, Color colorMod) + { + Color beamColor = Color.Lerp(Color.Blue, Color.Goldenrod, 0.5f + 0.5f * (float)Math.Sin(SpeenBeams * 0.2f)); + beamColor *= 0.54f; + beamColor = beamColor.MultiplyRGB(colorMod); + + Main.EntitySpriteDraw(beamTex, startPos + offset - Main.screenPosition, null, beamColor, rotation + MathHelper.PiOver2, beamOrigin, beamScale, SpriteEffects.None, 0); + + beamScale.X = 2.4f; + beamColor = Color.Lerp(Color.DeepSkyBlue, Color.Chocolate, 0.5f + 0.5f * (float)Math.Sin(SpeenBeams * 0.2f + 1.2f)); + beamColor = beamColor.MultiplyRGB(colorMod); + + Main.EntitySpriteDraw(beamTex, startPos + offset - Main.screenPosition, null, beamColor, rotation + MathHelper.PiOver2, beamOrigin, beamScale, SpriteEffects.None, 0); + }); + } + + public override bool PreDraw(ref Color lightColor) + { + if (!Projectile.active) + return false; + + + Vector2 normalizedVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + + //Draw the holdout. + Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = new Vector2(9f, tex.Height / 2f); + SpriteEffects effect = SpriteEffects.None; + if (Owner.direction * Owner.gravDir < 0) + effect = SpriteEffects.FlipVertically; + Main.EntitySpriteDraw(tex, Owner.MountedCenter + normalizedVelocity * 10f - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, effect, 0); + + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + + //Draw some bloom over the tool + if (GlowmaskTex == null) + GlowmaskTex = ModContent.Request("CalamityMod/Items/Tools/MarniteDeconstructorBloom"); + Texture2D glowTex = GlowmaskTex.Value; + float bloomOpacity = (float)Math.Pow(Math.Clamp(Timer / 100f, 0f, 1f), 2) * (0.85f + (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly))) * 0.8f; + Color bloomColor = Color.Lerp(Color.DeepSkyBlue, Color.Chocolate, 0.5f + 0.5f * (float)Math.Sin(SpeenBeams * 0.2f + 1.2f)); + Main.EntitySpriteDraw(glowTex, Owner.MountedCenter + normalizedVelocity * 10f - Main.screenPosition, null, bloomColor * bloomOpacity, Projectile.rotation, origin, Projectile.scale, effect, 0); + + //Add some bloom around the projectile's position + if (BloomTex == null) + BloomTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Texture2D bloomTex = BloomTex.Value; + Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, Color.DeepSkyBlue * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, 0.3f * Projectile.scale, SpriteEffects.None, 0); + + //Draw a square selection + if (SelectionTex == null) + SelectionTex = ModContent.Request("CalamityMod/Items/Tools/MarniteDeconstructorSelection"); + Texture2D selectionTex = SelectionTex.Value; + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 2f, delegate (Vector2 offset, Color colorMod) + { + Main.EntitySpriteDraw(selectionTex, Projectile.Center + offset - Main.screenPosition, null, bloomColor.MultiplyRGB(colorMod), 0f, selectionTex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + }); + + + //Draw laser beams going around the selection + Texture2D beamTex = ModContent.Request("CalamityMod/ExtraTextures/SimpleGradient").Value; + + for (int i = 0; i < 2; i++) + { + DrawBeam(beamTex, normalizedVelocity, i / 2f); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + return false; + } + } +} diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index c6d2c64a58..c26889e44b 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -1,18 +1,38 @@ -using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.GameContent; +using ReLogic.Content; +using Terraria.Graphics.Shaders; +using CalamityMod.Items.Tools; + namespace CalamityMod.Projectiles.Melee { public class MarniteObliteratorProj : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Obliterator"); + DisplayName.SetDefault("Marnite Obliterator"); } + public override string Texture => "CalamityMod/Items/Tools/MarniteObliterator"; + public static Asset GlowmaskTex; + public static Asset BloomTex; + internal PrimitiveTrail TrailDrawer; + + public Player Owner => Main.player[Projectile.owner]; + public ref float MoveInIntervals => ref Projectile.localAI[0]; + public ref float SpeenBeams => ref Projectile.localAI[1]; + public ref float Timer => ref Projectile.ai[0]; + public override void SetDefaults() { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 20; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -20,5 +40,188 @@ namespace CalamityMod.Projectiles.Melee Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; } + + public override bool ShouldUpdatePosition() => false; + + public override void AI() + { + Timer++; + SpeenBeams += Timer > 140 ? 1 : 1 + 2f * (float)Math.Pow(1 - Timer / 140f, 2); + + + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(MarniteObliterator.UseSound, Projectile.Center); + Projectile.soundDelay = 23; + } + + if ((Owner.Center - Projectile.Center).Length() >= 5f) + { + if ((Owner.MountedCenter - Projectile.Center).Length() >= 30f) + { + DelegateMethods.v3_1 = Color.Blue.ToVector3() * 0.5f; + Utils.PlotTileLine(Owner.MountedCenter + Owner.MountedCenter.DirectionTo(Projectile.Center) * 30f, Projectile.Center, 8f, DelegateMethods.CastLightOpen); + } + + Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.7f); + } + + if (MoveInIntervals > 0f) + MoveInIntervals -= 1f; + + if (!Owner.channel || Owner.noItems || Owner.CCed) + Projectile.Kill(); + + else if (MoveInIntervals <= 0f) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 newVelocity = Owner.Calamity().mouseWorld - Owner.MountedCenter; + + if (Main.tile[Player.tileTargetX, Player.tileTargetY].HasTile) + { + newVelocity = new Vector2(Player.tileTargetX, Player.tileTargetY) * 16f + Vector2.One * 8f - Owner.MountedCenter; + MoveInIntervals = 2f; + } + + newVelocity = Vector2.Lerp(newVelocity, Projectile.velocity, 0.7f); + if (float.IsNaN(newVelocity.X) || float.IsNaN(newVelocity.Y)) + newVelocity = -Vector2.UnitY; + + if (newVelocity.Length() < 50f) + newVelocity = newVelocity.SafeNormalize(-Vector2.UnitY) * 50f; + + //Tile reach is a fucking square in terraria. Can you believe that? + int tileBoost = Owner.inventory[Owner.selectedItem].tileBoost; + int fullRangeX = (Player.tileRangeX + tileBoost - 1) * 16 + 11; //Why are those 2 separate variables? Whatever + int fullRangeY = (Player.tileRangeY + tileBoost - 1) * 16 + 11; + + newVelocity.X = Math.Clamp(newVelocity.X, -fullRangeX, fullRangeX); + newVelocity.Y = Math.Clamp(newVelocity.Y, -fullRangeY, fullRangeY); + + if (newVelocity != Projectile.velocity) + Projectile.netUpdate = true; + + Projectile.velocity = newVelocity; + } + } + + //Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); + Owner.heldProj = Projectile.whoAmI; + Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2 - MathHelper.PiOver4 * 0.5f * Owner.direction); + + Owner.SetDummyItemTime(2); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.MountedCenter + Projectile.velocity; + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Sqrt(1 - completionRatio); + return Color.DeepSkyBlue * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return 29.4f * completionRatio; + } + + + public void DrawBeam(Texture2D beamTex, Vector2 direction, int beamIndex) + { + Vector2 startPos = Owner.MountedCenter + direction * 17f + direction.RotatedBy(MathHelper.PiOver2) * (float)Math.Cos(MathHelper.TwoPi * beamIndex / 3f + SpeenBeams * 0.06f) * 13f; + float rotation = (Projectile.Center - startPos).ToRotation(); + Vector2 beamOrigin = new Vector2(beamTex.Width / 2f, beamTex.Height); + Vector2 beamScale = new Vector2(5.4f, (startPos - Projectile.Center).Length() / (float)beamTex.Height); + + CalamityUtils.DrawChromaticAberration(direction.RotatedBy(MathHelper.PiOver2), 4f, delegate (Vector2 offset, Color colorMod) + { + Color beamColor = Color.Lerp(Color.Blue, Color.Goldenrod, 0.5f + 0.5f * (float)Math.Sin(SpeenBeams * 0.2f)); + beamColor *= 0.54f; + beamColor = beamColor.MultiplyRGB(colorMod); + + Main.EntitySpriteDraw(beamTex, startPos + offset - Main.screenPosition, null, beamColor, rotation + MathHelper.PiOver2, beamOrigin, beamScale, SpriteEffects.None, 0); + + beamScale.X = 2.4f; + beamColor = Color.Lerp(Color.DeepSkyBlue, Color.Chocolate, 0.5f + 0.5f * (float)Math.Sin(SpeenBeams * 0.2f + 1.2f)); + beamColor = beamColor.MultiplyRGB(colorMod); + + Main.EntitySpriteDraw(beamTex, startPos + offset - Main.screenPosition, null, beamColor, rotation + MathHelper.PiOver2, beamOrigin, beamScale, SpriteEffects.None, 0); + }); + } + + public override bool PreDraw(ref Color lightColor) + { + if (!Projectile.active) + return false; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + + Vector2 normalizedVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + Texture2D beamTex = ModContent.Request("CalamityMod/ExtraTextures/SimpleGradient").Value; + + for (int i = 0; i < 3; i++) + { + float beamElevation = (float)Math.Sin(MathHelper.TwoPi * i / 3f + SpeenBeams * 0.06f); + if (beamElevation < 0) + DrawBeam(beamTex, normalizedVelocity, i); + } + + if (BloomTex == null) + BloomTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Texture2D bloomTex = BloomTex.Value; + + Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, Color.DeepSkyBlue * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, 0.3f * Projectile.scale, SpriteEffects.None, 0); + + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/DoubleTrail")); + TrailDrawer.Draw(new Vector2[] { Projectile.Center , Owner.MountedCenter - normalizedVelocity * 13f}, - Main.screenPosition, 30); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Texture2D tex = TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = new Vector2(9f, tex.Height / 2f); + SpriteEffects effect = SpriteEffects.None; + if (Owner.direction * Owner.gravDir < 0) + effect = SpriteEffects.FlipVertically; + + Main.EntitySpriteDraw(tex, Owner.MountedCenter + normalizedVelocity * 10f - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, effect, 0); + + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + //Draw some bloom + if (GlowmaskTex == null) + GlowmaskTex = ModContent.Request("CalamityMod/Items/Tools/MarniteObliteratorBloom"); + Texture2D glowTex = GlowmaskTex.Value; + float bloomOpacity = (float)Math.Pow(Math.Clamp(Timer / 100f, 0f, 1f), 2) * (0.85f + (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly))) * 0.8f; + Color bloomColor = Color.Lerp(Color.DeepSkyBlue, Color.Chocolate, 0.5f + 0.5f * (float)Math.Sin(SpeenBeams * 0.2f + 1.2f)); + + Main.EntitySpriteDraw(glowTex, Owner.MountedCenter + normalizedVelocity * 10f - Main.screenPosition, null, bloomColor * bloomOpacity, Projectile.rotation, origin, Projectile.scale, effect, 0); + + + + for (int i = 0; i < 3; i++) + { + float beamElevation = (float)Math.Sin(MathHelper.TwoPi * i / 3f + SpeenBeams * 0.06f); + if (beamElevation >= 0) + DrawBeam(beamTex, normalizedVelocity, i); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + + return false; + } } } diff --git a/Projectiles/Melee/MarniteObliteratorProj.png b/Projectiles/Melee/MarniteObliteratorProj.png deleted file mode 100644 index 1626424a69..0000000000 Binary files a/Projectiles/Melee/MarniteObliteratorProj.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs index 51b7ccd281..718b24053f 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { Projectile.width = Projectile.height = 32; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index 1c3974b0ea..5902a61703 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.width = 200; diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index da42aa734d..6c8a04946c 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; } diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index b55bd46d38..9a2e554641 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 4; diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index 881e7bc3d3..0670ed7963 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index 5510bfbfef..56c5240805 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 3; diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index cf6d1509dc..841c7b2902 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index 774a7c3687..2fe9327706 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 58; Projectile.height = 58; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 100; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/Orbacle.cs b/Projectiles/Melee/Orbacle.cs index 355a890f94..163f592c08 100644 --- a/Projectiles/Melee/Orbacle.cs +++ b/Projectiles/Melee/Orbacle.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index fc7c3468de..eadbefa81a 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.timeLeft = 180; Projectile.extraUpdates = 1; } diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index 2b547fd04e..15fcee14a3 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index 2b6c201e17..a9c333e5cd 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index 719482dec3..dabc7bf42a 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 40; Projectile.aiStyle = 0; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index d57d5cc981..13df307505 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 40; Projectile.friendly = true; Projectile.timeLeft = 3600; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/RemsRevengeProj.cs b/Projectiles/Melee/RemsRevengeProj.cs index f5db9697c6..2e15080f76 100644 --- a/Projectiles/Melee/RemsRevengeProj.cs +++ b/Projectiles/Melee/RemsRevengeProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15; diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index f6c3af8b40..b94f80419a 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,15 +22,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 600; - Projectile.aiStyle = 27; + Projectile.timeLeft = 90; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.extraUpdates = 1; } public override void AI() { if (Projectile.velocity.Length() < 25f && Projectile.timeLeft % 2 == 0) - Projectile.velocity *= 1.04f; + Projectile.velocity *= 2.08f; int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > 85) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index 38ea479122..e88fc4958b 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 300; diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index 8990b83c59..0d3a716fe1 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 36; Projectile.alpha = 255; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.extraUpdates = 1; diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs index 54dd4db0f8..5947c350bb 100644 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ b/Projectiles/Melee/SeashineSwordProj.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = true; diff --git a/Projectiles/Melee/Shortswords/AquaticDischargeProj.cs b/Projectiles/Melee/Shortswords/AquaticDischargeProj.cs new file mode 100644 index 0000000000..0373fc8956 --- /dev/null +++ b/Projectiles/Melee/Shortswords/AquaticDischargeProj.cs @@ -0,0 +1,69 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Shortswords +{ + public class AquaticDischargeProj: BaseShortswordProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/AquaticDischarge"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Discharge"); + } + + public override void SetDefaults() + { + Projectile.Size = new Vector2(16); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 1f; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = 360; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + } + + public override void SetVisualOffsets() + { + const int HalfSpriteWidth = 32 / 2; + const int HalfSpriteHeight = 32 / 2; + + int HalfProjWidth = Projectile.width / 2; + int HalfProjHeight = Projectile.height / 2; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); + DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + } + + public override void ExtraBehavior() + { + if (Main.rand.NextBool(5)) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[Projectile.owner]; + var source = Projectile.GetSource_FromThis(); + int sparkDamage = player.CalcIntDamage(0.5f * Projectile.damage); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sparkDamage, knockback, Main.myPlayer); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + Player player = Main.player[Projectile.owner]; + var source = Projectile.GetSource_FromThis(); + int sparkDamage = player.CalcIntDamage(0.5f * Projectile.damage); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sparkDamage, Projectile.knockBack, Main.myPlayer); + } + } +} diff --git a/Projectiles/Melee/Shortswords/CosmicShivProj.cs b/Projectiles/Melee/Shortswords/CosmicShivProj.cs new file mode 100644 index 0000000000..4c8068b43b --- /dev/null +++ b/Projectiles/Melee/Shortswords/CosmicShivProj.cs @@ -0,0 +1,89 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using System; + +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Shortswords +{ + public class CosmicShivProj : BaseShortswordProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/CosmicShiv"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Shiv"); + } + + public override void SetDefaults() + { + Projectile.Size = new Vector2(24); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 1f; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = 360; + Projectile.extraUpdates = 1; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + } + + public override Action EffectBeforePullback => (proj) => + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + }; + + public override void SetVisualOffsets() + { + const int HalfSpriteWidth = 48 / 2; + const int HalfSpriteHeight = 48 / 2; + + int HalfProjWidth = Projectile.width / 2; + int HalfProjHeight = Projectile.height / 2; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); + DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + } + + public override void ExtraBehavior() + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + for (int k = 0; k < 36; k++) + { + int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height -16, 173, 0f, 0f, 0, default, 1f); + Main.dust[dustID].velocity *= 3f; + Main.dust[dustID].scale *= 2f; + } + + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + for (int k = 0; k < 36; k++) + { + int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); + Main.dust[dustID].velocity *= 3f; + Main.dust[dustID].scale *= 2f; + } + + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } +} +} diff --git a/Projectiles/Melee/Shortswords/ElementalShivProj.cs b/Projectiles/Melee/Shortswords/ElementalShivProj.cs new file mode 100644 index 0000000000..a073e02efb --- /dev/null +++ b/Projectiles/Melee/Shortswords/ElementalShivProj.cs @@ -0,0 +1,78 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using System; + +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Shortswords +{ + public class ElementalShivProj: BaseShortswordProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/ElementalShiv"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Shiv"); // TODO: Make this one function like PiercingStarlight + } + + public override void SetDefaults() + { + Projectile.Size = new Vector2(22); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 1f; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = 360; + Projectile.extraUpdates = 1; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + } + + public override Action EffectBeforePullback => (proj) => + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + }; + + public override void SetVisualOffsets() + { + const int HalfSpriteWidth = 44 / 2; + const int HalfSpriteHeight = 44 / 2; + + int HalfProjWidth = Projectile.width / 2; + int HalfProjHeight = Projectile.height / 2; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); + DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + } + + public override void ExtraBehavior() + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs new file mode 100644 index 0000000000..0e72981f08 --- /dev/null +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -0,0 +1,91 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using System; + +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Shortswords +{ + public class GalileoGladiusProj : BaseShortswordProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/GalileoGladius"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galileo Gladius"); // TODO: Make it function like Gladius, not like PiercingStarlight. + } + + public override void SetDefaults() + { + Projectile.Size = new Vector2(24); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 1f; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = 360; + Projectile.extraUpdates = 1; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + } + + public override Action EffectBeforePullback => (proj) => + { + int moonDamage = (int)(Projectile.damage * 0.3333f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType(), moonDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); + }; + + public override void SetVisualOffsets() + { + const int HalfSpriteWidth = 42 / 2; + const int HalfSpriteHeight = 46 / 2; + + int HalfProjWidth = Projectile.width / 2; + int HalfProjHeight = Projectile.height / 2; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); + DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + } + + public override void ExtraBehavior() + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (Main.rand.NextBool(2) ? 20 : 176), (float)(Main.player[Projectile.owner].direction * 2), 0f, 150, default, 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SpawnMeteor(Main.player[Projectile.owner]); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SpawnMeteor(Main.player[Projectile.owner]); + } + + private void SpawnMeteor(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_FromThis(); + if (player.Calamity().galileoCooldown <= 0) + { + int damage = player.GetWeaponDamage(player.ActiveItem()) * 2; + CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); + player.Calamity().galileoCooldown = 15; + } + } + } + } +} diff --git a/Projectiles/Melee/Shortswords/LucreciaProj.cs b/Projectiles/Melee/Shortswords/LucreciaProj.cs new file mode 100644 index 0000000000..cf3e2c54db --- /dev/null +++ b/Projectiles/Melee/Shortswords/LucreciaProj.cs @@ -0,0 +1,79 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using System; +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Shortswords +{ + public class LucreciaProj: BaseShortswordProjectile + { + public const int OnHitIFrames = 5; + public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lucrecia"); + } + + public override void SetDefaults() + { + Projectile.Size = new Vector2(31); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 1f; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = 360; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + } + + public override Action EffectBeforePullback => (proj) => + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 12f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + }; + + + public override void SetVisualOffsets() + { + const int HalfSpriteWidth = 62 / 2; + const int HalfSpriteHeight = 62 / 2; + + int HalfProjWidth = Projectile.width / 2; + int HalfProjHeight = Projectile.height / 2; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); + DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + } + + public override void ExtraBehavior() + { + if (Main.rand.NextBool(5)) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.player[Projectile.owner].GiveIFrames(OnHitIFrames, false); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + Player player = Main.player[Projectile.owner]; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + Owner.GiveIFrames(OnHitIFrames, true); + } + } + } +} diff --git a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs new file mode 100644 index 0000000000..e0d11c35c1 --- /dev/null +++ b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs @@ -0,0 +1,68 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Shortswords +{ + public class SubmarineShockerProj: BaseShortswordProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/SubmarineShocker"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Submarine Shocker"); + } + + public override void SetDefaults() + { + Projectile.Size = new Vector2(16); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.scale = 1f; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = 360; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + } + + public override void SetVisualOffsets() + { + const int HalfSpriteWidth = 32 / 2; + const int HalfSpriteHeight = 32 / 2; + + int HalfProjWidth = Projectile.width / 2; + int HalfProjHeight = Projectile.height / 2; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); + DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); + } + + public override void ExtraBehavior() + { + if (Main.rand.NextBool(5)) + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + var source = Projectile.GetSource_FromThis(); + if (crit) + damage /= 2; + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), knockback, Main.myPlayer); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + var source = Projectile.GetSource_FromThis(); + if (crit) + damage /= 2; + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), Projectile.knockBack, Main.myPlayer); + } + } +} diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index f3a2c8800e..f3cff20eda 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 55; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 1d53e1ffbb..dbaecbd459 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -1,7 +1,8 @@ -using System; +using CalamityMod.Projectiles.BaseProjectiles; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class AmidiasTridentProj : BaseSpearProjectile @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 70; - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 90; Projectile.height = 70; diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index 711e47c073..9fe513c286 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -1,9 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Typeless; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { @@ -17,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index 77058e6554..716f8cad25 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -1,8 +1,9 @@ using CalamityMod.Dusts; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class BrimlanceProj : BaseSpearProjectile @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index 2cd44fe109..3a92e8b156 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -1,7 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ModLoader; using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { public class DiseasedPikeSpear : BaseSpearProjectile @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index df559f23d3..817d8a742b 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -1,8 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Ranged; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class EarthenPikeSpear : BaseSpearProjectile @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs index d43378122c..de802144b1 100644 --- a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class ElementalLanceProjectile : BaseSpearProjectile @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 61b68f8238..d28598e938 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -1,5 +1,6 @@ -using Terraria; -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index ddfe873c95..39667199aa 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -1,6 +1,7 @@ -using Terraria; +using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class GoldplumeSpearProjectile : BaseSpearProjectile @@ -13,7 +14,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 54; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. Projectile.timeLeft = 90; Projectile.height = 54; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index 57aa9cde9b..efc51122e2 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -1,9 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index ebce68afe9..7cc39071e6 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class InsidiousImpalerProj : BaseSpearProjectile @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 90; Projectile.height = 40; diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs deleted file mode 100644 index ff4a4c0597..0000000000 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CalamityMod.Projectiles.BaseProjectiles; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee.Spears -{ - public class MarniteSpearProjectile : BaseSpearProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - Projectile.width = 50; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; - Projectile.DamageType = TrueMeleeDamageClass.Instance; - Projectile.timeLeft = 90; - Projectile.height = 50; //The height of the .png file in pixels divided by 2. - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.ownerHitCheck = true; - } - - public override float InitialSpeed => 3f; - public override float ReelbackSpeed => 1.1f; - public override float ForwardSpeed => 0.95f; - } -} diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.png b/Projectiles/Melee/Spears/MarniteSpearProjectile.png deleted file mode 100644 index 65cce638b4..0000000000 Binary files a/Projectiles/Melee/Spears/MarniteSpearProjectile.png and /dev/null differ diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index f0c562009b..5b4023331f 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee.Spears { public class NadirSpear : BaseSpearProjectile @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { Projectile.width = 55; Projectile.height = 55; - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; Projectile.timeLeft = 90; Projectile.friendly = true; diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs index fa6e96357f..e14d02f134 100644 --- a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs +++ b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs @@ -1,7 +1,8 @@ -using System; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -203,6 +204,8 @@ namespace CalamityMod.Projectiles.Melee.Spears if (CurrentAttackState == AttackState.RunAttack) { + Owner.GetModPlayer().ChargingKnockbackResist = true; + //Keep the projectile alive during the run attack. //The fullyRunning check is important, because the animation timer relies on the projectiles time left for the startup animation. if (FullyRunning) diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index 107bfb424b..35ac5ecdf7 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -1,6 +1,7 @@ -using Terraria; +using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class SausageMakerSpear : BaseSpearProjectile @@ -13,7 +14,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 44; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 42; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index b4c00f9df5..06c90abc92 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -1,8 +1,8 @@ -using System; +using CalamityMod.Projectiles.BaseProjectiles; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class StarnightLanceProjectile : BaseSpearProjectile @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index f7d8803fc4..09a6264973 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -1,14 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee.Spears { diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index b6b2390cd8..ca9b5dc5a4 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -1,9 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { @@ -18,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { Projectile.width = 46; //The width of the .png file in pixels divided by 2. Projectile.height = 46; //The height of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether projectile is a melee-class weapon. Projectile.timeLeft = 90; Projectile.friendly = true; diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 5471d64979..acf1d627d5 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -1,7 +1,8 @@ -using System; +using CalamityMod.Projectiles.BaseProjectiles; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { public class TerraLanceProjectile : BaseSpearProjectile @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. Projectile.timeLeft = 90; Projectile.height = 40; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs index 95a5922b3e..0afe7617dc 100644 --- a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs +++ b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs @@ -1,9 +1,9 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears { @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 95; //The width of the .png file in pixels divided by 2. - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 95; //The height of the .png file in pixels divided by 2. diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 0209b27942..2ffd079226 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -1,6 +1,6 @@ -using Terraria; +using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; using Terraria.ID; -using CalamityMod.Projectiles.BaseProjectiles; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = 40; - Projectile.aiStyle = 19; + Projectile.aiStyle = ProjAIStyleID.Spear; Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.height = 40; diff --git a/Projectiles/Melee/SpineOfThanatosProjectile.cs b/Projectiles/Melee/SpineOfThanatosProjectile.cs index e3e6e9ab8b..cc3df0dbbe 100644 --- a/Projectiles/Melee/SpineOfThanatosProjectile.cs +++ b/Projectiles/Melee/SpineOfThanatosProjectile.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.extraUpdates = 2; Projectile.timeLeft = Lifetime; Projectile.ownerHitCheck = true; diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 758cf011ba..093a1fda17 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 477429a7fe..b27565c813 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 44; Projectile.height = 44; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; @@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Melee { int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; } } } diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index 66a7cdbc15..5bd1d05a3e 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/StreamGougePortal.cs b/Projectiles/Melee/StreamGougePortal.cs index 55344b9435..e466849cd5 100644 --- a/Projectiles/Melee/StreamGougePortal.cs +++ b/Projectiles/Melee/StreamGougePortal.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Particles.Metaballs; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/SulphurousGrabberBubble.cs b/Projectiles/Melee/SulphurousGrabberBubble.cs index 98cf753033..8ae31b1826 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 120; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/SulphurousGrabberBubble2.cs b/Projectiles/Melee/SulphurousGrabberBubble2.cs index af9c4fce5c..da345ffbb4 100644 --- a/Projectiles/Melee/SulphurousGrabberBubble2.cs +++ b/Projectiles/Melee/SulphurousGrabberBubble2.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 120; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index 932e5629e3..81fe165ac1 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 50; Projectile.height = 50; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.alpha = 100; Projectile.friendly = true; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index 680bcfb9b3..5e1415c195 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index 19212d93e1..c698b3ee4a 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index ab9934cd09..c5772b17d5 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index 1afc80aed8..c24535fff2 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 31b9f222fd..b0b2efaff9 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs index 8295432bd6..18768908bf 100644 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ b/Projectiles/Melee/TerraEdgeBeam.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs index ebcc64fde2..e577e47ec7 100644 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ b/Projectiles/Melee/TerratomereProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 30; Projectile.height = 30; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/ThanatosBoom.cs b/Projectiles/Melee/ThanatosBoom.cs index eb0c53c9a2..382ae0ce1d 100644 --- a/Projectiles/Melee/ThanatosBoom.cs +++ b/Projectiles/Melee/ThanatosBoom.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 45; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 4; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/ThornBase.cs b/Projectiles/Melee/ThornBase.cs index 7bb2459a8b..0c4c767b5e 100644 --- a/Projectiles/Melee/ThornBase.cs +++ b/Projectiles/Melee/ThornBase.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; } public override void AI() diff --git a/Projectiles/Melee/ThornTip.cs b/Projectiles/Melee/ThornTip.cs index f94a4f3b43..1e0e32638b 100644 --- a/Projectiles/Melee/ThornTip.cs +++ b/Projectiles/Melee/ThornTip.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index fa47d20927..efefe5a4e7 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using System; using Terraria; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.extraUpdates = 3; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 8adccb635f..f2c746f7fb 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee } public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 75; Projectile.width = Projectile.height = 75; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index e07bb918e1..4f6b5104e0 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.width = Projectile.height = 60; Projectile.width = Projectile.height = 60; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs index 852e982776..40dfb6fa22 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { Projectile.width = Projectile.height = 32; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index 69b0fa058c..7df7882eb8 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs index 1e2228374b..b3dd1130e4 100644 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ b/Projectiles/Melee/TumbleweedFlail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; } diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index 715bff23bf..94af22b4b2 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.penetrate = 8; Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; } public override void AI() diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs index 92789e1146..dd1a987a37 100644 --- a/Projectiles/Melee/UrchinBall.cs +++ b/Projectiles/Melee/UrchinBall.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 3; diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index d7e2d3e7df..96648e7426 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 6; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; AIType = ProjectileID.BoneJavelin; } diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/UrchinMaceProjectile.cs index 9310242891..abc4d1c88d 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/UrchinMaceProjectile.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.ownerHitCheck = true; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -87,6 +88,13 @@ namespace CalamityMod.Projectiles.Melee if (Windup == MaxWindup && Owner.whoAmI == Main.myPlayer) { SoundEngine.PlaySound(SoundID.Item43, Owner.MountedCenter); + + for (int i = 0; i < 25; i++) + { + Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); + Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; + } } Windup++; diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index cab3ca7405..92544b84bc 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 6; Projectile.height = 6; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.alpha = 255; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 9adfade565..a7fbd36458 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = Projectile.height = 142; Projectile.aiStyle = -1; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.timeLeft = 90000; Projectile.ignoreWater = true; diff --git a/Projectiles/Melee/VolcanicFireball.cs b/Projectiles/Melee/VolcanicFireball.cs index 9d8fe7e7d8..0958c509d4 100644 --- a/Projectiles/Melee/VolcanicFireball.cs +++ b/Projectiles/Melee/VolcanicFireball.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 16; Projectile.height = 16; - Projectile.aiStyle = 44; + Projectile.aiStyle = ProjAIStyleID.MoveShort; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/VolcanicFireballLarge.cs b/Projectiles/Melee/VolcanicFireballLarge.cs index 05da17bfe1..2d97bb056f 100644 --- a/Projectiles/Melee/VolcanicFireballLarge.cs +++ b/Projectiles/Melee/VolcanicFireballLarge.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 44; + Projectile.aiStyle = ProjAIStyleID.MoveShort; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/Waterfall.cs b/Projectiles/Melee/Waterfall.cs index b67e6e5a64..8876cb43c1 100644 --- a/Projectiles/Melee/Waterfall.cs +++ b/Projectiles/Melee/Waterfall.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 8; Projectile.penetrate = 3; Projectile.timeLeft /= 2; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.tileCollide = false; } diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs new file mode 100644 index 0000000000..56ee83223f --- /dev/null +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -0,0 +1,253 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Melee +{ + public class WulfrumScrew : ModProjectile + { + internal PrimitiveTrail TrailDrawer; + internal Color PrimColorMult = Color.White; + + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Screw"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public static int Lifetime = 950; + public float LifetimeCompletion => MathHelper.Clamp((Lifetime - Projectile.timeLeft) / (float)Lifetime, 0f, 1f); + public ref float BazingaTime => ref Projectile.ai[0]; + public ref float AlreadyBazinged => ref Projectile.ai[1]; + public static float BazingaTimeMax = 120f; + public float BazingaTimeCompletion => (BazingaTimeMax - BazingaTime) / BazingaTimeMax; + public float FadePercent => Math.Clamp(Projectile.timeLeft / FadeTime, 0f, 1f); + public static float FadeTime => 30f; + public Player Owner => Main.player[Projectile.owner]; + + public static Asset SheenTex; + + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; + Projectile.scale = 1.2f; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity *= 0.998f; + + if (Projectile.timeLeft < Lifetime - 100 && BazingaTime == 0) + Projectile.velocity.Y += 0.01f; + + + if (BazingaTime > 0) + { + BazingaTime--; + + if (BazingaTime == BazingaTimeMax - 2) + Owner.Calamity().GeneralScreenShakePower = 0; + + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Projectile.velocity * Main.rand.NextFloat(0.6f, 1.5f), Scale: Main.rand.NextFloat(1f, 1.4f)); + chust.noGravity = true; + + if (!Main.rand.NextBool(5)) + chust.noLightEmittence = true; + } + + if (Projectile.Center.Distance(Owner.MountedCenter) > 1300 && Projectile.timeLeft > FadeTime) + Projectile.timeLeft = (int)FadeTime; + + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); + + + bool screwRegained = false; + + //50% chance to gain back the screw on kill. + if (target.life - damage <= 0) + { + if (Main.rand.NextBool() && Main.myPlayer == Owner.whoAmI) + { + if (Owner.HeldItem.ModItem is WulfrumScrewdriver screwdriver && !screwdriver.ScrewStored) + { + WulfrumScrewdriver.ScrewStart = new Vector3(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 4f * Main.rand.NextFloat() - Main.screenPosition, Projectile.rotation); + WulfrumScrewdriver.ScrewTimer = WulfrumScrewdriver.ScrewTime; + screwdriver.ScrewStored = true; + + SoundEngine.PlaySound(SoundID.Item156); + + screwRegained = true; + } + } + } + + if (!screwRegained && Main.netMode != NetmodeID.Server) + { + Gore screwGore = Gore.NewGorePerfect(Projectile.GetSource_Death(), Projectile.position, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(4f, 6f) + Projectile.velocity * 0.7f, Mod.Find("WulfrumScrewGore").Type); + screwGore.timeLeft = 20; + } + + //Screenstun + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + + if (BazingaTime > 0) + SoundEngine.PlaySound(CommonCalamitySounds.WulfrumNPCDeathSound, Projectile.Center); + + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + Gore screwGore = Gore.NewGorePerfect(Projectile.GetSource_Death(), Projectile.position, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1f, 3f) + Projectile.velocity * 0.7f, Mod.Find("WulfrumScrewGore").Type); + screwGore.timeLeft = 20; + } + + + + return base.OnTileCollide(oldVelocity); + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Pow(1 - completionRatio, 2) * (float)Math.Pow(1 - BazingaTimeCompletion, 0.4f); + return Color.GreenYellow.MultiplyRGB(PrimColorMult) * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return 9.4f; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + + float distanceFromAim = Projectile.Center.ShortestDistanceToLine(Owner.MountedCenter, Main.MouseWorld); + float distanceFromPlayerAcrossSightLine = (Owner.MountedCenter - Projectile.Center.ClosestPointOnLine(Owner.MountedCenter, Main.MouseWorld)).Length(); + + float opacity = MathHelper.Clamp(1f - distanceFromAim / 90f, 0f, 1f) * (1f - Math.Clamp((float)Math.Pow(distanceFromPlayerAcrossSightLine / 300f, 9f) , 0f, 1f)); + + //Draw a sightline before the player hits it. + if (Owner.whoAmI == Main.myPlayer && BazingaTime == 0 && opacity > 0) + { + Texture2D empty = Request("CalamityMod/Projectiles/InvisibleProj").Value; + + //Setup the laser sights effect. + Effect laserScopeEffect = Filters.Scene["PixelatedSightLine"].GetShader().Shader; + laserScopeEffect.Parameters["sampleTexture2"].SetValue(ModContent.Request("CalamityMod/ExtraTextures/CertifiedCrustyNoise").Value); + laserScopeEffect.Parameters["noiseOffset"].SetValue(Main.GameUpdateCount * -0.003f); + + laserScopeEffect.Parameters["mainOpacity"].SetValue((float)Math.Pow(opacity , 0.5f)); //Opacity increases as the screw gets close to the cursor + + laserScopeEffect.Parameters["Resolution"].SetValue(new Vector2(700f * 0.2f)); + laserScopeEffect.Parameters["laserAngle"].SetValue((Main.MouseWorld - Owner.MountedCenter).ToRotation() * -1); + + laserScopeEffect.Parameters["laserWidth"].SetValue(0.0025f + (float)Math.Pow(opacity, 5) * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.002f + 0.002f)); + laserScopeEffect.Parameters["laserLightStrenght"].SetValue(3f); + + laserScopeEffect.Parameters["color"].SetValue(Color.GreenYellow.ToVector3()); + laserScopeEffect.Parameters["darkerColor"].SetValue(Color.Black.ToVector3()); + laserScopeEffect.Parameters["bloomSize"].SetValue(0.06f + (1 - opacity) * 0.1f); + laserScopeEffect.Parameters["bloomMaxOpacity"].SetValue(0.4f); + laserScopeEffect.Parameters["bloomFadeStrenght"].SetValue(3f); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, laserScopeEffect, Main.GameViewMatrix.TransformationMatrix); + + Main.EntitySpriteDraw(empty, Projectile.Center - Main.screenPosition, null, Color.White, 0, empty.Size() / 2f, 700f, 0, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + + + opacity = BazingaTimeCompletion * FadePercent; + + if (BazingaTime > 0) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + //Draw a trail + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1f, delegate (Vector2 offset, Color colorMod) + { + PrimColorMult = colorMod; + + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + offset, 30); + }); + + //Draw the screw with chroma abberation + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 3f, delegate (Vector2 offset, Color colorMod) + { + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + offset, null, Color.GreenYellow.MultiplyRGB(colorMod) * opacity, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + }); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * (1 - opacity), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + + //Very, very, very, unfortunate spritebatch restart x2, but draw a sheen texture like zenith. + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + + if (SheenTex == null) + SheenTex = ModContent.Request("CalamityMod/Particles/HalfStar"); + Texture2D shineTex = SheenTex.Value; + Vector2 shineScale = new Vector2(1f, 3f - opacity * 2f); + + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, Color.GreenYellow * (1 - opacity) * 0.7f, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + } + + else + { + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * FadePercent, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + } + return false; + } + + } +} diff --git a/Projectiles/Melee/WulfrumScrew.png b/Projectiles/Melee/WulfrumScrew.png new file mode 100644 index 0000000000..a5d96ffcff Binary files /dev/null and b/Projectiles/Melee/WulfrumScrew.png differ diff --git a/Projectiles/Melee/WulfrumScrewOutline.png b/Projectiles/Melee/WulfrumScrewOutline.png new file mode 100644 index 0000000000..ac652ebe6b Binary files /dev/null and b/Projectiles/Melee/WulfrumScrewOutline.png differ diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs new file mode 100644 index 0000000000..bd1a7cef16 --- /dev/null +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -0,0 +1,242 @@ +using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using Terraria.Audio; +using static CalamityMod.CalamityUtils; +using ReLogic.Content; +using Terraria.Graphics.Shaders; +using Terraria.Graphics.Effects; + +namespace CalamityMod.Projectiles.Melee +{ + public class WulfrumScrewdriverProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/WulfrumScrewdriver"; + public float Timer => MaxTime - Projectile.timeLeft; + public float LifetimeCompletion => Timer / (float)MaxTime; + + public static int MaxTime = 14; + public ref float EndLag => ref Projectile.ai[0]; + public ref float TrueDirection => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + + public static Asset SmearTex; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Screwdriver"); + } + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Melee; + Projectile.width = 14; + Projectile.height = 50; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.timeLeft = MaxTime; + } + + public override bool? CanDamage() + { + return Projectile.timeLeft <= (MaxTime - 5); + } + + public override bool ShouldUpdatePosition() => false; + public CurveSegment ThrustSegment = new CurveSegment(LinearEasing, 0f, 0f, 1f, 3); + public CurveSegment HoldSegment = new CurveSegment(SineBumpEasing, 0.2f, 1f, 0.2f); + public CurveSegment RetractSegment = new CurveSegment(PolyOutEasing, 0.76f, 1f, -0.8f, 3); + public CurveSegment BumpSegment = new CurveSegment(SineBumpEasing, 0.9f, 0.2f, 0.15f); + internal float DistanceFromPlayer => PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { ThrustSegment, HoldSegment, RetractSegment, BumpSegment }); + public Vector2 OffsetFromPlayer => Projectile.velocity * DistanceFromPlayer * 12f; + + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + //The hitbox is simplified into a line collision. + float collisionPoint = 0f; + float bladeLenght = 78f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + } + + public override void AI() + { + if (EndLag == 0) //Initialization + { + EndLag = (float)Math.Max(Owner.ActiveItem().useTime - MaxTime, 1); + TrueDirection = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.Zero).ToRotation(); //Store this for the screw hit + Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.15f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + //Manage position and rotation + Projectile.Center = Owner.MountedCenter + OffsetFromPlayer ; + Projectile.scale = 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; + Owner.direction = Math.Sign(Projectile.velocity.X); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2); + Owner.itemTime = 2; + Owner.itemAnimation = 2; + + + //Check for launchable screws. + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.ModProjectile != null && proj.owner == Projectile.owner && proj.ModProjectile is WulfrumScrew screw && screw.BazingaTime == 0) + { + float collisionPoint = 0f; + float bladeLenght = 86f * Projectile.scale; + if (Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + OffsetFromPlayer, Owner.Center + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 34, ref collisionPoint)) + { + Vector2 thudVelocity = TrueDirection.ToRotationVector2() * 6f; + NPC potentialAimAssist = FindTarget(); + if (potentialAimAssist != null) + thudVelocity = (potentialAimAssist.Center - proj.Center).SafeNormalize(Vector2.Zero) * 6f; + + screw.BazingaTime = WulfrumScrew.BazingaTimeMax; + proj.velocity = thudVelocity; + if (screw.AlreadyBazinged == 0) + proj.damage = (int)(proj.damage * WulfrumScrewdriver.ScrewBazingaModeDamageMult); + proj.timeLeft = WulfrumScrew.Lifetime; + proj.knockBack *= 2.5f; + screw.AlreadyBazinged++; + + SoundEngine.PlaySound(WulfrumScrewdriver.ScrewHitSound, Projectile.Center); + + if (screw.AlreadyBazinged > 2) + SoundEngine.PlaySound(WulfrumScrewdriver.FunnyUltrablingSound, Projectile.Center); + + + if (Main.myPlayer == proj.owner) + { + Owner.Calamity().GeneralScreenShakePower = 6f; + } + + return; + } + } + } + } + + public NPC FindTarget() + { + float bestScore = 0; + NPC bestTarget = null; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC potentialTarget = Main.npc[i]; + + if (!potentialTarget.CanBeChasedBy(null, false)) + continue; + + float distance = potentialTarget.Distance(Projectile.Center); + float angle = TrueDirection.ToRotationVector2().AngleBetween((potentialTarget.Center - Projectile.Center)); + + float extraDistance = potentialTarget.width / 2 + potentialTarget.height / 2; + + if (distance - extraDistance < WulfrumScrewdriver.ScrewBazingaAimAssistReach && angle < WulfrumScrewdriver.ScrewBazingaAimAssistAngle / 2f) + { + if (!Collision.CanHit(Projectile.Center, 1, 1, potentialTarget.Center, 1, 1) && extraDistance < distance) + continue; + + float attemptedScore = EvaluatePotentialTarget(distance - extraDistance, angle / 2f); + if (attemptedScore > bestScore) + { + bestTarget = potentialTarget; + bestScore = attemptedScore; + } + } + } + return bestTarget; + } + + public float EvaluatePotentialTarget(float distance, float angle) + { + float score = 1 - distance / WulfrumScrewdriver.ScrewBazingaAimAssistReach * 0.2f; + //Prioritize angle over distance + score += (1 - Math.Abs(angle) / (WulfrumScrewdriver.ScrewBazingaAimAssistAngle / 2f)) * 0.8f; + + return score; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + SoundEngine.PlaySound(WulfrumScrewdriver.ThudSound, target.Center); + Projectile.timeLeft = 0; + + //Chance to gain a screw + if (Main.rand.NextBool(5) && Main.myPlayer == Owner.whoAmI) + { + if (Owner.HeldItem.ModItem is WulfrumScrewdriver screwdriver && !screwdriver.ScrewStored) + { + WulfrumScrewdriver.ScrewStart = new Vector3(target.Center + Projectile.velocity * 14f * Main.rand.NextFloat() - Main.screenPosition, Main.rand.NextFloat(MathHelper.PiOver2 - MathHelper.PiOver4)); + WulfrumScrewdriver.ScrewTimer = WulfrumScrewdriver.ScrewTime; + WulfrumScrewdriver.ScrewQeuedForStorage = true; + + SoundEngine.PlaySound(SoundID.Item156); + } + } + + //Dust + for (int k = 0; k < 4; k++) + { + Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * 70f, 16, Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(6), 0, default, Main.rand.NextFloat(0.7f, 1f)); + } + + + base.OnHitNPC(target, damage, knockback, crit); + } + + public override void Kill(int timeLeft) + { + if (Projectile.numHits == 0) + { + Owner.itemTime = (int)EndLag; + Owner.itemAnimation = (int)EndLag; + } + + //Go into jojo spam mode if you hit an enemy + else + { + Owner.itemTime = 0; + Owner.itemAnimation = 0; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + + if (SmearTex == null) + SmearTex = ModContent.Request("CalamityMod/ExtraTextures/MediumLongThrust"); + Texture2D smearTex = SmearTex.Value; + + Vector2 drawOrigin = new Vector2(tex.Width / 2f, tex.Height); + Vector2 scale = new Vector2(Math.Abs((float)Math.Sin(LifetimeCompletion * MathHelper.TwoPi * 0.5f)), 1f); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, drawOrigin, scale * Projectile.scale, 0f, 0); + + if (LifetimeCompletion < 0.6f) + { + int frameCount = (int)Math.Floor((LifetimeCompletion / 0.6f) * 3f); + 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); + } + return false; + } + } +} diff --git a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index b475cf969a..949369e101 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.05f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/AortaYoyo.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs index 5ad98eef69..fb34f99abf 100644 --- a/Projectiles/Melee/Yoyos/AortaYoyo.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 3646c52cda..d198c1615d 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 24; Projectile.height = 24; Projectile.scale = 1.2f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs index 9339ce9deb..f465c73a82 100644 --- a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs +++ b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.15f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) - Main.projectile[boom].DamageType = DamageClass.Melee; + Main.projectile[boom].DamageType = DamageClass.MeleeNoSpeed; } } diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index fda3f60a5d..10836945b1 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -18,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.15f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index c65f5507ff..e6a030ace0 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 4cbdd200f8..a3ae8da2e6 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -32,12 +32,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 26f4e409bb..2c70926bef 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.6f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = UpdatesPerFrame; Projectile.usesLocalNPCImmunity = true; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; } } } diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index 8a885dd1c7..ee8608fa19 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index d42a429de6..4ae5db8c96 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -61,12 +61,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 20; Projectile.height = 20; Projectile.scale = 1.2f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = UpdatesPerFrame; Projectile.usesLocalNPCImmunity = true; @@ -244,7 +244,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { Projectile p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, Projectile.owner, i); if (p.whoAmI.WithinBounds(Main.maxProjectiles)) - p.DamageType = DamageClass.Melee; + p.DamageType = DamageClass.MeleeNoSpeed; } } } diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index f8abff22dd..ec21aa4f7d 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -19,12 +19,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index 137e45a64a..12967419de 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.25f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.35f, Projectile.velocity.Y * 0.35f, ProjectileID.SporeGas, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, ProjectileID.SporeGas2, (int)(Projectile.damage * 0.6), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.15f, Projectile.velocity.Y * 0.15f, ProjectileID.SporeGas3, (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index 390d458edb..df624198fd 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,12 +16,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 150; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; diff --git a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index 520224d910..eb368c760e 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -18,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 57923a990a..278d47d6cd 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.15f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Melee; + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; } } diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs index 2d676a37e1..5ef3593a3c 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 18; Projectile.height = 18; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; diff --git a/Projectiles/Melee/Yoyos/VerdantYoyo.cs b/Projectiles/Melee/Yoyos/VerdantYoyo.cs index ee73fd0c78..319d515c10 100644 --- a/Projectiles/Melee/Yoyos/VerdantYoyo.cs +++ b/Projectiles/Melee/Yoyos/VerdantYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1.1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/Yoyos/YinYoyo.cs b/Projectiles/Melee/Yoyos/YinYoyo.cs index 80dcf7792a..8cd1cb4023 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -18,12 +18,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { - Projectile.aiStyle = 99; + Projectile.aiStyle = ProjAIStyleID.Yoyo; Projectile.width = 16; Projectile.height = 16; Projectile.scale = 1f; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 0ab69d2148..635b534c12 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.netImportant = true; Projectile.width = 38; Projectile.height = 46; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft *= 5; diff --git a/Projectiles/Pets/FoxPet.cs b/Projectiles/Pets/FoxPet.cs index bc6b98f91e..3393c67c1a 100644 --- a/Projectiles/Pets/FoxPet.cs +++ b/Projectiles/Pets/FoxPet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.width = 24; Projectile.height = 32; Projectile.friendly = true; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; AIType = ProjectileID.Puppy; Projectile.penetrate = -1; Projectile.timeLeft *= 5; diff --git a/Projectiles/Pets/LadShark.cs b/Projectiles/Pets/LadShark.cs index 23930dbeaa..e9d35edd1a 100644 --- a/Projectiles/Pets/LadShark.cs +++ b/Projectiles/Pets/LadShark.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Pets Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft *= 5; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; AIType = ProjectileID.BabySkeletronHead; } diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index 2cb74ceeb1..c1dfeaf25a 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Ranged/AccelerationRoundProj.cs b/Projectiles/Ranged/AccelerationRoundProj.cs index 3a08c28a21..a96e1c5b7a 100644 --- a/Projectiles/Ranged/AccelerationRoundProj.cs +++ b/Projectiles/Ranged/AccelerationRoundProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/AcidRoundProj.cs b/Projectiles/Ranged/AcidRoundProj.cs index f6da436f40..a5914e7741 100644 --- a/Projectiles/Ranged/AcidRoundProj.cs +++ b/Projectiles/Ranged/AcidRoundProj.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 81c5700f00..2aaa521063 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index 4d887e6616..1f0c256077 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; } public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs index d1e1a9c1cd..320dda2b06 100644 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ b/Projectiles/Ranged/ArcticArrowProj.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.coldDamage = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 1eea0dc300..7a4751a32c 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index b0e3be5217..66336919a7 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 2; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.WoodenArrowFriendly; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 84118fe5e6..b867f897e8 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -75,6 +75,21 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -191,10 +206,12 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); int blastRadius = 0; - if (projID == ProjectileID.RocketII) + if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII) // Not adding the actual shrapnel tho blastRadius = 3; else if (projID == ProjectileID.RocketIV) blastRadius = 6; + else if (projID == ProjectileID.MiniNukeRocketII) + blastRadius = 9; Projectile.ExpandHitboxBy(14); @@ -202,6 +219,29 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs index 32fe8910ca..02b8a100c3 100644 --- a/Projectiles/Ranged/BigCoral.cs +++ b/Projectiles/Ranged/BigCoral.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index b3c22a2f67..d69a0c673e 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -76,6 +76,21 @@ namespace CalamityMod.Projectiles.Ranged } } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -163,17 +178,39 @@ namespace CalamityMod.Projectiles.Ranged Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; - bool canShoot = true; int damage = 0; float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); Projectile.ExpandHitboxBy(16); - if (Projectile.owner == Main.myPlayer && (projID == ProjectileID.RocketII || projID == ProjectileID.RocketIV)) + if (Projectile.owner == Main.myPlayer && (projID == ProjectileID.RocketII || projID == ProjectileID.RocketIV || projID == ProjectileID.MiniNukeRocketII || projID == ProjectileID.ClusterRocketII)) { CalamityUtils.ExplodeandDestroyTiles(Projectile, 23, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 5f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 5.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } } } diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index ea590ebdd8..527b17edf5 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.extraUpdates = 3; AIType = ProjectileID.Bullet; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/BlueExoArrow.cs b/Projectiles/Ranged/BlueExoArrow.cs deleted file mode 100644 index d370a0db90..0000000000 --- a/Projectiles/Ranged/BlueExoArrow.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class BlueExoArrow : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blue Exo Arrow"); - } - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.ExoDebuffs(); - OnHitEffects(target.Center); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.ExoDebuffs(); - OnHitEffects(target.Center); - } - - private void OnHitEffects(Vector2 targetPos) - { - var source = Projectile.GetSource_FromThis(); - for (int x = 0; x < 3; x++) - { - if (Projectile.owner == Main.myPlayer) - { - CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, Main.rand.NextBool(2), 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner); - } - } - } - } -} diff --git a/Projectiles/Ranged/BlueExoArrow2.cs b/Projectiles/Ranged/BlueExoArrow2.cs deleted file mode 100644 index b81723aa9b..0000000000 --- a/Projectiles/Ranged/BlueExoArrow2.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class BlueExoArrow2 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.extraUpdates = 5; - Projectile.timeLeft = 300; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - } - - public override void AI() - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); - } -} diff --git a/Projectiles/Ranged/BouncingShotgunPellet.cs b/Projectiles/Ranged/BouncingShotgunPellet.cs index 5feeaad4d6..31cde239c6 100644 --- a/Projectiles/Ranged/BouncingShotgunPellet.cs +++ b/Projectiles/Ranged/BouncingShotgunPellet.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.DamageType = DamageClass.Ranged; Projectile.friendly = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.timeLeft = 180; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 1c6e6e3089..01dbeae395 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index 0e2ec35af9..e18aff78ef 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 06bf9526b6..6ee24fb27f 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index 527bc44f6a..da3722348f 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index 882f20f196..2da46b868d 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 8; diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 453eb119bd..ff01c19cdb 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index 204a4c3cdb..fed8705746 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/CrackshotBlast.cs b/Projectiles/Ranged/CrackshotBlast.cs new file mode 100644 index 0000000000..f87b537578 --- /dev/null +++ b/Projectiles/Ranged/CrackshotBlast.cs @@ -0,0 +1,133 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CrackshotBlast : ModProjectile + { + internal PrimitiveTrail TrailDrawer; + + public ref float Boosted => ref Projectile.ai[0]; + public ref float DieSoon => ref Projectile.ai[1]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = TrailLenght; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 4000; + } + + public static int Lifetime = 600; + public static int TrailLenght = 35; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 7; + Projectile.alpha = 255; + } + + public override bool? CanDamage() => Projectile.numHits == 0; + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (Color.Gold * 0.8f).ToVector3() * 0.5f); + + if (Boosted == 0) + { + //Check for coins + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.ModProjectile != null && proj.type == ModContent.ProjectileType() && proj.active) + { + if (Collision.CheckAABBvAABBCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Projectile.Hitbox.TopLeft(), Projectile.Hitbox.Size())) + { + NPC target = Projectile.Center.ClosestNPCAt(900, false, true); + if (target != null) + { + Projectile.velocity = (Projectile.DirectionTo(target.Center) * 16f); + Boosted = 1; + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 2; + Projectile.damage = (int)(Projectile.damage * CrackshotColt.RicochetDamageMult); + } + + proj.active = false; + if (proj.owner == Main.myPlayer) + { + int coin = Item.NewItem(proj.GetSource_DropAsItem(), proj.Center, Vector2.One, ItemID.CopperCoin, noBroadcast: false); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, coin, 1f); + } + + SoundEngine.PlaySound(CrackshotColt.BlingHitSound, proj.Center); + return; + } + } + } + } + + if (DieSoon == 1) + Projectile.velocity = Vector2.Zero; + + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + //sfx + Projectile.velocity = Vector2.Zero; + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + DieSoon = 1f; + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), TrailLenght); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + //sfx + DieSoon = 1f; + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), TrailLenght); + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = Math.Min(Projectile.timeLeft / (float)TrailLenght, 1f); + return Color.PaleGoldenrod * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + float width = Math.Min(Projectile.timeLeft / (float)TrailLenght, 1f); + return (1 - completionRatio) * 6.4f * width; + } + + public override bool PreDraw(ref Color lightColor) + { + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, TrailLenght); + + return false; + } + } +} diff --git a/Projectiles/Ranged/CrackshotCoin.cs b/Projectiles/Ranged/CrackshotCoin.cs new file mode 100644 index 0000000000..b70035513a --- /dev/null +++ b/Projectiles/Ranged/CrackshotCoin.cs @@ -0,0 +1,104 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CrackshotCoin : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coin"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 8; + } + + public static int Lifetime = 950; + public float LifetimeCompletion => MathHelper.Clamp((Lifetime - Projectile.timeLeft) / (float)Lifetime, 0f, 1f); + public float FadePercent => Math.Clamp(Projectile.timeLeft / FadeTime, 0f, 1f); + public static float FadeTime => 30f; + public Player Owner => Main.player[Projectile.owner]; + + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; + Projectile.scale = 1.1f; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 0.2f); + + + Projectile.rotation = Projectile.velocity.X * 0.5f; + Projectile.velocity *= 0.998f; + + if (Projectile.timeLeft < Lifetime - 100) + Projectile.velocity.Y += 0.01f; + + if (Projectile.Center.Distance(Owner.MountedCenter) > 1300 && Projectile.timeLeft > FadeTime) + Projectile.timeLeft = (int)FadeTime; + + if (Main.rand.NextBool(10)) + { + int schyste = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246); + Main.dust[schyste].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + + return base.OnTileCollide(oldVelocity); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Rectangle frame = new Rectangle(0, Projectile.frame * tex.Height / Main.projFrames[Projectile.type], tex.Width, tex.Height / Main.projFrames[Projectile.type]); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor) * FadePercent, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + + return false; + } + + public override void Kill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer && Main.rand.NextBool(4)) + Item.NewItem(Projectile.GetSource_DropAsItem(), Projectile.Center, Vector2.One, ItemID.CopperCoin); + } + } +} diff --git a/Projectiles/Ranged/CrackshotCoin.png b/Projectiles/Ranged/CrackshotCoin.png new file mode 100644 index 0000000000..38bbfa904c Binary files /dev/null and b/Projectiles/Ranged/CrackshotCoin.png differ diff --git a/Projectiles/Ranged/DragonsBreathRound.cs b/Projectiles/Ranged/DragonsBreathRound.cs index 5a639d1b9a..18f9adf64e 100644 --- a/Projectiles/Ranged/DragonsBreathRound.cs +++ b/Projectiles/Ranged/DragonsBreathRound.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(ModContent.BuffType(), 300); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index 1d44dbd20d..37d703feff 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 5; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.timeLeft = 300; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index d3aac581f5..5f6075d22c 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index 6f88bbbcaa..b7334706b6 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs new file mode 100644 index 0000000000..28b1e0a6a0 --- /dev/null +++ b/Projectiles/Ranged/ExoCrystalArrow.cs @@ -0,0 +1,134 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Sounds; +using CalamityMod.Particles; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Weapons.Ranged; +using Terraria.DataStructures; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoCrystalArrow : ModProjectile + { + public PrimitiveTrail PierceAfterimageDrawer = null; + + public bool CreateLightning => Projectile.ai[0] == 1f; + + public ref float Time => ref Projectile.ai[1]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Crystal"); + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + } + + public override void SetDefaults() + { + Projectile.width = 26; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.arrow = true; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + // Fade in. + Projectile.Opacity = Utils.GetLerpValue(0f, 3f, Time, true); + + // Rapidly race towards the nearest target. + NPC potentialTarget = Projectile.Center.ClosestNPCAt(HeavenlyGale.ArrowTargetingRange); + if (potentialTarget != null && Time >= 10f) + { + Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 33f; + Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); + } + + // Determine rotation. + Projectile.rotation = Projectile.velocity.ToRotation(); + + Time++; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + return true; + } + + public float PrimitiveWidthFunction(float completionRatio) => Projectile.scale * 30f; + + public Color PrimitiveColorFunction(float _) => Color.Lime * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + PierceAfterimageDrawer ??= new(PrimitiveWidthFunction, PrimitiveColorFunction, null, GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"]); + + float localIdentityOffset = Projectile.identity * 0.1372f; + Color mainColor = CalamityUtils.MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f + localIdentityOffset) % 1f, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange); + Color secondaryColor = CalamityUtils.MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f + localIdentityOffset + 0.2f) % 1f, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange); + + mainColor = Color.Lerp(Color.White, mainColor, 0.85f); + secondaryColor = Color.Lerp(Color.White, secondaryColor, 0.85f); + + Vector2 trailOffset = Projectile.Size * 0.5f - Main.screenPosition; + GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/EternityStreak")); + GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].UseSecondaryColor(secondaryColor); + GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].Apply(); + PierceAfterimageDrawer.Draw(Projectile.oldPos, trailOffset, 53); + + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 origin = tex.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Main.spriteBatch.Draw(tex, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, 0, 0f); + + return false; + } + + public override void Kill(int timeLeft) + { + // Play a loud impact sound. + SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = 0.2f }, Projectile.Center); + + // Explode into a bunch of exo particles. + for (int i = 0; i < 2; i++) + { + Vector2 energyVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 11f); + Color exoEnergyColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityUtils.ExoPalette); + SparkParticle exoEnergy = new(Projectile.Center, energyVelocity, false, 30, 1.3f, exoEnergyColor); + GeneralParticleHandler.SpawnParticle(exoEnergy); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Create lightning from above if necessary. + if (!CreateLightning) + return; + + int lightningDamage = (int)(Projectile.damage * HeavenlyGale.LightningDamageFactor); + Vector2 lightningSpawnPosition = target.Center - Vector2.UnitY.RotatedByRandom(0.24f) * Main.rand.NextFloat(960f, 1020f); + Vector2 lightningShootVelocity = (target.Center - lightningSpawnPosition + target.velocity * 7.5f).SafeNormalize(Vector2.UnitY) * 14f; + int lightning = Projectile.NewProjectile(Projectile.GetSource_FromThis(), lightningSpawnPosition, lightningShootVelocity, ModContent.ProjectileType(), lightningDamage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(lightning)) + { + Main.projectile[lightning].CritChance = Projectile.CritChance; + Main.projectile[lightning].ai[0] = lightningShootVelocity.ToRotation(); + Main.projectile[lightning].ai[1] = Main.rand.Next(100); + } + } + } +} diff --git a/Projectiles/Ranged/ExoCrystalArrow.png b/Projectiles/Ranged/ExoCrystalArrow.png new file mode 100644 index 0000000000..9ba7643d0e Binary files /dev/null and b/Projectiles/Ranged/ExoCrystalArrow.png differ diff --git a/Projectiles/Ranged/ExoLightningBolt.cs b/Projectiles/Ranged/ExoLightningBolt.cs new file mode 100644 index 0000000000..bcfc256a16 --- /dev/null +++ b/Projectiles/Ranged/ExoLightningBolt.cs @@ -0,0 +1,174 @@ +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoLightningBolt : ModProjectile + { + internal PrimitiveTrail LightningDrawer; + + public bool HasPlayedSound; + + public const int Lifetime = 45; + public ref float InitialVelocityAngle => ref Projectile.ai[0]; + + // Technically not a ratio, and more of a seed, but it is used in a 0-2pi squash + // later in the code to get an arbitrary unit vector (which is then checked). + public ref float BaseTurnAngleRatio => ref Projectile.ai[1]; + public ref float AccumulatedXMovementSpeeds => ref Projectile.localAI[0]; + public ref float BranchingIteration => ref Projectile.localAI[1]; + + public virtual float LightningTurnRandomnessFactor { get; } = 2f; + public override string Texture => "CalamityMod/Projectiles/LightningProj"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Teratesla Lightningbolt"); + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 50; + } + + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 13; + Projectile.timeLeft = Projectile.MaxUpdates * Lifetime; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AccumulatedXMovementSpeeds); + writer.Write(BranchingIteration); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + AccumulatedXMovementSpeeds = reader.ReadSingle(); + BranchingIteration = reader.ReadSingle(); + } + + public override void AI() + { + // FrameCounter in this context is really just an arbitrary timer + // which allows random turning to occur. + Projectile.frameCounter++; + Projectile.oldPos[1] = Projectile.oldPos[0]; + + // Adjust opacity and scale. + float adjustedTimeLife = Projectile.timeLeft / Projectile.MaxUpdates; + Projectile.Opacity = Utils.GetLerpValue(0f, 9f, adjustedTimeLife, true) * Utils.GetLerpValue(Lifetime, Lifetime - 3f, adjustedTimeLife, true); + Projectile.scale = Projectile.Opacity; + + // Play a strike sound on the first frame. + if (!HasPlayedSound) + { + SoundEngine.PlaySound(HeavenlyGale.LightningStrikeSound with { Volume = 0.3f }, Main.player[Projectile.owner].Center); + HasPlayedSound = true; + } + + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); + if (Projectile.frameCounter >= Projectile.extraUpdates * 2) + { + Projectile.frameCounter = 0; + + float originalSpeed = MathHelper.Min(15f, Projectile.velocity.Length()); + UnifiedRandom unifiedRandom = new((int)BaseTurnAngleRatio); + int turnTries = 0; + Vector2 newBaseDirection = -Vector2.UnitY; + Vector2 potentialBaseDirection; + + do + { + BaseTurnAngleRatio = unifiedRandom.Next() % 100; + potentialBaseDirection = (BaseTurnAngleRatio / 100f * MathHelper.TwoPi).ToRotationVector2(); + + // Ensure that the new potential direction base is always moving upwards (this is supposed to be somewhat similar to a -UnitY + RotatedBy). + potentialBaseDirection.Y = -Math.Abs(potentialBaseDirection.Y); + + bool canChangeLightningDirection = true; + + // Potential directions with very little Y speed should not be considered, because this + // consequentially means that the X speed would be quite large. + if (potentialBaseDirection.Y > -0.02f) + canChangeLightningDirection = false; + + // This mess of math basically encourages movement at the ends of an extraUpdate cycle, + // discourages super frequenent randomness as the accumulated X speed changes get larger, + // or if the original speed is quite large. + if (Math.Abs(potentialBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed + AccumulatedXMovementSpeeds) > Projectile.MaxUpdates * LightningTurnRandomnessFactor) + canChangeLightningDirection = false; + + // If the above checks were all passed, redefine the base direction of the lightning. + if (canChangeLightningDirection) + newBaseDirection = potentialBaseDirection; + + turnTries++; + } + while (turnTries < 100); + + if (Projectile.velocity != Vector2.Zero) + { + AccumulatedXMovementSpeeds += newBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed; + Projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + } + } + + public float PrimitiveWidthFunction(float completionRatio) => CalamityUtils.Convert01To010(completionRatio) * Projectile.scale * Projectile.width; + + public Color PrimitiveColorFunction(float completionRatio) + { + float colorInterpolant = (float)Math.Sin(Projectile.identity / 3f + completionRatio * 20f + Main.GlobalTimeWrappedHourly * 1.1f) * 0.5f + 0.5f; + Color color = CalamityUtils.MulticolorLerp(colorInterpolant, Color.GreenYellow, Color.Lime, Color.Cyan); + return color; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + List checkPoints = Projectile.oldPos.Where(oldPos => oldPos != Vector2.Zero).ToList(); + if (checkPoints.Count <= 2) + return false; + + for (int i = 0; i < checkPoints.Count - 1; i++) + { + float _ = 0f; + float width = PrimitiveWidthFunction(i / (float)checkPoints.Count); + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), checkPoints[i], checkPoints[i + 1], width * 0.8f, ref _)) + return true; + } + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]); + + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].UseImage1("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].Apply(); + + LightningDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 18); + return false; + } + } +} diff --git a/Projectiles/Ranged/ExoMark.cs b/Projectiles/Ranged/ExoMark.cs deleted file mode 100644 index 67973db10e..0000000000 --- a/Projectiles/Ranged/ExoMark.cs +++ /dev/null @@ -1,153 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class ExoMark : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 900; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 9; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - } - if (Projectile.localAI[1] < 30f) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 107, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 0.8f; - Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; - if (Projectile.localAI[1] < 33f) - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - } - if (Projectile.localAI[1] > 103f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 16; - } - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - if (Projectile.alpha == 0) - { - Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) - { - Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; - } - Projectile.velocity = Vector2.Zero; - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 1f, 0f); - } - if (Projectile.localAI[1] >= 120f) - { - Projectile.Kill(); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0f, 3f, 0f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Ranged/ExoTornado.cs b/Projectiles/Ranged/ExoTornado.cs deleted file mode 100644 index a214d2fcb0..0000000000 --- a/Projectiles/Ranged/ExoTornado.cs +++ /dev/null @@ -1,155 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class ExoTornado : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/TornadoProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; - Projectile.timeLeft = 240; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; - } - - public override void AI() - { - float num1125 = 165f; //900 - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item122, Projectile.position); - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= num1125) - { - Projectile.Kill(); - } - if (Projectile.localAI[0] >= 30f) - { - Projectile.damage = 0; - if (Projectile.ai[0] < num1125 - 120f) - { - float num1126 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1126; - Projectile.netUpdate = true; - } - } - float num1127 = 30f; //15 - float num1128 = 30f; //15 - Point point8 = Projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - Projectile.width = (int)(value74.X * 0.65f); - Projectile.height = (int)value74.Y; - Projectile.Center = vector146; - if (Projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[Projectile.owner].Center; - Vector2 top = Main.player[Projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && Projectile.ai[0] < num1125 - 120f) - { - float num1132 = Projectile.ai[0] % 60f; - Projectile.ai[0] = num1125 - 120f + num1132; - Projectile.netUpdate = true; - } - } - if (Projectile.ai[0] < num1125 - 120f) - { - return; - } - } - - public override bool PreDraw(ref Color lightColor) - { - float num226 = 150f; //600 - float num227 = 30f; //15 - float num228 = 30f; //15 - float num229 = Projectile.ai[0]; - float maxAlpha = 0.3f; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, maxAlpha); //Fade in - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(maxAlpha, 0f, (num229 - (num226 - 60f)) / 60f); //Fade out - } - Point point5 = Projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = ModContent.Request(Texture).Value; - Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Color value34 = new Color(0, 250, 0); - for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f ); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None , 0f); - } - return false; - } - } -} diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 8a054a07d4..86012ac3cf 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/FlurrystormIceChunk.cs b/Projectiles/Ranged/FlurrystormIceChunk.cs index 26593557cb..b451d54e74 100644 --- a/Projectiles/Ranged/FlurrystormIceChunk.cs +++ b/Projectiles/Ranged/FlurrystormIceChunk.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.coldDamage = true; diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 8e076a36e2..936de7fe29 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 120; AIType = ProjectileID.WoodenArrowFriendly; } diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index 35ac1bdd2c..fca8204d80 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index 9b4db19ddd..7bde2267b8 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 180; } diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 20ef0dcd1c..90f9a9bd41 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.alpha = 255; Projectile.MaxUpdates = 6; diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 7f3cdc2b80..e71086778b 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -75,6 +75,21 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool PreDraw(ref Color lightColor) @@ -191,10 +206,12 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); int blastRadius = 0; - if (projID == ProjectileID.RocketII) + if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII) blastRadius = 6; else if (projID == ProjectileID.RocketIV) blastRadius = 9; + else if (projID == ProjectileID.MiniNukeRocketII) + blastRadius = 12; Projectile.ExpandHitboxBy(14); @@ -202,6 +219,29 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/GreenExoArrow.cs b/Projectiles/Ranged/GreenExoArrow.cs deleted file mode 100644 index ddd4db2b7a..0000000000 --- a/Projectiles/Ranged/GreenExoArrow.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class GreenExoArrow : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Green Exo Arrow"); - } - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - - public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 0, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); - - public override void Kill(int timeLeft) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(),Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } -} diff --git a/Projectiles/Ranged/HeavenlyGaleProj.cs b/Projectiles/Ranged/HeavenlyGaleProj.cs new file mode 100644 index 0000000000..567d98d025 --- /dev/null +++ b/Projectiles/Ranged/HeavenlyGaleProj.cs @@ -0,0 +1,234 @@ +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria.Audio; +using Terraria.ID; +using CalamityMod.Sounds; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HeavenlyGaleProj : BaseIdleHoldoutProjectile + { + public bool OwnerCanShoot => Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed; + + public float StringReelbackInterpolant + { + get + { + int duration = Owner.ActiveItem().useAnimation; + float time = duration - ShootDelay; + float firstHalf = Utils.GetLerpValue(8f, 0f, time, true); + float secondHalf = Utils.GetLerpValue(8f, duration * 0.6f, time, true); + return firstHalf + secondHalf; + } + } + + public float ChargeupInterpolant => Utils.GetLerpValue(HeavenlyGale.ShootDelay, HeavenlyGale.MaxChargeTime, ChargeTimer, true); + + public float StringHalfHeight => Projectile.height * 0.4f; + + public float StringReelbackDistance => Projectile.width * StringReelbackInterpolant * 0.25f; + + public ref float CurrentChargingFrames => ref Projectile.ai[0]; + + public ref float ChargeTimer => ref Projectile.ai[1]; + + public ref float ShootDelay => ref Projectile.localAI[0]; + + public override int AssociatedItemID => ModContent.ItemType(); + + public override int IntendedProjectileType => ModContent.ProjectileType(); + + public override void SetStaticDefaults() => DisplayName.SetDefault("Heavenly Gale"); + + public override void SetDefaults() + { + Projectile.width = 138; + Projectile.height = 138; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = 2; + } + + public override void SafeAI() + { + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; + + // Activate shot behavior if the owner stops channeling or otherwise cannot use the weapon. + bool activatingShoot = ShootDelay <= 0 && Main.mouseLeft && !Main.mapFullscreen && !Main.blockMouse; + if (Main.myPlayer == Projectile.owner && OwnerCanShoot && activatingShoot) + { + SoundEngine.PlaySound(HeavenlyGale.FireSound, Projectile.Center); + ShootDelay = Owner.ActiveItem().useAnimation; + Projectile.netUpdate = true; + } + + UpdateProjectileHeldVariables(armPosition); + ManipulatePlayerVariables(); + + // Fire arrows. + if (ShootDelay > 0f && Projectile.FinalExtraUpdate()) + { + float shootCompletionRatio = 1f - ShootDelay / (Owner.ActiveItem().useAnimation - 1f); + float bowAngularOffset = (float)Math.Sin(MathHelper.TwoPi * shootCompletionRatio) * 0.4f; + float damageFactor = Utils.Remap(ChargeTimer, 0f, HeavenlyGale.MaxChargeTime, 1f, HeavenlyGale.MaxChargeDamageBoost); + + // Fire arrows. + if (ShootDelay % HeavenlyGale.ArrowShootRate == 0) + { + Vector2 arrowDirection = Projectile.velocity.RotatedBy(bowAngularOffset); + + // Release a streak of energy. + Color energyBoltColor = CalamityUtils.MulticolorLerp(shootCompletionRatio, CalamityUtils.ExoPalette); + energyBoltColor = Color.Lerp(energyBoltColor, Color.White, 0.35f); + SquishyLightParticle exoEnergyBolt = new(tipPosition + arrowDirection * 16f, arrowDirection * 4.5f, 0.85f, energyBoltColor, 40, 1f, 5.4f, 4f, 0.08f); + GeneralParticleHandler.SpawnParticle(exoEnergyBolt); + + // Update the tip position for one frame. + tipPosition = armPosition + arrowDirection * Projectile.width * 0.5f; + + if (Main.myPlayer == Projectile.owner) + { + int arrowDamage = (int)(Projectile.damage * damageFactor); + bool createLightning = ChargeTimer / HeavenlyGale.MaxChargeTime >= HeavenlyGale.ChargeLightningCreationThreshold; + Vector2 arrowVelocity = arrowDirection * 20f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, arrowVelocity, ModContent.ProjectileType(), arrowDamage, Projectile.knockBack, Projectile.owner, createLightning.ToInt()); + } + } + + ShootDelay--; + if (ShootDelay <= 0f) + ChargeTimer = 0f; + } + + // Create exo energy at the tip of the bow. + if (Main.rand.NextBool(4)) + { + Color energyColor = Color.Orange; + Vector2 verticalOffset = Vector2.UnitY.RotatedBy(Projectile.rotation) * 8f; + if (Math.Cos(Projectile.rotation) < 0f) + verticalOffset *= -1f; + + SquishyLightParticle exoEnergy = new(tipPosition + verticalOffset, -Vector2.UnitY.RotatedByRandom(0.39f) * Main.rand.NextFloat(0.4f, 1.6f), 0.28f, energyColor, 25); + GeneralParticleHandler.SpawnParticle(exoEnergy); + } + + // Create a puff of energy in a star shape and play a sound to indicate that the bow is at max charge. + if (ShootDelay <= 0) + ChargeTimer++; + if (ChargeTimer == HeavenlyGale.MaxChargeTime) + { + SoundEngine.PlaySound(SoundID.Item158 with { Volume = 1.6f }, Projectile.Center); + for (int i = 0; i < 75; i++) + { + float offsetAngle = MathHelper.TwoPi * i / 75f; + + // Parametric equations for an asteroid. + float unitOffsetX = (float)Math.Pow(Math.Cos(offsetAngle), 3D); + float unitOffsetY = (float)Math.Pow(Math.Sin(offsetAngle), 3D); + + Vector2 puffDustVelocity = new Vector2(unitOffsetX, unitOffsetY) * 5f; + Dust magic = Dust.NewDustPerfect(tipPosition, 267, puffDustVelocity); + magic.scale = 1.8f; + magic.fadeIn = 0.5f; + magic.color = CalamityUtils.MulticolorLerp(i / 75f, CalamityUtils.ExoPalette); + magic.noGravity = true; + } + ChargeTimer++; + } + } + + public void UpdateProjectileHeldVariables(Vector2 armPosition) + { + if (Main.myPlayer == Projectile.owner) + { + float aimInterpolant = Utils.GetLerpValue(10f, 40f, Projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), aimInterpolant); + if (Projectile.velocity != oldVelocity) + { + Projectile.netSpam = 0; + Projectile.netUpdate = true; + } + } + + Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 36f; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + } + + public void ManipulatePlayerVariables() + { + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; + + // Make the player lower their front arm a bit to indicate the pulling of the string. + // This is precisely calculated by representing the top half of the string as a right triangle and using SOH-CAH-TOA to + // calculate the respective angle from the appropriate widths and heights. + float frontArmRotation = (float)Math.Atan(StringHalfHeight / MathHelper.Max(StringReelbackDistance, 0.001f) * 0.5f); + if (Owner.direction == -1) + frontArmRotation += MathHelper.PiOver4; + else + frontArmRotation = MathHelper.PiOver2 - frontArmRotation; + frontArmRotation += Projectile.rotation + MathHelper.Pi + Owner.direction * MathHelper.PiOver2 + 0.12f; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, frontArmRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() - MathHelper.PiOver2); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 origin = texture.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + // Draw the string of the bow. It reels back in the initial frames. + float stringNeckOffset = 40f; + Vector2 aimDirection = Projectile.rotation.ToRotationVector2(); + Vector2 center = Projectile.Center - aimDirection * 12f; + Vector2 topOfBow = center + Vector2.UnitY.RotatedBy(Projectile.rotation) * StringHalfHeight; + Vector2 bottomOfBow = center - Vector2.UnitY.RotatedBy(Projectile.rotation) * StringHalfHeight; + Vector2 endOfString = center - aimDirection * (StringReelbackDistance + (1f - StringReelbackInterpolant) * stringNeckOffset * 0.5f); + + float chargeOffset = ChargeupInterpolant * Projectile.scale * 3f; + Color chargeColor = Color.Lerp(Color.Lime, Color.Cyan, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.1f) * 0.5f + 0.5f) * ChargeupInterpolant * 0.6f; + chargeColor.A = 0; + + float rotation = Projectile.rotation; + SpriteEffects direction = SpriteEffects.None; + if (Math.Cos(rotation) < 0f) + { + direction = SpriteEffects.FlipHorizontally; + rotation += MathHelper.Pi; + topOfBow -= aimDirection * stringNeckOffset; + } + else + bottomOfBow -= aimDirection * stringNeckOffset; + + Color stringColor = new(105, 239, 145); + Main.spriteBatch.DrawLineBetter(topOfBow, endOfString, stringColor, 2f); + Main.spriteBatch.DrawLineBetter(bottomOfBow, endOfString, stringColor, 2f); + + // Draw a backglow effect as an indicator of charge. + for (int i = 0; i < 8; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * chargeOffset; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, chargeColor, rotation, origin, Projectile.scale, direction, 0f); + } + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0f); + return false; + } + + // The bow itself should not do contact damage. + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Ranged/HeavenlyGaleProj.png b/Projectiles/Ranged/HeavenlyGaleProj.png new file mode 100644 index 0000000000..ba3ff0c8a2 Binary files /dev/null and b/Projectiles/Ranged/HeavenlyGaleProj.png differ diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index f10c743049..400197f70a 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -75,6 +75,21 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool PreDraw(ref Color lightColor) @@ -191,10 +206,12 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); int blastRadius = 0; - if (projID == ProjectileID.RocketII) + if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII) blastRadius = 4; else if (projID == ProjectileID.RocketIV) blastRadius = 7; + else if (projID == ProjectileID.MiniNukeRocketII) + blastRadius = 10; Projectile.ExpandHitboxBy(14); @@ -202,6 +219,29 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index cdeec2d50c..6007453a6c 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -75,6 +75,21 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool PreDraw(ref Color lightColor) @@ -191,10 +206,12 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); int blastRadius = 0; - if (projID == ProjectileID.RocketII) + if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII) blastRadius = 5; else if (projID == ProjectileID.RocketIV) blastRadius = 8; + else if (projID == ProjectileID.MiniNukeRocketII) + blastRadius = 11; Projectile.ExpandHitboxBy(14); @@ -202,6 +219,29 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } } } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 4c6b35c626..fa436506aa 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 337d02e222..406c781cc8 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged // Intentionally large bullet hitbox to make Hyperius swarm more forgiving with hits Projectile.width = 8; Projectile.height = 8; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 8d951d7bdb..1ee1b2669f 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 10; Projectile.height = 10; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs index afc20bfebe..8c8adc811a 100644 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ b/Projectiles/Ranged/IcyBulletProj.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.timeLeft = 600; Projectile.friendly = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 3; Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; // changed from 20 to prevent multi-hit madness on fat targets Projectile.coldDamage = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index 73ba7ea7a8..94617ce1bc 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; Projectile.timeLeft = 600; diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index 86ee8620e7..83d895771d 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.width = 22; Projectile.height = 22; Projectile.friendly = true; - Projectile.aiStyle = 39; + Projectile.aiStyle = ProjAIStyleID.MechanicalPiranha; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; diff --git a/Projectiles/Ranged/MidasBlast.cs b/Projectiles/Ranged/MidasBlast.cs new file mode 100644 index 0000000000..7e54389d2c --- /dev/null +++ b/Projectiles/Ranged/MidasBlast.cs @@ -0,0 +1,327 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Projectiles.Typeless; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MidasBlast : ModProjectile + { + internal PrimitiveTrail TrailDrawer; + + public static int Pause = 6 * 6; + public static int CoinPause = 3 * 30; + + public ref float Ricochets => ref Projectile.ai[0]; + public ref float PauseTime => ref Projectile.ai[1]; + + internal List cachedPos; + public Vector2 StoredDirection = Vector2.Zero; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 4000; + } + + public static int Lifetime = 600; + public static int TrailLenght = 35; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 7; + Projectile.alpha = 255; + + + + Pause = 4 * 6; + } + + public override bool? CanDamage() => Projectile.numHits == 0; + public override bool ShouldUpdatePosition() => PauseTime <= 0; + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (Color.Gold * 0.8f).ToVector3() * 0.5f); + if (ShouldUpdatePosition()) + UpdateCache(); + + if (Ricochets < 4) + { + int[] flyingCoins = new int[4]; + int coinIndex = 0; + int struckCoinIndex = -1; + + //Check for coins + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.ModProjectile != null && proj.type == ModContent.ProjectileType() && proj.active && proj.owner == Projectile.owner) + { + flyingCoins[coinIndex] = proj.whoAmI; + coinIndex++; + + if (Collision.CheckAABBvAABBCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Projectile.Hitbox.TopLeft(), Projectile.Hitbox.Size())) + { + struckCoinIndex = proj.whoAmI; + coinIndex--; // We don't care about this coin, don't redirect it to itself + } + + if (coinIndex == 4) + break; + } + } + + if (struckCoinIndex >= 0) + { + Projectile struckCoin = Main.projectile[struckCoinIndex]; + + if (Ricochets == 0) + PlanFullRicochet(flyingCoins, coinIndex, struckCoin); + else + SimpleRicochet(flyingCoins, coinIndex, struckCoin); + } + } + + PauseTime--; + } + + public void RicochetEffect(Vector2 target, Projectile struckCoin, bool shouldPause = true) + { + //Play sound + SoundEngine.PlaySound(CrackshotColt.BlingHitSound, struckCoin.Center); + Projectile.velocity = Projectile.DirectionTo(target) * 16f; + Ricochets++; + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 5; + + float ripening = MathHelper.Clamp((MidasCoin.Lifetime - struckCoin.timeLeft) / (float)MidasPrime.RipeningTime, 0f, 1f); //Coins take a specific amount of time to "ripen" and give the full damage mult + float damageMult = MathHelper.Lerp(1f, (struckCoin.ai[0] == 0 ? MidasPrime.SilverRicochetDamageMult : MidasPrime.GoldRicochetDamageMult), Math.Min((float)Math.Pow(ripening, 3f), 1f)); + Projectile.damage = (int)(Projectile.damage * damageMult); + + struckCoin.active = false; + if (struckCoin.owner == Main.myPlayer) + { + int coin = Item.NewItem(struckCoin.GetSource_DropAsItem(), struckCoin.Center, Vector2.One, struckCoin.ai[0] == 0 ? ItemID.SilverCoin : ItemID.GoldCoin, noBroadcast:false); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, coin, 1f); + + Main.item[coin].GetGlobalItem().magnetMode = true; + + //Play the funny + Player coinOwner = Main.player[struckCoin.owner]; + if (coinOwner.name.ToLower() == "v1" || coinOwner.name.ToLower() == "v2" || coinOwner.name.ToLower() == "mirage") + ORDERSystem.ORDER(); + } + + if (shouldPause) + PauseTime = Pause; + } + + public void SimpleRicochet(int[] flyingCoins, int flyingCoinCount, Projectile struckCoin) + { + //If we find a redirection target, do the ricochet and a bunch of cool effects. + if (FindRicochetTarget(Projectile.Center, flyingCoins, flyingCoinCount, out Vector2 redirectionTarget, out int coinIndex)) + RicochetEffect(redirectionTarget, struckCoin, coinIndex >= 0); + + //If no target is found, just ricochet the shot forward + else + RicochetEffect(Projectile.Center + Projectile.velocity, struckCoin, false); + } + + public void PlanFullRicochet(int[] flyingCoins, int flyingCoinCount, Projectile struckCoin) + { + Vector2 ricochetPosition = Projectile.Center; + Vector2 firstRicochetTarget = Vector2.Zero; + + + for (int i = 0; i <= flyingCoinCount; i++) + { + //Check for a potential ricochet target that isnt paused already (aka we already hit. + if (FindRicochetTarget(ricochetPosition, flyingCoins, flyingCoinCount, out Vector2 redirectionTarget, out int redirectedCoinIndex, false)) + { + if (redirectedCoinIndex >= 0) + { + if (firstRicochetTarget == Vector2.Zero) + firstRicochetTarget = redirectionTarget; + + Main.projectile[redirectedCoinIndex].ai[1] = CoinPause; + ricochetPosition = redirectionTarget; + } + + + else + { + //If we can't ricochet to any coins from the start but we still found a valid npc target, go to them. + if (i == 0) + { + RicochetEffect(redirectionTarget, struckCoin, false); + return; + } + + else + break; + } + } + + else + { + if (i == 0) + { + //If no target at all was found, just propel the coin forward + RicochetEffect(Projectile.Center + Projectile.velocity, struckCoin, false); + return; + } + else + { + break; + } + } + } + + RicochetEffect(firstRicochetTarget, struckCoin); + return; + } + + public bool FindRicochetTarget(Vector2 ricochetStart, int[] flyingCoins, int flyingCoinCount, out Vector2 redirectionTarget, out int redirectedCoinIndex, bool ignorePausedCoins = true) + { + bool targetFound = false; + float closestCoinDistance = 1000; + redirectionTarget = ricochetStart; + redirectedCoinIndex = -1; + + //Search for a coin to ricochet off of. + if (Ricochets < 3) + { + for (int i = 0; i < flyingCoinCount; i++) + { + Projectile coin = Main.projectile[flyingCoins[i]]; + if ((ignorePausedCoins || coin.ai[1] <= 0) && Collision.CanHitLine(ricochetStart - Projectile.Size / 2f, Projectile.width, Projectile.height, coin.position, coin.width, coin.height)) + { + float coinDistance = (ricochetStart - coin.Center).Length(); + if (closestCoinDistance > coinDistance) + { + targetFound = true; + closestCoinDistance = coinDistance; + redirectionTarget = coin.Center; + redirectedCoinIndex = coin.whoAmI; + } + } + } + } + + //If no coin was found, search for a npc to hit. + if (!targetFound) + { + NPC target = ricochetStart.ClosestNPCAt(900, false, true); + if (target != null) + { + targetFound = true; + redirectionTarget = target.Center; + + if (Main.player[Projectile.owner].Calamity().spiritOrigin) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile checkedProj = Main.projectile[i]; + if (checkedProj.type == ProjectileType() && checkedProj.active && checkedProj.owner == Projectile.owner && (int)checkedProj.ai[0] == target.whoAmI) + { + redirectionTarget = checkedProj.Center; + break; + } + + } + } + } + } + + if (redirectionTarget != ricochetStart) + return true; + + return false; + } + + + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity = Vector2.Zero; + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), TrailLenght); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.numHits++; + target.AddBuff(BuffID.Midas, 60); + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), TrailLenght); + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = Math.Min(Projectile.timeLeft / (float)TrailLenght, 1f); + return Color.PaleGoldenrod * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + float width = Math.Min(Projectile.timeLeft / (float)TrailLenght, 1f); + return (1 - completionRatio) * 6.4f * width; + } + + public override bool PreDraw(ref Color lightColor) + { + if (cachedPos is null) + return false; + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + TrailDrawer.Draw(cachedPos, Projectile.Size * 0.5f - Main.screenPosition, TrailLenght); + + return false; + } + + //Done like that for better control instead of relying on Projectile.OldPos() + private void UpdateCache() + { + if (cachedPos == null) + { + cachedPos = new List(); + + for (int i = 0; i < TrailLenght; i++) + { + cachedPos.Add(Projectile.Center); + } + } + + cachedPos.Insert(0, Projectile.Center); + + while (cachedPos.Count > TrailLenght) + { + cachedPos.RemoveAt(cachedPos.Count - 1); + } + } + } +} diff --git a/Projectiles/Ranged/MidasCoin.cs b/Projectiles/Ranged/MidasCoin.cs new file mode 100644 index 0000000000..7e213fe6ac --- /dev/null +++ b/Projectiles/Ranged/MidasCoin.cs @@ -0,0 +1,141 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using ReLogic.Content; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MidasCoin : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coin"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + Main.projFrames[Projectile.type] = 8; + } + + public ref float BlingType => ref Projectile.ai[0]; + public ref float PauseTime => ref Projectile.ai[1]; + + public static int Lifetime = 950; + public float LifetimeCompletion => MathHelper.Clamp((Lifetime - Projectile.timeLeft) / (float)Lifetime, 0f, 1f); + public float FadePercent => Math.Clamp(Projectile.timeLeft / FadeTime, 0f, 1f); + public static float FadeTime => 30f; + public Player Owner => Main.player[Projectile.owner]; + public static Asset SheenTex; + public static Asset BloomTex; + + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; + Projectile.scale = 1.1f; + } + + public override bool ShouldUpdatePosition() => PauseTime <= 0; + + public override void AI() + { + PauseTime--; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 0.2f); + + + Projectile.rotation = Projectile.velocity.X * 0.5f; + Projectile.velocity *= 0.998f; + + if (Projectile.timeLeft < Lifetime - 100) + Projectile.velocity.Y += 0.01f; + + if (Projectile.Center.Distance(Owner.MountedCenter) > 1300 && Projectile.timeLeft > FadeTime) + Projectile.timeLeft = (int)FadeTime; + + if (Main.rand.NextBool(10)) + { + int schyste = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246); + Main.dust[schyste].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + + return base.OnTileCollide(oldVelocity); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Rectangle frame = new Rectangle((int)BlingType * tex.Width / 2, Projectile.frame * tex.Height / Main.projFrames[Projectile.type], tex.Width / 2 - 2, tex.Height / Main.projFrames[Projectile.type] - 2); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor) * FadePercent, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + + + float sheenOpacity = (float)Math.Sin(Math.Clamp((Lifetime - Projectile.timeLeft) / (MidasPrime.RipeningTime * 2f), 0f, 1f) * MathHelper.Pi); + + if (sheenOpacity > 0f) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + if (SheenTex == null) + SheenTex = Request("CalamityMod/Particles/HalfStar"); + Texture2D shineTex = SheenTex.Value; + + if (BloomTex == null) + BloomTex = Request("CalamityMod/Particles/BloomCircle"); + Texture2D bloomTex = BloomTex.Value; + + Vector2 shineScale = new Vector2(1f, 3f - sheenOpacity * 2f); + Color shineColor = BlingType == 0 ? Color.Silver : Color.Goldenrod; + + + Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.7f, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + return false; + } + + public override void Kill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer && Main.rand.NextBool(4)) + { + int coin = Item.NewItem(Projectile.GetSource_DropAsItem(), Projectile.Center, Vector2.One, BlingType == 0 ? ItemID.SilverCoin : ItemID.GoldCoin); + Main.item[coin].GetGlobalItem().magnetMode = true; + } + } + } +} diff --git a/Projectiles/Ranged/MidasCoin.png b/Projectiles/Ranged/MidasCoin.png new file mode 100644 index 0000000000..fad5268dd5 Binary files /dev/null and b/Projectiles/Ranged/MidasCoin.png differ diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index b8de264dfc..bd1a43a836 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -76,6 +76,21 @@ namespace CalamityMod.Projectiles.Ranged } } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override void Kill(int timeLeft) @@ -160,10 +175,12 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); int blastRadius = 0; - if (projID == ProjectileID.RocketII) + if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII) blastRadius = 3; else if (projID == ProjectileID.RocketIV) blastRadius = 6; + else if (projID == ProjectileID.MiniNukeRocketII) + blastRadius = 9; Projectile.ExpandHitboxBy(14); @@ -171,6 +188,29 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } } } diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs index acba6b3088..52f8b4a0c2 100644 --- a/Projectiles/Ranged/MiniSharkron.cs +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 10; Projectile.height = 10; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.MiniSharkron; Projectile.friendly = true; Projectile.alpha = 255; diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 576ee69007..379f8e16dd 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 300; AIType = ProjectileID.WoodenArrowFriendly; Projectile.arrow = true; diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index 40795efef7..f4ce0b7d5e 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 16; Projectile.height = 16; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index a47e30ee7b..e1cd20edc9 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index 657f2f13f3..f74251e2e0 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 1; diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 34323a1de8..f6cb9874fa 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -80,6 +80,22 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num249].velocity *= 0.05f; } + + // Construct a fake item to use with vanilla code for the sake of picking ammo. + if (FalseLauncher is null) + DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; + int projID = ProjectileID.RocketI; + float shootSpeed = 0f; + int damage = 0; + float kb = 0f; + player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); + if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket) + { + Projectile.ignoreWater = false; + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override void Kill(int timeLeft) @@ -164,10 +180,12 @@ namespace CalamityMod.Projectiles.Ranged float kb = 0f; player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true); int blastRadius = 0; - if (projID == ProjectileID.RocketII) + if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII) blastRadius = 6; else if (projID == ProjectileID.RocketIV) blastRadius = 12; + else if (projID == ProjectileID.MiniNukeRocketII) + blastRadius = 18; Projectile.ExpandHitboxBy(22); @@ -175,6 +193,29 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List() { }, new List() { }); } + if (Projectile.owner == Main.myPlayer) + { + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 4f; + if (projID == ProjectileID.DryRocket) + { + DelegateMethods.f_1 = 4.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (projID == ProjectileID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (projID == ProjectileID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } + else if (projID == ProjectileID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/OrangeExoArrow.cs b/Projectiles/Ranged/OrangeExoArrow.cs deleted file mode 100644 index a2107d2ce7..0000000000 --- a/Projectiles/Ranged/OrangeExoArrow.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class OrangeExoArrow : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orange Exo Arrow"); - } - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Ranged; - Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - float num55 = 40f; - float num56 = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) => new Color(250, 100, 0, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - - public override void Kill(int timeLeft) - { - Projectile.ExpandHitboxBy(188); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int d = 0; d < 4; d++) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 50, default, 1f); - } - for (int d = 0; d < 40; d++) - { - int orange = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 0, default, 1.5f); - Main.dust[orange].noGravity = true; - Main.dust[orange].noLight = true; - Main.dust[orange].velocity *= 3f; - orange = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 127, 0f, 0f, 50, default, 1f); - Main.dust[orange].velocity *= 2f; - Main.dust[orange].noGravity = true; - Main.dust[orange].noLight = true; - } - } - } -} diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index ec156911ef..27c220763e 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -18,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 40; + Projectile.width = 48; Projectile.height = 82; Projectile.friendly = true; Projectile.penetrate = -1; @@ -132,6 +133,16 @@ namespace CalamityMod.Projectiles.Ranged player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); } + public override void PostDraw(Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/PhangasmGlow").Value; + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, spriteEffects, 0); + } + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs index e320a9fe99..4f3e1c99a2 100644 --- a/Projectiles/Ranged/PiercingBullet.cs +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 8f18ca9ccf..d953a8a41a 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 600; AIType = ProjectileID.WoodenArrowFriendly; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 4a871ddfdc..7473a5369b 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 10; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/PumplerGrenade.cs b/Projectiles/Ranged/PumplerGrenade.cs index d5754f4532..8f46a6cb44 100644 --- a/Projectiles/Ranged/PumplerGrenade.cs +++ b/Projectiles/Ranged/PumplerGrenade.cs @@ -3,11 +3,16 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; using Terraria.Audio; +using CalamityMod.Particles; +using System; namespace CalamityMod.Projectiles.Ranged { public class PumplerGrenade : ModProjectile { + public ref float State => ref Projectile.ai[0]; + public static int MaxTime => 180; + public override void SetStaticDefaults() { DisplayName.SetDefault("Squash Shell"); @@ -15,63 +20,123 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 16; - Projectile.height = 22; + Projectile.width = 26; + Projectile.height = 26; Projectile.friendly = true; - Projectile.timeLeft = 180; - Projectile.penetrate = 1; + Projectile.timeLeft = MaxTime; + Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } public override string Texture => "CalamityMod/Projectiles/Ranged/PumplerGrenade"; private void Explode(bool NPCHit = false) { 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), Projectile.knockBack, Projectile.owner, NPCHit ? 1 : 0); - } - Projectile.Kill(); + + int size = NPCHit ? 50 : 70; //Bigger explosion if no npc is hit + Projectile.scale = (size / (float)Projectile.height) * Projectile.scale; + + Projectile.position -= Vector2.One * (size - Projectile.width) * 0.5f; + Projectile.height = Projectile.width = size; + + Projectile.tileCollide = false; + Projectile.timeLeft = 6; + Projectile.hide = true; + Projectile.velocity = Vector2.Zero; + State = 1; } public override void AI() { - if (Projectile.timeLeft == 1) - Explode(); - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Point tileCoords = Projectile.Bottom.ToTileCoordinates(); - if (Main.tile[tileCoords.X, tileCoords.Y + 1].HasUnactuatedTile && - WorldGen.SolidTile(Main.tile[tileCoords.X, tileCoords.Y + 1]) && Projectile.timeLeft < 165) + //Behave like a grenade + if (State == 0) { - Explode(); - Projectile.Kill(); + if (Projectile.timeLeft == 1) + { + Explode(); + return; + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Point tileCoords = Projectile.Bottom.ToTileCoordinates(); + if (Main.tile[tileCoords.X, tileCoords.Y + 1].HasUnactuatedTile && + WorldGen.SolidTile(Main.tile[tileCoords.X, tileCoords.Y + 1]) && Projectile.timeLeft < 165) + { + Explode(); + return; + } + + else if (Projectile.timeLeft < MaxTime - 8) + { + Projectile.velocity.Y += 0.4f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } } + else { - Projectile.velocity.Y += 0.4f; - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; + if (Projectile.timeLeft == 5) + SmokeBoom(); } } + + private void SmokeBoom() + { + for (int i = 0; i < 15; i++) + { + Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); + smoke.Velocity = (smoke.Position - Projectile.Center) * 0.2f + Projectile.velocity; + GeneralParticleHandler.SpawnParticle(smoke); + } + } + public override bool OnTileCollide(Vector2 oldVelocity) { Projectile.velocity *= -1f; return false; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Explode(true); + if (State == 0) + { + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Explode(true); + } } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + public override bool? CanHitNPC(NPC target) { - //Damage gets lowered for the main hit, most of the damage comes from the explosion itself. - damage = (int)(damage * 0.1f); + if (State == 0) + return null; + + float blastRadius = Projectile.height / 2f; + + //Get the absolute value of the distance between the target's hitbox center & the explosion's center + float distanceX = Math.Abs(Projectile.Center.X - target.Hitbox.Center.X); + float distanceY = Math.Abs(Projectile.Center.Y - target.Hitbox.Center.Y); + + //If the distance is just too big for the two to intersect, return false + if (distanceX > (target.Hitbox.Width / 2f + blastRadius) || distanceY > (target.Hitbox.Height / 2f + blastRadius)) + return false; + + //If either distance is too small (aka if the projectile's center is inside of the target's hitbox, return true + if (distanceX <= (target.Hitbox.Width / 2f) || distanceY <= (target.Hitbox.Height / 2f)) + return null; + + //Pythagorean theorem stuff to determine the litteral edge cases + float squaredCornerDisance = (float)(Math.Pow(distanceX - target.Hitbox.Width / 2f, 2) + Math.Pow(distanceY - target.Hitbox.Height / 2f, 2)); + if (squaredCornerDisance <= Math.Pow(blastRadius, 2)) + return null; + + return false; } } } diff --git a/Projectiles/Ranged/PumplerGrenadeExplosion.cs b/Projectiles/Ranged/PumplerGrenadeExplosion.cs deleted file mode 100644 index 42ae940ae8..0000000000 --- a/Projectiles/Ranged/PumplerGrenadeExplosion.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Particles; - -namespace CalamityMod.Projectiles.Ranged -{ - public class PumplerGrenadeExplosion : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private bool NPCHit => Projectile.ai[0] == 1; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cucurbitace Blast"); - } - - public override void SetDefaults() - { - Projectile.width = 70; - Projectile.height = 70; - Projectile.friendly = true; - Projectile.timeLeft = 5; - Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - } - - private void SmokeBoom() - { - for (int i = 0; i < 15; i++) - { - Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); - smoke.Velocity = (smoke.Position - Projectile.Center) * 0.2f + Projectile.velocity; - GeneralParticleHandler.SpawnParticle(smoke); - } - } - - public override bool? CanHitNPC(NPC target) - { - float blastRadius = Projectile.height / 2f; - - //Get the absolute value of the distance between the target's hitbox center & the explosion's center - float distanceX = Math.Abs(Projectile.Center.X - target.Hitbox.Center.X); - float distanceY = Math.Abs(Projectile.Center.Y - target.Hitbox.Center.Y); - - //If the distance is just too big for the two to intersect, return false - if (distanceX > (target.Hitbox.Width / 2f + blastRadius) || distanceY > (target.Hitbox.Height / 2f + blastRadius)) - return false; - - //If either distance is too small (aka if the projectile's center is inside of the target's hitbox, return true - if (distanceX <= (target.Hitbox.Width / 2f) || distanceY <= (target.Hitbox.Height / 2f)) - return true; - - //Pythagorean theorem stuff to determine the litteral edge cases - float squaredCornerDisance = (float)(Math.Pow(distanceX - target.Hitbox.Width / 2f, 2) + Math.Pow(distanceY - target.Hitbox.Height / 2f, 2)); - return (squaredCornerDisance <= Math.Pow(blastRadius, 2)); - } - - public override void AI() - { - //Bigger explosion if no npc gets hit - if (!NPCHit) - { - Projectile.width = 120; - Projectile.height = 120; - } - - if (Projectile.timeLeft == 5) - SmokeBoom(); - } - } -} diff --git a/Projectiles/Ranged/RainbowTrail.cs b/Projectiles/Ranged/RainbowTrail.cs index cc2e7b6297..8d39097b36 100644 --- a/Projectiles/Ranged/RainbowTrail.cs +++ b/Projectiles/Ranged/RainbowTrail.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 46; + Projectile.aiStyle = ProjAIStyleID.Rainbow; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 1785a4f4ba..a267c5fa37 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.extraUpdates = 3; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index 83a27a587b..5cdc604e4e 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.extraUpdates = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/SevensStrikerBrick.cs b/Projectiles/Ranged/SevensStrikerBrick.cs new file mode 100644 index 0000000000..f8860da28c --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerBrick.cs @@ -0,0 +1,53 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerBrick : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ThrowingBrick"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brick"); + } + + public override void SetDefaults() + { + Projectile.width = 19; + Projectile.height = 19; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void AI() + { + //Constant rotation and gravity + Projectile.rotation += 0.4f * Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + //Dust trail + if (Main.rand.NextBool(13)) + { + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 22, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f); + } + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item50, Projectile.position); + //Dust on impact + int dust_splash = 0; + while (dust_splash < 9) + { + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); + dust_splash += 1; + } + } + } +} diff --git a/Projectiles/Ranged/SevensStrikerCherry.cs b/Projectiles/Ranged/SevensStrikerCherry.cs new file mode 100644 index 0000000000..f8d5d356e1 --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerCherry.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerCherry : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cherry"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 480; + } + + public override void AI() + { + Projectile.rotation += 0.1f * Projectile.direction; + } + + public override void Kill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer) + { + for (int f = 0; f < 3; f++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner); + } + } + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + } + } +} diff --git a/Projectiles/Ranged/SevensStrikerCherry.png b/Projectiles/Ranged/SevensStrikerCherry.png new file mode 100644 index 0000000000..2cb1f0cd0b Binary files /dev/null and b/Projectiles/Ranged/SevensStrikerCherry.png differ diff --git a/Projectiles/Ranged/SevensStrikerCherrySplit.cs b/Projectiles/Ranged/SevensStrikerCherrySplit.cs new file mode 100644 index 0000000000..13917b1848 --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerCherrySplit.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerCherrySplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cherry"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 240; + } + + public override void AI() + { + Projectile.rotation += 0.4f * Projectile.direction; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + } + } +} diff --git a/Projectiles/Ranged/SevensStrikerCherrySplit.png b/Projectiles/Ranged/SevensStrikerCherrySplit.png new file mode 100644 index 0000000000..5b812f08ad Binary files /dev/null and b/Projectiles/Ranged/SevensStrikerCherrySplit.png differ diff --git a/Projectiles/Ranged/SevensStrikerGrape.cs b/Projectiles/Ranged/SevensStrikerGrape.cs new file mode 100644 index 0000000000..1ccdee2796 --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerGrape.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerGrape : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grapes"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 480; + + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.rotation += 0.1f * Projectile.direction; + } + } +} diff --git a/Projectiles/Ranged/SevensStrikerGrape.png b/Projectiles/Ranged/SevensStrikerGrape.png new file mode 100644 index 0000000000..5d0c1ce0fe Binary files /dev/null and b/Projectiles/Ranged/SevensStrikerGrape.png differ diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs new file mode 100644 index 0000000000..88dacec803 --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -0,0 +1,347 @@ +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Ranged; +using ReLogic.Utilities; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerHoldout : ModProjectile + { + public bool rolling = true; // If the slot machine is currently rolling + public bool shotonce = false; // So that the first shot doesn't consume two ammo + public int shottimer = 0; // Solely exists so that the Platinum shots aren't instantaneous + public int rolltimer = 60; // Cooldown for the slot machine so that it doesn't instantly role + public int soundtimer = 0; // Counts how long the slot machine has been spinning + the cooldown + + public SlotId RouletteSoundSlot; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sevens Striker"); + Main.projFrames[Projectile.type] = 19; + } + + public override void SetDefaults() + { + Projectile.width = 160; + Projectile.height = 62; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); + bool shouldBeHeld = player.channel && !player.noItems && !player.CCed; + + int shot; + float scaleFactor = 14f; + int weaponDamage = player.GetWeaponDamage(player.ActiveItem()); + float weaponKnockback = player.ActiveItem().knockBack; + + // Consumes a coin, stores it, then calculates what effect will be executed + if (Projectile.ai[1] == 0) + { + // These checks are here so that the weapon doesn't consume two coins when first used + if (shotonce) + { + if (player.PickAmmo(player.ActiveItem(), out shot, out scaleFactor, out weaponDamage, out weaponKnockback, out _)) + { + Projectile.ai[0] = shot; + Projectile.ai[1] = CalculateOutcome(); + } + else + { + Projectile.Kill(); + } + } + else + { + Projectile.ai[1] = CalculateOutcome(); + shotonce = true; + } + } + + rolltimer--; + soundtimer++; + + // While the slot machine is rolling, play the animation + if (rolling) + { + Projectile.frameCounter++; + } + // Make sure that it defaults at frame 1 + else + { + Projectile.frame = 0; + } + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + // Once the animation is finished, stop rolling, set the extra timer to 16 frames, and reset the sprite to frame 0 + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + rolling = false; + rolltimer = 16; + Projectile.frame = 0; + } + + if (Main.myPlayer == Projectile.owner) + { + if (shouldBeHeld && Projectile.ai[1] != 0) + { + // Holdout stuff + float holdscale = player.ActiveItem().shootSpeed * Projectile.scale; + Vector2 playerpos2 = playerpos; + Vector2 going = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerpos2; + if (player.gravDir == -1f) + { + going.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerpos2.Y; + } + Vector2 normalizedgoing = Vector2.Normalize(going); + if (float.IsNaN(normalizedgoing.X) || float.IsNaN(normalizedgoing.Y)) + { + normalizedgoing = -Vector2.UnitY; + } + normalizedgoing *= holdscale; + if (normalizedgoing.X != Projectile.velocity.X || normalizedgoing.Y != Projectile.velocity.Y) + { + Projectile.netUpdate = true; + } + Projectile.velocity = normalizedgoing * 0.55f; + + // If the animation isn't playing and the cooldown timer is at or below 0 + if (!rolling && rolltimer <= 0) + { + // Jackpot gets special benefits since it shoots multiple rounds + if (Projectile.ai[1] == 4) + { + shottimer++; + // Play a sound and display the jackpot text + if (shottimer == 1) + { + SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); + CombatText.NewText(player.getRect(), Color.Gold, "Jackpot!!!", true); + } + // Every 5 frames, shoot 7 coins. The first 5 frames are excluded for timing purposes + if (shottimer % 5 == 0 && shottimer > 5) + { + int jackpotDamage = (int)(weaponDamage * TheSevensStriker.JackpotMultiplier); + Shoot(7, ModContent.ProjectileType(), jackpotDamage, weaponKnockback, (int)scaleFactor * 2f, 0.2f); + SoundEngine.PlaySound(TheSevensStriker.CoinSound, Projectile.Center); + } + // After 7 waves have been shot, reset the gun and roll again + if (shottimer > 40) + { + soundtimer = 0; + rolling = true; + Projectile.ai[1] = 0; + shottimer = 0; + } + } + else + { + shottimer++; + + if (shottimer == 1) + { + // The other three outcomes + switch (Projectile.ai[1]) + { + // A single brick with 100% damage + case 1: + Shoot(1, ModContent.ProjectileType(), weaponDamage, 0, 2f, 0); + CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true); + SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center); + break; + // 7 exploding oranges with 200% damage + case 2: + int doublesDamage = (int)(weaponDamage * TheSevensStriker.DoublesMultiplier); + Shoot(7, ModContent.ProjectileType(), doublesDamage, weaponKnockback, 2f, 0.1f); + CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true); + SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center); + break; + // 7 piercing grapes with X% damage + // Also fires 7 splitting cherries in a tighter spread with Y% damage + case 3: + int cherryDamage = (int)(weaponDamage * TheSevensStriker.TriplesCherryMultiplier); + int grapeDamage = (int)(weaponDamage * TheSevensStriker.TriplesGrapeMultiplier); + Shoot(7, ModContent.ProjectileType(), cherryDamage, weaponKnockback, 1.5f, 0.1f); + Shoot(7, ModContent.ProjectileType(), grapeDamage, weaponKnockback, 2f, 0.2f); + CombatText.NewText(player.getRect(), Color.Red, "Triples!", true); + SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); + break; + } + } + + // Reset the gun and roll again + if (shottimer > 16) + { + soundtimer = 0; + rolling = true; + Projectile.ai[1] = 0; + shottimer = 0; + } + } + } + } + // If the player can't use the gun, KILL it + else + { + Projectile.Kill(); + } + } + + // Sounds + // Crank & new casino + if (Projectile.frameCounter == 0 && Projectile.frame == 2 * (Main.projFrames[Projectile.type] / 19)) + { + SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.9f }, Projectile.Center); + RouletteSoundSlot = SoundEngine.PlaySound(TheSevensStriker.RouletteSound, Projectile.Center); + } + // Clicks for when each slot is finished + if (soundtimer == 92 || soundtimer == 108 || soundtimer == 124) + { + SoundEngine.PlaySound(TheSevensStriker.RouletteTickSound, Projectile.Center); + } + + // Holdout stuff + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); + } + + // Calculates which attack will occur based on coin. + public int CalculateOutcome() + { + switch (Projectile.ai[0]) + { + // Copper Coins have: + // 50% chance for a brick + // 30% chance for oranges + // 15% chance for grapes and cherries + // 5% chance for a jackpot + case ProjectileID.CopperCoin: + { + int roll = Main.rand.Next(100); + if (roll <= 50) + return 1; + else if (roll > 50 && roll <= 80) + return 2; + else if (roll > 80 && roll <= 95) + return 3; + else + return 4; + } + // Silver Coins have: + // 20% chance for a brick + // 50% chance for oranges + // 20% chance for grapes and cherries + // 10% chance for a jackpot + case ProjectileID.SilverCoin: + { + int roll = Main.rand.Next(100); + if (roll <= 20) + return 1; + else if (roll > 20 && roll <= 70) + return 2; + else if (roll > 70 && roll <= 90) + return 3; + else + return 4; + } + // Gold Coins have: + // 5% chance for a brick + // 30% chance for oranges + // 50% chance for grapes and cherries + // 15% chance for a jackpot + case ProjectileID.GoldCoin: + { + int roll = Main.rand.Next(100); + if (roll <= 5) + return 1; + else if (roll > 5 && roll <= 35) + return 2; + else if (roll > 35 && roll <= 85) + return 3; + else + return 4; + } + // Platinum Coins are a guaranteed jackpot + case ProjectileID.PlatinumCoin: + return 4; + } + // This should never be returned + return 1; + } + + // Where the shooting takes place (wow!) + public void Shoot(int projcount, int type, int damage, float kb, float scaleFactor, float spreadfactor) + { + Player player = Main.player[Projectile.owner]; + Vector2 armPosition = player.RotatedRelativePoint(player.MountedCenter, true); + armPosition += Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * 32f; + armPosition.Y -= 20f; + Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); + Vector2 gunTip = armPosition + shootDirection * player.ActiveItem().scale * 90f; + for (int i = 0; i < projcount; ++i) + { + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-spreadfactor, spreadfactor, i / 7f)) * scaleFactor; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), gunTip, perturbedSpeed, type, damage, kb, Main.player[Projectile.owner].whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = damage; + + } + } + public override bool PreDraw(ref Color lightColor) + { + Player Owner = Main.player[Projectile.owner]; + Texture2D gun = ModContent.Request("CalamityMod/Projectiles/Ranged/SevensStrikerHoldout").Value; + + SpriteEffects flip = Projectile.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float drawAngle = Projectile.rotation + (Owner.direction < 0 ? MathHelper.Pi : 0); + Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? gun.Width - 33f : 33f, 33f); + Vector2 drawOffset = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() - Main.screenPosition; + drawOffset.Y -= 10; + int indframeheight = gun.Height / Main.projFrames[Projectile.type]; + int currentframe = indframeheight * Projectile.frame; + Rectangle frame = new Rectangle(0, currentframe, gun.Width, indframeheight); + + Main.EntitySpriteDraw(gun, drawOffset, frame, lightColor, drawAngle, drawOrigin, Projectile.scale, flip, 0); + + return false; + } + + // When the gun disappears, stop any in-progress slots sounds and set a cooldown of 12 frames. + public override void Kill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var dringdring)) + dringdring.Stop(); + + Main.player[Projectile.owner].SetDummyItemTime(12); + } + + // This gun does not deal melee damage, thanks. + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Ranged/SevensStrikerHoldout.png b/Projectiles/Ranged/SevensStrikerHoldout.png new file mode 100644 index 0000000000..91ac944a85 Binary files /dev/null and b/Projectiles/Ranged/SevensStrikerHoldout.png differ diff --git a/Projectiles/Ranged/SevensStrikerOrange.cs b/Projectiles/Ranged/SevensStrikerOrange.cs new file mode 100644 index 0000000000..0dcb24c70e --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerOrange.cs @@ -0,0 +1,49 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerOrange : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orange"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 480; + } + + public override void AI() + { + Projectile.rotation += 0.1f * Projectile.direction; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + } + + public override void Kill(int timeLeft) + { + Projectile.ExpandHitboxBy(48, 48); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + // Iban copied the explosion from Pumpler + for (int i = 0; i < 15; i++) + { + Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); + smoke.Velocity = (smoke.Position - Projectile.Center) * 0.2f + Projectile.velocity; + GeneralParticleHandler.SpawnParticle(smoke); + } + } + } +} diff --git a/Projectiles/Ranged/SevensStrikerOrange.png b/Projectiles/Ranged/SevensStrikerOrange.png new file mode 100644 index 0000000000..b8661a3975 Binary files /dev/null and b/Projectiles/Ranged/SevensStrikerOrange.png differ diff --git a/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs b/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs new file mode 100644 index 0000000000..5be037b797 --- /dev/null +++ b/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SevensStrikerPlatinumCoin : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Platinum Coin"); + } + + public override void SetDefaults() + { + Projectile.CloneDefaults(ProjectileID.PlatinumCoin); + Projectile.DamageType = DamageClass.Ranged; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.PlatinumCoin; + Projectile.width = 10; // Cool gaming facts: the vanilla coin projectiles are literally 4 pixels in hitbox size + Projectile.height = 10; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Midas, 25200); // 7 Minutes of Midas + } + } +} diff --git a/Projectiles/Ranged/SevensStrikerPlatinumCoin.png b/Projectiles/Ranged/SevensStrikerPlatinumCoin.png new file mode 100644 index 0000000000..6711fdf068 Binary files /dev/null and b/Projectiles/Ranged/SevensStrikerPlatinumCoin.png differ diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index 6f0bded4ef..ca3b591d6d 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 5; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.arrow = true; Projectile.timeLeft = 600; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index d84450a17b..8a34a82996 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 3c71e3d061..f16e4d5742 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 626273c089..5fceecc1b1 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index f838073774..0caa6fa762 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.extraUpdates = 3; AIType = ProjectileID.Bullet; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index 29a76b0d15..fd4573b49e 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 6; Projectile.height = 6; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 2; diff --git a/Projectiles/Ranged/SmallCoral.cs b/Projectiles/Ranged/SmallCoral.cs index f083f17601..3515861e46 100644 --- a/Projectiles/Ranged/SmallCoral.cs +++ b/Projectiles/Ranged/SmallCoral.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index 09dab31fc3..888fb7d61d 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - DisplayName.SetDefault("Fire"); + DisplayName.SetDefault("Sparked Flames"); } public override void SetDefaults() @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.wet && !Projectile.lavaWet) { Projectile.Kill(); + return; } if (Main.rand.NextBool(3)) @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged { int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 10, default, 0.75f); Dust dust = Main.dust[fire]; - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { dust.noGravity = true; dust.scale *= 1.75f; @@ -80,17 +81,10 @@ namespace CalamityMod.Projectiles.Ranged } } - Projectile.rotation += 0.3f * (float)Projectile.direction; + Projectile.rotation += 0.3f * Projectile.direction; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); } } diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 8221516e35..1719f19ad7 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 8; Projectile.height = 8; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index e3313e8aa7..db70516030 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 8; Projectile.height = 8; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index 9bba51429e..f9f7e2f759 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; } diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs index d8bec66391..9b25995303 100644 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ b/Projectiles/Ranged/SuperballBulletProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 5; diff --git a/Projectiles/Ranged/TealExoArrow.cs b/Projectiles/Ranged/TealExoArrow.cs deleted file mode 100644 index 210e4c7297..0000000000 --- a/Projectiles/Ranged/TealExoArrow.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TealExoArrow : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Teal Exo Arrow"); - } - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Ranged; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - if (Projectile.alpha > 0) - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - - float num55 = 40f; - float num56 = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - Projectile.localAI[0] = num55; - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - Projectile.Kill(); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - - public override Color? GetAlpha(Color lightColor) => new Color(0, 100, 100, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(40f, 1.5f, lightColor); - } -} diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index a29846e67d..97e69bc9db 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -55,8 +55,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 8; } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPvp(Player target, int damage, bool crit) { + if (damage <= 0) + return; + RestrictLifetime(); target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index 76b344e9d8..a576641df6 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.alpha = 255; Projectile.timeLeft = 120; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; } public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 90 && target.CanBeChasedBy(Projectile); diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index 74fc2e538a..6b3efaf6d0 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 8610e75a74..24d8e3eef9 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index c999fa8757..ba9bbad6a6 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 600; AIType = ProjectileID.WoodenArrowFriendly; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index bb11f24f96..7dad4c676f 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 18; Projectile.height = 18; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.timeLeft = 600; diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 4a0a369959..2e80abb67c 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 2; diff --git a/Projectiles/Ranged/WulfrumScrapBullet.cs b/Projectiles/Ranged/WulfrumScrapBullet.cs new file mode 100644 index 0000000000..4b90752c01 --- /dev/null +++ b/Projectiles/Ranged/WulfrumScrapBullet.cs @@ -0,0 +1,72 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class WulfrumScrapBullet : ModProjectile + { + internal PrimitiveTrail TrailDrawer; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("High Speed Scrap"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 100; + Projectile.extraUpdates = 4; + Projectile.alpha = 255; + } + + public override void AI() + { + Projectile.velocity *= 0.95f; + Lighting.AddLight(Projectile.Center, (Color.PaleGoldenrod * 0.8f).ToVector3() * 0.5f); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + + return base.OnTileCollide(oldVelocity); + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Sqrt(Projectile.timeLeft / 100f); + return Color.PaleGoldenrod * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return (1 - completionRatio) * 6.4f; + } + + public override bool PreDraw(ref Color lightColor) + { + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30); + + return false; + } + } +} diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index 6c621a125d..8efee71afc 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.aiStyle = 2; + Projectile.penetrate = 6; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.Shuriken; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index a27e67d959..32f60474f9 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index 8c85d1e2be..43b0ee640d 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 3; Projectile.alpha = 255; Projectile.extraUpdates = 2; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/BouncyBol.cs b/Projectiles/Rogue/BouncyBol.cs index 316100f8a3..738ff6294f 100644 --- a/Projectiles/Rogue/BouncyBol.cs +++ b/Projectiles/Rogue/BouncyBol.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -26,12 +27,12 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 8; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; } public override void AI() { - if (hasHitEnemy == true && Projectile.timeLeft < 575) + if (hasHitEnemy && Projectile.timeLeft < 575) { Projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out Projectile.velocity.Y *= 1.005f; @@ -80,14 +81,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocityNew; if (minDist < 999f) { - if (Projectile.Calamity().stealthStrike && hasHitEnemy == false) - { - Projectile.damage = (int)(Projectile.damage * 1.5f); - } - else - { - Projectile.damage = (int)(Projectile.damage * 1.1f); - } + Projectile.damage = (int)(Projectile.damage * 1.1f); hasHitEnemy = true; targetNPC = index; velocityNew = Main.npc[index].Center - Projectile.Center; diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index 2d50191207..d91abe94fd 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 24; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 180; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs index ca9def9c8d..73fda5133f 100644 --- a/Projectiles/Rogue/BrackishSpear.cs +++ b/Projectiles/Rogue/BrackishSpear.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 52; Projectile.height = 52; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 255; diff --git a/Projectiles/Rogue/BrackishSpear2.cs b/Projectiles/Rogue/BrackishSpear2.cs index 3a7bf22a04..0a92f63488 100644 --- a/Projectiles/Rogue/BrackishSpear2.cs +++ b/Projectiles/Rogue/BrackishSpear2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 52; Projectile.height = 52; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = -1; diff --git a/Projectiles/Rogue/Brimblade2.cs b/Projectiles/Rogue/Brimblade2.cs index c6c9d58e4e..36321071a1 100644 --- a/Projectiles/Rogue/Brimblade2.cs +++ b/Projectiles/Rogue/Brimblade2.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 180; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/BrimbladeProj.cs b/Projectiles/Rogue/BrimbladeProj.cs index 6ab76a5221..aad63cebc5 100644 --- a/Projectiles/Rogue/BrimbladeProj.cs +++ b/Projectiles/Rogue/BrimbladeProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 180; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index ceee5851c4..b5a0278fc2 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -127,13 +127,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[Projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { Player player = Main.player[Projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index d7795b41d3..cf7e3d9b30 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; @@ -43,13 +43,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[Projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { Player player = Main.player[Projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index d3a0800fdc..8e2d67a861 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 3; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index e1a4a45efd..6a7675f528 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 2; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 14; diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 0fe9651ac2..7110859c8c 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 3762bfc3f1..2c4a59fae5 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 1; - //projectile.aiStyle = 113; + //Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 30; //AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index f151b1059e..aa2485e26e 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 120; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 7c872596c0..47ab20ce20 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 3; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index 2a3d4c4501..d4cd154fab 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 300; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 7c6ce73ee7..b07418d7f7 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.penetrate = 16; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 5; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.timeLeft = 300; @@ -76,6 +76,8 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.owner == Main.myPlayer) { + if (hitCount < 4) + hitCount = 4; for (int i = 0; i < hitCount; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 6553093ca8..cba210e4d6 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 180; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs new file mode 100644 index 0000000000..f77dd98bbb --- /dev/null +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -0,0 +1,145 @@ +using Microsoft.Xna.Framework; +using System; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DynamicPursuerElectricity : ModProjectile + { + internal PrimitiveTrail LightningDrawer; + + public const int MaximumBranchingIterations = 3; + public const float LightningTurnRandomnessFactor = 1.7f; + public ref float InitialVelocityAngle => ref Projectile.ai[0]; + // Technically not a ratio, and more of a seed, but it is used in a 0-2pi squash + // later in the code to get an arbitrary unit vector (which is then checked). + public ref float BaseTurnAngleRatio => ref Projectile.ai[1]; + public ref float AccumulatedXMovementSpeeds => ref Projectile.localAI[0]; + public ref float BranchingIteration => ref Projectile.localAI[1]; + /*public float Time + { + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; + }*/ + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electricity"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 2; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 20; + Projectile.timeLeft = 45 * Projectile.extraUpdates; + Projectile.DamageType = RogueDamageClass.Instance; + + // Readjust the velocity magnitude the moment this projectile is created + // to make velocity setting outside the scope of this projectile less irritating + // to consider alongside extraUpdate multipliers. + // Also set the initial angle. + if (Projectile.velocity != Vector2.Zero) + { + Projectile.velocity /= Projectile.extraUpdates; + } + } + public override void AI() + { + Projectile.frameCounter++; + + Projectile.scale = (float)Math.Sin(MathHelper.Pi * Projectile.timeLeft / (45f * (Projectile.MaxUpdates - 1))) * 4f; + if (Projectile.scale > 1f) + Projectile.scale = 1f; + + Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3()); + if (Projectile.frameCounter >= Projectile.extraUpdates * 2) + { + Projectile.frameCounter = 0; + + float originalSpeed = MathHelper.Min(6f, Projectile.velocity.Length()); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)BaseTurnAngleRatio); + int turnTries = 0; + Vector2 newBaseDirection = -Vector2.UnitY; + Vector2 potentialBaseDirection; + + do + { + BaseTurnAngleRatio = unifiedRandom.Next() % 100; + potentialBaseDirection = (BaseTurnAngleRatio / 100f * MathHelper.TwoPi).ToRotationVector2(); + + // Ensure that the new potential direction base is always moving upwards (this is supposed to be somewhat similar to a -UnitY + RotatedBy). + potentialBaseDirection.Y = -Math.Abs(potentialBaseDirection.Y); + + bool canChangeLightningDirection = true; + + // Potential directions with very little Y speed should not be considered, because this + // consequentially means that the X speed would be quite large. + if (potentialBaseDirection.Y > -0.02f) + canChangeLightningDirection = false; + + // This mess of math basically encourages movement at the ends of an extraUpdate cycle, + // discourages super frequenent randomness as the accumulated X speed changes get larger, + // or if the original speed is quite large. + if (Math.Abs(potentialBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed + AccumulatedXMovementSpeeds) > Projectile.MaxUpdates * LightningTurnRandomnessFactor) + { + canChangeLightningDirection = false; + } + + // If the above checks were all passed, redefine the base direction of the lightning. + if (canChangeLightningDirection) + newBaseDirection = potentialBaseDirection; + + turnTries++; + } + while (turnTries < 100); + + if (Projectile.velocity != Vector2.Zero) + { + AccumulatedXMovementSpeeds += newBaseDirection.X * (Projectile.extraUpdates + 1) * 2f * originalSpeed; + Projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + } + } + + public override void Kill(int timeLeft) + { + Projectile.ExpandHitboxBy(60); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + } + + internal float WidthFunction(float completionRatio) + { + float baseWidth = MathHelper.Lerp(2f, 6f, (float)Math.Sin(MathHelper.Pi * 4f * completionRatio) * 0.5f + 0.5f) * Projectile.scale; + return baseWidth * (float)Math.Sin(MathHelper.Pi * completionRatio); + } + internal Color ColorFunction(float completionRatio) + { + Color baseColor = Color.Lerp(Color.Blue, Color.DarkBlue, (float)Math.Sin(MathHelper.TwoPi * completionRatio + Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); + return Color.Lerp(baseColor, Color.Violet, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f) * 0.8f); + } + public override bool PreDraw(ref Color lightColor) + { + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + + LightningDrawer.Draw(Projectile.oldPos.Where(oldPos => oldPos != Vector2.Zero), Projectile.Size * 0.5f - Main.screenPosition, 300); + return false; + } + } +} diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.png b/Projectiles/Rogue/DynamicPursuerElectricity.png new file mode 100644 index 0000000000..f99e9c57d5 Binary files /dev/null and b/Projectiles/Rogue/DynamicPursuerElectricity.png differ diff --git a/Projectiles/Rogue/DynamicPursuerLaser.cs b/Projectiles/Rogue/DynamicPursuerLaser.cs new file mode 100644 index 0000000000..7121dab38d --- /dev/null +++ b/Projectiles/Rogue/DynamicPursuerLaser.cs @@ -0,0 +1,55 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DynamicPursuerLaser : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public float Time + { + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, 182, 0f, 0f, 160, default, 2f); + dust.position = Projectile.Center; + dust.velocity = Projectile.velocity; + dust.scale = Projectile.scale; + dust.noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + Projectile.ExpandHitboxBy(60); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + } + } +} diff --git a/Projectiles/Rogue/DynamicPursuerProjectile.cs b/Projectiles/Rogue/DynamicPursuerProjectile.cs new file mode 100644 index 0000000000..76f634a3ca --- /dev/null +++ b/Projectiles/Rogue/DynamicPursuerProjectile.cs @@ -0,0 +1,253 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Projectiles.DraedonsArsenal; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DynamicPursuerProjectile : ModProjectile + { + public bool ReturningToPlayer + { + get => Projectile.ai[0] == 1f; + set => Projectile.ai[0] = value.ToInt(); + } + + public float Time + { + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; + } + public const float MaxTargetSearchDistance = 480f; + public float ReturnAcceleration = 0.15f; + public float ReturnMaxSpeed = 12f; + public float ElectricVelocityCharge = 0f; + public float LaserVelocityCharge = 0f; + public bool Ricochet = false; + public NPC nextTarget = null; + public int glowmaskFrame = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dynamic Pursuer"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3()); + + Player player = Main.player[Projectile.owner]; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + glowmaskFrame++; + Projectile.frameCounter = 0; + } + if (glowmaskFrame >= 9) + glowmaskFrame = 0; + + Time++; + if (!ReturningToPlayer) + { + if (Time >= 45f && !Ricochet) + { + ReturningToPlayer = true; + Projectile.tileCollide = false; + Projectile.netUpdate = true; + } + else if (Ricochet) + { + if (nextTarget != null) + Projectile.velocity = (float)Math.Pow(Math.E, Time / 100)*(nextTarget.Center - Projectile.Center).SafeNormalize(Vector2.One); + + ElectricVelocityCharge += Projectile.velocity.Length(); + + if (ElectricVelocityCharge >= 300f) + { + ElectricVelocityCharge -= 300f; + AttemptToFireElectricity((int)(Projectile.damage * 0.25)); + } + } + } + else + { + float distanceFromPlayer = Projectile.Distance(player.Center); + if (distanceFromPlayer > 3000f) + Projectile.Kill(); + + // This is done instead of a Normalize or DirectionTo call because the variables needed are already present and calculating the square root again would be unnecessary. + ReturnMaxSpeed = (float)Math.Pow(Math.E, Time / 175); + + if (Projectile.Calamity().stealthStrike) + { + ReturnMaxSpeed = (float)Math.Pow(Math.E, Time / 125); + } + Vector2 idealVelocity = (player.Center - Projectile.Center) / distanceFromPlayer * ReturnMaxSpeed; + + ReturnAcceleration = (float)Math.Pow(Math.E, Time / 300); + Projectile.velocity.X += Math.Sign(idealVelocity.X - Projectile.velocity.X) * ReturnAcceleration; + Projectile.velocity.Y += Math.Sign(idealVelocity.Y - Projectile.velocity.Y) * ReturnAcceleration; + ElectricVelocityCharge += Projectile.velocity.Length(); + LaserVelocityCharge = ElectricVelocityCharge; + if (ElectricVelocityCharge >= 300f) + { + ElectricVelocityCharge -= 300f; + AttemptToFireElectricity((int)(Projectile.damage * 0.25)); + } + + if (Projectile.Calamity().stealthStrike && LaserVelocityCharge >= 300f) + { + LaserVelocityCharge -= 300f; + Projectile.velocity = Vector2.Zero; + AttemptToFireLasers((int)(Projectile.damage * 0.3)); + } + + if (Main.myPlayer == Projectile.owner) + { + if (Projectile.Hitbox.Intersects(player.Hitbox)) + Projectile.Kill(); + } + } + + Projectile.rotation += 0.25f; + } + + public void AttemptToFireElectricity(int damage) + { + if (Main.myPlayer != Projectile.owner) + return; + NPC potentialTarget = Projectile.Center.ClosestNPCAt(MaxTargetSearchDistance); + Vector2 blueGem = (Vector2.UnitY * (-12)).RotatedBy(Projectile.rotation); + if (potentialTarget != null) + { + Vector2 initialVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 2f; + if (Main.rand.NextBool(2)) + initialVelocity = initialVelocity.RotatedByRandom(0.4f); + float initialAngle = initialVelocity.ToRotation(); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + blueGem, Projectile.SafeDirectionTo(potentialTarget.Center) * 3f, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, initialAngle, Main.rand.Next(100)); + + } + } + public void AttemptToFireLasers(int damage) + { + Vector2 direction1 = new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)); + Vector2 direction2 = new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)); + Vector2 redExtremity1 = new Vector2(-27, 7).RotatedBy(Projectile.rotation); + Vector2 redExtremity2 = new Vector2(27, 7).RotatedBy(Projectile.rotation); + SoundEngine.PlaySound(SoundID.Item12 with { Volume = SoundID.Item12.Volume * 0.4f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + redExtremity1, direction1 * 3f, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item12 with { Volume = SoundID.Item12.Volume * 0.4f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + redExtremity2, direction2 * 3f, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (((Projectile.Calamity().stealthStrike && Projectile.numHits == 4) || !Projectile.Calamity().stealthStrike) && !ReturningToPlayer) + { + if ((Projectile.Calamity().stealthStrike && Projectile.numHits == 4)) + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2f, Projectile.owner); + if (!Main.dedServ) + { + for (int i = 0; i < 220; i++) + { + int type = Main.rand.NextBool(2) ? 261 : 107; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); + dust.scale = Main.rand.NextFloat(1.6f, 2.2f); + dust.velocity = Main.rand.NextVector2CircularEdge(75f, 75f); + dust.noGravity = true; + if (type == 261) + { + dust.velocity *= 1.5f; + } + } + } + } + ReturningToPlayer = true; + Ricochet = false; + } + + else + { + //Retarget + Ricochet = true; + NPC newTarget = null; + float closestNPCDistance = 10000f; + float targettingDistance = 1000f; + + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i == target.whoAmI) + continue; + + if (Main.npc[i].CanBeChasedBy(Projectile)) + { + float potentialNewDistance = (Projectile.Center - Main.npc[i].Center).Length(); + if (potentialNewDistance < targettingDistance && potentialNewDistance < closestNPCDistance) + { + closestNPCDistance = potentialNewDistance; + newTarget = Main.npc[i]; + nextTarget = newTarget; + } + } + } + + if (newTarget == null) + { + ReturningToPlayer = true; + return; + } + + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + ReturningToPlayer = true; + Projectile.tileCollide = false; + Projectile.netUpdate = true; + 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 bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[Projectile.type]); + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/DynamicPursuerProjectileGlowmask").Value; + Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 9, 0, glowmaskFrame); + Vector2 origin = glowmaskRectangle.Size()/2f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); + + return false; + } + } +} diff --git a/Projectiles/Rogue/DynamicPursuerProjectile.png b/Projectiles/Rogue/DynamicPursuerProjectile.png new file mode 100644 index 0000000000..608ad6d975 Binary files /dev/null and b/Projectiles/Rogue/DynamicPursuerProjectile.png differ diff --git a/Projectiles/Rogue/DynamicPursuerProjectileGlowmask.png b/Projectiles/Rogue/DynamicPursuerProjectileGlowmask.png new file mode 100644 index 0000000000..c1f76d57b7 Binary files /dev/null and b/Projectiles/Rogue/DynamicPursuerProjectileGlowmask.png differ diff --git a/Projectiles/Rogue/ElementalDiskSplit.cs b/Projectiles/Rogue/ElementalDiskSplit.cs index c48a71ddc8..6090bd949f 100644 --- a/Projectiles/Rogue/ElementalDiskSplit.cs +++ b/Projectiles/Rogue/ElementalDiskSplit.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 60; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 9109253c4b..3465b31cb8 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Rogue if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) { laser.DamageType = RogueDamageClass.Instance; - laser.aiStyle = Main.rand.NextBool() ? 1 : -1; + laser.aiStyle = Main.rand.NextBool() ? ProjAIStyleID.Arrow : -1; laser.penetrate = -1; laser.usesLocalNPCImmunity = true; diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index c7101a9c00..58e1de0a12 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 240; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs index 13eede3c59..5691afefbb 100644 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ b/Projectiles/Rogue/ExplosiveSun.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 22; Projectile.height = 22; - //projectile.aiStyle = 115; + //Projectile.aiStyle = ProjAIStyleID.TerrarianBeam; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 39f7d9cc04..9ca99aa1d9 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; Projectile.timeLeft = 600; diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 819ce03406..46a658f0d4 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = -1; Projectile.timeLeft = 600; diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 7aece0f304..9473f1e1bf 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs index 2ba7a94ef6..bc620e1dc0 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue if (calamityPlayer.rogueStealth > calamityPlayer.rogueStealthMax) calamityPlayer.rogueStealth = calamityPlayer.rogueStealthMax; HasRegeneratedStealth = true; - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs index 41457c176b..109147e6ff 100644 --- a/Projectiles/Rogue/FinalDawnFireball.cs +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Rogue/FinalDawnFlame.cs b/Projectiles/Rogue/FinalDawnFlame.cs index e82ab3c5d1..e2bddfbb14 100644 --- a/Projectiles/Rogue/FinalDawnFlame.cs +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index 128e1d6029..bc9df81e78 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index 020e812655..b6a8f143ee 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index 13ec5b2abd..3299ffeaf6 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index 8becf33b1b..33bb0c508f 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -72,10 +72,10 @@ namespace CalamityMod.Projectiles.Rogue { Projectile proj = Main.projectile[i]; - if (!proj.active || proj.owner != player.whoAmI || proj.aiStyle != 7) + if (!proj.active || proj.owner != player.whoAmI || proj.aiStyle != ProjAIStyleID.Hook) continue; - if (proj.aiStyle == 7) + if (proj.aiStyle == ProjAIStyleID.Hook) proj.Kill(); } diff --git a/Projectiles/Rogue/FishboneBoomerangProjectile.cs b/Projectiles/Rogue/FishboneBoomerangProjectile.cs index 4cd6efc108..4f5c38446d 100644 --- a/Projectiles/Rogue/FishboneBoomerangProjectile.cs +++ b/Projectiles/Rogue/FishboneBoomerangProjectile.cs @@ -100,6 +100,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Length() < 2f && Bouncing == 0f) { Returning = 1f; + Projectile.numHits = 0; } if (Returning == 0f && Bouncing == 0f && Projectile.velocity.Length() > 2f) @@ -130,6 +131,12 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.Kill(); } + + if (Projectile.numHits >= 5) + { + ImpactEffects(); + Projectile.Kill(); + } } } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 4a0a1fc7e0..a1fad0626e 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; @@ -42,7 +42,8 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Projectile.owner]; target.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -50,7 +51,8 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Bleeding, 300); target.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index a320179641..2a2cd8a644 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 90; AIType = ProjectileID.WoodenArrowFriendly; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index 18c6149f4d..593f7a14ff 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 12; Projectile.height = 12; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.coldDamage = true; Projectile.friendly = true; Projectile.penetrate = 1; @@ -66,10 +66,14 @@ namespace CalamityMod.Projectiles.Rogue return new Color(200, 200, 200, Projectile.alpha); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Projectile.ai[0] != 1f) + SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item12.Volume * 0.7f }, Projectile.position); + } + public override void Kill(int timeLeft) { - if (Projectile.ai[0] != 1f || Main.rand.NextBool(20)) - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int index1 = 0; index1 < 3; ++index1) { int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 636f6c796d..80a5f14bbf 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class GacruxianHome : ModProjectile { - public override string Texture => "CalamityMod/Items/Fishing/AstralCatches/GacruxianMollusk"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GacruxianMollusk"; public override void SetStaticDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = 18; + Projectile.aiStyle = ProjAIStyleID.Sickle; Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = 3; diff --git a/Projectiles/Rogue/GacruxianProj.cs b/Projectiles/Rogue/GacruxianProj.cs index a21d39f7a6..ed075fd414 100644 --- a/Projectiles/Rogue/GacruxianProj.cs +++ b/Projectiles/Rogue/GacruxianProj.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class GacruxianProj : ModProjectile { - public override string Texture => "CalamityMod/Items/Fishing/AstralCatches/GacruxianMollusk"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GacruxianMollusk"; public override void SetStaticDefaults() { @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 0f878479f5..b2950f9eb7 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 4; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/GodsParanoiaDart.cs b/Projectiles/Rogue/GodsParanoiaDart.cs index 59adb7e355..fabc22b206 100644 --- a/Projectiles/Rogue/GodsParanoiaDart.cs +++ b/Projectiles/Rogue/GodsParanoiaDart.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 600; - Projectile.aiStyle = 27; + Projectile.aiStyle = ProjAIStyleID.Beam; } public override void AI() diff --git a/Projectiles/Rogue/GraveGrimreaverProjectile.cs b/Projectiles/Rogue/GraveGrimreaverProjectile.cs new file mode 100644 index 0000000000..c2cbb911e6 --- /dev/null +++ b/Projectiles/Rogue/GraveGrimreaverProjectile.cs @@ -0,0 +1,126 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Rogue +{ + public class GraveGrimreaverProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GraveGrimreaver"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grave Grimreaver"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 80; + Projectile.height = 80; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 310; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + if (Projectile.soundDelay == 0) + { + Projectile.soundDelay = 22; + SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + } + + //Spawn a skull ever 20 frames + if (Projectile.timeLeft % 20 == 0) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f, 0f); + } + + CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 4f, 14f); + + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation += 0.1f * Projectile.spriteDirection; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Confused, 180); + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + if (Projectile.Calamity().stealthStrike) + { + // Stealth strikes play a wraith death noise, summon a larger dust explosion, a swarm of 20 bats, and a rain of 10 skulls + SoundEngine.PlaySound(SoundID.NPCDeath52 with { Volume = SoundID.NPCDeath52.Volume * 0.75f }, Projectile.Center); + SpawnBats(20, -12, 12); //"At least 20"... + DustExplosion(15, 6, 12, 30, 2.4f); + for (int i = 0; i < 10; i++) + { + CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 600f, 100f, 700f, 1000f, 20, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), 3f, Projectile.owner); + } + } + else + { + // Normal strikes play no extra sound, have a smaller dust explosion, and summon 4 bats + SpawnBats(4, -12, 12); + DustExplosion(10, 3, 9, 20, 2.15f); + } + } + + public void SpawnBats(int amount, int minspread, int maxspread) + { + if (Projectile.owner == Main.myPlayer) + { + for (int i = 0; i < amount; i++) + { + Vector2 speed = new Vector2(Main.rand.NextFloat(minspread, maxspread), Main.rand.NextFloat(minspread, maxspread)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 0f, Projectile.owner, 4); + } + } + } + + public void DustExplosion(int spreadspeed, int minspeed, int maxspeed, int amount, float size) + { + for (int i = 0; i < amount; i++) + { + float num463 = (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); + float num464 = (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); + float num465 = (float)Main.rand.Next(minspeed, maxspeed); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 75, 0, 0, 0, default, size); + Dust dust = Main.dust[d]; + dust.noGravity = true; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); + dust.position.Y += (float)Main.rand.Next(-spreadspeed, spreadspeed + 1); + dust.velocity.X = num463; + dust.velocity.Y = num464; + } + } + } +} diff --git a/Projectiles/Rogue/GrimreaverBat.cs b/Projectiles/Rogue/GrimreaverBat.cs new file mode 100644 index 0000000000..107bf3eebe --- /dev/null +++ b/Projectiles/Rogue/GrimreaverBat.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class GrimreaverBat : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grim Bat"); // There's an incredibly obvious thing that I could add/change in this name, but I will restrain + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = 2; + Projectile.timeLeft = 320; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + + // Each bounce subtracts from projectile.ai[0] instead of penetration because it shouldn't pierce enemies + if (Projectile.ai[0] <= 0) + { + Projectile.Kill(); + } + + // Fade out + if (Projectile.timeLeft <= 60) + { + Projectile.alpha += 4; + } + + // Current bat burst code occasionally has a few duds, so they get an acceleration boost that blends them in (also mildly interesting to look at) + if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 10) + { + Projectile.velocity *= 1.1f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + Projectile.ai[0]--; + return false; + } + } +} diff --git a/Projectiles/Rogue/GrimreaverBat.png b/Projectiles/Rogue/GrimreaverBat.png new file mode 100644 index 0000000000..cd2b42f98e Binary files /dev/null and b/Projectiles/Rogue/GrimreaverBat.png differ diff --git a/Projectiles/Rogue/GrimreaverSkull.cs b/Projectiles/Rogue/GrimreaverSkull.cs new file mode 100644 index 0000000000..fbba3e6ee4 --- /dev/null +++ b/Projectiles/Rogue/GrimreaverSkull.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class GrimreaverSkull : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grim Skull"); + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + Projectile.ai[1]++; + + if (Projectile.ai[0] != 0) + { + Projectile.tileCollide = true; + } + + // Stealth skulls instantly home in + if (Projectile.ai[0] == 0) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 16f, 14f); + } + // Otherwise home in after 20 frames have passed + else if (Projectile.ai[1] > 20) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 12f, 14f); + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 240); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 240); + } + } +} diff --git a/Projectiles/Rogue/GrimreaverSkull.png b/Projectiles/Rogue/GrimreaverSkull.png new file mode 100644 index 0000000000..64fbefa508 Binary files /dev/null and b/Projectiles/Rogue/GrimreaverSkull.png differ diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index e2d2b00703..92ac307791 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 30; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 300; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 5bfa0cbb88..8b7fc2ded3 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 30; Projectile.friendly = true; Projectile.penetrate = 3; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 280; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index b807c610e9..cd265dfe0b 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.extraUpdates = 1; Projectile.timeLeft = 600; AIType = ProjectileID.WoodenBoomerang; diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index e8da2df384..d6becf3209 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 2; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index f9e5302cf4..c134d76b91 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 30; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 5054c753e3..c251bb1092 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; @@ -41,13 +41,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[Projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { Player player = Main.player[Projectile.owner]; - player.AddBuff(BuffID.WellFed, 180); + if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) + player.AddBuff(BuffID.WellFed, 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs index c52f616401..e97a9361dc 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 50; Projectile.height = 42; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index ef25b191f8..a6203f0a33 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 18; Projectile.friendly = true; Projectile.penetrate = 4; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.alpha = 255; Projectile.timeLeft = 300; AIType = ProjectileID.ThrowingKnife; diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index d598c8a16c..4ad5ca8edd 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 3; Projectile.alpha = 255; Projectile.extraUpdates = 3; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 1; diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index 794ecca2dd..6a8bb7bdaa 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 600; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/MycorootProj.cs b/Projectiles/Rogue/MycorootProj.cs index eb912fb70b..f74718d5df 100644 --- a/Projectiles/Rogue/MycorootProj.cs +++ b/Projectiles/Rogue/MycorootProj.cs @@ -2,6 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -38,6 +40,18 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Projectile.Calamity().stealthStrike) + SoundEngine.PlaySound(SoundID.NPCHit45, Projectile.position); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Projectile.Calamity().stealthStrike) + SoundEngine.PlaySound(SoundID.NPCHit45, Projectile.position); + } + public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index 4f3202a811..8cff5d25ba 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/NastyChollaNeedle.cs b/Projectiles/Rogue/NastyChollaNeedle.cs index b4199997b8..73329b185f 100644 --- a/Projectiles/Rogue/NastyChollaNeedle.cs +++ b/Projectiles/Rogue/NastyChollaNeedle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = 3; Projectile.timeLeft = 180; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -2; } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index 9bab14bed3..1630b98085 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.aiStyle = 2; - Projectile.penetrate = 6; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + Projectile.penetrate = 5; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index 17dab369d1..49470f1369 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PoisonBol.cs b/Projectiles/Rogue/PoisonBol.cs index 0b9f503d23..ff61f21e54 100644 --- a/Projectiles/Rogue/PoisonBol.cs +++ b/Projectiles/Rogue/PoisonBol.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 5; Projectile.timeLeft = 1200; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 45; } diff --git a/Projectiles/Rogue/Prismalline2.cs b/Projectiles/Rogue/Prismalline2.cs index 086aa6a5cf..3d89492a7f 100644 --- a/Projectiles/Rogue/Prismalline2.cs +++ b/Projectiles/Rogue/Prismalline2.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 60; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index c4711df934..a2f4e21a81 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 2; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 180; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 85a7b7a695..09aeeaa58e 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 3; Projectile.timeLeft = Projectile.MaxUpdates * 90; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 32; // can't hit too fast, but can hit many many times + Projectile.localNPCHitCooldown = 26; // can't hit too fast, but can hit many many times Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 83b30c01f7..399380c5c9 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 30; Projectile.friendly = true; Projectile.penetrate = 3; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index f57295cb32..5655a13c40 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.Bananarang; } diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index a56adf6572..37c6fd8a50 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.Bananarang; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index 56e3288e9e..01955f087c 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 26; Projectile.height = 26; Projectile.friendly = true; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; AIType = ProjectileID.BoneJavelin; Projectile.penetrate = 3; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index afaf61ef67..5f721802e9 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 26; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; AIType = ProjectileID.BoneJavelin; Projectile.penetrate = 1; Projectile.extraUpdates = 1; diff --git a/Projectiles/Rogue/SeraphimBeamLarge.cs b/Projectiles/Rogue/SeraphimBeamLarge.cs index 79267dae9c..898f4f6aca 100644 --- a/Projectiles/Rogue/SeraphimBeamLarge.cs +++ b/Projectiles/Rogue/SeraphimBeamLarge.cs @@ -1,13 +1,14 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Sounds; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using System.Linq; using Terraria; -using Terraria.ModLoader; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; using ReLogic.Content; -using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Rogue { @@ -57,7 +58,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; - CooldownSlot = 1; + // This is a friendly projectile. What is this for? + CooldownSlot = ImmunityCooldownID.Bosses; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index 94732b84bf..7ee6439b01 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 2; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 200d28bdb1..51c1e2b39a 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index b82dc40011..261d14b8d0 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.penetrate = -1; Projectile.ignoreWater = true; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index 0042a498ab..c7dda87952 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/SubductionSlicerProj.cs b/Projectiles/Rogue/SubductionSlicerProj.cs index 4237449a84..5d5ef42fb8 100644 --- a/Projectiles/Rogue/SubductionSlicerProj.cs +++ b/Projectiles/Rogue/SubductionSlicerProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.extraUpdates = 1; Projectile.timeLeft = 600; Projectile.alpha = 55; diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs index 86bc1516b1..3e4efedc77 100644 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ b/Projectiles/Rogue/SupernovaSpike.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 3; Projectile.alpha = 255; Projectile.extraUpdates = 2; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Rogue/TarraThornRight.cs b/Projectiles/Rogue/TarraThornRight.cs index 059144c628..de19d6e082 100644 --- a/Projectiles/Rogue/TarraThornRight.cs +++ b/Projectiles/Rogue/TarraThornRight.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -18,14 +19,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 28; Projectile.height = 28; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; } public override void AI() diff --git a/Projectiles/Rogue/TarraThornTip.cs b/Projectiles/Rogue/TarraThornTip.cs index 5eb749a214..831d985e86 100644 --- a/Projectiles/Rogue/TarraThornTip.cs +++ b/Projectiles/Rogue/TarraThornTip.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.ignoreWater = true; diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 0082da231b..25d6fe82a1 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 6; - Projectile.aiStyle = 113; + Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/TerraDiskProjectile2.cs index 40d5446610..573571cbc9 100644 --- a/Projectiles/Rogue/TerraDiskProjectile2.cs +++ b/Projectiles/Rogue/TerraDiskProjectile2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 60; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index aebcb8377f..6522fcea76 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; @@ -38,7 +38,8 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(8)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.Next(2) == 1 ? 107 : 89, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - Projectile.damage += Projectile.Calamity().defDamage / 200; + // TODO -- This will almost never work due to the base damage being too low, and will round down. + Projectile.damage += Projectile.originalDamage / 200; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/TheSyringeS1.cs b/Projectiles/Rogue/TheSyringeS1.cs index d0a2c1d5b5..92e08d4949 100644 --- a/Projectiles/Rogue/TheSyringeS1.cs +++ b/Projectiles/Rogue/TheSyringeS1.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -18,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.width = 6; Projectile.height = 6; - Projectile.aiStyle = 24; + Projectile.aiStyle = ProjAIStyleID.CrystalShard; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.light = 0.5f; diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 0647b2b7ef..8bbfd8bc95 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 4246e42596..ec6d3bd305 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = 3; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/TotalityFlask.cs b/Projectiles/Rogue/TotalityFlask.cs index e77643741a..a1c8dc4b56 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.aiStyle = 68; + Projectile.aiStyle = ProjAIStyleID.MolotovCocktail; Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index ff7f99b34c..1245f86a41 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 2; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index ee6b6ef9a0..46783abf4f 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.coldDamage = true; } diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs index fb39f801e3..d190f103f4 100644 --- a/Projectiles/Rogue/Valaricicle2.cs +++ b/Projectiles/Rogue/Valaricicle2.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.coldDamage = true; } diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index 6893984e37..e7dca2f0fd 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 3; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; } public override void AI() diff --git a/Projectiles/Rogue/WrathwingFireball.cs b/Projectiles/Rogue/WrathwingFireball.cs index deba6ac6c1..0f6ee20886 100644 --- a/Projectiles/Rogue/WrathwingFireball.cs +++ b/Projectiles/Rogue/WrathwingFireball.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.DD2BetsyFireball; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/WrathwingSpear.cs b/Projectiles/Rogue/WrathwingSpear.cs index b3d47e9954..9d82ec4493 100644 --- a/Projectiles/Rogue/WrathwingSpear.cs +++ b/Projectiles/Rogue/WrathwingSpear.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -101,8 +102,8 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Daybreak, 300); - public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Daybreak, 300); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index 5183317fda..1b69740c73 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -1,37 +1,93 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using Terraria.Audio; + namespace CalamityMod.Projectiles.Rogue { public class WulfrumKnifeProj : ModProjectile { + internal PrimitiveTrail TrailDrawer; + internal Color PrimColorMult = Color.White; public override string Texture => "CalamityMod/Items/Weapons/Rogue/WulfrumKnife"; public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } + public static int Lifetime = 950; + public float LifetimeCompletion => MathHelper.Clamp((Lifetime - Projectile.timeLeft) / (float)Lifetime, 0f, 1f); + public float StealthEffectOpacity => MathHelper.Clamp(1 - LifetimeCompletion, 0f, 1f); + public override void SetDefaults() { Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.aiStyle = 2; - Projectile.timeLeft = 600; - AIType = ProjectileID.ThrowingKnife; + Projectile.penetrate = 1; Projectile.DamageType = RogueDamageClass.Instance; + + Projectile.timeLeft = Lifetime; + Projectile.extraUpdates = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; } - public override bool PreDraw(ref Color lightColor) + + public override void AI() { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity *= 0.998f; + + if (Projectile.timeLeft < Lifetime - 100) + Projectile.velocity.Y += 0.01f; + + + if (!Projectile.Calamity().stealthStrike) + { + if (Main.rand.NextBool(10)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Projectile.velocity * Main.rand.NextFloat(0.6f, 1.5f), Scale: Main.rand.NextFloat(1f, 1.4f)); + chust.noGravity = true; + + if (!Main.rand.NextBool(5)) + chust.noLightEmittence = true; + } + } + + else + { + Lighting.AddLight(Projectile.Center, (Main.rand.NextBool() ? Color.GreenYellow : Color.DeepSkyBlue).ToVector3() * StealthEffectOpacity); + + if (Main.rand.NextBool(7)) + { + Vector2 center = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(4, 10); + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(center, velocity, Main.rand.NextFloat(1f, 2f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25, StealthEffectOpacity)); + + } + + if (Main.rand.NextBool(8)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Projectile.velocity * Main.rand.NextFloat(0.6f, 1.5f), Scale: Main.rand.NextFloat(1f, 1.4f)); + chust.noGravity = true; + chust.noLightEmittence = true; + } + } } public override void Kill(int timeLeft) @@ -41,5 +97,71 @@ namespace CalamityMod.Projectiles.Rogue Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); } } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); + + return base.OnTileCollide(oldVelocity); + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Pow(1 - completionRatio, 2) * StealthEffectOpacity; + return Color.GreenYellow.MultiplyRGB(PrimColorMult) * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return 9.4f; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + float opacitey = StealthEffectOpacity; + + if (Projectile.Calamity().stealthStrike) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1f, delegate (Vector2 offset, Color colorMod) + { + PrimColorMult = colorMod; + + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + offset, 30); + }); + + + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 3f, delegate (Vector2 offset, Color colorMod) + { + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + offset, null, Color.GreenYellow.MultiplyRGB(colorMod) * opacitey, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + }); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + + opacitey = MathHelper.Clamp(LifetimeCompletion * 8f, 0f, 1f); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * opacitey, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + } + + else + { + opacitey = MathHelper.Clamp(LifetimeCompletion * 15f, 0f, 1f); + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * opacitey, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + } + return false; + } + } } diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index a10f8d7219..e509dd3327 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; AIType = ProjectileID.BabySlime; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index 623627a36c..8ce5747ce7 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.minionSlots = 1f; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.timeLeft *= 5; @@ -52,14 +52,16 @@ namespace CalamityMod.Projectiles.Summon { Projectile proj = Main.projectile[j]; // Short circuits to make the loop as fast as possible - if (!proj.active || proj.owner != Projectile.owner || !proj.minion || proj.Calamity().lineColor != 0) + if (!proj.active || proj.owner != Projectile.owner || !proj.minion || proj.Calamity().lineColor != 1) continue; if (proj.type == Projectile.type) { spiderCount += (int)proj.minionSlots; - proj.Calamity().lineColor = 1; + proj.Calamity().lineColor = 2; } } + if (Projectile.Calamity().lineColor == 0) + Projectile.Calamity().lineColor = 1; if (dust == 0f) { diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index 094c67617f..5111d003bb 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.tileCollide = false; diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index e818e0d958..92ff77f1b0 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +12,9 @@ namespace CalamityMod.Projectiles.Summon { public class BlackHawkSummon : ModProjectile { + public static Item FalseGun = null; + public static Item BlackHawk = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("Black Hawk"); @@ -25,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 66; + Projectile.aiStyle = ProjAIStyleID.MiniTwins; Projectile.minionSlots = 1f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; @@ -35,6 +40,25 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } + // Defines an Item which is a hacked clone of a P90, edited to be summon class instead of ranged. + // The false gun's damage is changed to the appropriate value every time a Black Hawk wants to fire a bullet. + private static void DefineFalseGun(int baseDamage) + { + int p90ID = ModContent.ItemType(); + int BHRID = ModContent.ItemType(); + FalseGun = new Item(); + BlackHawk = new Item(); + FalseGun.SetDefaults(p90ID, true); + BlackHawk.SetDefaults(BHRID, true); + FalseGun.damage = baseDamage; + FalseGun.knockBack = BlackHawk.knockBack; + FalseGun.shootSpeed = BlackHawk.shootSpeed; + FalseGun.consumeAmmoOnFirstShotOnly = false; + FalseGun.consumeAmmoOnLastShotOnly = false; + + FalseGun.DamageType = DamageClass.Summon; + } + public override void AI() { //Set namespaces @@ -56,6 +80,11 @@ namespace CalamityMod.Projectiles.Summon Main.dust[fire].noGravity = true; Main.dust[fire].velocity = dustVel; } + + // Construct a fake item to use with vanilla code for the sake of firing bullets. + if (FalseGun is null) + DefineFalseGun(Projectile.originalDamage); + Projectile.localAI[0] += 1f; } @@ -93,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 targetVec = Projectile.position; bool foundTarget = false; //If targeting something, prioritize that enemy - if (player.HasMinionAttackTargetNPC) + if (player.HasMinionAttackTargetNPC && player.HasAmmo(FalseGun)) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) @@ -109,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (!foundTarget) + if (!foundTarget && player.HasAmmo(FalseGun)) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { @@ -226,10 +255,10 @@ namespace CalamityMod.Projectiles.Summon //Increment attack cooldown if (Projectile.ai[1] > 0f) { - Projectile.ai[1] += Main.rand.Next(1, 4); + Projectile.ai[1]++; } //Set the minion to be ready for attack - if (Projectile.ai[1] > 130f) + if (Projectile.ai[1] > 85f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; @@ -242,16 +271,31 @@ namespace CalamityMod.Projectiles.Summon //Shoot a bullet if (Main.myPlayer == Projectile.owner) { - float projSpeed = 6f; int projType = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.ai[1] += 2f; - Vector2 velocity = targetVec - Projectile.Center; - velocity.Normalize(); - velocity *= projSpeed; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; + + // 50% chance to not consume ammo. + bool dontConsumeAmmo = Main.rand.NextBool(); + int projIndex; + + // Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item". + player.PickAmmo(FalseGun, out int projID, out float shootSpeed, out int damage, out float kb, out _, dontConsumeAmmo); + + Vector2 velocity = Projectile.SafeDirectionTo(targetVec) * shootSpeed; + + // Musket Balls get converted to Black Hawk's special bullets + if (projID == ProjectileID.Bullet) + projID = projType; + + projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projID, damage, kb, Projectile.owner); + + // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. + if (projIndex.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[projIndex].DamageType = DamageClass.Summon; + Main.projectile[projIndex].minion = false; + } Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index f9ba05fc9c..39f18ea9e9 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = 2; Projectile.height = 2; - Projectile.aiStyle = 45; + Projectile.aiStyle = ProjAIStyleID.RainCloud; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 33aace46bb..08686ed596 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.frameCounter++; - if (Projectile.frameCounter > 16) + if (Projectile.frameCounter > 9) { Projectile.frame++; Projectile.frameCounter = 0; @@ -192,14 +192,14 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] == 0f) { float fireballShootSpeed = 14f; - int num658 = ModContent.ProjectileType(); + int projID = ModContent.ProjectileType(); if (flag25 && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetCenter, 0, 0)) { Vector2 fireballshootVelocity = Projectile.SafeDirectionTo(targetCenter) * fireballShootSpeed; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, fireballshootVelocity, num658, Projectile.damage, 0f, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, fireballshootVelocity, projID, Projectile.damage, 0f, Projectile.owner, 0f, 0f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 41729f4d23..55c1fbeccc 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -76,7 +76,11 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + { + int explosion = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(explosion)) + Main.projectile[explosion].originalDamage = Projectile.originalDamage; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 2ae96b11f4..06981a745d 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = 2; Projectile.height = 2; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.minion = true; diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index d04c330ced..489865fe6d 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -22,12 +22,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; - Projectile.penetrate = 1; + Projectile.penetrate = 5; Projectile.timeLeft = 180; Projectile.minion = true; Projectile.minionSlots = 0f; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index 7a265bc254..e8990b7fbb 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -47,21 +47,25 @@ namespace CalamityMod.Projectiles.Summon } Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + + // Spawn dust on frame 1 if (Projectile.localAI[1] == 0f) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 109, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 spawnPos = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + spawnPos = spawnPos.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 velocity = spawnPos - Projectile.Center; + int idx = Dust.NewDust(spawnPos + velocity, 0, 0, 109, velocity.X * 1.5f, velocity.Y * 1.5f, 100, default, 1.4f); + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + Main.dust[idx].velocity = velocity; } Projectile.localAI[1] += 1f; } + + // Update frames Projectile.frameCounter++; if (Projectile.frameCounter > 8) { @@ -72,9 +76,11 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - bool flag64 = Projectile.type == ModContent.ProjectileType(); + + // Update buffs and player bools + bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (isMinion) { if (player.dead) { @@ -85,10 +91,13 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + + // Randomly make noise if (Main.rand.NextBool(600)) { SoundEngine.PlaySound(SoundID.Zombie35, Projectile.position); } + if (Projectile.ai[0] == 2f) { Projectile.ai[1] -= 1f; @@ -127,150 +136,158 @@ namespace CalamityMod.Projectiles.Summon { Projectile.localAI[0] -= 1f; } + + // Prevent clumping Projectile.MinionAntiClump(); + + // Find a target Vector2 shootPosition = Projectile.position; - float num10 = 3000f; - bool flag = false; + float range = 3500f; + bool foundTarget = false; Vector2 center = player.Center; - Vector2 value = new Vector2(0.5f); - value.Y = 0f; + Vector2 half = new Vector2(0.5f); + half.Y = 0f; int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) { - Vector2 vector2 = npc.position + npc.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (!flag && num12 < num10 && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + Vector2 npcPos = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npcPos, center); + if (!foundTarget && npcDist < range && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - shootPosition = vector2; - flag = true; + shootPosition = npcPos; + foundTarget = true; targetIndex = npc.whoAmI; } } } - if (!flag) + if (!foundTarget) { for (int k = 0; k < Main.maxNPCs; k++) { - NPC nPC = Main.npc[k]; - if (nPC.CanBeChasedBy(Projectile, false)) + NPC npc = Main.npc[k]; + if (npc.CanBeChasedBy(Projectile, false)) { - Vector2 vector3 = nPC.position + nPC.Size * value; - float num13 = Vector2.Distance(vector3, center); - if (!flag && num13 < num10 && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC.position, nPC.width, nPC.height)) + Vector2 npcPos = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npcPos, center); + if (!foundTarget && npcDist < range && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - num10 = num13; - shootPosition = vector3; - flag = true; + range = npcDist; + shootPosition = npcPos; + foundTarget = true; targetIndex = k; } } } } - int num16 = 3500; - if (flag) + + // Return to the player when far away + int returnDist = 3500; + if (foundTarget) { - num16 = 4000; + returnDist = 4000; } - if (Vector2.Distance(player.Center, Projectile.Center) > num16) + if (Vector2.Distance(player.Center, Projectile.Center) > returnDist) { Projectile.ai[0] = 1f; Projectile.netUpdate = true; } - if (flag && Projectile.ai[0] == 0f) + + // Position towards the target + if (foundTarget && Projectile.ai[0] == 0f) { - Vector2 vector4 = shootPosition - Projectile.Center; - float num17 = vector4.Length(); - vector4.Normalize(); - vector4 = shootPosition - Vector2.UnitY * 80f; - int num18 = (int)vector4.Y / 16; - if (num18 < 0) + Vector2 shootDir = shootPosition - Projectile.Center; + shootDir.Normalize(); + shootDir = shootPosition - Vector2.UnitY * 80f; + int tileY = (int)shootDir.Y / 16; + if (tileY < 0) { - num18 = 0; + tileY = 0; } - Tile tile = Main.tile[(int)vector4.X / 16, num18]; + Tile tile = Main.tile[(int)shootDir.X / 16, tileY]; if (tile != null && tile.HasTile && Main.tileSolid[tile.TileType] && !Main.tileSolidTop[tile.TileType]) { - vector4 += Vector2.UnitY * 16f; - tile = Main.tile[(int)vector4.X / 16, (int)vector4.Y / 16]; + shootDir += Vector2.UnitY * 16f; + tile = Main.tile[(int)shootDir.X / 16, (int)shootDir.Y / 16]; if (tile != null && tile.HasTile && Main.tileSolid[tile.TileType] && !Main.tileSolidTop[tile.TileType]) { - vector4 += Vector2.UnitY * 16f; + shootDir += Vector2.UnitY * 16f; } } - vector4 -= Projectile.Center; - num17 = vector4.Length(); - vector4.Normalize(); - if (num17 > 300f && num17 <= 1600f && Projectile.localAI[0] == 0f) + shootDir -= Projectile.Center; + float distance = shootDir.Length(); + shootDir.Normalize(); + if (distance > 300f && distance <= 1600f && Projectile.localAI[0] == 0f) { Projectile.ai[0] = 2f; - Projectile.ai[1] = (int)(num17 / 10f); - Projectile.extraUpdates = (int)(Projectile.ai[1] * 2f); - Projectile.velocity = vector4 * 10f; + Projectile.ai[1] = (int)(distance / 10f); + Projectile.extraUpdates = (int)(Projectile.ai[1] * 2f) + 1; + Projectile.velocity = shootDir * 20f; Projectile.localAI[0] = 60f; return; } - if (num17 > 200f) + if (distance > 200f) { float scaleFactor2 = 20f; - vector4 *= scaleFactor2; - Projectile.velocity.X = (Projectile.velocity.X * 40f + vector4.X) / 41f; - Projectile.velocity.Y = (Projectile.velocity.Y * 40f + vector4.Y) / 41f; + shootDir *= scaleFactor2; + Projectile.velocity.X = (Projectile.velocity.X * 30f + shootDir.X) / 31f; + Projectile.velocity.Y = (Projectile.velocity.Y * 30f + shootDir.Y) / 31f; } - if (num17 > 70f && num17 < 130f) + if (distance > 70f && distance < 130f) { float scaleFactor3 = 18f; - if (num17 < 100f) + if (distance < 100f) { scaleFactor3 = -7.5f; } - vector4 *= scaleFactor3; - Projectile.velocity = (Projectile.velocity * 20f + vector4) / 21f; - if (Math.Abs(vector4.X) > Math.Abs(vector4.Y)) + shootDir *= scaleFactor3; + Projectile.velocity = (Projectile.velocity * 15f + shootDir) / 16f; + if (Math.Abs(shootDir.X) > Math.Abs(shootDir.Y)) { - Projectile.velocity.X = (Projectile.velocity.X * 10f + vector4.X) / 11f; + Projectile.velocity.X = (Projectile.velocity.X * 6f + shootDir.X) / 7f; } } else { - Projectile.velocity *= 0.97f; + Projectile.velocity *= 0.99f; } } + + // Idle Behavior else { if (!Collision.CanHitLine(Projectile.Center, 1, 1, Main.player[Projectile.owner].Center, 1, 1)) { Projectile.ai[0] = 1f; } - float num21 = 12f; //6 + float returnSpd = 12f; //6 if (Projectile.ai[0] == 1f) { - num21 = 18f; //15 + returnSpd = 18f; //15 } - Vector2 center2 = Projectile.Center; - Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f); - float num23 = vector6.Length(); - if (num23 > 200f && num21 < 13.5f) + Vector2 returnPos = player.Center - Projectile.Center + new Vector2(0f, -60f); + float returnPosDist = returnPos.Length(); + if (returnPosDist > 200f && returnSpd < 13.5f) { - num21 = 13.5f; //9 + returnSpd = 13.5f; //9 } - if (num23 < 800f && Projectile.ai[0] == 1f) + if (returnPosDist < 800f && Projectile.ai[0] == 1f) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (num23 > 4000f) + if (returnPosDist > 4000f) { Projectile.position.X = player.Center.X - (Projectile.width / 2); Projectile.position.Y = player.Center.Y - (Projectile.width / 2); } - if (num23 > 70f) + if (returnPosDist > 70f) { - vector6.Normalize(); - vector6 *= num21; - Projectile.velocity = (Projectile.velocity * 20f + vector6) / 21f; + returnPos.Normalize(); + returnPos *= returnSpd; + Projectile.velocity = (Projectile.velocity * 20f + returnPos) / 21f; } else { @@ -282,7 +299,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity *= 1.01f; } } + + // Update rotation Projectile.rotation = Projectile.velocity.X * 0.025f; + + // Update shoot cooldown if (Projectile.ai[1] > 0f) { Projectile.ai[1] += 1f; @@ -296,15 +317,17 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1] = 0f; Projectile.netUpdate = true; } + + // Shoot projectiles if (Projectile.ai[0] == 0f) { - float inkShootSpeed = 12f; + float inkShootSpeed = 15f; int projID = ModContent.ProjectileType(); - if (flag) + if (foundTarget) { if (Math.Abs((shootPosition - Projectile.Center).ToRotation() - MathHelper.PiOver2) > MathHelper.PiOver4) { - Projectile.velocity += (shootPosition - Projectile.Center - Vector2.UnitY * 80f).SafeNormalize(Vector2.Zero); + Projectile.velocity += (shootPosition - Projectile.Center - Vector2.UnitY * 100f).SafeNormalize(Vector2.Zero) * 2f; return; } if ((shootPosition - Projectile.Center).Length() <= 600f && Projectile.ai[1] == 0f) diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index ab00665b58..7824b79cfd 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); Projectile.frameCounter++; - if (Projectile.frameCounter > 16) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; diff --git a/Projectiles/Melee/CnidarianJellyfishOnTheString.cs b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs similarity index 84% rename from Projectiles/Melee/CnidarianJellyfishOnTheString.cs rename to Projectiles/Summon/CnidarianJellyfishOnTheString.cs index e3178d3559..8c8d172ccc 100644 --- a/Projectiles/Melee/CnidarianJellyfishOnTheString.cs +++ b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs @@ -1,8 +1,9 @@ -using System; +using CalamityMod.DataStructures; +using CalamityMod.Particles; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,28 +13,15 @@ using Terraria.ModLoader; using static CalamityMod.CalamityUtils; using static Terraria.ModLoader.ModContent; -namespace CalamityMod.Projectiles.Melee +namespace CalamityMod.Projectiles.Summon { - public class VerletSimulatedSegment - { - public Vector2 position, oldPosition; - public bool locked; - - public VerletSimulatedSegment(Vector2 _position, bool _locked = false) - { - position = _position; - oldPosition = _position; - locked = _locked; - } - } - public class CnidarianJellyfishOnTheString : ModProjectile { public const int SegmentCount = 10; public const float SegmentDistance = 20; public static int FadeoutTime = 20; public static int ElectrifyTimer = 180; - public static float ZapDamageMultiplier = 0.75f; + public static float ZapDamageMultiplier = 0.5f; //Sounds public static readonly SoundStyle ZapSound = SoundID.Item94 with { Volume = SoundID.Item94.Volume * 0.5f }; @@ -51,9 +39,6 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidarian"); - ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 7f; - ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 240f; - ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 11f; } public override void SetDefaults() @@ -75,8 +60,8 @@ namespace CalamityMod.Projectiles.Melee public void SetOrigin(Vector2 position) { Projectile.Center = position; - if ((Projectile.Center - Owner.Center).Length() > 380f) - Projectile.Center = Owner.Center + (Projectile.Center - Owner.Center).SafeNormalize(Vector2.One) * 380f; + if ((Projectile.Center - Owner.Center).Length() > 380f * Owner.whipRangeMultiplier) + Projectile.Center = Owner.Center + (Projectile.Center - Owner.Center).SafeNormalize(Vector2.One) * 380f * Owner.whipRangeMultiplier; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -216,39 +201,7 @@ namespace CalamityMod.Projectiles.Melee Segments[0].oldPosition = Segments[0].position; Segments[0].position = Projectile.Center; - //https://youtu.be/PGk0rnyTa1U?t=400 we use verlet integration chains here - foreach (VerletSimulatedSegment segment in Segments) - { - if (!segment.locked) - { - Vector2 positionBeforeUpdate = segment.position; - - segment.position += (segment.position - segment.oldPosition); // This adds conservation of energy to the segments. This makes it super bouncy and shouldnt be used but it's really funny - segment.position += Vector2.UnitY * 0.3f; //=> This adds gravity to the segments. - - segment.oldPosition = positionBeforeUpdate; - } - } - - for (int k = 0; k < 10; k++) - { - for (int j = 0; j < SegmentCount - 1; j++) - { - VerletSimulatedSegment pointA = Segments[j]; - VerletSimulatedSegment pointB = Segments[j + 1]; - Vector2 segmentCenter = (pointA.position + pointB.position) / 2f; - Vector2 segmentDirection = Utils.SafeNormalize(pointA.position - pointB.position, Vector2.UnitY); - - if (!pointA.locked) - pointA.position = segmentCenter + segmentDirection * SegmentDistance / 2f; - - if (!pointB.locked) - pointB.position = segmentCenter - segmentDirection * SegmentDistance / 2f; - - Segments[j] = pointA; - Segments[j + 1] = pointB; - } - } + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SegmentDistance); Projectile.netUpdate = true; Projectile.netSpam = 0; diff --git a/Projectiles/Melee/CnidarianJellyfishOnTheString.png b/Projectiles/Summon/CnidarianJellyfishOnTheString.png similarity index 100% rename from Projectiles/Melee/CnidarianJellyfishOnTheString.png rename to Projectiles/Summon/CnidarianJellyfishOnTheString.png diff --git a/Projectiles/Melee/CnidarianSpark.cs b/Projectiles/Summon/CnidarianSpark.cs similarity index 98% rename from Projectiles/Melee/CnidarianSpark.cs rename to Projectiles/Summon/CnidarianSpark.cs index 009e7f9469..86c3bf9010 100644 --- a/Projectiles/Melee/CnidarianSpark.cs +++ b/Projectiles/Summon/CnidarianSpark.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.Audio; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee +namespace CalamityMod.Projectiles.Summon { public class CnidarianSpark : ModProjectile { diff --git a/Projectiles/Melee/CnidarianSpark.png b/Projectiles/Summon/CnidarianSpark.png similarity index 100% rename from Projectiles/Melee/CnidarianSpark.png rename to Projectiles/Summon/CnidarianSpark.png diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index c3a843aadd..a49e5646e9 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.minionSlots = 1; Projectile.alpha = 75; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.timeLeft *= 5; diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index dca7a1c6c4..1f8ad6cbaa 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.minionSlots = 0f; Projectile.alpha = 75; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.timeLeft *= 5; diff --git a/Projectiles/Summon/CosmicViperConcussionMissile.cs b/Projectiles/Summon/CosmicViperConcussionMissile.cs index c933360138..82dc49d9f1 100644 --- a/Projectiles/Summon/CosmicViperConcussionMissile.cs +++ b/Projectiles/Summon/CosmicViperConcussionMissile.cs @@ -25,10 +25,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.extraUpdates = 4; Projectile.scale = 1.18f; Projectile.friendly = true; - Projectile.minion = true; - Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.tileCollide = false; @@ -72,27 +70,19 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - for (int num621 = 0; num621 < 3; num621++) + Projectile.ExpandHitboxBy(50); + for (int i = 0; i < 3; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; + Main.dust[idx].scale = 0.5f; } if (Main.rand.NextBool(2)) { - Main.dust[num622].scale *= 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale *= 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } } diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index 72d43a4b68..7069d51329 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -26,10 +26,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.extraUpdates = 1; Projectile.scale = 1.18f; Projectile.friendly = true; - Projectile.minion = true; - Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.tileCollide = false; @@ -133,27 +131,19 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); + Projectile.ExpandHitboxBy(50); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; + Main.dust[idx].scale = 0.5f; } if (Main.rand.NextBool(2)) { - Main.dust[num622].scale *= 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale *= 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } } diff --git a/Projectiles/Summon/CosmicViperSplitRocket1.cs b/Projectiles/Summon/CosmicViperSplitRocket1.cs index 3a2b669c37..f8eb1ebcfe 100644 --- a/Projectiles/Summon/CosmicViperSplitRocket1.cs +++ b/Projectiles/Summon/CosmicViperSplitRocket1.cs @@ -20,10 +20,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 4; Projectile.alpha = 255; Projectile.friendly = true; - Projectile.minion = true; - Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.penetrate = 1; Projectile.timeLeft = 60; Projectile.tileCollide = false; diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index 5258a8dfa8..5e099252f9 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = 14; Projectile.height = 14; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.timeLeft = 600; @@ -132,14 +131,8 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 0; i < numProj; i++) { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; - int rocket = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack, Projectile.owner, Main.rand.Next(2), 0f); + Vector2 speed = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); + int rocket = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed, ModContent.ProjectileType(), Projectile.damage / numProj, Projectile.knockBack, Projectile.owner, Main.rand.Next(2), 0f); if (Main.projectile.IndexInRange(rocket)) Main.projectile[rocket].originalDamage = (int)(Projectile.originalDamage * 0.25f); } @@ -178,27 +171,19 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - for (int num621 = 0; num621 < 3; num621++) + Projectile.ExpandHitboxBy(50); + for (int i = 0; i < 3; i++) { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; + Main.dust[idx].scale = 0.5f; } if (Main.rand.NextBool(2)) { - Main.dust[num622].scale *= 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale *= 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 39ca52edb2..2e9945c2cb 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +12,9 @@ namespace CalamityMod.Projectiles.Summon { public class CosmicViperSummon : ModProjectile { + public static Item FalseGun = null; + public static Item CosmicViper = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Viper"); @@ -25,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 66; + Projectile.aiStyle = ProjAIStyleID.MiniTwins; Projectile.minionSlots = 1f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; @@ -35,6 +40,25 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } + // Defines an Item which is a hacked clone of a P90, edited to be summon class instead of ranged. + // The false gun's damage is changed to the appropriate value every time a Cosmic Viper wants to fire a bullet. + private static void DefineFalseGun(int baseDamage) + { + int p90ID = ModContent.ItemType(); + int CVEID = ModContent.ItemType(); + FalseGun = new Item(); + CosmicViper = new Item(); + FalseGun.SetDefaults(p90ID, true); + CosmicViper.SetDefaults(CVEID, true); + FalseGun.damage = baseDamage; + FalseGun.knockBack = CosmicViper.knockBack; + FalseGun.shootSpeed = CosmicViper.shootSpeed; + FalseGun.consumeAmmoOnFirstShotOnly = false; + FalseGun.consumeAmmoOnLastShotOnly = false; + + FalseGun.DamageType = DamageClass.Summon; + } + public override void AI() { Player player = Main.player[Projectile.owner]; @@ -53,6 +77,11 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dusty].noGravity = true; Main.dust[dusty].velocity = vector7; } + + // Construct a fake item to use with vanilla code for the sake of firing bullets. + if (FalseGun is null) + DefineFalseGun(Projectile.originalDamage); + Projectile.localAI[0] += 1f; } @@ -90,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 targetVec = Projectile.position; bool foundTarget = false; int targetIndex = -1; - if (player.HasMinionAttackTargetNPC) + if (player.HasMinionAttackTargetNPC && player.HasAmmo(FalseGun)) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) @@ -107,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (!foundTarget) + if (!foundTarget && player.HasAmmo(FalseGun)) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { @@ -214,16 +243,15 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[1] > 0f) { - Projectile.ai[1] += (float)Main.rand.Next(1, 5); + Projectile.ai[1]++; } - if (Projectile.ai[1] > 90f) + if (Projectile.ai[1] > 60f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; } if (Projectile.ai[0] == 0f) { - float speedMult = 6f; if (foundTarget && Projectile.ai[1] == 0f) { //play cool sound @@ -231,35 +259,50 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1] += 2f; if (Main.myPlayer == Projectile.owner) { - int projType; - float dmgMult; - if (Main.rand.NextBool(5)) + // Fire a rocket every other time + bool shootRocket = ++Projectile.localAI[1] % 2f == 0f; + int projType = ModContent.ProjectileType(); + switch (Projectile.localAI[1] % 3f) { - projType = ModContent.ProjectileType(); - dmgMult = 0.75f; + case 0f: + projType = ModContent.ProjectileType(); + break; + case 1f: + projType = ModContent.ProjectileType(); + break; + case 2f: + projType = ModContent.ProjectileType(); + break; } - else if (Main.rand.NextBool(3)) + + // Rockets never consume ammo + 50% chance to not consume ammo. + bool dontConsumeAmmo = Main.rand.NextBool() || shootRocket; + int projIndex; + + // Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item". + player.PickAmmo(FalseGun, out int projID, out float shootSpeed, out int damage, out float kb, out _, dontConsumeAmmo); + + Vector2 velocity = Projectile.SafeDirectionTo(targetVec) * shootSpeed; + + // One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback. + if (shootRocket) { - projType = ModContent.ProjectileType(); - dmgMult = 1f; + //add some inaccuracy + velocity.Y += Main.rand.NextFloat(-15f, 15f) * 0.05f; + velocity.X += Main.rand.NextFloat(-15f, 15f) * 0.05f; + projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, damage, kb, Projectile.owner); } + + // Fire the selected bullet, nothing special. else + projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projID, damage, kb, Projectile.owner); + + // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. + if (projIndex.WithinBounds(Main.maxProjectiles)) { - projType = ModContent.ProjectileType(); - dmgMult = 1.5f; + Main.projectile[projIndex].DamageType = DamageClass.Summon; + Main.projectile[projIndex].minion = false; } - - Vector2 velocity = targetVec - Projectile.Center; - velocity.Normalize(); - velocity *= speedMult; - - //add some inaccuracy - velocity.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; - velocity.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; - - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, (int)(Projectile.damage * dmgMult), Projectile.knockBack, Projectile.owner, targetIndex, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * dmgMult); Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index 604a5087cf..9fe48d89bd 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.minionSlots = 1; Projectile.alpha = 75; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.timeLeft *= 5; diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index 79e8c63c7c..6e411512e2 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.minionSlots = 0f; Projectile.alpha = 75; - Projectile.aiStyle = 26; + Projectile.aiStyle = ProjAIStyleID.Pet; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.timeLeft *= 5; diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs index 0d84849565..801f8d774f 100644 --- a/Projectiles/Summon/DeathstareBeam.cs +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon } Projectile.Opacity = Utils.GetLerpValue(1f, 0f, 1f - Projectile.timeLeft / 10f, true); - Projectile.Center = Main.projectile[(int)OwnerUUID].Center - Projectile.velocity; + Projectile.Center = CalamityUtils.FindProjectileByIdentity((int)OwnerUUID, Projectile.owner).Center - Projectile.velocity; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/DeathstareEyeball.cs b/Projectiles/Summon/DeathstareEyeball.cs index 31d801ae1c..9c4a9e5a2a 100644 --- a/Projectiles/Summon/DeathstareEyeball.cs +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.projectile.IndexInRange(beam)) { Main.projectile[beam].originalDamage = Projectile.originalDamage; - Main.projectile[beam].ai[0] = Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI); + Main.projectile[beam].ai[0] = Projectile.identity; Main.projectile[beam].Damage(); } } diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs index 37f82fcee5..0637c1d21d 100644 --- a/Projectiles/Summon/FleshBallMinion.cs +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -18,14 +18,15 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Flesh Ball"); - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = Projectile.height = 32; + Projectile.width = 46; + Projectile.height = 38; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon internal void DetermineFrames() { Projectile.frameCounter++; - if (Projectile.frameCounter % 5 == 4) + if (Projectile.frameCounter % 5 == 6) Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; } diff --git a/Projectiles/Summon/FleshBallMinion.png b/Projectiles/Summon/FleshBallMinion.png index 955f105050..f3856c30c3 100644 Binary files a/Projectiles/Summon/FleshBallMinion.png and b/Projectiles/Summon/FleshBallMinion.png differ diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.cs b/Projectiles/Summon/FlowersOfMortalityPetal.cs index 863fc91149..f0224cd714 100644 --- a/Projectiles/Summon/FlowersOfMortalityPetal.cs +++ b/Projectiles/Summon/FlowersOfMortalityPetal.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 0.5f; + Projectile.minionSlots = 0.6f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; diff --git a/Projectiles/Summon/FungalClumpMinion.png b/Projectiles/Summon/FungalClumpMinion.png deleted file mode 100644 index 537360db53..0000000000 Binary files a/Projectiles/Summon/FungalClumpMinion.png and /dev/null differ diff --git a/Projectiles/Summon/GammaCanister.cs b/Projectiles/Summon/GammaCanister.cs index a9deaa4634..7ad3edec26 100644 --- a/Projectiles/Summon/GammaCanister.cs +++ b/Projectiles/Summon/GammaCanister.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Summon; + Projectile.extraUpdates = 1; } public override void AI() { @@ -50,8 +51,8 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 6; i++) { Vector2 shootVelocity = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * Main.rand.NextFloat(6f, 17f); - int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + shootVelocity * 2f, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.4f, Projectile.owner); - Main.projectile[bullet].originalDamage = Projectile.originalDamage / 2; + int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + shootVelocity * 2f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); + Main.projectile[bullet].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index f5469a8f1a..e09a045548 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.direction = Projectile.spriteDirection = Owner.direction; float idealRotation = 0f; - NPC potentialTarget = Projectile.Center.MinionHoming(950f, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(3000f, Owner); if (potentialTarget != null) NoticeTarget(potentialTarget, ref returnPosition, ref idealRotation); else diff --git a/Projectiles/Summon/GastricBelcherBubble.cs b/Projectiles/Summon/GastricBelcherBubble.cs index 5350103b77..8d9cc545b0 100644 --- a/Projectiles/Summon/GastricBelcherBubble.cs +++ b/Projectiles/Summon/GastricBelcherBubble.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 18; Projectile.minion = true; Projectile.timeLeft = 180; - Projectile.aiStyle = 72; + Projectile.aiStyle = ProjAIStyleID.Bubble; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index e1f709f43a..748d5861c2 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -345,7 +345,7 @@ namespace CalamityMod.Projectiles.Summon 8f, Projectile.owner, Projectile.whoAmI); - deathLaser.originalDamage = damage; + deathLaser.originalDamage = LaserBaseDamage; if (player.HeldItem != null && deathLaser.whoAmI.WithinBounds(Main.maxProjectiles)) deathLaser.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index 8d339dfc1e..2527552d4f 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Projectiles.Summon { public class Hive : ModProjectile { - public override string Texture => "CalamityMod/NPCs/Astral/Hive"; + public override string Texture => "CalamityMod/NPCs/Astral/HiveEnemy"; public override void SetStaticDefaults() { diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs index 98d28bdbca..6eb1d91a79 100644 --- a/Projectiles/Summon/HomingGammaBullet.cs +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,9 @@ namespace CalamityMod.Projectiles.Summon { public class HomingGammaBullet : ModProjectile { + private int targetNPC = -1; + private List previousNPCs = new List() { -1 }; + public override string Texture => "CalamityMod/Projectiles/Enemy/NuclearBulletMedium"; public override void SetStaticDefaults() @@ -28,19 +33,93 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 2; } public override void AI() { + Player player = Main.player[Projectile.owner]; + Projectile.alpha = Utils.Clamp(Projectile.alpha - 35, 0, 255); Projectile.rotation = Projectile.velocity.ToRotation(); - NPC potentialTarget = Projectile.Center.MinionHoming(1000f, Main.player[Projectile.owner]); - if (potentialTarget != null && !Projectile.WithinRange(potentialTarget.Center, 100f) && Projectile.timeLeft < 290) + if (targetNPC == -1) + FindTarget(); + + NPC potentialTarget = null; + if (targetNPC != -1) + potentialTarget = Main.npc[targetNPC]; + if (potentialTarget != null && !Projectile.WithinRange(potentialTarget.Center, 100f) && Projectile.timeLeft < 320) Projectile.velocity = (Projectile.velocity * 6f + Projectile.SafeDirectionTo(potentialTarget.Center) * 15f) / 7f; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + previousNPCs.Add(target.whoAmI); + target.AddBuff(ModContent.BuffType(), 240); + targetNPC = -1; + FindTarget(); + } + + private void FindTarget() + { + Player player = Main.player[Projectile.owner]; + float range = 1000f; + bool foundTarget = false; + Vector2 center = player.Center; + Vector2 half = new Vector2(0.5f); + half.Y = 0f; + bool hasHitNPC = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + for (int j = 0; j < previousNPCs.Count; j++) + { + if (previousNPCs[j] == player.MinionAttackTargetNPC) + { + hasHitNPC = true; + } + } + if (npc.CanBeChasedBy(Projectile, false) && !hasHitNPC) + { + Vector2 npcPos = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npcPos, center); + if (npcDist < range && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + { + foundTarget = true; + targetNPC = npc.whoAmI; + } + } + } + hasHitNPC = false; + if (!foundTarget) + { + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + for (int j = 0; j < previousNPCs.Count; j++) + { + if (previousNPCs[j] == k) + { + hasHitNPC = true; + } + } + if (npc.CanBeChasedBy(Projectile, false) && !hasHitNPC) + { + Vector2 npcPos = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npcPos, center); + if (npcDist < range && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + { + range = npcDist; + targetNPC = k; + } + } + } + } + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index 9a731e448b..916b5ab63f 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -266,7 +266,7 @@ namespace CalamityMod.Projectiles.Summon targetVec *= speedMult; SoundEngine.PlaySound(SoundID.Item20, Projectile.position); int fireball = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, targetIndex, 0f); - Main.projectile[fireball].originalDamage = Projectile.damage; + Main.projectile[fireball].originalDamage = Projectile.originalDamage; Main.projectile[fireball].netUpdate = true; Main.projectile[fireball].frame = Main.rand.Next(4); Projectile.netUpdate = true; diff --git a/Projectiles/Summon/HydrothermicVent.cs b/Projectiles/Summon/HydrothermicVent.cs index 6898250d3a..87100da8ee 100644 --- a/Projectiles/Summon/HydrothermicVent.cs +++ b/Projectiles/Summon/HydrothermicVent.cs @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Summon if (reversedGravity) velocityY *= -1f; int flame = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2), velocityX, velocityY, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Main.projectile[flame].aiStyle = 1; + Main.projectile[flame].aiStyle = ProjAIStyleID.Arrow; Main.projectile[flame].originalDamage = Projectile.originalDamage; } SoundEngine.PlaySound(SoundID.Item20, Projectile.position); diff --git a/Projectiles/Summon/IceSentryShard.cs b/Projectiles/Summon/IceSentryShard.cs index 8f363a5654..87c4f7c5e4 100644 --- a/Projectiles/Summon/IceSentryShard.cs +++ b/Projectiles/Summon/IceSentryShard.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = 12; Projectile.height = 12; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.coldDamage = true; Projectile.friendly = true; Projectile.minion = true; diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs index 4cfc27c1f1..693169737c 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.minion = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 10a153cd4b..d759068f09 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; Projectile.hide = true; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 4f60c49f8a..bf6759b1e3 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; Projectile.hide = true; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index b4cff08097..dd4c98cb9f 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; Projectile.hide = true; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/MidnightSunShot.cs b/Projectiles/Summon/MidnightSunShot.cs index ca32d61881..c2fc24ca99 100644 --- a/Projectiles/Summon/MidnightSunShot.cs +++ b/Projectiles/Summon/MidnightSunShot.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.minion = true; Projectile.minionSlots = 0f; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 120; diff --git a/Projectiles/Summon/PlantSeed.cs b/Projectiles/Summon/PlantSeed.cs index e8944d2054..720e7e80fc 100644 --- a/Projectiles/Summon/PlantSeed.cs +++ b/Projectiles/Summon/PlantSeed.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Summon/PlantSeedGreen.cs b/Projectiles/Summon/PlantSeedGreen.cs index 328afe70de..d1b55f8b27 100644 --- a/Projectiles/Summon/PlantSeedGreen.cs +++ b/Projectiles/Summon/PlantSeedGreen.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Summon/PlantThornBall.cs b/Projectiles/Summon/PlantThornBall.cs index 455706205e..40c62b980a 100644 --- a/Projectiles/Summon/PlantThornBall.cs +++ b/Projectiles/Summon/PlantThornBall.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.penetrate = 3; Projectile.timeLeft = 300; Projectile.minion = true; - Projectile.aiStyle = 14; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.extraUpdates = 1; diff --git a/Projectiles/Summon/PlateProjectile.cs b/Projectiles/Summon/PlateProjectile.cs index 81912cba9c..a88aba2619 100644 --- a/Projectiles/Summon/PlateProjectile.cs +++ b/Projectiles/Summon/PlateProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 8b930c76c6..27b966276a 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Projectiles.Summon if (!hit) mult = enrage ? 0.2f : 0.1f; //punishing to miss int damage = (int)((Projectile.damage * 0.2f) * mult); + int origDmg = (int)((Projectile.originalDamage * 0.2f) * mult); float outerAngleVariance = MathHelper.TwoPi / (float)outerSplits; float outerOffsetAngle = MathHelper.Pi / (2f * outerSplits); @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + outerPosVec, velocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) { - Main.projectile[proj].originalDamage = damage; + Main.projectile[proj].originalDamage = origDmg; Main.projectile[proj].DamageType = DamageClass.Summon; } if (innerSplits > 0) //only runs if there's still inner splits to create @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + innerPosVec, velocity, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) { - Main.projectile[proj].originalDamage = damage; + Main.projectile[proj].originalDamage = origDmg; Main.projectile[proj].DamageType = DamageClass.Summon; } } @@ -147,8 +148,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.active = false; } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPvp(Player target, int damage, bool crit) { + if (damage <= 0) + return; + if (Main.myPlayer == Projectile.owner) { Split(true, true); diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index c90006f0c2..88df6c2105 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon } Projectile.frameCounter++; - if (Projectile.frameCounter > 16) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index aab4e0e050..50c7d243f4 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 6; } Projectile.frameCounter++; - if (Projectile.frameCounter > 12) + if (Projectile.frameCounter > 7) { Projectile.frame++; Projectile.frameCounter = 0; @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Summon else { Projectile.frameCounter++; - if (Projectile.frameCounter > 12) + if (Projectile.frameCounter > 7) { Projectile.frame++; Projectile.frameCounter = 0; diff --git a/Projectiles/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index 7c07476c4c..15422d540b 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Projectiles.Summon softcappedDamageMultiplier = ((damageMultiplier - 3f) * 0.1f) + 3f; int radiantOrbDamage = (int)(Projectile.damage * softcappedDamageMultiplier); + int radiantOrbOriginalDamage = (int)(Projectile.originalDamage * softcappedDamageMultiplier); int radiantOrbAppearRate = (int)(130 * Math.Pow(0.9, AllocatedSlots)); // Hard-cap the orb appear rate and damage. @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Summon GeneralTimer++; NPC potentialTarget = Projectile.Center.MinionHoming(TargetCheckDistance, Owner); if (potentialTarget != null && Main.myPlayer == Projectile.owner) - AttackTarget(potentialTarget, radiantOrbAppearRate, radiantOrbDamage); + AttackTarget(potentialTarget, radiantOrbAppearRate, radiantOrbDamage, radiantOrbOriginalDamage); } public void VerifyIdentityOfCaller() @@ -93,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon } } - public void AttackTarget(NPC target, int radiantOrbAppearRate, int radiantOrbDamage) + public void AttackTarget(NPC target, int radiantOrbAppearRate, int radiantOrbDamage, int radiantOrbOriginalDamage) { if (GeneralTimer % 35f == 34f) { @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 15f; int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = radiantOrbDamage / 2; + Main.projectile[p].originalDamage = radiantOrbOriginalDamage / 2; } } @@ -113,14 +114,14 @@ namespace CalamityMod.Projectiles.Summon Vector2 bootlegRadianceOrbVelocity = Projectile.SafeDirectionTo(target.Center) * 2f; int p2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, Projectile.knockBack * 4f, Projectile.owner); if (Main.projectile.IndexInRange(p2)) - Main.projectile[p2].originalDamage = radiantOrbDamage; + Main.projectile[p2].originalDamage = radiantOrbOriginalDamage; for (int i = 0; i < 3; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 19f; int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = radiantOrbDamage / 2; + Main.projectile[p].originalDamage = radiantOrbOriginalDamage / 2; } } } diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 671ec76d7d..34f7deca5e 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon player.AddBuff(ModContent.BuffType(), 3600); Projectile.minionSlots = Projectile.ai[0]; - Lighting.AddLight(Projectile.Center, 1f, 0.5f, 0.5f); + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 1f); Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon float damageMult = ((float)Math.Log(Projectile.ai[0], MathHelper.E)) + 1f; int beam = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(beam)) - Main.projectile[beam].originalDamage = Projectile.originalDamage; + Main.projectile[beam].originalDamage = (int)(Projectile.originalDamage * damageMult); Main.projectile[beam].penetrate = (int)Projectile.ai[0]; Projectile.ai[1] = 30f; } diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index f50f21f50d..6b2e6aad30 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon } else { - Projectile.velocity = (Projectile.velocity * 44f + Projectile.SafeDirectionTo(player.Center) * 24f) / 45f; + Projectile.velocity = (Projectile.velocity * 44f + Projectile.SafeDirectionTo(target.Center) * 24f) / 45f; Projectile.ai[0] += 30 - Projectile.ai[0] % 30f; } Projectile.ai[1] = 1f; diff --git a/Projectiles/Summon/SmallAresArms/ArmPart1.png b/Projectiles/Summon/SmallAresArms/ArmPart1.png new file mode 100644 index 0000000000..ed29779ed5 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ArmPart1.png differ diff --git a/Projectiles/Summon/SmallAresArms/ArmPart1Glowmask.png b/Projectiles/Summon/SmallAresArms/ArmPart1Glowmask.png new file mode 100644 index 0000000000..2988cc3e3b Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ArmPart1Glowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/ArmPart2.png b/Projectiles/Summon/SmallAresArms/ArmPart2.png new file mode 100644 index 0000000000..45a03af177 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ArmPart2.png differ diff --git a/Projectiles/Summon/SmallAresArms/ArmPart2Glowmask.png b/Projectiles/Summon/SmallAresArms/ArmPart2Glowmask.png new file mode 100644 index 0000000000..791078abfa Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ArmPart2Glowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/ArmTopShoulder.png b/Projectiles/Summon/SmallAresArms/ArmTopShoulder.png new file mode 100644 index 0000000000..fe6a82ee40 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ArmTopShoulder.png differ diff --git a/Projectiles/Summon/SmallAresArms/ArmTopShoulderGlowmask.png b/Projectiles/Summon/SmallAresArms/ArmTopShoulderGlowmask.png new file mode 100644 index 0000000000..a8dab820ed Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ArmTopShoulderGlowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/Arrow.png b/Projectiles/Summon/SmallAresArms/Arrow.png new file mode 100644 index 0000000000..dd54c01276 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/Arrow.png differ diff --git a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs new file mode 100644 index 0000000000..da885ee432 --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs @@ -0,0 +1,159 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class CannonLaserbeam : BaseLaserbeamProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Player Owner => Main.player[Projectile.owner]; + + public Projectile OwnerProjectile => CalamityUtils.FindProjectileByIdentity((int)Projectile.ai[1], Projectile.owner); + + public const int LifetimeConst = 75; + public override float MaxScale => 0.5f + (float)Math.Cos(Main.GlobalTimeWrappedHourly * 10f) * 0.07f; + public override float MaxLaserLength => 1560f; + public override float Lifetime => LifetimeConst; + public override Color LaserOverlayColor => Color.White; + public override Color LightCastColor => LaserOverlayColor; + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/Projectiles/Boss/ThanatosBeamStart", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd", AssetRequestMode.ImmediateLoad).Value; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exothermal Deathray"); + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 38; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.localNPCHitCooldown = 10; + Projectile.scale = 0.5f; + Projectile.usesLocalNPCImmunity = true; + Projectile.hide = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.Calamity().UpdatePriority = 1f; + } + + public override float DetermineLaserLength() + { + float[] samples = new float[4]; + Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.width * Projectile.scale, MaxLaserLength, samples); + return samples.Average(); + } + + public override void UpdateLaserMotion() + { + if (OwnerProjectile is null) + { + Projectile.Kill(); + return; + } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override void AttachToSomething() + { + Projectile ownerProjectile = OwnerProjectile; + if (ownerProjectile is null) + { + Projectile.Kill(); + return; + } + + float attachmentOffset = ownerProjectile.width * ownerProjectile.scale * 0.75f; + Projectile.Center = ownerProjectile.Center + ownerProjectile.rotation.ToRotationVector2() * attachmentOffset - Owner.velocity; + Projectile.rotation = ownerProjectile.rotation; + Projectile.velocity = Projectile.rotation.ToRotationVector2(); + + // Update frames. + Projectile.frame = Projectile.frameCounter++ / 5 % Main.projFrames[Type]; + } + + public override bool ShouldUpdatePosition() => false; + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } + + public override bool PreDraw(ref Color lightColor) + { + // This should never happen, but just in case. + if (Projectile.velocity == Vector2.Zero || Projectile.localAI[0] < 2f) + return false; + + Color beamColor = LaserOverlayColor; + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + + // Start texture drawing. + Main.EntitySpriteDraw(LaserBeginTexture, + Projectile.Center - Main.screenPosition, + startFrameArea, + beamColor, + Projectile.rotation, + startFrameArea.Size() * new Vector2(0.5f, 1f), + Projectile.scale, + SpriteEffects.None, + 0); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength + middleFrameArea.Height; + Vector2 centerOnLaser = Projectile.Center; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = middleFrameArea.Height * Projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + Main.EntitySpriteDraw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + middleFrameArea, + beamColor, + Projectile.rotation, + middleFrameArea.Size() * 0.5f, + Projectile.scale, + SpriteEffects.None, + 0); + incrementalBodyLength += laserOffset; + centerOnLaser += Projectile.velocity * laserOffset; + middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type]; + if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height) + middleFrameArea.Y = 0; + } + } + + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + Main.EntitySpriteDraw(LaserEndTexture, + laserEndCenter, + endFrameArea, + beamColor, + Projectile.rotation, + endFrameArea.Size() * 0.5f, + Projectile.scale, + SpriteEffects.None, + 0); + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs new file mode 100644 index 0000000000..bc47b7fa53 --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -0,0 +1,218 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.InverseKinematics; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using CalamityMod.Buffs.Summon; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public abstract class ExoskeletonCannon : ModProjectile + { + public int ShootTimer; + + public int HoverOffsetIndex => (int)Projectile.ai[0]; + + public bool TargetingSomething => Projectile.ai[1] == 1f; + + public Player Owner => Main.player[Projectile.owner]; + + public LimbCollection Limbs = new(new CyclicCoordinateDescentUpdateRule(0.27f, MathHelper.PiOver2), 70f, 82f); + + public static readonly Vector2[] HoverOffsetTable = new Vector2[] + { + new(300f, 96f), + new(-300f, 96f), + new(190f, -102f), + new(-190f, -102f) + }; + + public static readonly float[] RotationalClampTable = new float[] + { + 0.23f, + MathHelper.Pi - 0.23f, + 0.2f, + MathHelper.Pi - 0.2f + }; + + public virtual bool UsesSuperpredictiveness => false; + + public virtual Vector2 DrawOffset => new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 6f, -6f); + + public virtual Vector2 ConnectOffset => HoverOffsetIndex >= 2 ? new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 14f, -30f) : Vector2.Zero; + + public abstract int ShootRate { get; } + + public abstract float ShootSpeed { get; } + + public abstract Vector2 OwnerRestingOffset { get; } + + public abstract void ClampFirstLimbRotation(ref double limbRotation); + + public abstract void ShootAtTarget(NPC target, Vector2 shootDirection); + + public override void SetDefaults() + { + ShootTimer = Main.rand?.Next(ShootRate) ?? 0; + Projectile.width = 94; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.netImportant = true; + Projectile.minion = true; + Projectile.minionSlots = AresExoskeleton.MinionSlotsPerCannon; + Projectile.penetrate = -1; + Projectile.timeLeft = 900000; + Projectile.scale = 1f; + Projectile.DamageType = DamageClass.Summon; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.rotation); + writer.Write(Limbs?.Limbs?.Length ?? 0); + for (int i = 0; i < Limbs.Limbs.Length; i++) + writer.Write(Limbs[i].Rotation); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.rotation = reader.ReadSingle(); + + int limbCount = Limbs.Limbs.Length; + for (int i = 0; i < limbCount; i++) + { + Limbs[i].Rotation = reader.ReadDouble(); + if (i >= 1) + Limbs[i].ConnectPoint = Limbs[i - 1].EndPoint; + } + } + + public override void AI() + { + // Update limbs. + if (Main.myPlayer == Projectile.owner) + { + Vector2 connectPosition = Main.LocalPlayer.Center + ConnectOffset; + connectPosition.X += (OwnerRestingOffset.X > 0f).ToDirectionInt() * Projectile.scale * 20f; + Vector2 endPosition = Owner.Center + OwnerRestingOffset; + endPosition += (Main.MouseWorld - endPosition) * 0.075f; + + ClampFirstLimbRotation(ref Limbs[0].Rotation); + Limbs.Update(connectPosition, endPosition); + + Projectile.netSpam = 0; + Projectile.netUpdate = true; + } + + Projectile.ai[1] = 0f; + Projectile.velocity = Vector2.Zero; + Projectile.Center = Limbs.EndPoint; + + // Handle buffs. + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Owner.dead) + Owner.Calamity().AresCannons = false; + if (Owner.Calamity().AresCannons) + Projectile.timeLeft = 2; + + // Look at the mouse if not targetting anything. + // If something is being targeted, look at them instead. + float idealRotation = Main.myPlayer != Projectile.owner ? Projectile.rotation : Projectile.AngleTo(Main.MouseWorld); + NPC potentialTarget = Projectile.Center.ClosestNPCAt(AresExoskeleton.TargetingDistance); + if (potentialTarget != null) + { + Projectile.ai[1] = 1f; + + idealRotation = Projectile.AngleTo(potentialTarget.Center); + if (UsesSuperpredictiveness) + idealRotation = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, potentialTarget, ShootSpeed).ToRotation(); + + ShootTimer++; + if (ShootTimer >= ShootRate) + { + ShootAtTarget(potentialTarget, idealRotation.ToRotationVector2()); + ShootTimer = 0; + } + } + + Projectile.rotation = Projectile.rotation.AngleLerp(idealRotation, 0.15f); + Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0f).ToDirectionInt(); + } + + public void DefaultDrawCannon(Texture2D glowmask) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(2, Main.projFrames[Type], TargetingSomething.ToInt(), Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + float rotation = Projectile.rotation; + if (Projectile.spriteDirection == -1) + rotation += MathHelper.Pi; + + DrawLimbs(); + + Color lightColor = Lighting.GetColor(Projectile.Center.ToTileCoordinates()); + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(glowmask, drawPosition, frame, Projectile.GetAlpha(Color.White), rotation, origin, Projectile.scale, direction, 0); + } + + public void DrawLimbs() + { + // Draw the arms. Third and onward arms use the otherwise unused old Ares arm segment texture. + int frame = (int)(Main.GlobalTimeWrappedHourly * 8.1f) % 9; + for (int i = 0; i < Limbs.Limbs.Length; i++) + { + float scale = Projectile.scale; + float rotation = (float)Limbs[i].Rotation; + Vector2 segmentOriginFactor = new(0f, 0.5f); + SpriteEffects segmentDirection = SpriteEffects.FlipHorizontally; + Texture2D segmentTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/Ares/AresArmSegment").Value; + Texture2D glowmaskTexture = null; + + Rectangle segmentFrame = segmentTexture.Frame(1, 24, 0, (int)(Main.GlobalTimeWrappedHourly * 13f + i) % 24); + if (i == 0) + { + segmentTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart1").Value; + glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart1Glowmask").Value; + } + if (i == 1) + { + segmentTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart2").Value; + glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart2Glowmask").Value; + } + if (i <= 1) + { + segmentFrame = segmentTexture.Frame(1, 9, 0, frame); + segmentDirection = OwnerRestingOffset.X < 0f ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (OwnerRestingOffset.X < 0f) + { + segmentOriginFactor.X = 1f; + rotation += MathHelper.Pi; + } + } + else + scale *= 0.67f; + + Color segmentColor = Lighting.GetColor(Limbs[i].ConnectPoint.ToTileCoordinates()); + Vector2 segmentDrawPosition = Limbs[i].ConnectPoint - Main.screenPosition; + Main.spriteBatch.DrawLineBetter(Limbs[i].ConnectPoint, Limbs[i].EndPoint, Color.Cyan, 3f); + Main.EntitySpriteDraw(segmentTexture, segmentDrawPosition, segmentFrame, Projectile.GetAlpha(segmentColor), rotation, segmentFrame.Size() * segmentOriginFactor, scale, segmentDirection, 0); + if (glowmaskTexture != null) + Main.EntitySpriteDraw(glowmaskTexture, segmentDrawPosition, segmentFrame, Projectile.GetAlpha(Color.White), rotation, segmentFrame.Size() * segmentOriginFactor, scale, segmentDirection, 0); + } + + // Draw the shoulders on top of everything else. + Vector2 shoulderPosition = Limbs.ConnectPoint + DrawOffset * Projectile.scale; + Color shoulderColor = Lighting.GetColor(Limbs.ConnectPoint.ToTileCoordinates()); + Texture2D shoulderTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ArmTopShoulder").Value; + SpriteEffects shoulderDirection = OwnerRestingOffset.X < 0f ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Rectangle shoulderFrame = shoulderTexture.Frame(1, 9, 0, frame); + Main.EntitySpriteDraw(shoulderTexture, shoulderPosition - Main.screenPosition, shoulderFrame, Projectile.GetAlpha(shoulderColor), 0f, shoulderFrame.Size() * 0.5f, Projectile.scale, shoulderDirection, 0); + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs new file mode 100644 index 0000000000..466e99c646 --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.cs @@ -0,0 +1,142 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; +using CalamityMod.Items.Weapons.Summon; +using System; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class ExoskeletonGaussNukeCannon : ExoskeletonCannon + { + public int NukeRebuildTime => ShootRate - 45; + + public ref float RebuildTimer => ref Projectile.localAI[0]; + + public override int ShootRate => AresExoskeleton.GaussNukeShootRate; + + public override float ShootSpeed => 16f; + + public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex]; + + public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Nuke"); + Main.projFrames[Type] = 12; + } + + public override void ShootAtTarget(NPC target, Vector2 shootDirection) + { + // Play the large gun fire sound. + SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = 0.4f }, Projectile.Center); + + // Start the rebuild timer. + RebuildTimer = 1f; + + // Shoot the fireball. This only happens for the owner client. + if (Main.myPlayer != Projectile.owner) + return; + + int nukeID = ModContent.ProjectileType(); + Vector2 laserVelocity = shootDirection * ShootSpeed; + int laser = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, laserVelocity, nukeID, (int)(Projectile.damage * AresExoskeleton.NukeDamageFactor), 0f, Projectile.owner); + if (Main.projectile.IndexInRange(laser)) + Main.projectile[laser].originalDamage = (int)(Projectile.originalDamage * AresExoskeleton.NukeDamageFactor); + } + + public override void PostAI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % 6; + if (RebuildTimer >= 1f) + { + RebuildTimer++; + Projectile.frame += 6; + } + + if (RebuildTimer >= NukeRebuildTime) + { + RebuildTimer = 0f; + Projectile.frameCounter = 0; + Projectile.frame = 0; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D glowmask = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannonGlowmask").Value; + + // The two stabilizers have two different shades of lighting, thus necessitating two different textures. + Texture2D stabilizer = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizer").Value; + Texture2D stabilizer2 = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizerBottom").Value; + Texture2D crystal = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCrystal").Value; + Texture2D core = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCore").Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + + float stabilizerRotationInterpolant = (float)Math.Pow(Utils.GetLerpValue(NukeRebuildTime * 0.75f, NukeRebuildTime * 0.92f, RebuildTimer, true), 1.7); + Vector2 origin = frame.Size() * 0.5f; + Vector2 crystalOrigin = crystal.Size() * new Vector2(Projectile.spriteDirection == 1 ? 1f : 0f, 0.5f); + Vector2 stabilizerOrigin = stabilizer.Size() * new Vector2(0.5f, 1f); + Vector2 coreOrigin = core.Size() * new Vector2(Projectile.spriteDirection == 1 ? 0f : 1f, 0.5f); + Vector2 perpendicularStabilizerOffset = (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * Projectile.scale * MathHelper.Lerp(18f, 10f, stabilizerRotationInterpolant); + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + float rotation = Projectile.rotation; + if (Projectile.spriteDirection == -1) + rotation += MathHelper.Pi; + + DrawLimbs(); + + // Draw the nuke pieces when rebuilding. This is done before the cannon itself is drawn, to make it look like they're attached to it. + if (RebuildTimer >= 1f) + { + float componentDirection = rotation + MathHelper.Pi; + float stabilizerDirection = componentDirection; + if (Projectile.spriteDirection == -1) + stabilizerDirection += MathHelper.Pi; + + Vector2 aimDirection = Projectile.rotation.ToRotationVector2(); + + // Draw the crystal. + float crystalOffsetInterpolant = Utils.GetLerpValue(0f, NukeRebuildTime * 0.5f, RebuildTimer, true); + Vector2 crystalOffset = aimDirection * crystalOffsetInterpolant * Projectile.scale * (crystal.Width - 15f); + Main.EntitySpriteDraw(crystal, drawPosition + crystalOffset, null, Projectile.GetAlpha(lightColor), rotation, crystalOrigin, Projectile.scale, direction, 0); + + // Draw the stabilizers. + float stabilizerOffsetInterpolant = Utils.GetLerpValue(NukeRebuildTime * 0.5f, NukeRebuildTime * 0.75f, RebuildTimer, true); + float stabilizerOffsetMagnitude = MathHelper.Lerp(-stabilizer.Width * 0.32f, stabilizer.Width * 0.4f - 8f, stabilizerOffsetInterpolant) * Projectile.scale; + float leftStabilizerRotation = stabilizerDirection + MathHelper.Pi - (1f - stabilizerRotationInterpolant) * 0.42f; + float rightStabilizerRotation = stabilizerDirection + (1f - stabilizerRotationInterpolant) * 0.42f; + Vector2 stabilizerOffset = aimDirection * stabilizerOffsetMagnitude; + Color stabilizerColor = Projectile.GetAlpha(lightColor) * (float)Math.Pow(stabilizerOffsetInterpolant, 1.61); + Vector2 leftStabilizerPosition = drawPosition + stabilizerOffset - perpendicularStabilizerOffset * 0.9f; + Vector2 rightStabilizerPosition = drawPosition + stabilizerOffset + perpendicularStabilizerOffset; + SpriteEffects leftStabilizerDirection = direction; + SpriteEffects rightStabilizerDirection = direction ^ SpriteEffects.FlipHorizontally; + if (Projectile.spriteDirection == -1) + { + leftStabilizerDirection ^= SpriteEffects.FlipHorizontally; + rightStabilizerDirection ^= SpriteEffects.FlipHorizontally; + Utils.Swap(ref stabilizer, ref stabilizer2); + } + Main.EntitySpriteDraw(stabilizer, leftStabilizerPosition, null, stabilizerColor, leftStabilizerRotation, stabilizerOrigin, Projectile.scale, leftStabilizerDirection, 0); + Main.EntitySpriteDraw(stabilizer2, rightStabilizerPosition, null, stabilizerColor, rightStabilizerRotation, stabilizerOrigin, Projectile.scale, rightStabilizerDirection, 0); + + // Draw the core. + Vector2 coreDrawPosition = drawPosition + aimDirection * Projectile.scale * -12f; + Main.EntitySpriteDraw(core, coreDrawPosition, null, Projectile.GetAlpha(lightColor) * stabilizerRotationInterpolant, rotation, coreOrigin, Projectile.scale, direction, 0); + } + + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(glowmask, drawPosition, frame, Projectile.GetAlpha(Color.White), rotation, origin, Projectile.scale, direction, 0); + + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.png b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.png new file mode 100644 index 0000000000..281210e432 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannon.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannonGlowmask.png b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannonGlowmask.png new file mode 100644 index 0000000000..e97dce2be6 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannonGlowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCore.png b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCore.png new file mode 100644 index 0000000000..07bc33e0d7 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCore.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCrystal.png b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCrystal.png new file mode 100644 index 0000000000..4b71265a0b Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCrystal.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizer.png b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizer.png new file mode 100644 index 0000000000..29b08d3e2d Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizer.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizerBottom.png b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizerBottom.png new file mode 100644 index 0000000000..72b1fbe1c1 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizerBottom.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs new file mode 100644 index 0000000000..3b5d8892be --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs @@ -0,0 +1,105 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; +using CalamityMod.Items.Weapons.Summon; +using System.IO; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class ExoskeletonLaserCannon : ExoskeletonCannon + { + public ref float ShootCounter => ref Projectile.localAI[0]; + + // This is how many small, regular lasers will happen before the laser will charge up and prepare a laserbeam. + public const int NormalLasersBeforeBeam = 6; + + public override int ShootRate => ShootCounter % NormalLasersBeforeBeam == 0f ? 150 : AresExoskeleton.LaserCannonNormalShootRate; + + public override float ShootSpeed => 19f; + + public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex]; + + public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser Cannon"); + Main.projFrames[Type] = 6; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(ShootCounter); + base.SendExtraAI(writer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + ShootCounter = reader.ReadSingle(); + base.ReceiveExtraAI(reader); + } + + public override void ShootAtTarget(NPC target, Vector2 shootDirection) + { + // Play the laser cannon fire sound. + SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = 0.2f }, Projectile.Center); + + // Create a burst of dust. + for (int i = 0; i < 24; i++) + { + Dust laserEnergy = Dust.NewDustPerfect(Projectile.Center + shootDirection * Projectile.width * Projectile.scale * 0.45f, 182); + laserEnergy.velocity = (MathHelper.TwoPi * i / 24f).ToRotationVector2() * 4f; + laserEnergy.scale = 1.1f; + laserEnergy.fadeIn = 0.4f; + laserEnergy.noGravity = true; + } + + // Shoot the laser. This only happens for the owner client. + if (Main.myPlayer != Projectile.owner) + return; + + int laserID = ModContent.ProjectileType(); + bool fireLaser = ShootCounter % NormalLasersBeforeBeam == NormalLasersBeforeBeam - 1f; + if (fireLaser) + laserID = ModContent.ProjectileType(); + + Vector2 laserVelocity = shootDirection * ShootSpeed; + int laser = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, laserVelocity, laserID, (int)(Projectile.damage * AresExoskeleton.LaserDamageFactor), 0f, Projectile.owner); + if (Main.projectile.IndexInRange(laser)) + { + Main.projectile[laser].originalDamage = (int)(Projectile.originalDamage * AresExoskeleton.LaserDamageFactor); + if (fireLaser) + Main.projectile[laser].ai[1] = Projectile.identity; + } + + // Increment the shoot counter. This decides if the cannon fires a simple laser or a beam. + ShootCounter++; + Projectile.netUpdate = true; + } + + // Create some charge dust before firing a laserbeam. + public override void PostAI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + if (ShootCounter % NormalLasersBeforeBeam != NormalLasersBeforeBeam - 1f || !TargetingSomething) + return; + + Vector2 aimDirection = Projectile.rotation.ToRotationVector2(); + Dust laserEnergy = Dust.NewDustPerfect(Projectile.Center + aimDirection * Projectile.width * Projectile.scale * 0.51f, 182); + laserEnergy.velocity = aimDirection.RotatedByRandom(0.48f) * Main.rand.NextFloat(3f); + laserEnergy.scale = 1.1f; + laserEnergy.fadeIn = 0.4f; + laserEnergy.noGravity = true; + } + + public override bool PreDraw(ref Color lightColor) + { + DefaultDrawCannon(ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannonGlowmask").Value); + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.png b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.png new file mode 100644 index 0000000000..bb40ea3449 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannonGlowmask.png b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannonGlowmask.png new file mode 100644 index 0000000000..a3afe8e3fd Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannonGlowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs new file mode 100644 index 0000000000..8d11da156b --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs @@ -0,0 +1,369 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items.Weapons.Summon; +using Terraria.GameContent; +using Terraria.Audio; +using System.Linq; +using System; +using System.Collections.Generic; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class ExoskeletonPanel : ModProjectile + { + public enum IconType + { + Inactive, + Plasma, + Tesla, + Laser, + Gauss + } + + public class IconState + { + public int PanelFlashTimer; + + public int MousePressFrameCountdown; + + public bool BeingHoveredOver; + + public bool PlacedInPanel; + + public IconType CurrentState; + + public Texture2D IconTexture + { + get + { + Texture2D plasmaTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value; + Texture2D teslaTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla").Value; + Texture2D laserTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser").Value; + Texture2D gaussTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss").Value; + return CurrentState switch + { + IconType.Plasma => plasmaTexture, + IconType.Tesla => teslaTexture, + IconType.Laser => laserTexture, + IconType.Gauss => gaussTexture, + _ => null, + }; + } + } + + public Rectangle Frame + { + get + { + int frame = 0; + if (BeingHoveredOver) + frame = PlacedInPanel ? 3 : 1; + if (MousePressFrameCountdown >= 1) + frame = 2; + if (PanelFlashTimer >= 1) + frame = (int)Math.Round(MathHelper.Lerp(4f, 6f, PanelFlashTimer / 16f)); + + return IconTexture?.Frame(1, 7, 0, frame) ?? default; + } + } + + public IconState(bool hover, bool panel, IconType state) + { + BeingHoveredOver = hover; + PlacedInPanel = panel; + CurrentState = state; + } + + public void Update() + { + if (PanelFlashTimer >= 1) + PanelFlashTimer++; + if (PanelFlashTimer >= 16) + PanelFlashTimer = 0; + + if (MousePressFrameCountdown > 0) + MousePressFrameCountdown--; + } + } + + public IconType ClickedIcon = IconType.Inactive; + + public IconState[] SelectionIcons = new IconState[] + { + new(false, false, IconType.Plasma), + new(false, false, IconType.Tesla), + new(false, false, IconType.Laser), + new(false, false, IconType.Gauss), + }; + + public IconState[] PanelIcons = new IconState[] + { + new(false, true, IconType.Inactive), + new(false, true, IconType.Inactive), + new(false, true, IconType.Inactive), + new(false, true, IconType.Inactive), + }; + + public bool ShouldDeleteArmIndex = false; + + public int ArmIDToSpawn = -1; + + public int ArmIndex = -1; + + public bool FadeOut => Projectile.ai[0] == 1f; + + public Vector2 PlayerOffset; + + public ref float Time => ref Projectile.ai[1]; + + public static Rectangle MouseRectangle => new((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("UI"); + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 9999999; + } + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 36000; + Projectile.Opacity = 0f; + Projectile.tileCollide = false; + Projectile.hide = true; + } + + public override void AI() + { + int plasmaCannonID = ModContent.ProjectileType(); + int teslaCannonID = ModContent.ProjectileType(); + int laserCannonID = ModContent.ProjectileType(); + int gaussNukeID = ModContent.ProjectileType(); + int[] arms = new int[] + { + plasmaCannonID, + teslaCannonID, + laserCannonID, + gaussNukeID, + }; + + // Initialize things. + if (PlayerOffset == Vector2.Zero) + PlayerOffset = Main.MouseWorld - Main.LocalPlayer.Center; + + // Dynamically update panel icons. + for (int i = 0; i < 4; i++) + PanelIcons[i].CurrentState = IconType.Inactive; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active) + continue; + + IconType stateFromID = IconType.Inactive; + if (Main.projectile[i].type == plasmaCannonID) + stateFromID = IconType.Plasma; + if (Main.projectile[i].type == teslaCannonID) + stateFromID = IconType.Tesla; + if (Main.projectile[i].type == laserCannonID) + stateFromID = IconType.Laser; + if (Main.projectile[i].type == gaussNukeID) + stateFromID = IconType.Gauss; + + PanelIcons[(int)Main.projectile[i].ai[0]].CurrentState = stateFromID; + } + + // Handle fade effects. + if (Time >= AresExoskeleton.BoxParticleLifetime) + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity - FadeOut.ToDirectionInt() * 0.0225f, 0f, 1f); + if (FadeOut && Projectile.Opacity <= 0f) + Projectile.Kill(); + + if (Main.player[Projectile.owner].dead || !Main.player[Projectile.owner].active) + Projectile.Kill(); + Time++; + + // Create and destroy arms as necessary. + if (Main.myPlayer != Projectile.owner) + return; + + if (ArmIDToSpawn >= 0) + { + bool armAlreadyExists = false; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active || Main.projectile[i].ai[0] != ArmIndex) + continue; + + armAlreadyExists = true; + break; + } + + if (!armAlreadyExists) + { + SoundEngine.PlaySound(SoundID.Zombie66, Projectile.Center); + int cannon = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, Vector2.Zero, ArmIDToSpawn, Projectile.damage, 0f, Projectile.owner, ArmIndex); + if (Main.projectile.IndexInRange(cannon)) + Main.projectile[cannon].originalDamage = Projectile.originalDamage; + } + } + if (ShouldDeleteArmIndex) + { + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active || Main.projectile[i].ai[0] != ArmIndex) + continue; + + Main.projectile[i].Kill(); + } + } + + ShouldDeleteArmIndex = false; + ArmIDToSpawn = -1; + ArmIndex = -1; + } + + public override bool PreDraw(ref Color lightColor) + { + // This UI only renders for the player that created it. + if (Main.myPlayer != Projectile.owner) + return false; + + Texture2D panelTexture = ModContent.Request(Texture).Value; + Texture2D plasmaTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value; + Texture2D arrowTexture = ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/Arrow").Value; + Vector2 area = plasmaTexture.Frame(1, 7, 0, 0).Size(); + Vector2 drawPosition = (Main.LocalPlayer.Center + PlayerOffset - Main.screenPosition).Floor(); + + Rectangle[] selectionIconAreas = new Rectangle[4] + { + Utils.CenteredRectangle(drawPosition + new Vector2(-62f, -70f) * Projectile.scale, area * Projectile.scale), + Utils.CenteredRectangle(drawPosition + new Vector2(-22f, -70f) * Projectile.scale, area * Projectile.scale), + Utils.CenteredRectangle(drawPosition + new Vector2(22f, -70f) * Projectile.scale, area * Projectile.scale), + Utils.CenteredRectangle(drawPosition + new Vector2(62f, -70f) * Projectile.scale, area * Projectile.scale) + }; + + bool hoveringOverAnySlot = false; + bool clickedAnIconOnPanel = false; + 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. + for (int i = 0; i < 4; i++) + { + Texture2D selectionIconTexture = SelectionIcons[i].IconTexture; + + // Handle selection icon click stuff. + SelectionIcons[i].BeingHoveredOver = false; + PanelIcons[i].BeingHoveredOver = false; + if (selectionIconAreas[i].Intersects(MouseRectangle)) + { + hoveringOverAnySlot = true; + SelectionIcons[i].BeingHoveredOver = true; + if (Main.mouseLeft && Main.mouseLeftRelease && Projectile.Opacity >= 1f) + { + ClickedIcon = SelectionIcons[i].CurrentState; + SelectionIcons[i].MousePressFrameCountdown = 15; + } + } + + // Handle panel icon click stuff. + Rectangle panelArea = selectionIconAreas[i]; + panelArea.Y += (int)(Projectile.scale * 78f); + if (panelArea.Intersects(MouseRectangle)) + { + hoveringOverAnySlot = true; + PanelIcons[i].BeingHoveredOver = true; + if (Main.mouseLeft && Main.mouseLeftRelease && Projectile.Opacity >= 1f && sufficientSlots) + { + clickedAnIconOnPanel = true; + PanelIcons[i].CurrentState = ClickedIcon; + PanelIcons[i].PanelFlashTimer = 1; + + switch (ClickedIcon) + { + case IconType.Plasma: + ArmIDToSpawn = ModContent.ProjectileType(); + break; + case IconType.Tesla: + ArmIDToSpawn = ModContent.ProjectileType(); + break; + case IconType.Laser: + ArmIDToSpawn = ModContent.ProjectileType(); + break; + case IconType.Gauss: + ArmIDToSpawn = ModContent.ProjectileType(); + break; + case IconType.Inactive: + ShouldDeleteArmIndex = true; + PanelIcons[i].PanelFlashTimer = 0; + break; + } + ArmIndex = i; + } + } + + Main.EntitySpriteDraw(selectionIconTexture, selectionIconAreas[i].Center.ToVector2(), SelectionIcons[i].Frame, Projectile.GetAlpha(Color.White), 0f, area * 0.5f, Projectile.scale, 0, 0); + } + + Main.EntitySpriteDraw(panelTexture, drawPosition, null, Projectile.GetAlpha(Color.White), 0f, panelTexture.Size() * 0.5f, Projectile.scale, 0, 0); + + // Draw panel icons. + for (int i = 0; i < 4; i++) + { + Rectangle panelArea = selectionIconAreas[i]; + panelArea.Y += (int)(Projectile.scale * 78f); + Texture2D panelIconTexture = PanelIcons[i].IconTexture; + if (panelIconTexture is not null) + Main.EntitySpriteDraw(panelIconTexture, panelArea.Center.ToVector2(), PanelIcons[i].Frame, Projectile.GetAlpha(Color.White), 0f, area * 0.5f, Projectile.scale, 0, 0); + + SelectionIcons[i].Update(); + PanelIcons[i].Update(); + } + + // Draw an arrow at the mouse from the selected icon if one has been selected. + if (ClickedIcon != IconType.Inactive) + { + Vector2 arrowDrawPosition = selectionIconAreas[(int)ClickedIcon - 1].Center.ToVector2(); + Vector2 arrowDirection = (Main.MouseScreen - arrowDrawPosition).SafeNormalize(Vector2.UnitY); + arrowDrawPosition += arrowDirection * Projectile.scale * 24f; + + Main.EntitySpriteDraw(arrowTexture, arrowDrawPosition, null, Projectile.GetAlpha(Color.White), arrowDirection.ToRotation(), arrowTexture.Size() * 0.5f, Projectile.scale, 0, 0); + } + + // Tell the player if they don't have enough summon slots. + if (hoveringOverAnySlot && !sufficientSlots) + Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, "Insufficient minion slots!", Main.MouseScreen.X + 20f, Main.MouseScreen.Y + 12f, Color.Cyan, Color.Black, new Vector2(0f, 0.5f)); + + // Reset the clicked icon if a click is made but not to a specific icon. + if (!hoveringOverAnySlot && Main.mouseLeft && Main.mouseLeftRelease) + ClickedIcon = IconType.Inactive; + + if (hoveringOverAnySlot) + { + Main.blockMouse = true; + Main.LocalPlayer.mouseInterface = true; + } + + // Reset the clicked icon and handle the arm creation/deletion if an icon was clicked on the panel. + if (clickedAnIconOnPanel) + ClickedIcon = IconType.Inactive; + + return false; + } + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overWiresUI.Add(index); + } + + // This is a UI. It should not do damage. + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.png new file mode 100644 index 0000000000..d0d85a8a57 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss.png new file mode 100644 index 0000000000..399ca0170c Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser.png new file mode 100644 index 0000000000..b92fa1e06c Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma.png new file mode 100644 index 0000000000..88bf8c292a Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla.png new file mode 100644 index 0000000000..77dde33046 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs new file mode 100644 index 0000000000..9641b1796e --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs @@ -0,0 +1,93 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Summon; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class ExoskeletonPlasmaCannon : ExoskeletonCannon + { + public override int ShootRate => AresExoskeleton.PlasmaCannonShootRate; + + public override float ShootSpeed => 13.5f; + + public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex]; + + public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Cannon"); + Main.projFrames[Type] = 6; + } + + public override void PostAI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + } + + public override void ShootAtTarget(NPC target, Vector2 shootDirection) + { + // Play the plasma caster fire sound. + SoundEngine.PlaySound(PlasmaCaster.FireSound with { Volume = 0.4f }, Projectile.Center); + + // Create a burst of dust. + for (int i = 0; i < 40; i++) + { + float dustSpeed = Main.rand.NextFloat(1.8f, 3f); + Vector2 dustVel = shootDirection * dustSpeed; + dustVel = dustVel.RotatedBy(-0.35f); + dustVel = dustVel.RotatedByRandom(2.0f * 0.35f); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + Dust plasma = Dust.NewDustDirect(Projectile.TopLeft, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + plasma.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 4f; + plasma.position += shootDirection * 60f; + plasma.noGravity = true; + plasma.velocity *= Projectile.scale * 1.6f; + + plasma = Dust.NewDustDirect(Projectile.TopLeft, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + plasma.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 4f; + plasma.position += shootDirection * 60f; + plasma.velocity *= Projectile.scale * 0.9f; + + plasma.noGravity = true; + plasma.fadeIn = 1f; + plasma.color = Color.Green * 0.5f; + } + for (int i = 0; i < 20; i++) + { + float dustSpeed = Main.rand.NextFloat(1.8f, 3f); + Vector2 dustVel = shootDirection * dustSpeed; + dustVel = dustVel.RotatedBy(-0.35f); + dustVel = dustVel.RotatedByRandom(2.0f * 0.35f); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + Dust plasma = Dust.NewDustDirect(Projectile.TopLeft, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + plasma.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(shootDirection.ToRotation()) * Projectile.width / 5f; + plasma.position += shootDirection * 60f; + plasma.noGravity = true; + plasma.velocity *= Projectile.scale * 0.27f; + } + + // Shoot the fireball. This only happens for the owner client. + if (Main.myPlayer != Projectile.owner) + return; + + Vector2 fireballVelocity = shootDirection * ShootSpeed; + int fireball = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, fireballVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * AresExoskeleton.PlasmaCannonBlastFactor), 0f, Projectile.owner); + if (Main.projectile.IndexInRange(fireball)) + Main.projectile[fireball].originalDamage = (int)(Projectile.originalDamage * AresExoskeleton.PlasmaCannonBlastFactor); + } + + public override bool PreDraw(ref Color lightColor) + { + DefaultDrawCannon(ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannonGlowmask").Value); + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.png new file mode 100644 index 0000000000..782b1e8be3 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannonGlowmask.png b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannonGlowmask.png new file mode 100644 index 0000000000..60e386b179 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannonGlowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs new file mode 100644 index 0000000000..23ea43b7fe --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.cs @@ -0,0 +1,67 @@ +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Weapons.Summon; +using System.IO; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class ExoskeletonTeslaCannon : ExoskeletonCannon + { + public ref float TeslaOrbIndex => ref Projectile.localAI[0]; + + public override int ShootRate => AresExoskeleton.TeslaCannonShootRate; + + public override float ShootSpeed => 16f; + + public override bool UsesSuperpredictiveness => true; + + public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex]; + + public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla Cannon"); + Main.projFrames[Type] = 6; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(TeslaOrbIndex); + + public override void ReceiveExtraAI(BinaryReader reader) => TeslaOrbIndex = reader.ReadSingle(); + + public override void PostAI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; + } + + public override void ShootAtTarget(NPC target, Vector2 shootDirection) + { + // Play the plasma bolt fire sound. + SoundEngine.PlaySound(CommonCalamitySounds.PlasmaBoltSound with { Volume = 0.4f }, Projectile.Center); + + // Shoot the tesla orb. This only happens for the owner client. + if (Main.myPlayer != Projectile.owner) + return; + + int damage = (int)(Projectile.damage * AresExoskeleton.TeslaOrbDamageFactor); + Vector2 teslaOrbVelocity = shootDirection * ShootSpeed; + int teslaOrb = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, teslaOrbVelocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(teslaOrb)) + { + Main.projectile[teslaOrb].originalDamage = (int)(Projectile.originalDamage * AresExoskeleton.TeslaOrbDamageFactor); + Main.projectile[teslaOrb].ai[0] = TeslaOrbIndex++ % 6; + } + } + + public override bool PreDraw(ref Color lightColor) + { + DefaultDrawCannon(ModContent.Request("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannonGlowmask").Value); + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.png b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.png new file mode 100644 index 0000000000..21761e7ad1 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannon.png differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannonGlowmask.png b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannonGlowmask.png new file mode 100644 index 0000000000..bf6a231509 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannonGlowmask.png differ diff --git a/Projectiles/Summon/SmallAresArms/MinionGaussBoom.cs b/Projectiles/Summon/SmallAresArms/MinionGaussBoom.cs new file mode 100644 index 0000000000..a5323cc3ee --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/MinionGaussBoom.cs @@ -0,0 +1,34 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class MinionGaussBoom : BaseMassiveExplosionProjectile + { + public override int Lifetime => 60; + + // No screenshake is used for the sake of gameplay convenience. + public override bool UsesScreenshake => false; + public override float GetScreenshakePower(float pulseCompletionRatio) => 0f; + public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Yellow * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); + public override void SetStaticDefaults() => DisplayName.SetDefault("Gauss Hyperexplosion"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + } + + public override void PostAI() => Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); + } +} diff --git a/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs b/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs new file mode 100644 index 0000000000..adf35b497c --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/MinionGaussNuke.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class MinionGaussNuke : ModProjectile + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Gauss Nuke"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 76; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.timeLeft = 180; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + } + + public override void AI() + { + // Handle rotation. + Projectile.rotation = Projectile.velocity.ToRotation(); + + // Home towards targets. + NPC potentialTarget = Projectile.Center.ClosestNPCAt(960f, false); + if (potentialTarget != null) + Projectile.velocity = Projectile.SuperhomeTowardsTarget(potentialTarget, 23f, 10f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.Kill(); + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(TeslaCannon.FireSound, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + int boom = Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.1f), Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(boom)) + { + Main.projectile[boom].ai[1] = AresExoskeleton.MaxNukeExplosionRadius; + Main.projectile[boom].originalDamage = Projectile.originalDamage; + } + } + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/MinionGaussNuke.png b/Projectiles/Summon/SmallAresArms/MinionGaussNuke.png new file mode 100644 index 0000000000..a4b11364a1 Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/MinionGaussNuke.png differ diff --git a/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs b/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs new file mode 100644 index 0000000000..469b4cb3b3 --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/MinionLaserBurst.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class MinionLaserBurst : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/ThanatosLaser"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exothermal Laser"); + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 420; + Projectile.Opacity = 0f; + Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.extraUpdates = 3; // THESE MOVE SUPER FAST NOW I AM NOT SORRY + } + + public override void AI() + { + // Accelerate. + if (Projectile.velocity.Length() < 27f) + Projectile.velocity *= 1.024f; + + // Fade in. + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.12f, 0f, 1f); + + // Handle frames and rotation. + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs new file mode 100644 index 0000000000..e7ef090a06 --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaBlast.cs @@ -0,0 +1,83 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class MinionPlasmaBlast : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/AresPlasmaFireball"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Volatile Plasma Blast"); + Main.projFrames[Type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.netImportant = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 420; + Projectile.Opacity = 0f; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + // Accelerate. + if (Projectile.velocity.Length() < 23f) + Projectile.velocity *= 1.0175f; + + // Fade in. + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.06667f, 0f, 1f); + + // Handle frames and rotation. + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + // Home towards targets. + NPC potentialTarget = Projectile.Center.ClosestNPCAt(900f, false); + if (potentialTarget != null) + Projectile.velocity = Projectile.SuperhomeTowardsTarget(potentialTarget, 23f, 10f); + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); + + // Release a spread of plasma gas. + if (Main.netMode != NetmodeID.MultiplayerClient && Projectile.ai[1] != -1f) + { + int type = ModContent.ProjectileType(); + for (int i = 0; i < 15; i++) + { + Vector2 plasmaVelocity = Main.rand.NextVector2Circular(5f, 5f); + int gas = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, plasmaVelocity, type, Projectile.damage, 0f, Main.myPlayer); + if (Main.projectile.IndexInRange(gas)) + Main.projectile[gas].originalDamage = Projectile.originalDamage; + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs new file mode 100644 index 0000000000..f658e408ee --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs @@ -0,0 +1,67 @@ +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class MinionPlasmaGas : ModProjectile, IAdditiveDrawer + { + public ref float LightPower => ref Projectile.ai[0]; + + public ref float Time => ref Projectile.ai[1]; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Superheated Plasma Cloud"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 50; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 150; + Projectile.scale = 1.5f; + Projectile.hide = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; + } + + public override void AI() + { + // Decide scale and initial rotation on the first frame this projectile exists. + if (Projectile.localAI[0] == 0f) + { + Projectile.scale = Main.rand.NextFloat(1f, 1.7f); + Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Projectile.localAI[0] = 1f; + } + + // Calculate light power. This checks below the position of the fog to check if this fog is underground. + // Without this, it may render over the fullblack that the game renders for obscured tiles. + float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); + LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); + Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(0f, 60f, Projectile.timeLeft, true); + Projectile.rotation += Projectile.velocity.X * 0.004f; + Projectile.velocity *= 0.97f; + Time++; + } + + public void AdditiveDraw(SpriteBatch spriteBatch) + { + Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = texture.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.3f; + Color drawColor = new Color(141, 255, 105) * opacity; + Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale * 1.35f; + spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.png b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.png new file mode 100644 index 0000000000..d26f30cbff Binary files /dev/null and b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.png differ diff --git a/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs new file mode 100644 index 0000000000..e4b5ac34de --- /dev/null +++ b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs @@ -0,0 +1,151 @@ +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.SmallAresArms +{ + public class MinionTeslaOrb : ModProjectile + { + public ref float Identity => ref Projectile.ai[0]; + + public ref float Time => ref Projectile.ai[1]; + + public PrimitiveTrail LightningDrawer; + + public PrimitiveTrail LightningBackgroundDrawer; + + public override string Texture => "CalamityMod/Projectiles/Boss/AresTeslaOrb"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla Sphere"); + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + } + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 420; + Projectile.Opacity = 0f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + Projectile.DamageType = DamageClass.Summon; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + // Accelerate. + if (Projectile.velocity.Length() < 21f) + Projectile.velocity *= 1.012f; + + // Handle fade effects. + Projectile.Opacity = Utils.GetLerpValue(0f, 4f, Time, true) * Utils.GetLerpValue(0f, 15f, Projectile.timeLeft, true); + + // Emit electric light. + Lighting.AddLight(Projectile.Center, 0.1f * Projectile.Opacity, 0.25f * Projectile.Opacity, 0.25f * Projectile.Opacity); + + // Handle frames. + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + + Time++; + } + + public Projectile GetOrbToAttachTo() + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != Projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active) + continue; + + if (!Main.projectile[i].WithinRange(Projectile.Center, AresExoskeleton.TeslaOrbDetatchDistance)) + continue; + + return Main.projectile[i]; + } + + return null; + } + + internal float WidthFunction(float completionRatio) + { + return MathHelper.Lerp(0.75f, 1.85f, (float)Math.Sin(MathHelper.Pi * completionRatio)) * Projectile.scale; + } + + internal Color ColorFunction(float completionRatio) + { + float fadeToWhite = MathHelper.Lerp(0f, 0.65f, (float)Math.Sin(MathHelper.TwoPi * completionRatio + Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); + Color baseColor = Color.Lerp(Color.Cyan, Color.White, fadeToWhite); + return Color.Lerp(baseColor, Color.LightBlue, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f) * 0.8f) * Projectile.Opacity; + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 4f; + + internal Color BackgroundColorFunction(float completionRatio) + { + Color color = Color.CornflowerBlue * Projectile.Opacity * 0.4f; + return color; + } + + public override bool PreDraw(ref Color lightColor) + { + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + if (LightningBackgroundDrawer is null) + LightningBackgroundDrawer = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + + Projectile orbToAttachTo = GetOrbToAttachTo(); + if (orbToAttachTo != null) + { + List arcPoints = AresTeslaOrb.DetermineElectricArcPoints(Projectile.Center, orbToAttachTo.Center, 117); + LightningBackgroundDrawer.Draw(arcPoints, -Main.screenPosition, 90); + LightningDrawer.Draw(arcPoints, -Main.screenPosition, 90); + } + + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + + float _ = 0f; + Projectile orbToAttachTo = GetOrbToAttachTo(); + if (orbToAttachTo != null && Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, orbToAttachTo.Center, 8f, ref _)) + return true; + + return false; + } + } +} diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 97ca60f58d..a2db6cf144 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = 4; Projectile.height = 4; - Projectile.aiStyle = 48; + Projectile.aiStyle = ProjAIStyleID.Ray; Projectile.friendly = true; Projectile.minion = true; Projectile.minionSlots = 0f; diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 39ced8bb1d..ca842a9243 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots = 0f; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 2a457faa01..f93159a9de 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using System; using Terraria; @@ -12,6 +14,7 @@ namespace CalamityMod.Projectiles.Summon public class TacticalPlagueJet : ModProjectile { public static Item FalseGun = null; + public static Item PlagueEngine = null; public override void SetStaticDefaults() { @@ -39,15 +42,20 @@ namespace CalamityMod.Projectiles.Summon // Defines an Item which is a hacked clone of a P90, edited to be summon class instead of ranged. // The false gun's damage is changed to the appropriate value every time a Tactical Plague Jet wants to fire a bullet. - private static void DefineFalseGun() + private static void DefineFalseGun(int baseDamage) { - int p90ID = ModContent.ItemType(); + int p90ID = ModContent.ItemType(); + int TPEID = ModContent.ItemType(); FalseGun = new Item(); + PlagueEngine = new Item(); FalseGun.SetDefaults(p90ID, true); + PlagueEngine.SetDefaults(TPEID, true); + FalseGun.damage = baseDamage; + FalseGun.knockBack = PlagueEngine.knockBack; + FalseGun.shootSpeed = PlagueEngine.shootSpeed; FalseGun.consumeAmmoOnFirstShotOnly = false; FalseGun.consumeAmmoOnLastShotOnly = false; - // FalseGun.ranged = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; FalseGun.DamageType = DamageClass.Summon; } @@ -72,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon // Construct a fake item to use with vanilla code for the sake of firing bullets. if (FalseGun is null) - DefineFalseGun(); + DefineFalseGun(Projectile.originalDamage); Projectile.localAI[0] = 1f; } @@ -174,14 +182,14 @@ namespace CalamityMod.Projectiles.Summon } // Fire the selected bullet, nothing special. - else { - projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, Projectile.owner);} + else + projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, Projectile.owner); // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. if (projIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projIndex].DamageType = DamageClass.Summon; - Main.projectile[projIndex].originalDamage = Projectile.originalDamage; + Main.projectile[projIndex].minion = false; } } diff --git a/Projectiles/Summon/UniverseSplitterField.cs b/Projectiles/Summon/UniverseSplitterField.cs index 41d8ff0ef3..9e71901e7d 100644 --- a/Projectiles/Summon/UniverseSplitterField.cs +++ b/Projectiles/Summon/UniverseSplitterField.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.knockBack, Projectile.owner, (-Vector2.Normalize(offset)).ToRotation()); - Main.projectile[beam].originalDamage = Projectile.damage; + Main.projectile[beam].originalDamage = Projectile.originalDamage; } } // Summon a giant beam @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.knockBack, Projectile.owner, 0f); - Main.projectile[beam].originalDamage = Projectile.damage; + Main.projectile[beam].originalDamage = Projectile.originalDamage; } } diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs index fa8b090ce4..9efc2d77de 100644 --- a/Projectiles/Summon/UrchinSpike.cs +++ b/Projectiles/Summon/UrchinSpike.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minionSlots = 0f; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/ViridVanguardBlade.png b/Projectiles/Summon/ViridVanguardBlade.png index 400382aa1c..dadc21641b 100644 Binary files a/Projectiles/Summon/ViridVanguardBlade.png and b/Projectiles/Summon/ViridVanguardBlade.png differ diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index 016cc9ada0..cfc707603a 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon } Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f); Projectile.frameCounter++; - if (Projectile.frameCounter > 8) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; diff --git a/Projectiles/Summon/WitherBolt.cs b/Projectiles/Summon/WitherBolt.cs index 241e6cd0c1..99c44f9c0d 100644 --- a/Projectiles/Summon/WitherBolt.cs +++ b/Projectiles/Summon/WitherBolt.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2CircularEdge(8f, 8f); int seeker = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); - Main.projectile[seeker].originalDamage = Projectile.damage / 2; + Main.projectile[seeker].originalDamage = Projectile.originalDamage / 2; Main.projectile[seeker].DamageType = DamageClass.Summon; } } diff --git a/Projectiles/Summon/WulfrumBoltMinion.cs b/Projectiles/Summon/WulfrumBoltMinion.cs deleted file mode 100644 index bf1b684315..0000000000 --- a/Projectiles/Summon/WulfrumBoltMinion.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class WulfrumBoltMinion : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.minionSlots = 0f; - Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.1f / 255f, 0f); - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f); - Main.dust[num155].noGravity = true; - Main.dust[num155].noLight = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noLight = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; - return; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index 83bedff251..15adaa6546 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -4,12 +4,97 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using Terraria.Audio; +using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Accessories; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.Graphics.Effects; +using static Terraria.ModLoader.ModContent; +using ReLogic.Content; +using System.IO; namespace CalamityMod.Projectiles.Summon { public class WulfrumDroid : ModProjectile { - public float dust = 0f; + public static readonly SoundStyle HelloSound = new("CalamityMod/Sounds/Custom/WulfrumDroidSpawnBeep") { PitchVariance = 0.4f }; + public static readonly SoundStyle PewSound = new("CalamityMod/Sounds/Custom/WulfrumDroidFire") { PitchVariance = 0.4f, Volume = 0.6f, MaxInstances = 0 }; + public static readonly SoundStyle RandomChirpSound = new("CalamityMod/Sounds/Custom/WulfrumDroidChirp", 4) { PitchVariance = 0.3f }; + public static readonly SoundStyle HurrySound = new("CalamityMod/Sounds/Custom/WulfrumDroidHurry", 2) { PitchVariance = 0.3f }; + public static readonly SoundStyle RepairSound = new("CalamityMod/Sounds/Custom/WulfrumDroidRepair") { Volume = 0.8f, PitchVariance = 0.3f, SoundLimitBehavior = SoundLimitBehavior.IgnoreNew }; + public int NewSoundDelay + { + get + { + int minionCount = 1; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.active && proj.owner == Owner.whoAmI && proj.type == Type && proj.whoAmI != Projectile.whoAmI) + { + minionCount++; + } + } + + return (int)(Main.rand.Next(340, 1460) * minionCount); + } + } + + internal PrimitiveTrail TrailDrawer; + internal Color PrimColorMult; + public Player healedPlayer; + + public float Initialized = 0f; + public static float AggroRange = 450f; + public static float ShootDelay = 110f; //This is the max delay, but it can b e shorter + public enum BehaviorState { Aggressive, Idle }; + public BehaviorState State + { + get => (BehaviorState)(int)Projectile.ai[0]; + + set => Projectile.ai[0] = (float)value; + } + + public ref float ShootTimer => ref Projectile.ai[1]; + + public ref float AyeAyeCaptainCooldown => ref Projectile.localAI[0]; + public ref float NuzzleFlashTime => ref Projectile.localAI[1]; + + public float BuffModeBuffer = 0f; + + public NPC Target + { + get + { + NPC target = null; + + if (Owner.HasMinionAttackTargetNPC) + target = CheckNPCTargetValidity(Main.npc[Owner.MinionAttackTargetNPC]); + + if (target != null) + return target; + + else + { + for (int npcIndex = 0; npcIndex < Main.npc.Length; npcIndex++) + { + target = CheckNPCTargetValidity(Main.npc[npcIndex]); + if (target != null) + return target; + } + } + + return null; + } + } + + public Player Owner => Main.player[Projectile.owner]; + + public static Asset SheenTex; + public override void SetStaticDefaults() { @@ -33,178 +118,410 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Initialized = 0f; + } + + //Returns the npc if targetable, returns null if not + public NPC CheckNPCTargetValidity(NPC potentialTarget) + { + if (potentialTarget.CanBeChasedBy(this, false)) + { + float targetDist = Vector2.Distance(potentialTarget.Center, Projectile.Center); + + if ((targetDist < AggroRange) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) + { + return potentialTarget; + } + } + + return null; } public override void AI() { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (dust == 0f) + + //Spawn dust + if (Initialized == 0f) { - int dustAmt = 36; + int dustAmt = Main.rand.Next(10, 16); for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 dustVel = source - Projectile.Center; - int green = Dust.NewDust(source + dustVel, 0, 0, 61, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); - Main.dust[green].noGravity = true; - Main.dust[green].noLight = true; - Main.dust[green].velocity = dustVel; + Vector2 direction = Main.rand.NextVector2CircularEdge(1f, 1f); + + Dust wishyDust = Dust.NewDustPerfect(Projectile.Center + direction * Main.rand.NextFloat(1f, 8f), 229, Alpha : 100, Scale: Main.rand.NextFloat(1f, 1.4f)); + wishyDust.noGravity = true; + wishyDust.noLight = true; + wishyDust.velocity = direction * Main.rand.NextFloat(2f, 4); } - dust += 1f; + + SoundEngine.PlaySound(HelloSound, Projectile.Center); + Projectile.soundDelay = NewSoundDelay; + ShootTimer = ShootDelay; + + Initialized ++; } + + if (Owner.Calamity().mouseRight && Owner.HeldItem.type == ModContent.ItemType()) + { + if (BuffModeBuffer > 0) + { + BuffModeBuffer--; + Projectile.netUpdate = true; + } + } + + else if (BuffModeBuffer < 15) + BuffModeBuffer = 15; + + bool buffMode = BuffModeBuffer <= 0; + + //Do frame stuff i guess + Projectile.frame = Projectile.frame % (Main.projFrames[Projectile.type] / 2); + Projectile.frameCounter++; if (Projectile.frameCounter > 8) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + if (Projectile.frame >= Main.projFrames[Projectile.type] / 2) { Projectile.frame = 0; } - bool correctMinion = Projectile.type == ModContent.ProjectileType(); + + if (buffMode) + Projectile.frame += Main.projFrames[Projectile.type] / 2; + + + //Buff stuff player.AddBuff(ModContent.BuffType(), 3600); - if (correctMinion) - { - if (player.dead) - { - modPlayer.wDroid = false; - } - if (modPlayer.wDroid) - { - Projectile.timeLeft = 2; - } - } + if (player.dead) + modPlayer.wDroid = false; + if (modPlayer.wDroid) + Projectile.timeLeft = 2; Projectile.MinionAntiClump(); - Vector2 targetVector = Projectile.position; - float range = 450f; - bool foundTarget = false; - int targetIndex = -1; - if (player.HasMinionAttackTargetNPC) + + + //Lets only recalculate our target once per frame aight + NPC targetCache = buffMode ? null : Target; + float separationAnxietyDist = targetCache != null ? 1000f : 500f; //Have more lenience on how far away from the player should the drone return if theyre attacking an enemy + + if (AyeAyeCaptainCooldown > 0) + AyeAyeCaptainCooldown--; + else if (buffMode) { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy((object) this, false)) - { - float targetDist = Vector2.Distance(npc.Center, Projectile.Center); - if ((!foundTarget && targetDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - range = targetDist; - targetVector = npc.Center; - foundTarget = true; - targetIndex = npc.whoAmI; - } - } - } - if (!foundTarget) - { - for (int npcIndex = 0; npcIndex < Main.npc.Length; ++npcIndex) - { - NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy((object) this, false)) - { - float targetDist = Vector2.Distance(npc.Center, Projectile.Center); - if ((!foundTarget && targetDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - range = targetDist; - targetVector = npc.Center; - foundTarget = true; - targetIndex = npcIndex; - } - } - } - } - float separationAnxietyDist = 500f; - if (foundTarget) - separationAnxietyDist = 1000f; - if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) - { - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - if (Projectile.ai[0] == 1f) - Projectile.tileCollide = false; - if (foundTarget && Projectile.ai[0] == 0f) - { - Vector2 targetPos = targetVector - Projectile.Center; - float targetDist = targetPos.Length(); - targetPos.Normalize(); - if (targetDist > 200f) - { - float speed = 6f; - Vector2 goToTarget = targetPos * speed; - Projectile.velocity.X = (Projectile.velocity.X * 40f + goToTarget.X) / 41f; - Projectile.velocity.Y = (Projectile.velocity.Y * 40f + goToTarget.Y) / 41f; - } - else if (Projectile.velocity.Y > -1f) - Projectile.velocity.Y -= 0.1f; + SoundEngine.PlaySound(RepairSound, Projectile.Center); + AyeAyeCaptainCooldown = 100; } + + if (Projectile.soundDelay > 0) + Projectile.soundDelay--; else { - if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) - Projectile.ai[0] = 1f; - float returnSpeed = 6f; - if (Projectile.ai[0] == 1f) - returnSpeed = 15f; - Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, -60f); + SoundEngine.PlaySound(RandomChirpSound with { Volume = RandomChirpSound.Volume * Main.rand.NextFloat(0.5f, 1f) }, Projectile.Center); + Projectile.soundDelay = NewSoundDelay; + + if (targetCache == null) + { + Vector2 emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 0.7f); + + Particle emote = new WulfrumDroidEmote(Projectile.Center + emoteDirection * 10f, emoteDirection * Main.rand.NextFloat(3f, 5f), Main.rand.Next(30, 65), Main.rand.NextFloat(1.4f, 2f)); + GeneralParticleHandler.SpawnParticle(emote); + } + } + + + //Return to the player if too far away from them. Hurry up droids! + if (Vector2.Distance(Owner.Center, Projectile.Center) > separationAnxietyDist) + { + State = BehaviorState.Idle; + Projectile.netUpdate = true; + + //play the hurry sound once and never again until it is reset + if (Projectile.soundDelay < 10000) + SoundEngine.PlaySound(HurrySound, Projectile.Center); + + Projectile.soundDelay = 10010; + + if (Main.rand.NextBool(7)) + { + Vector2 emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 0.7f); + emoteDirection.X -= Math.Sign(Projectile.velocity.X) * 1f; + + Particle emote = new WulfrumDroidSweatEmote(Projectile.Center + emoteDirection * 10f, emoteDirection * Main.rand.NextFloat(3f, 5f), Main.rand.Next(20, 35), Main.rand.NextFloat(1.4f, 2f)); + GeneralParticleHandler.SpawnParticle(emote); + } + } + //If not hurrying up, reset the sound delay. + else if (Projectile.soundDelay >= 10000) + Projectile.soundDelay = NewSoundDelay; + + + //Target the enemy + if (targetCache != null && State == BehaviorState.Aggressive) + { + Vector2 vectorToTarget = targetCache.Center - Projectile.Center; + float distanceToTarget = vectorToTarget.Length(); + vectorToTarget = vectorToTarget.SafeNormalize(Vector2.Zero); + + //Accelerate towards target if far away + if (distanceToTarget > 200f) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, vectorToTarget * 6f, 1 / 41f); + + //"Float" the minion + else if (Projectile.velocity.Y > -1f) + Projectile.velocity.Y -= 0.1f; + + //Small tweak that makes the minion hop away from the targets center if its too aligned with it vertically + if (Math.Abs(Projectile.Center.X - targetCache.Center.X) < 10f) + Projectile.velocity.X += 4f * Math.Sign(Projectile.Center.X - targetCache.Center.X); + } + + else + { + //Become passive if theres obstruction between it and the player + if (!Collision.CanHitLine(Projectile.Center, 1, 1, Owner.Center, 1, 1)) + State = BehaviorState.Idle; + + float returnSpeed = State == BehaviorState.Idle ? 15f : 6f; + + //Accelerate towards the player if too far & not fast enough + Vector2 playerVec = Owner.Center - Projectile.Center - Vector2.UnitY * 60f; float playerDist = playerVec.Length(); if (playerDist > 200f && returnSpeed < 9f) returnSpeed = 9f; - if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + + if (playerDist < 100f && State == BehaviorState.Idle && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - Projectile.ai[0] = 0f; + State = BehaviorState.Aggressive; Projectile.netUpdate = true; } + + //Teleport to player if too far away. if (playerDist > 2000f) { - Projectile.position.X = player.Center.X - (float) (Projectile.width / 2); - Projectile.position.Y = player.Center.Y - (float) (Projectile.width / 2); + Projectile.Center = player.Center; Projectile.netUpdate = true; } - else if (playerDist > 70f) + + else if (buffMode) { - playerVec.Normalize(); - Projectile.velocity = (Projectile.velocity * 20f + playerVec * returnSpeed) / 21f; + AyeAyeCaptainCooldown = 50f; + + Player playerToBuff = Owner; + float mouseDistanceToOwner = (Owner.MountedCenter - Owner.Calamity().mouseWorld).Length(); + + if (Main.netMode == NetmodeID.MultiplayerClient && mouseDistanceToOwner > 120f) + { + for (int i = 0; i < Main.maxPlayers; i++) + { + if (Main.player[i].active && !Main.player[i].dead && (Main.player[i].team == Owner.team || Main.player[i].team == 0)) + { + float mouseDistanceToPotentialTarget = (Main.player[i].MountedCenter - Owner.Calamity().mouseWorld).Length(); + if (mouseDistanceToPotentialTarget < 120f && mouseDistanceToOwner > mouseDistanceToPotentialTarget) + { + playerToBuff = Main.player[i]; + mouseDistanceToOwner = mouseDistanceToPotentialTarget; + } + } + } + + if (playerToBuff != Owner && Main.rand.NextBool(4)) + { + Vector2 direction = Main.rand.NextVector2CircularEdge(1f, 1f); + + Dust wishyDust = Dust.NewDustPerfect(playerToBuff.Center + direction * Main.rand.NextFloat(4f, 9f), 229, Alpha: 100, Scale: Main.rand.NextFloat(1f, 1.4f)); + wishyDust.noGravity = true; + wishyDust.noLight = true; + wishyDust.velocity = direction * Main.rand.NextFloat(2f, 4); + + } + } + + healedPlayer = playerToBuff; + float distanceToHealed = (healedPlayer.Center - Projectile.Center).Length(); + Vector2 aimPosition = playerToBuff.MountedCenter - Vector2.UnitY.RotatedBy((float)Math.Sin(Main.GlobalTimeWrappedHourly + Projectile.whoAmI) * MathHelper.PiOver2 * 0.9f) * 60f - Vector2.UnitY * 20f; + float distanceToAim = (aimPosition - Projectile.Center).Length(); + + if (distanceToAim > 50) + { + float speed = MathHelper.Lerp(10f, 30f, Math.Clamp((distanceToAim - 110f) / 400f, 0f, 1f)); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, (aimPosition - Projectile.Center).SafeNormalize(Vector2.Zero) * speed, 0.05f); + } + + else + { + Projectile.velocity *= 0.98f; + if (Projectile.velocity == Vector2.Zero) + Projectile.velocity = (aimPosition - Projectile.Center).SafeNormalize(Vector2.Zero) * 5f; + } + + if (distanceToHealed < 200f) + { + //Heal player + playerToBuff.GetModPlayer().buffingDrones++; + + ShootTimer--; + if (ShootTimer <= 0) + { + ShootTimer = ShootDelay; + + if (Main.rand.NextBool(3)) + { + RoverDrivePlayer shieldMan = playerToBuff.GetModPlayer(); + if (shieldMan.ProtectionMatrixDurability > 0 && shieldMan.ProtectionMatrixDurability < RoverDrive.ProtectionMatrixDurabilityMax) + { + shieldMan.ProtectionMatrixDurability++; + if (playerToBuff.Calamity().cooldowns.TryGetValue(Cooldowns.WulfrumRoverDriveDurability.ID, out var cd)) + cd.timeLeft = shieldMan.ProtectionMatrixDurability; + } + } + } + } } + else { - if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) + //Aim towards the top of the player + if (playerDist > 70f) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, playerVec.SafeNormalize(Vector2.Zero) * returnSpeed, 1 / 21f); + + else { - Projectile.velocity.X = -0.15f; - Projectile.velocity.Y = -0.05f; + //Get unstuck if your movespeed is zero + if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) + Projectile.velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * -0.15f; + + //Accelerate more + Projectile.velocity *= 1.01f; } - Projectile.velocity *= 1.01f; } } + Projectile.rotation = Projectile.velocity.X * 0.05f; - if (Projectile.velocity.X > 0f) - Projectile.spriteDirection = Projectile.direction = 1; - else if (Projectile.velocity.X < 0f) - Projectile.spriteDirection = Projectile.direction = -1; - if (Projectile.ai[1] > 0f) - Projectile.ai[1] += (float) Main.rand.Next(1, 4); - if (Projectile.ai[1] > 90f) + Projectile.spriteDirection = Projectile.direction = Math.Sign(Projectile.velocity.X); + + if (!buffMode) + ChargeUpAndFire(targetCache); + } + + public void ChargeUpAndFire(NPC targetCache) + { + //Decrease the timer by a random number + ShootTimer -= Main.rand.Next(1, 4); + + + if (ShootTimer <= 0) { - Projectile.ai[1] = 0.0f; + ShootTimer = ShootDelay; Projectile.netUpdate = true; + + //Don't shoot if no target. + if (targetCache == null) + return; + + NuzzleFlashTime = 20f; + SoundEngine.PlaySound(PewSound, Projectile.Center); + //Recoil + Vector2 velocity = targetCache.Center - Projectile.Center; + velocity.Normalize(); + velocity *= 10f; + Projectile.velocity += velocity * -0.3f; + + + if (Main.myPlayer == Projectile.owner) + { + int bolt = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[bolt].originalDamage = Projectile.originalDamage; + Main.projectile[bolt].netUpdate = true; + Projectile.netUpdate = true; + } + } + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = 0.4f + 0.4f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f + completionRatio * -12f) * 0.5f + 0.5f); + + fadeOpacity *= (1 - MathHelper.Clamp(((healedPlayer.Center - Projectile.Center).Length() - 170f) / 70f, 0f, 1f)); + + return Color.CornflowerBlue.MultiplyRGB(PrimColorMult) * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return (3.4f + 4f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f + completionRatio * -12f) * 0.5f + 0.5f)) * 2f; + } + + + public override bool PreDraw(ref Color lightColor) + { + if (healedPlayer == null) + healedPlayer = Owner; + + if (BuffModeBuffer <= 0 && (healedPlayer.Center - Projectile.Center).Length() < 240f) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/ZapTrail")); + + Vector2[] drawPos = new Vector2[] { Projectile.Center, Projectile.Center, healedPlayer.Center + (Projectile.Center - healedPlayer.Center) * 0.5f + Vector2.UnitY * 40f, healedPlayer.Center, healedPlayer.Center }; + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1.8f, delegate (Vector2 offset, Color colorMod) + { + PrimColorMult = colorMod; + TrailDrawer.Draw(drawPos, - Main.screenPosition + offset, 30); + }); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + } + return true; + } + + public override void PostDraw(Color lightColor) + { + if (NuzzleFlashTime > 0) + { + NuzzleFlashTime--; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + float opacity = (float)Math.Pow(NuzzleFlashTime / 20f, 1.7f); + + if (SheenTex == null) + SheenTex = ModContent.Request("CalamityMod/Particles/HalfStar"); + + Texture2D shineTex = SheenTex.Value; + Vector2 shineScale = new Vector2(1.2f, 2f - (opacity) * 1.33f); + //float rotationBoost = opacity * MathHelper.PiOver2; + + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition + Vector2.UnitY * 2f, null, Color.GreenYellow * opacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + //Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition + Vector2.UnitY * 2f, null, Color.GreenYellow * opacity, rotationBoost + 0.3f, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } - if (Projectile.ai[1] != 0f) - return; - ++Projectile.ai[1]; - if (Main.myPlayer != Projectile.owner) - return; - if (!foundTarget) - return; - Vector2 velocity = targetVector - Projectile.Center; - velocity.Normalize(); - velocity *= 10f; - int bolt = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Main.projectile[bolt].originalDamage = Projectile.originalDamage; - Main.projectile[bolt].netUpdate = true; - Projectile.netUpdate = true; } public override bool? CanDamage() => false; + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(BuffModeBuffer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + BuffModeBuffer = reader.ReadSingle(); + } } } diff --git a/Projectiles/Summon/WulfrumEnergyBurst.cs b/Projectiles/Summon/WulfrumEnergyBurst.cs new file mode 100644 index 0000000000..a18c0dd266 --- /dev/null +++ b/Projectiles/Summon/WulfrumEnergyBurst.cs @@ -0,0 +1,216 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using System; +using CalamityMod.Particles; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; +using Terraria.Graphics.Shaders; +using Terraria.Graphics.Effects; +using ReLogic.Content; + +namespace CalamityMod.Projectiles.Summon +{ + public class WulfrumEnergyBurst : ModProjectile + { + public ref float OriginalRotation => ref Projectile.ai[0]; + public NPC Target + { + get + { + if (Projectile.ai[1] < 0 || Projectile.ai[1] > Main.maxNPCs) + return null; + + return Main.npc[(int)Projectile.ai[1]]; + } + set + { + if (value == null) + Projectile.ai[1] = -1; + else + Projectile.ai[1] = value.whoAmI; + } + } + + public static float MaxDeviationAngle = MathHelper.PiOver4; + public static float HomingRange = 350; + public static float HomingAngle = MathHelper.PiOver4 * 1f; + + internal PrimitiveTrail TrailDrawer; + internal Color PrimColorMult = Color.White; + + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.MinionShot[Projectile.type] = true; + + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.minionSlots = 0f; + Projectile.minion = true; + Projectile.DamageType = DamageClass.Summon; + + Projectile.timeLeft = 140; + Projectile.extraUpdates = 2; + + + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public NPC FindTarget() + { + float bestScore = 0; + NPC bestTarget = null; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC potentialTarget = Main.npc[i]; + + if (!potentialTarget.CanBeChasedBy(null, false)) + continue; + + float distance = potentialTarget.Distance(Projectile.Center); + float angle = Projectile.velocity.AngleBetween((potentialTarget.Center - Projectile.Center)); + + float extraDistance = potentialTarget.width / 2 + potentialTarget.height / 2; + + if (distance - extraDistance < HomingRange && angle < HomingAngle / 2f) + { + if (!Collision.CanHit(Projectile.Center, 1, 1, potentialTarget.Center, 1, 1) && extraDistance < distance) + continue; + + float attemptedScore = EvaluatePotentialTarget(distance - extraDistance, angle / 2f); + if (attemptedScore > bestScore) + { + bestTarget = potentialTarget; + bestScore = attemptedScore; + } + } + } + return bestTarget; + + } + + public float EvaluatePotentialTarget(float distance, float angle) + { + float score = 1 - distance / HomingRange * 0.5f; + + score += (1 - Math.Abs(angle) / (HomingAngle / 2f)) * 0.5f; + + return score; + } + + public override void AI() + { + if (Projectile.timeLeft == 140) + { + if (OriginalRotation == 0) + { + OriginalRotation = Projectile.velocity.ToRotation(); + Projectile.rotation = OriginalRotation; + } + Target = null; + } + else + { + Target = FindTarget(); + } + + Lighting.AddLight(Projectile.Center, (Color.GreenYellow * 0.8f).ToVector3() * 0.5f); + + if (Target != null) + { + float distanceFromTarget = (Target.Center - Projectile.Center).Length(); + + Projectile.rotation = Projectile.rotation.AngleTowards((Target.Center - Projectile.Center).ToRotation(), 0.07f * (float)Math.Pow((1 - distanceFromTarget / HomingRange), 2)); + } + + Projectile.velocity *= 1.01f; + Projectile.velocity = Projectile.rotation.ToRotationVector2() * Projectile.velocity.Length(); + + //Blast off. + if (Projectile.timeLeft == 140) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity * 1f; + + for (int i = 0; i < 5; i++) + { + Dust chust = Dust.NewDustPerfect(dustCenter, 178, Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.2f, 0.5f), Scale: Main.rand.NextFloat(1f, 1.2f)); + chust.noGravity = true; + } + } + + if (Projectile.timeLeft <= 137) + { + if (Main.rand.NextBool(4)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 178, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f), Scale: Main.rand.NextFloat(0.6f, 1.15f)); + chust.noGravity = true; + } + + if (Main.rand.NextBool(4)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust largeDust = Dust.NewDustPerfect(dustCenter, 178, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.4f), Scale: Main.rand.NextFloat(0.4f, 1f)); + largeDust.noGravity = true; + largeDust.noLight = true; + } + } + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Sqrt(1 - completionRatio); + return Color.Chartreuse.MultiplyRGB(PrimColorMult) * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return 9.4f; + } + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/ZapTrail")); + + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1.5f, delegate (Vector2 offset, Color colorMod) + { + PrimColorMult = colorMod; + + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + offset, 30); + }); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Texture2D tex = ModContent.Request(Texture).Value; + float stretchy = MathHelper.Clamp((Projectile.velocity.Length() - 6f) / 16f, 0f, 1f); + Vector2 scale = new Vector2(1f + stretchy * -0.2f, stretchy * 0.5f + 1f); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation + MathHelper.PiOver2, tex.Size() / 2f, Projectile.scale * scale, SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Summon/WulfrumEnergyBurst.png b/Projectiles/Summon/WulfrumEnergyBurst.png new file mode 100644 index 0000000000..0afbd7a453 Binary files /dev/null and b/Projectiles/Summon/WulfrumEnergyBurst.png differ diff --git a/Projectiles/Summon/WulfrumFusionBolt.cs b/Projectiles/Summon/WulfrumFusionBolt.cs new file mode 100644 index 0000000000..90816ccd9b --- /dev/null +++ b/Projectiles/Summon/WulfrumFusionBolt.cs @@ -0,0 +1,230 @@ +using System; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Summon +{ + //Mostly a retread of the magic one, with altered visuals + public class WulfrumFusionBolt : ModProjectile + { + public ref float OriginalRotation => ref Projectile.ai[0]; + public NPC Target + { + get + { + if (Projectile.ai[1] < 0 || Projectile.ai[1] > Main.maxNPCs) + return null; + + return Main.npc[(int)Projectile.ai[1]]; + } + set + { + if (value == null) + Projectile.ai[1] = -1; + else + Projectile.ai[1] = value.whoAmI; + } + } + + public static float MaxDeviationAngle = MathHelper.PiOver4; + public static float HomingRange = 250; + public static float HomingAngle = MathHelper.PiOver4 * 1.65f; + + internal PrimitiveTrail TrailDrawer; + internal Color PrimColorMult = Color.White; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fusion Bolt"); + + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 140; + Projectile.extraUpdates = 2; + } + + public NPC FindTarget() + { + float bestScore = 0; + NPC bestTarget = null; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC potentialTarget = Main.npc[i]; + + if (!potentialTarget.CanBeChasedBy(null, false)) + continue; + + float distance = potentialTarget.Distance(Projectile.Center); + float angle = Projectile.velocity.AngleBetween((potentialTarget.Center - Projectile.Center)); + + float extraDistance = potentialTarget.width / 2 + potentialTarget.height / 2; + + if (distance - extraDistance < HomingRange && angle < HomingAngle / 2f) + { + if (!Collision.CanHit(Projectile.Center, 1, 1, potentialTarget.Center, 1, 1) && extraDistance < distance) + continue; + + float attemptedScore = EvaluatePotentialTarget(distance - extraDistance, angle / 2f); + if (attemptedScore > bestScore) + { + bestTarget = potentialTarget; + bestScore = attemptedScore; + } + } + } + return bestTarget; + + } + + public float EvaluatePotentialTarget(float distance, float angle) + { + float score = 1 - distance / HomingRange * 0.5f; + + score += (1 - Math.Abs(angle) / (HomingAngle / 2f)) * 0.5f; + + return score; + } + + public override void AI() + { + if (Projectile.timeLeft == 140) + { + Projectile.rotation = Projectile.velocity.ToRotation(); + + Target = null; + } + else + { + Target = FindTarget(); + } + + Lighting.AddLight(Projectile.Center, (Color.DeepSkyBlue).ToVector3() * 0.5f); + + if (Target != null) + { + float distanceFromTarget = (Target.Center - Projectile.Center).Length(); + Projectile.rotation = Projectile.rotation.AngleTowards((Target.Center - Projectile.Center).ToRotation(), 0.07f * (float)Math.Pow(( 1 - distanceFromTarget / HomingRange), 2)); + } + + Projectile.velocity *= 0.983f; + Projectile.velocity = Projectile.rotation.ToRotationVector2() * Projectile.velocity.Length(); + + //Blast off. + if (Projectile.timeLeft == 140) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity * 1f; + + for (int i = 0; i < 5; i++) + { + Dust chust = Dust.NewDustPerfect(dustCenter, 15, Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.2f, 0.5f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + } + } + + if (Projectile.timeLeft <= 137) + { + if (Main.rand.NextBool(5)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + } + + if (Main.rand.NextBool(8)) + { + Vector2 dustCenter = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Dust largeDust = Dust.NewDustPerfect(dustCenter, 257, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.4f), Scale: Main.rand.NextFloat(0.4f, 1f)); + largeDust.noGravity = true; + largeDust.noLight = true; + } + + if (Main.rand.NextBool(5)) + { + Vector2 center = Projectile.Center + Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(-3f, 3f); + + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(4, 10); + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(center, velocity, Main.rand.NextFloat(1f, 2f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25)); + + } + } + } + + internal Color ColorFunction(float completionRatio) + { + float fadeOpacity = (float)Math.Sqrt(1 - completionRatio); + return Color.Lerp(Color.DeepSkyBlue, Color.YellowGreen, Projectile.timeLeft / 140f).MultiplyRGB(PrimColorMult) * fadeOpacity; + } + + internal float WidthFunction(float completionRatio) + { + return 6.4f; + } + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/BasicTrail")); + CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 0.5f, delegate (Vector2 offset, Color colorMod) + { + PrimColorMult = colorMod; + + TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition + offset, 30); + }); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + return false; + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(WulfrumProsthesis.HitSound with { Volume = WulfrumProsthesis.HitSound.Volume * 0.6f }, Projectile.Center); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + return base.OnTileCollide(oldVelocity); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.player[Projectile.owner].MinionAttackTargetNPC = target.whoAmI; //There exists a "whoAmIToTargettingIndex but idk if thats needed question mark + + int numParticles = Main.rand.Next(1, 3); + for (int i = 0; i < numParticles; i++) + { + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(3, 14); + GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(target.Center, velocity, Main.rand.NextFloat(2.5f, 3f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25)); + } + } + } +} diff --git a/Projectiles/Typeless/AstralFallingSand.png b/Projectiles/Typeless/AstralFallingSand.png index 1ca14800e4..b174c0674f 100644 Binary files a/Projectiles/Typeless/AstralFallingSand.png and b/Projectiles/Typeless/AstralFallingSand.png differ diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index a8bec55145..1dc82b4472 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.alpha = 50; Projectile.penetrate = 1; Projectile.tileCollide = false; + Projectile.timeLeft = 300; } public override void AI() diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index 466fc4371a..a6c7059a7e 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Typeless { BossRushEvent.End(); Player p = Main.LocalPlayer; - DropHelper.DropItem(p.GetSource_Misc(ModContent.ItemType().ToString()), p, ModContent.ItemType()); + p.QuickSpawnItemDirect(p.GetSource_Misc("CalamityMod_BossRushRock"), ModContent.ItemType()); CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFiveEndText", BossRushEvent.XerocTextColor); } } diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index b9242b74b1..9e155022bc 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -32,6 +32,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = Lifetime; } + public override bool? CanHitNPC(NPC target) => !target.CountsAsACritter && !target.friendly && target.chaseable; + public override void AI() { Projectile.Opacity = 1f - (float)Math.Pow(LifetimeCompletion, 1.56); diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index dfc1348387..b90996d2b0 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.friendly = true; Projectile.penetrate = -1; diff --git a/Projectiles/Typeless/DevourerofCodsBobber.cs b/Projectiles/Typeless/DevourerofCodsBobber.cs index a5f9b8239f..ae2812ddb1 100644 --- a/Projectiles/Typeless/DevourerofCodsBobber.cs +++ b/Projectiles/Typeless/DevourerofCodsBobber.cs @@ -1,8 +1,9 @@ +using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index 171e30fc7c..a93f1561e9 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -87,12 +87,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 0; - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Typeless/EarlyBloomBobber.cs b/Projectiles/Typeless/EarlyBloomBobber.cs index 2327cc3718..0fed5e398d 100644 --- a/Projectiles/Typeless/EarlyBloomBobber.cs +++ b/Projectiles/Typeless/EarlyBloomBobber.cs @@ -1,7 +1,8 @@ +using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class EarlyBloomBobber : ModProjectile @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/FeralDoubleBobber.cs b/Projectiles/Typeless/FeralDoubleBobber.cs index a7ebc055a1..61a2cb3c10 100644 --- a/Projectiles/Typeless/FeralDoubleBobber.cs +++ b/Projectiles/Typeless/FeralDoubleBobber.cs @@ -1,7 +1,8 @@ +using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class FeralDoubleBobber : ModProjectile @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs index 48b9e5bd7a..5e17bbee99 100644 --- a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs +++ b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse Projectile.extraUpdates = 10; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Typeless/FiniteUse/MagnumRound.cs b/Projectiles/Typeless/FiniteUse/MagnumRound.cs index 6be383cdbb..b6a62372f5 100644 --- a/Projectiles/Typeless/FiniteUse/MagnumRound.cs +++ b/Projectiles/Typeless/FiniteUse/MagnumRound.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse Projectile.extraUpdates = 10; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs similarity index 87% rename from Projectiles/Summon/FungalClumpMinion.cs rename to Projectiles/Typeless/FungalClumpMinion.cs index 7f16ad3163..8a71041e9d 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -6,7 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon +namespace CalamityMod.Projectiles.Typeless { public class FungalClumpMinion : ModProjectile { @@ -15,25 +15,23 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Clump"); + Main.projFrames[Projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = 40; - Projectile.height = 40; + Projectile.width = 50; + Projectile.height = 50; Projectile.netImportant = true; Projectile.friendly = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.minionSlots = 0f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.timeLeft *= 5; - Projectile.minion = true; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Summon; } public override void AI() @@ -59,19 +57,33 @@ namespace CalamityMod.Projectiles.Summon } } + Projectile.damage = (int)player.GetBestClassDamage().ApplyTo(Projectile.originalDamage); + + //Animation + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + //Initializing dust and damage if (Projectile.localAI[0] == 0f) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int i = 0; i < dustAmt; i++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 56, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 spawnPos = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + spawnPos = spawnPos.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 velocity = spawnPos - Projectile.Center; + int idx = Dust.NewDust(spawnPos + velocity, 0, 0, 56, velocity.X * 1.5f, velocity.Y * 1.5f, 100, default, 1.4f); + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + Main.dust[idx].velocity = velocity; } Projectile.localAI[0] += 1f; } diff --git a/Projectiles/Typeless/FungalClumpMinion.png b/Projectiles/Typeless/FungalClumpMinion.png new file mode 100644 index 0000000000..9b215b042b Binary files /dev/null and b/Projectiles/Typeless/FungalClumpMinion.png differ diff --git a/Projectiles/Typeless/HeronBobber.cs b/Projectiles/Typeless/HeronBobber.cs index c11f72b6f5..26cceab9f0 100644 --- a/Projectiles/Typeless/HeronBobber.cs +++ b/Projectiles/Typeless/HeronBobber.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; using CalamityMod.Items.Fishing.FishingRods; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class HeronBobber : ModProjectile @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs index f0321439fc..d42c74833f 100644 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ b/Projectiles/Typeless/MageHammerBoom.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class MageHammerBoom : ModProjectile @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 500; Projectile.height = 500; + Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs new file mode 100644 index 0000000000..5bbcd2ce1f --- /dev/null +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -0,0 +1,269 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class MagnusBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.alpha = 0; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + float limit = 5f; + float scaleFactor = 6f; + if (Projectile.ai[1] == 0f) + { + Projectile.ai[1] = 1f; + Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); + } + else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) + { + int targetIdx = -1; + float npcRange = 150f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].CanBeChasedBy(Projectile, false)) + { + Vector2 npcPos = Main.npc[i].Center; + float npcDist = Vector2.Distance(npcPos, Projectile.Center); + if (npcDist < npcRange && targetIdx == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, npcPos, 1, 1)) + { + npcRange = npcDist; + targetIdx = i; + } + } + } + if (npcRange < 8f) + { + Projectile.Kill(); + return; + } + if (targetIdx != -1) + { + Projectile.ai[1] = limit + 1f; + Projectile.ai[0] = (float)targetIdx; + Projectile.netUpdate = true; + } + } + else if (Projectile.ai[1] > limit) + { + Projectile.ai[1] += 1f; + int idx = (int)Projectile.ai[0]; + if (!Main.npc[idx].active || !Main.npc[idx].CanBeChasedBy(Projectile, false)) + { + Projectile.ai[1] = 1f; + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; + } + else + { + Projectile.velocity.ToRotation(); + Vector2 toNPC = Main.npc[idx].Center - Projectile.Center; + if (toNPC.Length() < 20f) + { + Projectile.Kill(); + return; + } + if (toNPC != Vector2.Zero) + { + toNPC.Normalize(); + toNPC *= scaleFactor; + } + float homingSpeed = 30f; + Projectile.velocity = (Projectile.velocity * (homingSpeed - 1f) + toNPC) / homingSpeed; + } + } + if (Projectile.ai[1] >= 1f && Projectile.ai[1] < limit) + { + Projectile.ai[1] += 1f; + if (Projectile.ai[1] == limit) + { + Projectile.ai[1] = 1f; + } + } + + int dustTypeRand = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int dustType = 261; + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] == 48f) + { + Projectile.localAI[0] = 0f; + } + else if (Projectile.alpha == 0) + { + for (int i = 0; i < 2; i++) + { + Vector2 offset = Vector2.UnitX * -30f; + offset = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + i * MathHelper.Pi), default) * new Vector2(10f, 20f) - Projectile.rotation.ToRotationVector2() * 10f; + int idx = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); + Main.dust[idx].scale = 1f; + Main.dust[idx].noGravity = true; + Main.dust[idx].position = Projectile.Center + offset + Projectile.velocity * 2f; + Main.dust[idx].velocity = Vector2.Normalize(Projectile.Center + Projectile.velocity * 2f * 8f - Main.dust[idx].position) * 2f + Projectile.velocity * 2f; + } + } + if (Main.rand.NextBool(12)) + { + Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 100, default, 1f); + Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f + Projectile.velocity * 2f; + Main.dust[idx].fadeIn = 0.9f; + } + if (Main.rand.NextBool(64)) + { + Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.4).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, 0f, 0f, 155, default, 0.8f); + Main.dust[idx].velocity *= 0.3f; + Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[idx].fadeIn = 1.4f; + } + } + if (Main.rand.NextBool(4)) + { + for (int i = 0; i < 2; i++) + { + Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.8).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustTypeRand, 0f, 0f, 0, default, 1.2f); + Main.dust[idx].velocity *= 0.3f; + Main.dust[idx].noGravity = true; + Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[idx].fadeIn = 1.4f; + } + } + } + if (Main.rand.NextBool(3)) + { + Vector2 offset = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)Projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); + Main.dust[idx].velocity *= 0.3f; + Main.dust[idx].position = Projectile.Center + offset * (float)Projectile.width / 2f; + Main.dust[idx].fadeIn = 1.2f; + Main.dust[idx].scale = 1.5f; + Main.dust[idx].noGravity = true; + } + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); + for (int i = 0; i < 2; i++) + { + int sizeFactor = 14; + int idx = Dust.NewDust(Projectile.position, Projectile.width - sizeFactor * 2, Projectile.height - sizeFactor * 2, 263, 0f, 0f, 100, default, 1.35f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 0.1f; + Main.dust[idx].velocity += Projectile.velocity * 0.5f; + } + if (Main.rand.NextBool(8)) + { + int sizeFactor = 16; + int idx = Dust.NewDust(Projectile.position, Projectile.width - sizeFactor * 2, Projectile.height - sizeFactor * 2, 263, 0f, 0f, 100, default, 1f); + Main.dust[idx].velocity *= 0.25f; + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity += Projectile.velocity * 0.5f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 480); + + if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) + return; + + Player player = Main.player[Projectile.owner]; + player.statLife += 1; + player.statMana += 25; + player.HealEffect(1); + player.ManaEffect(25); + } + + public override void Kill(int timeLeft) + { + int dustType1 = 263; + int dustType2 = 263; + int height = 50; + float scale1 = 1.7f; + float scale2 = 0.8f; + float scale3 = 2f; + Vector2 value3 = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2 velocity = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.ExpandHitboxBy(height); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + for (int i = 0; i < 40; i++) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 200, default, scale1); + Dust dust = Main.dust[idx]; + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust.noGravity = true; + dust.velocity *= 3f; + dust.velocity += velocity * Main.rand.NextFloat(); + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType1, 0f, 0f, 100, default, scale2); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust.velocity *= 2f; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.color = Color.Crimson * 0.5f; + dust.velocity += velocity * Main.rand.NextFloat(); + } + for (int i = 0; i < 20; i++) + { + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType2, 0f, 0f, 0, default, scale3); + Dust dust = Main.dust[idx]; + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; + dust.noGravity = true; + dust.velocity *= 0.5f; + dust.velocity += velocity * (0.6f + 0.6f * Main.rand.NextFloat()); + } + } + } +} diff --git a/Projectiles/Magic/MagnusBeam.png b/Projectiles/Typeless/MagnusBeam.png similarity index 100% rename from Projectiles/Magic/MagnusBeam.png rename to Projectiles/Typeless/MagnusBeam.png diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index e5ed178261..7ba45272af 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/ReaverThornBase.cs b/Projectiles/Typeless/ReaverThornBase.cs index 74e9c36c14..a81d0ddb41 100644 --- a/Projectiles/Typeless/ReaverThornBase.cs +++ b/Projectiles/Typeless/ReaverThornBase.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.ignoreWater = true; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; } diff --git a/Projectiles/Typeless/ReaverThornTip.cs b/Projectiles/Typeless/ReaverThornTip.cs index 118032e560..d3ccf1a7da 100644 --- a/Projectiles/Typeless/ReaverThornTip.cs +++ b/Projectiles/Typeless/ReaverThornTip.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 28; Projectile.height = 28; - Projectile.aiStyle = 4; + Projectile.aiStyle = ProjAIStyleID.Vilethorn; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; diff --git a/Projectiles/Typeless/RiftReelerBobber.cs b/Projectiles/Typeless/RiftReelerBobber.cs index 9365cd4dbb..fbc2aaaf6e 100644 --- a/Projectiles/Typeless/RiftReelerBobber.cs +++ b/Projectiles/Typeless/RiftReelerBobber.cs @@ -1,7 +1,8 @@ +using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class RiftReelerBobber : ModProjectile @@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 864035dfa0..b65cc0dbcb 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Typeless { public class SandCloakVeil : ModProjectile { - private const float radius = 225f; + private const float radius = 272f; private const int duration = 900; public override void SetStaticDefaults() @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = duration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.scale = 1.2f; } public override void AI() diff --git a/Projectiles/Typeless/Seashell.cs b/Projectiles/Typeless/Seashell.cs index 25735dcecb..b00ea9751c 100644 --- a/Projectiles/Typeless/Seashell.cs +++ b/Projectiles/Typeless/Seashell.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.friendly = true; Projectile.penetrate = 2; - Projectile.aiStyle = 3; + Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Typeless/SlurperBobber.cs b/Projectiles/Typeless/SlurperBobber.cs index 333e870008..b8b5b652c0 100644 --- a/Projectiles/Typeless/SlurperBobber.cs +++ b/Projectiles/Typeless/SlurperBobber.cs @@ -1,7 +1,8 @@ +using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class SlurperBobber : ModProjectile @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index 56676e8238..e7f216ad2a 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 2; + Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.friendly = true; Projectile.penetrate = 1; } diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index ede7254774..33a25344f6 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = 360; Projectile.penetrate = 3; Projectile.alpha = 255; - Projectile.aiStyle = 93; + Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; } diff --git a/Projectiles/Typeless/TrueBattleSpawn.cs b/Projectiles/Typeless/TrueBattleSpawn.cs index 4582e1bca6..8b3ff0462b 100644 --- a/Projectiles/Typeless/TrueBattleSpawn.cs +++ b/Projectiles/Typeless/TrueBattleSpawn.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 6; Projectile.height = 6; - Projectile.aiStyle = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.scale = 1f; Projectile.penetrate = 1; Projectile.timeLeft = 20; diff --git a/Projectiles/Typeless/VerstaltiteBobber.cs b/Projectiles/Typeless/VerstaltiteBobber.cs index 158dc59ed4..3baab0d7f4 100644 --- a/Projectiles/Typeless/VerstaltiteBobber.cs +++ b/Projectiles/Typeless/VerstaltiteBobber.cs @@ -1,7 +1,8 @@ +using CalamityMod.Items.Fishing.FishingRods; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class VerstaltiteBobber : ModProjectile @@ -16,7 +17,7 @@ namespace CalamityMod.Projectiles.Typeless //projectile.CloneDefaults(360); //Wooden Bobber Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/VoidFieldGenerator.cs b/Projectiles/Typeless/VoidFieldGenerator.cs new file mode 100644 index 0000000000..0433401d00 --- /dev/null +++ b/Projectiles/Typeless/VoidFieldGenerator.cs @@ -0,0 +1,97 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Particles.Metaballs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VoidFieldGenerator : ModProjectile + { + public bool start = true; + public BaseFusableParticleSet.FusableParticle voidaura; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Field Generator"); + } + + public override void SetDefaults() + { + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft *= 5; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + if (!modPlayer.voidField) + { + Projectile.active = false; + return; + } + if (player.dead) + modPlayer.voidField = false; + if (modPlayer.voidField) + Projectile.timeLeft = 2; + + if (Projectile.ai[1] == 0) + { + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + } + + Vector2 vector = player.Center - Projectile.Center; + + Projectile.Center = player.Center + new Vector2(300, 0).RotatedBy(Projectile.ai[1] + Projectile.ai[0] * MathHelper.PiOver2); + + Projectile.ai[1] += 0.01f; + + Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + + for (int k = 0; k < Main.projectile.Length; k++) + { + var proj = Main.projectile[k]; + if (proj.active && proj.owner == Projectile.owner && proj.arrow && !proj.Calamity().nihilicArrow && proj.friendly && Vector2.Distance(proj.Center, Projectile.Center) < 65) + { + Main.projectile[k].damage = (int)(proj.damage * 2f); + proj.extraUpdates += 1; + Main.projectile[k].Calamity().nihilicArrow = true; + SoundEngine.PlaySound(SoundID.Item104 with { Volume = SoundID.Item104.Volume * 0.75f }, Projectile.Center); + + for (int i = 0; i < 12; i++) + { + Vector2 dustpos = Vector2.UnitX * (float)-(float)proj.width / 2f; + dustpos += -Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f / 6f), default) * new Vector2(8f, 16f); + dustpos = dustpos.RotatedBy((double)(proj.rotation - 1.57079637f), default); + int dust = Dust.NewDust(proj.Center, 0, 0, 27, 0f, 0f, 100, Color.HotPink, 1f); + Main.dust[dust].scale = 1.1f; + Main.dust[dust].noGravity = true; + Main.dust[dust].position = proj.Center + dustpos; + Main.dust[dust].velocity = proj.velocity * 0.1f; + Main.dust[dust].velocity = Vector2.Normalize(proj.Center - proj.velocity * 3f - Main.dust[dust].position) * 1.25f; + } + } + } + + if (voidaura == null) + { + voidaura = FusableParticleManager.GetParticleSetByType()?.SpawnParticle(Projectile.Center, 500); + } + else + { + voidaura.Center = Projectile.Center; + voidaura.Size = 500; + } + } + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/VoidFieldGenerator.png b/Projectiles/Typeless/VoidFieldGenerator.png new file mode 100644 index 0000000000..9397c1da00 Binary files /dev/null and b/Projectiles/Typeless/VoidFieldGenerator.png differ diff --git a/Projectiles/Typeless/VoidFieldGenerator_Glow.png b/Projectiles/Typeless/VoidFieldGenerator_Glow.png new file mode 100644 index 0000000000..443ee697fa Binary files /dev/null and b/Projectiles/Typeless/VoidFieldGenerator_Glow.png differ diff --git a/Projectiles/Typeless/WulfrumBobber.cs b/Projectiles/Typeless/WulfrumBobber.cs index 72c4d36c39..1cb08f186c 100644 --- a/Projectiles/Typeless/WulfrumBobber.cs +++ b/Projectiles/Typeless/WulfrumBobber.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; using CalamityMod.Items.Fishing.FishingRods; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { public class WulfrumBobber : ModProjectile @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.width = 14; Projectile.height = 14; - Projectile.aiStyle = 61; + Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; Projectile.penetrate = -1; } diff --git a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs new file mode 100644 index 0000000000..b2a4037428 --- /dev/null +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -0,0 +1,248 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; +using CalamityMod.Items.Materials; +using Terraria.DataStructures; +using ReLogic.Utilities; + +namespace CalamityMod.Projectiles.Typeless +{ + public class WulfrumDiggingTurtleProjectile : ModProjectile + { + public static readonly SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/WulfrumSawIdle") { IsLooped = true, Volume = 0.8f, MaxInstances = 0 }; + public static readonly SoundStyle CuttingSound = new("CalamityMod/Sounds/Custom/WulfrumSawCutting") { IsLooped = true, Volume = 0.7f, MaxInstances = 0 }; + public static readonly SoundStyle BreakingSound = new("CalamityMod/Sounds/Custom/WulfrumMachineBreak"); + + private SlotId CuttingSoundSlot; + private SlotId IdlingSoundSlot; + + public Player Owner => Main.player[Projectile.owner]; + public bool Diggging + { + get => Projectile.ai[0] == 1; + set { Projectile.ai[0] = value ? 1f : 0f; } + } + + public bool HasDug + { + get => Projectile.ai[1] == 1; + set { Projectile.ai[1] = value ? 1f : 0f; } + } + + public float CuttingVolume + { + get => Projectile.localAI[0]; + set { Projectile.localAI[0] = Math.Clamp(value, 0f, 1f); } + } + + public override string Texture => "CalamityMod/Items/Tools/WulfrumDiggingTurtle"; + public static Texture2D SmallGearTexture; + public static Texture2D GearTexture; + + public static int Lifetime = 400; + public static int DigTime = 350; + public static float DigSpeed = 1.5f; + public static int MaxPickPower = 160; + public static float ClearSpaceDiagonal = 50; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Digging Turtle"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.netImportant = true; + } + + public override bool? CanDamage() => false; + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (!HasDug) + { + HasDug = true; + Projectile.timeLeft = DigTime; + } + + Diggging = true; + Projectile.velocity = oldVelocity.SafeNormalize(Vector2.UnitY) * DigSpeed; + + return false; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3()); + + //Idle chainsaw sounds + if ((!SoundEngine.TryGetActiveSound(IdlingSoundSlot, out var idleSoundOut))) + IdlingSoundSlot = SoundEngine.PlaySound(IdleSound with { Volume = IdleSound.Volume }, Projectile.Center); + else if (idleSoundOut != null) + { + idleSoundOut.Volume = (1 - CuttingVolume); + idleSoundOut.Position = Projectile.Center; + } + + + //Heavy cutting sound + if ((!SoundEngine.TryGetActiveSound(CuttingSoundSlot, out var cuttingSoundOut))) + CuttingSoundSlot = SoundEngine.PlaySound(CuttingSound with { Volume = CuttingSound.Volume }, Projectile.Center); + else if (cuttingSoundOut != null) + { + cuttingSoundOut.Volume = CuttingVolume; + cuttingSoundOut.Position = Projectile.Center; + } + + + + if (Diggging) + { + CuttingVolume += 0.1f; + for (int i = -1; i <= 1; i++) + { + Point tilePos = (Projectile.Center + (Projectile.rotation + MathHelper.PiOver4 * i).ToRotationVector2() * 16).ToTileCoordinates(); + + DigTile(tilePos.X, tilePos.Y); + } + } + + //the flung state. + else + { + CuttingVolume -= 0.1f; + + float fallSpeed = Projectile.velocity.Y; + + if (Projectile.timeLeft < 345) + Projectile.velocity += Vector2.UnitY * 0.5f * (1 - Math.Clamp((Projectile.timeLeft - 310f) / 35f, 0f, 1f)); + + Projectile.velocity *= 0.98f; + + if (Projectile.velocity.Y > 0) + Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed)); + + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + if (!Collision.SolidCollision(Projectile.Center - Vector2.One * ClearSpaceDiagonal * 0.5f, (int)ClearSpaceDiagonal, (int)ClearSpaceDiagonal)) + Diggging = false; + } + + public override void Kill(int timeLeft) + { + if (Main.myPlayer == Owner.whoAmI) + { + if (Main.rand.NextBool() && !Projectile.noDropItem) + Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType(), 1); + } + + if (SoundEngine.TryGetActiveSound(CuttingSoundSlot, out var cuttingSoundOut)) + cuttingSoundOut.Stop(); + + if (SoundEngine.TryGetActiveSound(IdlingSoundSlot, out var idleSoundOut)) + idleSoundOut.Stop(); + + SoundEngine.PlaySound(BreakingSound, Projectile.position); + + int smokeCount = Main.rand.Next(5, 10); + int sparkCount = Main.rand.Next(4, 8); + + for (int i = 0; i < smokeCount; i++) + { + Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f); + + Color smokeStart = Main.rand.NextBool() ? Color.GreenYellow : Color.Aqua; + Color smokeEnd = new Color(60, 60, 60); + + float smokeSize = Main.rand.NextFloat(1.4f, 2.2f); + + Particle smoke = new SmallSmokeParticle(Projectile.Center, velocity, smokeStart, smokeEnd, smokeSize, 135 - Main.rand.Next(30)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 4; i++) + { + Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(9f, 9f); + float shrapnelScale = Main.rand.NextFloat(0.8f, 1f); + + string goreType = i < 2 ? "WulfrumTurtle1" : i < 3 ? "WulfrumTurtle2" : "WulfrumTurtle3"; + + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, shrapnelVelocity, Mod.Find(goreType).Type, shrapnelScale); + } + + + } + + for (int i = 0; i < sparkCount; i++) + { + Dust.NewDustPerfect(Projectile.Center, 226, Main.rand.NextVector2Circular(18f, 18f), Scale: Main.rand.NextFloat(0.4f, 1f)); + } + } + + public void DigTile(int x, int y) + { + Tile tile = Main.tile[x, y]; + if (!tile.HasTile) + return; + + int pickPower = Math.Min( Owner.GetBestPickPower(), MaxPickPower); + int pickaxeRequirement = tile.GetRequiredPickPower(x, y); + + bool true_ = true; + bool false_ = false; + + bool canBreakTileCheck = TileLoader.CanKillTile(x, y, tile.TileType, ref true_) && TileLoader.CanKillTile(x, y, tile.TileType, ref false_); + bool shouldBreakTile = tile.ShouldBeMined(); + + if (!Owner.noBuilding && shouldBreakTile && pickaxeRequirement < pickPower && canBreakTileCheck) + { + WorldGen.KillTile(x, y, false, false, false); + if (!Main.tile[x, y].HasTile && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, x, y, 0f, 0, 0, 0); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + + GearTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/WulfrumDiggingTurtle_Gear").Value; + + SmallGearTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/WulfrumDiggingTurtle_SmallGear").Value; + + + Vector2 position = Projectile.Center - Main.screenPosition; + if (Diggging) + position += Main.rand.NextVector2Circular(2f, 2f); + float drawRotation = Projectile.rotation + MathHelper.PiOver2; + + for (int i = -1; i <= 1; i += 2) + { + Vector2 diggingGearOffset = new Vector2(9 * i, -11).RotatedBy(drawRotation) * Projectile.scale; + Main.EntitySpriteDraw(SmallGearTexture, position + diggingGearOffset, null, lightColor, drawRotation + Main.GlobalTimeWrappedHourly * -10f * i, SmallGearTexture.Size() / 2f, Projectile.scale * 1.2f, 0, 0); + } + + Vector2 largeGearOffset = new Vector2(0f, 3f).RotatedBy(drawRotation) * Projectile.scale; + Main.EntitySpriteDraw(GearTexture, position + largeGearOffset, null, lightColor, Main.GlobalTimeWrappedHourly * 6f, GearTexture.Size() / 2f, Projectile.scale, 0, 0); + + Main.EntitySpriteDraw(texture, position, null, lightColor, drawRotation, texture.Size() / 2f, Projectile.scale, 0, 0); + return false; + } + } +} diff --git a/Projectiles/Typeless/WulfrumDiggingTurtle_Gear.png b/Projectiles/Typeless/WulfrumDiggingTurtle_Gear.png new file mode 100644 index 0000000000..ea5be5e19d Binary files /dev/null and b/Projectiles/Typeless/WulfrumDiggingTurtle_Gear.png differ diff --git a/Projectiles/Typeless/WulfrumDiggingTurtle_SmallGear.png b/Projectiles/Typeless/WulfrumDiggingTurtle_SmallGear.png new file mode 100644 index 0000000000..aa098b46aa Binary files /dev/null and b/Projectiles/Typeless/WulfrumDiggingTurtle_SmallGear.png differ diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs new file mode 100644 index 0000000000..95fd828518 --- /dev/null +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -0,0 +1,104 @@ +using System; +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 WulfrumDrillProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Tools/WulfrumDrill"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drill"); + } + + + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.aiStyle = ProjAIStyleID.Drill; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.ownerHitCheck = true; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.scale = 0.93f; + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float collisionPoint = 0f; + float bladeLenght = 54f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + } + + public override void AI() + { + if (!Owner.channel) + { + Projectile.Kill(); + Projectile.active = false; + return; + } + + Projectile.timeLeft = 2; + + //Vroom + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item22, Owner.Center); + Projectile.soundDelay = 30; + } + + Projectile.velocity = (Owner.Calamity().mouseWorld - Owner.MountedCenter).SafeNormalize(Vector2.One); + //Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); + Owner.heldProj = Projectile.whoAmI; + Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.velocity.ToRotation() * Owner.gravDir - MathHelper.PiOver2 - MathHelper.PiOver4 * 0.5f * Owner.direction); + + Owner.SetDummyItemTime(2); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + + Projectile.velocity.X *= 1f + (float)Main.rand.Next(-3, 4) * 0.01f; + + if (Main.rand.NextBool(6)) + { + Dust whirrDust = Dust.NewDustDirect(Projectile.position + Projectile.velocity * Main.rand.Next(6, 10) * 0.1f, Projectile.width, Projectile.height, 31, 0f, 0f, 80, Scale: 1.4f) ; + whirrDust.position.X -= 4f; + whirrDust.noGravity = true; + whirrDust.velocity *= 0.2f; + whirrDust.velocity.Y = (float)(-Main.rand.Next(7, 13)) * 0.15f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + //Necessary or else itll glitch out for a final frame??? + if (!Projectile.active) + return false; + + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(9f, tex.Height / 2f); + Vector2 shake = Main.rand.NextVector2Circular(1f, 1f) * ((float)Math.Sin(Main.GlobalTimeWrappedHourly ) * 0.25f + 0.75f); + SpriteEffects effect = SpriteEffects.None; + if (Owner.direction * Owner.gravDir < 0) + effect = SpriteEffects.FlipVertically; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + shake, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, effect, 0); + return false; + } + } +} diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs new file mode 100644 index 0000000000..bf7b5db93a --- /dev/null +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -0,0 +1,253 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; +using CalamityMod.Items.Materials; +using Terraria.DataStructures; +using ReLogic.Utilities; +using CalamityMod.Items.Accessories; +using System.Collections.Generic; +using System.Linq; + +namespace CalamityMod.Projectiles.Typeless +{ + public class WulfrumHook : ModProjectile + { + public Player Owner => Main.player[Projectile.owner]; + internal PrimitiveTrail TrailRenderer; + + public HookState State + { + get => (HookState)(int)Projectile.ai[0]; + set { Projectile.ai[0] = (int)value; } + } + + public ref float Timer => ref Projectile.ai[1]; + + public enum HookState + { + Thrown, + Retracting, + Grappling = 3 //Making this value "3" is important here, as it makes it so that i can put this projectile in the player grapple list while also never having it considered as "grappling" (aka ai[0] = 2) + } + + public static float MaxReach = 600; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Slingshot"); + //Expand the draw distance. Should never happen really , but just in case the player basically walks away from the hook. + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 3000; + } + + public override void SetDefaults() + { + Projectile.width = 3; + Projectile.height = 3; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.tileCollide = false; + Projectile.extraUpdates = WulfrumPackPlayer.HookUpdates; + Projectile.netImportant = true; + Projectile.aiStyle = ProjAIStyleID.Hook; //The projectile uses entirely custom AI, but for some reason terraria's only way to distinguish what is and isnt a hook is its ai style. + } + + public override bool? CanDamage() => false; + + public override bool PreAI() => false; + public override void PostAI() + { + Lighting.AddLight(Projectile.Center, Color.DeepSkyBlue.ToVector3()); + Vector2 BetweenOwner = Owner.Center - Projectile.Center; + + if (Owner.dead || Owner.stoned || Owner.webbed || Owner.frozen || BetweenOwner.Length() > 1500) + { + Projectile.Kill(); + return; + } + + Projectile.rotation = BetweenOwner.ToRotation() - MathHelper.PiOver2; + + if (Owner.GetModPlayer().WulfrumPackEquipped) + { + Projectile.timeLeft = 2; + } + + if (State == HookState.Thrown) + { + //Retract if too far. + if (MaxReach < BetweenOwner.Length()) + State = HookState.Retracting; + + float fallSpeed = Projectile.velocity.Y; + + if (Timer > 15 * Projectile.extraUpdates) + Projectile.velocity += Vector2.UnitY * 0.5f * (1 - Math.Clamp((Timer - 15) / 35f, 0f, 1f)) / Projectile.extraUpdates; + + Projectile.velocity *= 0.98f; + + if (Projectile.velocity.Y + 0.001 > 0) + Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed)); + + if (Projectile.velocity.Length() < 1f) + State = HookState.Retracting; + + CheckForGrapplableTiles(); + + } + + else if (State == HookState.Retracting) + { + Projectile.velocity = BetweenOwner.SafeNormalize(Vector2.One) * WulfrumPackPlayer.ReturnVelocity; + Projectile.Center += Vector2.UnitY * 0.5f; + + if (BetweenOwner.Length() < 25f) + Projectile.Kill(); + } + + else + { + float lenghtToOwner = BetweenOwner.Length(); + + if (lenghtToOwner > Owner.GetModPlayer().SwingLenght + 60f) + { + State = HookState.Retracting; + } + + Point tilePos = Projectile.Center.ToTileCoordinates(); + Tile tile = Main.tile[tilePos]; + if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo() || Owner.IsBlacklistedForGrappling(tilePos)) + State = HookState.Retracting; + + Projectile.velocity = Vector2.Zero; + + if (Owner.grapCount < 10) + { + Owner.grappling[Owner.grapCount] = Projectile.whoAmI; + Owner.grapCount++; + } + } + + Timer++; + } + + public void CheckForGrapplableTiles() + { + Vector2 hitboxStart = Projectile.Center - new Vector2(5f); + Vector2 hitboxEnd = Projectile.Center + new Vector2(5f); + + Point topLeftTile = (hitboxStart - new Vector2(16f)).ToTileCoordinates(); + Point bottomRightTile = (hitboxEnd + new Vector2(32f)).ToTileCoordinates(); + + for (int x = topLeftTile.X; x < bottomRightTile.X; x++) + { + for (int y = topLeftTile.Y; y < bottomRightTile.Y; y++) + { + Vector2 worldPos = new Vector2(x * 16f, y * 16f); + Point tilePos = new Point(x, y); + + //Ignore tiles that arent being collided with + if (!(hitboxStart.X + 10f > worldPos.X) || !(hitboxStart.X < worldPos.X + 16f) || !(hitboxStart.Y + 10f > worldPos.Y) || !(hitboxStart.Y < worldPos.Y + 16f)) + continue; + + Tile tile = Main.tile[tilePos]; + + if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo() || Owner.IsBlacklistedForGrappling(tilePos)) + continue; + if (Main.myPlayer != Owner.whoAmI) + continue; + + OnGrapple(worldPos, x, y); + + break; + } + + if (State == HookState.Grappling) + break; + } + } + + public void OnGrapple(Vector2 grapplePos, int x, int y) + { + WulfrumPackPlayer mp = Owner.GetModPlayer(); + //Clear previous grapple + if (Main.projectile[mp.Grapple].active && Main.projectile[mp.Grapple].ModProjectile is WulfrumHook hook && hook.State == WulfrumHook.HookState.Grappling) + Main.projectile[mp.Grapple].Kill(); + + //Hook onto the tile + Projectile.velocity = Vector2.Zero; + State = HookState.Grappling; + Projectile.Center = grapplePos + Vector2.One * 8f; + //effects + WorldGen.KillTile(x, y, fail: true, effectOnly: true); + SoundEngine.PlaySound(SoundID.Dig, grapplePos); + SoundEngine.PlaySound(WulfrumAcrobaticsPack.GrabSound, grapplePos); + + if (Owner.grapCount < 10) + { + Owner.grappling[Owner.grapCount] = Projectile.whoAmI; + Owner.grapCount++; + //Owner.velocity = Vector2.Zero; + } + + mp.SwingLenght = (Owner.Center - Projectile.Center).Length(); + mp.OldPosition = Owner.Center - Owner.velocity; + mp.SetSegments(Projectile.Center); + mp.Grapple = Projectile.whoAmI; + + Rectangle? tileVisualHitbox = WorldGen.GetTileVisualHitbox(x, y); + if (tileVisualHitbox.HasValue) + Projectile.Center = tileVisualHitbox.Value.Center.ToVector2(); + + Projectile.netUpdate = true; + NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, Owner.whoAmI); + } + + + public override void Kill(int timeLeft) + { + if (Owner.grappling[0] == Projectile.whoAmI) + { + Owner.grappling[0] = -1; + Owner.grapCount--; + } + } + + public float PrimWidthFunction(float completionRatio) + { + return 1.6f; + } + + public Color PrimColorFunction(float completionRatio) + { + return Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, (float)Math.Pow(completionRatio, 1.5D)); + } + + public override bool PreDraw(ref Color lightColor) + { + if (TrailRenderer is null) + TrailRenderer = new PrimitiveTrail(PrimWidthFunction, PrimColorFunction); + + Vector2[] segmentPositions = new Vector2[] {Projectile.Center, Owner.Center }; + + if (State == HookState.Grappling) + segmentPositions = Owner.GetModPlayer().Segments.Select(x => x.position).ToArray(); + + TrailRenderer.Draw(segmentPositions, -Main.screenPosition, 30); + + + Texture2D texture = TextureAssets.Projectile[Type].Value; + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, 0, 0); + return false; + } + + public override bool PreDrawExtras() => false; //Prevents vanilla chain drawing from taking place + } +} diff --git a/Projectiles/Typeless/WulfrumHook.png b/Projectiles/Typeless/WulfrumHook.png new file mode 100644 index 0000000000..6f91ff4256 Binary files /dev/null and b/Projectiles/Typeless/WulfrumHook.png differ diff --git a/Projectiles/Typeless/WulfrumLureSignal.cs b/Projectiles/Typeless/WulfrumLureSignal.cs new file mode 100644 index 0000000000..ec240679c6 --- /dev/null +++ b/Projectiles/Typeless/WulfrumLureSignal.cs @@ -0,0 +1,116 @@ +using CalamityMod.NPCs.AstrumDeus; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Items.Tools; + +namespace CalamityMod.Projectiles.Typeless +{ + public class WulfrumLureSignal : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Time => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Signal"); + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = WulfrumLureItem.SignalTime; + } + + public override void AI() + { + Time++; + + if (Time % WulfrumLureItem.SpawnIntervals == 0) + { + WulfrumLureItem.MaxEnemiesPerWave = 5; + int enemiesToSpawn = Main.rand.Next(1, WulfrumLureItem.MaxEnemiesPerWave); + + Player player = Main.LocalPlayer; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + float closestPlayerDistance = (Main.LocalPlayer.Center - Projectile.Center).Length(); + for (int i = 0; i < Main.maxPlayers; i++) + { + float newDistance = (Main.player[i].Center - Projectile.Center).Length(); + if (newDistance < closestPlayerDistance) + { + closestPlayerDistance = newDistance; + player = Main.player[i]; + } + } + } + + if ((player.Center - Projectile.Center).Length() > 3500) + return; + + for (int i = 0; i < enemiesToSpawn; i++) + { + int tries = 0; + Vector2 spawnPosition; + do + { + Vector2 displacey = Main.rand.NextVector2Unit(); + if (displacey.Y > 0) + displacey.Y *= -1; + spawnPosition = player.Center + displacey * Main.rand.NextFloat(600f, 1015f) * new Vector2(1.5f, 1f); + if (spawnPosition.Y > player.Center.Y) + spawnPosition.Y = player.Center.Y; + if (tries > 500) + break; + tries++; + } + while (WorldGen.SolidTile(CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16))); + + if (tries < 500) + { + int npcToSpawn = Main.rand.NextBool(2) ? ModContent.NPCType() : Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() ; + int index = NPC.NewNPC(Projectile.GetSource_FromAI(), (int)spawnPosition.X, (int)spawnPosition.Y, npcToSpawn, Target:player.whoAmI); + + for (int iy = 0; iy < 16; iy++) + { + Dust zapDust = Dust.NewDustPerfect(spawnPosition + Main.rand.NextVector2Circular(1f, 1f) * 20f, 226, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(1f, 2.3f) - Vector2.UnitY * 6f); + zapDust.noGravity = true; + } + } + } + } + + if (Time%2 == 0 && CalamityUtils.IntoMorseCode("perimeter breached", Time / WulfrumLureItem.SignalTime)) + { + float dustCount = MathHelper.TwoPi * 300 / 8f; + for (int i = 0; i < dustCount; i++) + { + float angle = MathHelper.TwoPi * i / dustCount; + Dust dust = Dust.NewDustPerfect(Projectile.Center, 229); + dust.position = Projectile.Center + angle.ToRotationVector2() * 300; + dust.scale = 0.7f; + dust.noGravity = true; + dust.velocity = Projectile.velocity; + } + } + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(WulfrumTreasurePinger.RechargeBeepSound, Projectile.Center); + } + } +} diff --git a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs new file mode 100644 index 0000000000..3619d9de6e --- /dev/null +++ b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs @@ -0,0 +1,240 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Tools; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class WulfrumScaffoldKitHoldout : ModProjectile + { + public override void Load() + { + PipeCleanupManager = new WulfrumPipeManager(); + } + + public Player Owner => Main.player[Projectile.owner]; + public WulfrumScaffoldKit Kit => Owner.HeldItem.ModItem as WulfrumScaffoldKit; + public bool CanOwnerGoOn => Kit.storedScrap > 0 || Owner.HasItem(ModContent.ItemType()); + + public bool CanSelectTile(Point tilePos) + { + //You only need to check when starting a scaffold + if (SelectedTiles.Count > 0) + return CanSelectMoreTiles(tilePos); + + + for (int i = -1; i < 2; i++) + { + for (int j = -1; j < 2; j++) + { + if (Main.tile[tilePos.X + i, tilePos.Y + j].IsTileFull()) + return true; + } + } + + return false; + } + public bool CanSelectMoreTiles(Point tilePos) + { + for (int i = -2; i < 3; i++) + { + for (int j = -2; j < 3; j++) + { + if (Math.Abs(i) == 2 && Math.Abs(j) == 2) + continue; + + if (Main.tile[tilePos.X + i, tilePos.Y + j].TileType == WulfrumScaffoldKit.PlacedTileType || SelectedTiles.ContainsKey(new Point(tilePos.X + i, tilePos.Y + j))) + return true; + } + } + + return false; + } + + public static TemporaryTileManager PipeCleanupManager; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Scaffold Kit"); + } + + public static int tileGlowTime = 10; + + public Dictionary SelectedTiles = new Dictionary(); //Might need some cloning stuff for mp? idk, probably not + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 1; + Projectile.height = 1; + Projectile.penetrate = -1; + Projectile.netImportant = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + } + + public override bool? CanDamage() => false; + public override bool ShouldUpdatePosition() => false; + + public override void AI() + { + if (Owner.channel && CanOwnerGoOn) + { + //Initialize the position + if (Projectile.timeLeft > 2) + Projectile.position = Owner.Calamity().mouseWorld; + + Owner.itemTime = 2; + Owner.itemAnimation = 2; + + Projectile.position = Projectile.position.MoveTowards(Owner.Calamity().mouseWorld, 16); + //Projectile.position = raytracePosition(); + + if ((Projectile.position - Owner.Center).Length() > WulfrumScaffoldKit.TileReach * 16) + Projectile.position = Owner.Center + Vector2.Normalize(Projectile.position - Owner.Center) * WulfrumScaffoldKit.TileReach * 16; + + if (Owner.whoAmI == Main.myPlayer) + { + Point tilePos = Projectile.position.ToTileCoordinates(); + Tile hoveredTile = Main.tile[tilePos]; + + if (!hoveredTile.HasTile && !SelectedTiles.ContainsKey(tilePos) && CanSelectTile(tilePos)) + { + SelectedTiles.Add(tilePos, tileGlowTime); + + if (Kit.storedScrap > 0) + Kit.storedScrap--; + + else + { + Owner.ConsumeItem(ModContent.ItemType()); + Kit.storedScrap = WulfrumScaffoldKit.TilesPerScrap - 1; + SoundEngine.PlaySound(SoundID.Item65); + if (Main.netMode != NetmodeID.Server) + { + Gore shard = Gore.NewGoreDirect(Projectile.GetSource_ItemUse(Owner.HeldItem), Owner.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find("WulfrumPinger2").Type, Main.rand.NextFloat(0.5f, 1f)); + shard.timeLeft = 10; + shard.alpha = 100 - Main.rand.Next(0, 60); + } + } + } + + foreach (Point position in SelectedTiles.Keys) + { + if (SelectedTiles[position] > 0) + SelectedTiles[position]--; + } + } + + Projectile.timeLeft = 2; + } + } + + public override bool PreDraw(ref Color lightColor) + { + if (Main.myPlayer != Owner.whoAmI) + return false; + + Texture2D sprite = ModContent.Request(Texture).Value; + + Effect tileEffect = Filters.Scene["WulfrumScaffoldSelection"].GetShader().Shader; + + tileEffect.Parameters["mainOpacity"].SetValue(1f); + tileEffect.Parameters["tileEdgeBlendStrenght"].SetValue(2f); + tileEffect.Parameters["placementGlowColor"].SetValue(Color.GreenYellow.ToVector4()); + tileEffect.Parameters["baseTintColor"].SetValue(Color.DeepSkyBlue.ToVector4() * 0.5f); + tileEffect.Parameters["scanlineColor"].SetValue(Color.YellowGreen.ToVector4() * 1f); + tileEffect.Parameters["tileEdgeColor"].SetValue(Color.GreenYellow.ToVector3()); + tileEffect.Parameters["Resolution"].SetValue(8f); + + tileEffect.Parameters["time"].SetValue(Main.GameUpdateCount); + Vector4[] scanLines = new Vector4[] + { + new Vector4(0f, 4f, 0.1f, 0.5f), + new Vector4(1f, 4f, 0.1f, 0.5f), + new Vector4(37f, 60f, 0.4f, 1f), + new Vector4(2f, 6f, -0.2f, 0.3f), + new Vector4(0f, 4f, 0.1f, 0.5f), //vertical start + new Vector4(1f, 4f, 0.1f, 0.5f), + new Vector4(2f, 6f, -0.2f, 0.3f) + }; + + tileEffect.Parameters["ScanLines"].SetValue(scanLines); + tileEffect.Parameters["ScanLinesCount"].SetValue(scanLines.Length); + tileEffect.Parameters["verticalScanLinesIndex"].SetValue(4); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, tileEffect, Main.GameViewMatrix.TransformationMatrix); + + foreach (Point pos in SelectedTiles.Keys) + { + tileEffect.Parameters["blinkTime"].SetValue(SelectedTiles[pos] / (float)tileGlowTime); + tileEffect.Parameters["cardinalConnections"].SetValue(new bool[] { Connected(pos, 0, -1), Connected(pos, -1, 0), Connected(pos, 1, 0), Connected(pos, 0, 1) }); + tileEffect.Parameters["tilePosition"].SetValue(pos.ToVector2() * 16f); + + Main.spriteBatch.Draw(sprite, pos.ToWorldCoordinates() - Main.screenPosition, null, Color.White, 0, new Vector2(sprite.Width / 2f, sprite.Height / 2f), 16f, 0, 0); + } + + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + + return false; + } + + public bool Connected(Point pos, int displaceX, int displaceY) => SelectedTiles.ContainsKey(new Point(pos.X + displaceX, pos.Y + displaceY)); + + + public override void Kill(int timeLeft) + { + if (SelectedTiles.Keys.Count > 0) + SoundEngine.PlaySound(SoundID.Item101 with { Volume = SoundID.Item101.Volume * 0.6f}, Owner.Center); + + if (Main.myPlayer == Owner.whoAmI) + { + foreach (Point pos in SelectedTiles.Keys) + { + if (PipeCleanupManager == null) + PipeCleanupManager = new WulfrumPipeManager(); + + TempTilesManagerSystem.AddTemporaryTile(pos, PipeCleanupManager); + WorldGen.PlaceTile(pos.X, pos.Y, WulfrumScaffoldKit.PlacedTileType) ; + NetMessage.SendTileSquare(-1, pos.X, pos.Y, TileChangeType.None); + } + } + } + } + + + public class WulfrumPipeManager : TemporaryTileManager + { + public override int[] ManagedTypes => new int[] { WulfrumScaffoldKit.PlacedTileType }; + + public override TemporaryTile Setup(Point pos) + { + for (int i = 0; i < 3; i++) + { + Vector2 dustpos = pos.ToWorldCoordinates(); + Dust.NewDustPerfect(dustpos, 83, Main.rand.NextVector2Circular(3f, 3f), Scale: Main.rand.NextFloat(0.4f, 0.7f)); + } + + TemporaryTile tile = new TemporaryTile(pos, this, WulfrumScaffoldKit.TileTime); + return tile; + } + + public override void UpdateEffect(TemporaryTile tile) + { + if (tile.timeleft < WulfrumScaffoldKit.TileTime * 0.1f && Main.rand.NextBool(10)) + { + Vector2 dustpos = tile.position.ToWorldCoordinates(); + Dust.NewDustPerfect(dustpos, 226, Main.rand.NextVector2Circular(4f, 4f), Scale: Main.rand.NextFloat(0.4f, 1f)); + } + } + } +} diff --git a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs index 2786223b92..2c5f5d5c76 100644 --- a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs +++ b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs @@ -44,9 +44,11 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides projectile.scale = MathHelper.Lerp(0.9f, 1.15f, (float)Math.Sin(timer / 27f) * 0.5f + 0.5f); // Emit life pulses periodically. - if (timer % ChlorophyteArmorSetChange.PulseReleaseRate == ChlorophyteArmorSetChange.PulseReleaseRate - 1f) + NPC potentialTarget = projectile.Center.ClosestNPCAt(560f, true, true); + bool ownerNotFullHealth = owner.statLife < owner.statLifeMax2; + bool willFirePulses = (potentialTarget is not null) || ownerNotFullHealth; + if (timer % ChlorophyteArmorSetChange.PulseReleaseRate == ChlorophyteArmorSetChange.PulseReleaseRate - 1f && willFirePulses) { - SoundEngine.PlaySound(SoundID.Item45, projectile.Center); if (Main.myPlayer == projectile.owner) { int pulseDamage = (int)Main.player[projectile.owner].GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.BaseDamageToEnemies); diff --git a/Rarities/CalamityRed.cs b/Rarities/CalamityRed.cs new file mode 100644 index 0000000000..97cb162adb --- /dev/null +++ b/Rarities/CalamityRed.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public class CalamityRed : ModRarity + { + // Calamity Red is Rarity 17 + // This rarity should never be assigned to any items. + // It is the equivalent of vanilla's Purple rarity (11): only used for positive reforges on top-rarity items. + public override Color RarityColor => new Color(163, 25, 26); // #A3191A + // (139, 0, 0) is the classic donator item color + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/DarkBlue.cs b/Rarities/DarkBlue.cs new file mode 100644 index 0000000000..24596eec7a --- /dev/null +++ b/Rarities/DarkBlue.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public class DarkBlue : ModRarity + { + // Dark Blue is Rarity 14 + public override Color RarityColor => new Color(43, 96, 222); + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/DarkOrange.cs b/Rarities/DarkOrange.cs new file mode 100644 index 0000000000..e7a2b677a3 --- /dev/null +++ b/Rarities/DarkOrange.cs @@ -0,0 +1,11 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + // Draedon's Arsenal "Rust" / "Bronze" rarity + public class DarkOrange : ModRarity + { + public override Color RarityColor => new Color(204, 71, 35); + } +} diff --git a/Rarities/HotPink.cs b/Rarities/HotPink.cs new file mode 100644 index 0000000000..938fdfe59c --- /dev/null +++ b/Rarities/HotPink.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public class HotPink : ModRarity + { + // Hot Pink is Rarity 16 + public override Color RarityColor => new Color(255, 0, 255); + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/PureGreen.cs b/Rarities/PureGreen.cs new file mode 100644 index 0000000000..958ace0025 --- /dev/null +++ b/Rarities/PureGreen.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public class PureGreen : ModRarity + { + // Pure Green is Rarity 13 + public override Color RarityColor => new Color(0, 255, 0); + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ItemRarityID.Purple, + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/Rainbow.cs b/Rarities/Rainbow.cs new file mode 100644 index 0000000000..af84446b62 --- /dev/null +++ b/Rarities/Rainbow.cs @@ -0,0 +1,14 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + // Heart of the Elements, The Community and Elemental Excalibur are Rainbow for decoration + // TODO -- this should be changed to be a color override + // it's only used for a few items and is purely decorative + public class Rainbow : ModRarity + { + public override Color RarityColor => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } +} diff --git a/Rarities/Turquoise.cs b/Rarities/Turquoise.cs new file mode 100644 index 0000000000..afc59dcb4e --- /dev/null +++ b/Rarities/Turquoise.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public class Turquoise : ModRarity + { + // Turquoise is Rarity 12 + public override Color RarityColor => new Color(0, 255, 200); + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ItemRarityID.Red, + -1 => ItemRarityID.Purple, + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/Violet.cs b/Rarities/Violet.cs new file mode 100644 index 0000000000..4aeb617b1b --- /dev/null +++ b/Rarities/Violet.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public class Violet : ModRarity + { + // Violet is Rarity 15 + public override Color RarityColor => new Color(108, 45, 199); + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Scenes/AstralScene.cs b/Scenes/AstralScene.cs deleted file mode 100644 index d1ca639599..0000000000 --- a/Scenes/AstralScene.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Systems -{ - public class AstralScene : ModSceneEffect - { - public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - - public override bool IsSceneEffectActive(Player player) => player.Calamity().ZoneAstral; - - public override void SpecialVisuals(Player player, bool isActive) - { - player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); - } - - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - } -} diff --git a/Scenes/AEWBackgroundScene.cs b/Scenes/BossBackgroundScenes/AEWBackgroundScene.cs similarity index 100% rename from Scenes/AEWBackgroundScene.cs rename to Scenes/BossBackgroundScenes/AEWBackgroundScene.cs diff --git a/Scenes/CalamitasCloneBackgroundScene.cs b/Scenes/BossBackgroundScenes/CalamitasCloneBackgroundScene.cs similarity index 100% rename from Scenes/CalamitasCloneBackgroundScene.cs rename to Scenes/BossBackgroundScenes/CalamitasCloneBackgroundScene.cs diff --git a/Scenes/CryogenBackgroundScene.cs b/Scenes/BossBackgroundScenes/CryogenBackgroundScene.cs similarity index 100% rename from Scenes/CryogenBackgroundScene.cs rename to Scenes/BossBackgroundScenes/CryogenBackgroundScene.cs diff --git a/Scenes/DoGBackgroundScene.cs b/Scenes/BossBackgroundScenes/DoGBackgroundScene.cs similarity index 100% rename from Scenes/DoGBackgroundScene.cs rename to Scenes/BossBackgroundScenes/DoGBackgroundScene.cs diff --git a/Scenes/ExoMechBackgroundScene.cs b/Scenes/BossBackgroundScenes/ExoMechBackgroundScene.cs similarity index 100% rename from Scenes/ExoMechBackgroundScene.cs rename to Scenes/BossBackgroundScenes/ExoMechBackgroundScene.cs diff --git a/Scenes/LeviathanBackgroundScene.cs b/Scenes/BossBackgroundScenes/LeviathanBackgroundScene.cs similarity index 100% rename from Scenes/LeviathanBackgroundScene.cs rename to Scenes/BossBackgroundScenes/LeviathanBackgroundScene.cs diff --git a/Scenes/PBGBackgroundScene.cs b/Scenes/BossBackgroundScenes/PBGBackgroundScene.cs similarity index 100% rename from Scenes/PBGBackgroundScene.cs rename to Scenes/BossBackgroundScenes/PBGBackgroundScene.cs diff --git a/Scenes/ProvBackgroundScene.cs b/Scenes/BossBackgroundScenes/ProvBackgroundScene.cs similarity index 100% rename from Scenes/ProvBackgroundScene.cs rename to Scenes/BossBackgroundScenes/ProvBackgroundScene.cs diff --git a/Scenes/SCalBackgroundScene.cs b/Scenes/BossBackgroundScenes/SCalBackgroundScene.cs similarity index 100% rename from Scenes/SCalBackgroundScene.cs rename to Scenes/BossBackgroundScenes/SCalBackgroundScene.cs diff --git a/Scenes/StormWeaverBackgroundScene.cs b/Scenes/BossBackgroundScenes/StormWeaverBackgroundScene.cs similarity index 100% rename from Scenes/StormWeaverBackgroundScene.cs rename to Scenes/BossBackgroundScenes/StormWeaverBackgroundScene.cs diff --git a/Scenes/YharonBackgroundScene.cs b/Scenes/BossBackgroundScenes/YharonBackgroundScene.cs similarity index 100% rename from Scenes/YharonBackgroundScene.cs rename to Scenes/BossBackgroundScenes/YharonBackgroundScene.cs diff --git a/Scenes/BossRushScene.cs b/Scenes/MiscScenes/BossRushScene.cs similarity index 62% rename from Scenes/BossRushScene.cs rename to Scenes/MiscScenes/BossRushScene.cs index 24fe6e88f1..3e08bea4ec 100644 --- a/Scenes/BossRushScene.cs +++ b/Scenes/MiscScenes/BossRushScene.cs @@ -20,20 +20,23 @@ namespace CalamityMod.Systems public override void SpecialVisuals(Player player, bool isActive) { // Clear all other skies, including the vanilla ones. - Dictionary skies = EffectsField.GetValue(SkyManager.Instance) as Dictionary; - bool updateRequired = false; - foreach (string skyName in skies.Keys) + if (isActive) { - if (skies[skyName].IsActive() && skyName != "CalamityMod:BossRush") + Dictionary skies = EffectsField.GetValue(SkyManager.Instance) as Dictionary; + bool updateRequired = false; + foreach (string skyName in skies.Keys) { - skies[skyName].Opacity = 0f; - skies[skyName].Deactivate(); - updateRequired = true; + if (skies[skyName].IsActive() && skyName != "CalamityMod:BossRush") + { + skies[skyName].Opacity = 0f; + skies[skyName].Deactivate(); + updateRequired = true; + } } - } - if (updateRequired) - SkyManager.Instance.Update(new GameTime()); + if (updateRequired) + SkyManager.Instance.Update(new GameTime()); + } player.ManageSpecialBiomeVisuals("CalamityMod:BossRush", isActive); } diff --git a/Scenes/DoGPhase2DelayScene.cs b/Scenes/MiscScenes/DoGPhase2DelayScene.cs similarity index 100% rename from Scenes/DoGPhase2DelayScene.cs rename to Scenes/MiscScenes/DoGPhase2DelayScene.cs diff --git a/Scenes/MiscScenes/MonolithAccursedScene.cs b/Scenes/MiscScenes/MonolithAccursedScene.cs new file mode 100644 index 0000000000..bc6cb839f4 --- /dev/null +++ b/Scenes/MiscScenes/MonolithAccursedScene.cs @@ -0,0 +1,17 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class MonolithAccursedScene : ModSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + + public override bool IsSceneEffectActive(Player player) => player.Calamity().monolithAccursedShader > 0; + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:MonolithAccursed", isActive); + } + } +} diff --git a/Scenes/MusicScenes/AEWMusicScene.cs b/Scenes/MusicScenes/AEWMusicScene.cs new file mode 100644 index 0000000000..6857a08cc3 --- /dev/null +++ b/Scenes/MusicScenes/AEWMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.AdultEidolonWyrm; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class AEWMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/AnahitaMusicScene.cs b/Scenes/MusicScenes/AnahitaMusicScene.cs new file mode 100644 index 0000000000..41746a90af --- /dev/null +++ b/Scenes/MusicScenes/AnahitaMusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.Leviathan; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class AnahitaMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Anahita"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + + public override bool AdditionalCheck() => CalamityGlobalNPC.leviathan == -1; + } +} diff --git a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs new file mode 100644 index 0000000000..bb227adf0e --- /dev/null +++ b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs @@ -0,0 +1,26 @@ +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.AquaticScourge; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class AquaticScourgeMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AquaticScourge"); + public override int VanillaMusic => MusicID.Boss2; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + + public override bool AdditionalCheck() + { + if (CalamityGlobalNPC.aquaticScourge == -1) + return false; + return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.getGoodWorld; + } + } +} diff --git a/Scenes/MusicScenes/AstrumAureusMusicScene.cs b/Scenes/MusicScenes/AstrumAureusMusicScene.cs new file mode 100644 index 0000000000..da9be0e2c0 --- /dev/null +++ b/Scenes/MusicScenes/AstrumAureusMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.AstrumAureus; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class AstrumAureusMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AstrumAureus"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/AstrumDeusMusicScene.cs b/Scenes/MusicScenes/AstrumDeusMusicScene.cs new file mode 100644 index 0000000000..340c785036 --- /dev/null +++ b/Scenes/MusicScenes/AstrumDeusMusicScene.cs @@ -0,0 +1,22 @@ +using CalamityMod.NPCs.AstrumDeus; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class AstrumDeusMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType() + }; + } +} diff --git a/Scenes/MusicScenes/BaseMusicSceneEffect.cs b/Scenes/MusicScenes/BaseMusicSceneEffect.cs new file mode 100644 index 0000000000..6f157d50a5 --- /dev/null +++ b/Scenes/MusicScenes/BaseMusicSceneEffect.cs @@ -0,0 +1,107 @@ +using Microsoft.Xna.Framework; +//using System.Reflection; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public abstract class BaseMusicSceneEffect : ModSceneEffect + { + // Scene Effect Priorities + // ??? (Anahita Lure): SceneEffectPriority.BossLow + // Most Bosses: SceneEffectPriority.BossMedium + // Major Post-ML Bosses: SceneEffectPriority.BossHigh + // + // BossLow = default for modded bosses but has a bug where Boss 1 is queued for 1 frame + // BossMedium = overrides all vanilla boss music, including events + // BossHigh = overrides even ML's pre-spawning music fadeout + + #region Overridable Properties + public abstract int NPCType { get; } + public abstract int? MusicModMusic { get; } + public abstract int VanillaMusic { get; } + public abstract int OtherworldMusic { get; } + public virtual int MusicDistance => 5000; + public virtual int[] AdditionalNPCs => new int[] { }; + #endregion + + #region Overridable Methods + public virtual bool AdditionalCheck() => true; + #endregion + + public virtual int SetMusic() + { + if (MusicModMusic is not null) + return (int)MusicModMusic; + + return VanillaMusic; + + // You can't even edit music if the game has Otherworld toggle on lol. Have fun with Boss 1 + /* + FieldInfo swapMusicField = typeof(Main).GetField("swapMusic", BindingFlags.Static | BindingFlags.NonPublic); + bool musicSwapped = (bool)swapMusicField.GetValue(null); + bool playingOtherworld = (!Main.drunkWorld && musicSwapped) || (Main.drunkWorld && !musicSwapped); + // Main.swapMusic is private. Todo: bug tmod devs to avoid reflection + return playingOtherworld ? OtherworldMusic : VanillaMusic; + */ + } + + public virtual bool SetSceneEffect(Player player) + { + if (!AdditionalCheck()) + return false; + + if (MusicModMusic is null && VanillaMusic == -1) + return false; + + /* + // You can't even edit music if the game has Otherworld toggle on lol. + // Theoretically, reflection would only occur if the music mod is disabled + if (MusicModMusic is null) + { + FieldInfo swapMusicField = typeof(Main).GetField("swapMusic", BindingFlags.Static | BindingFlags.NonPublic); + bool musicSwapped = (bool)swapMusicField.GetValue(null); + bool playingOtherworld = (!Main.drunkWorld && musicSwapped) || (Main.drunkWorld && !musicSwapped); + if (VanillaMusic == -1 && !playingOtherworld) + return false; + if (OtherworldMusic == -1 && playingOtherworld) + return false; + } + */ + + for (int j = 0; j < Main.maxNPCs; j++) + { + NPC npc = Main.npc[j]; + if (!npc.active) + continue; + + bool inList = false; + if (npc.type == NPCType) + inList = true; + else + { + for (int i = 0; i < AdditionalNPCs.Length; i++) + { + if (npc.type == AdditionalNPCs[i]) + { + inList = true; + break; + } + } + } + if (!inList) + continue; + + Rectangle screenRect = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); + Rectangle npcBox = new Rectangle((int)npc.Center.X - MusicDistance, (int)npc.Center.Y - MusicDistance, MusicDistance * 2, MusicDistance * 2); + if (screenRect.Intersects(npcBox)) + return true; + } + return false; + } + + public override int Music => SetMusic(); + + public override bool IsSceneEffectActive(Player player) => SetSceneEffect(player); + } +} diff --git a/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs b/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs new file mode 100644 index 0000000000..e08256546a --- /dev/null +++ b/Scenes/MusicScenes/BrimstoneElementalMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.BrimstoneElemental; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class BrimstoneElementalMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("BrimstoneElemental"); + public override int VanillaMusic => MusicID.Boss4; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/CalamitasMusicScene.cs b/Scenes/MusicScenes/CalamitasMusicScene.cs new file mode 100644 index 0000000000..e697339078 --- /dev/null +++ b/Scenes/MusicScenes/CalamitasMusicScene.cs @@ -0,0 +1,22 @@ +using CalamityMod.NPCs.Calamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class CalamitasMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Calamitas"); + public override int VanillaMusic => MusicID.Boss2; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType() + }; + } +} diff --git a/Scenes/MusicScenes/CeaselessVoidMusicScene.cs b/Scenes/MusicScenes/CeaselessVoidMusicScene.cs new file mode 100644 index 0000000000..3747c5ae14 --- /dev/null +++ b/Scenes/MusicScenes/CeaselessVoidMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.CeaselessVoid; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class CeaselessVoidMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("CeaselessVoid"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/CrabulonMusicScene.cs b/Scenes/MusicScenes/CrabulonMusicScene.cs new file mode 100644 index 0000000000..b21c95d1ef --- /dev/null +++ b/Scenes/MusicScenes/CrabulonMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Crabulon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class CrabulonMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Crabulon"); + public override int VanillaMusic => MusicID.Boss4; + public override int OtherworldMusic => MusicID.OtherworldlyBoss1; + } +} diff --git a/Scenes/MusicScenes/CryogenMusicScene.cs b/Scenes/MusicScenes/CryogenMusicScene.cs new file mode 100644 index 0000000000..6aa01cd208 --- /dev/null +++ b/Scenes/MusicScenes/CryogenMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Cryogen; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class CryogenMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Cryogen"); + public override int VanillaMusic => MusicID.FrostMoon; + public override int OtherworldMusic => MusicID.OtherworldlyIce; + } +} diff --git a/Scenes/MusicScenes/DesertScourgeMusicScene.cs b/Scenes/MusicScenes/DesertScourgeMusicScene.cs new file mode 100644 index 0000000000..58f95ff854 --- /dev/null +++ b/Scenes/MusicScenes/DesertScourgeMusicScene.cs @@ -0,0 +1,22 @@ +using CalamityMod.NPCs.DesertScourge; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class DesertScourgeMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge"); + public override int VanillaMusic => MusicID.Boss1; + public override int OtherworldMusic => MusicID.OtherworldlyBoss1; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType() + }; + } +} diff --git a/Scenes/MusicScenes/DevourerofGodsMusicScene.cs b/Scenes/MusicScenes/DevourerofGodsMusicScene.cs new file mode 100644 index 0000000000..42acfa2c2c --- /dev/null +++ b/Scenes/MusicScenes/DevourerofGodsMusicScene.cs @@ -0,0 +1,25 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.DevourerofGods; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class DevourerofGodsMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType() + }; + + public override bool AdditionalCheck() => CalamityGlobalNPC.DoGHead != -1 && CalamityGlobalNPC.DoGP2 == -1; + } +} diff --git a/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs b/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs new file mode 100644 index 0000000000..3ef0ad5663 --- /dev/null +++ b/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs @@ -0,0 +1,25 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.DevourerofGods; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class DevourerofGodsPhase2MusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP2"); + public override int VanillaMusic => MusicID.LunarBoss; + public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType() + }; + + public override bool AdditionalCheck() => CalamityGlobalNPC.DoGP2 != -1; + } +} diff --git a/Scenes/MusicScenes/DraedonMusicScene.cs b/Scenes/MusicScenes/DraedonMusicScene.cs new file mode 100644 index 0000000000..5f1571e221 --- /dev/null +++ b/Scenes/MusicScenes/DraedonMusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class DraedonMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/DraedonAmbience"); + public override int VanillaMusic => -1; + public override int OtherworldMusic => -1; + + public override bool AdditionalCheck() => CalamityGlobalNPC.draedonAmbience != -1; + } +} diff --git a/Scenes/MusicScenes/DragonfollyMusicScene.cs b/Scenes/MusicScenes/DragonfollyMusicScene.cs new file mode 100644 index 0000000000..e18a49bc8f --- /dev/null +++ b/Scenes/MusicScenes/DragonfollyMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Bumblebirb; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class DragonfollyMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Dragonfolly"); + public override int VanillaMusic => MusicID.Boss4; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/ExoMechsMusicScene.cs b/Scenes/MusicScenes/ExoMechsMusicScene.cs new file mode 100644 index 0000000000..97a9e11e4b --- /dev/null +++ b/Scenes/MusicScenes/ExoMechsMusicScene.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class ExoMechsMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("ExoMechs"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; + + public override bool AdditionalCheck() => CalamityGlobalNPC.draedonAmbience == -1; + } +} diff --git a/Scenes/MusicScenes/HiveMindMusicScene.cs b/Scenes/MusicScenes/HiveMindMusicScene.cs new file mode 100644 index 0000000000..00662ace7c --- /dev/null +++ b/Scenes/MusicScenes/HiveMindMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.HiveMind; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class HiveMindMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("HiveMind"); + public override int VanillaMusic => MusicID.Boss2; + public override int OtherworldMusic => MusicID.OtherworldlyWoF; + } +} diff --git a/Scenes/MusicScenes/LeviathanMusicScene.cs b/Scenes/MusicScenes/LeviathanMusicScene.cs new file mode 100644 index 0000000000..5875d37c7c --- /dev/null +++ b/Scenes/MusicScenes/LeviathanMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Leviathan; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class LeviathanMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndAnahita"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/LeviathanStartMusicScene.cs b/Scenes/MusicScenes/LeviathanStartMusicScene.cs new file mode 100644 index 0000000000..6e970b27a0 --- /dev/null +++ b/Scenes/MusicScenes/LeviathanStartMusicScene.cs @@ -0,0 +1,18 @@ +using CalamityMod.NPCs.Leviathan; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class LeviathanStartMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AnahitaPreboss"); + public override int VanillaMusic => -1; + public override int OtherworldMusic => -1; + public override int MusicDistance => 1600; + } +} diff --git a/Scenes/MusicScenes/OldDukeMusicScene.cs b/Scenes/MusicScenes/OldDukeMusicScene.cs new file mode 100644 index 0000000000..af357c9af3 --- /dev/null +++ b/Scenes/MusicScenes/OldDukeMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.OldDuke; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class OldDukeMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("BoomerDuke"); + public override int VanillaMusic => MusicID.DukeFishron; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/PerforatorMusicScene.cs b/Scenes/MusicScenes/PerforatorMusicScene.cs new file mode 100644 index 0000000000..cb33b7d2f6 --- /dev/null +++ b/Scenes/MusicScenes/PerforatorMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Perforator; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class PerforatorMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Perforators"); + public override int VanillaMusic => MusicID.Boss2; + public override int OtherworldMusic => MusicID.OtherworldlyWoF; + } +} diff --git a/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs b/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs new file mode 100644 index 0000000000..3058ce51e9 --- /dev/null +++ b/Scenes/MusicScenes/PlaguebringerGoliathMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.PlaguebringerGoliath; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class PlaguebringerGoliathMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("PlaguebringerGoliath"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyPlantera; + } +} diff --git a/Scenes/MusicScenes/PolterghastMusicScene.cs b/Scenes/MusicScenes/PolterghastMusicScene.cs new file mode 100644 index 0000000000..6c2ff15eba --- /dev/null +++ b/Scenes/MusicScenes/PolterghastMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Polterghast; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class PolterghastMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Polterghast"); + public override int VanillaMusic => MusicID.Plantera; + public override int OtherworldMusic => MusicID.OtherworldlyPlantera; + } +} diff --git a/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs b/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs new file mode 100644 index 0000000000..23b69ad91b --- /dev/null +++ b/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.ProfanedGuardians; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class ProfanedGuardiansMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Guardians"); + public override int VanillaMusic => MusicID.Boss1; + public override int OtherworldMusic => MusicID.OtherworldlyBoss1; + } +} diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs new file mode 100644 index 0000000000..3b94309145 --- /dev/null +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Providence; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class ProvidenceMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Providence"); + public override int VanillaMusic => MusicID.LunarBoss; + public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; + } +} diff --git a/Scenes/MusicScenes/RavagerMusicScene.cs b/Scenes/MusicScenes/RavagerMusicScene.cs new file mode 100644 index 0000000000..8e46296ab4 --- /dev/null +++ b/Scenes/MusicScenes/RavagerMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Ravager; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class RavagerMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Ravager"); + public override int VanillaMusic => MusicID.Boss4; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/SCalAcceptanceMusicScene.cs b/Scenes/MusicScenes/SCalAcceptanceMusicScene.cs new file mode 100644 index 0000000000..1770301199 --- /dev/null +++ b/Scenes/MusicScenes/SCalAcceptanceMusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SCalAcceptanceMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas4"); + public override int VanillaMusic => MusicID.Eerie; + public override int OtherworldMusic => MusicID.OtherworldlyEerie; + + public override bool AdditionalCheck() => CalamityGlobalNPC.SCalAcceptance != -1; + } +} diff --git a/Scenes/MusicScenes/SCalEpiphanyMusicScene.cs b/Scenes/MusicScenes/SCalEpiphanyMusicScene.cs new file mode 100644 index 0000000000..284e05f40e --- /dev/null +++ b/Scenes/MusicScenes/SCalEpiphanyMusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SCalEpiphanyMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas3"); + public override int VanillaMusic => MusicID.LunarBoss; + public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; + + public override bool AdditionalCheck() => CalamityGlobalNPC.SCalEpiphany != -1; + } +} diff --git a/Scenes/MusicScenes/SCalGriefMusicScene.cs b/Scenes/MusicScenes/SCalGriefMusicScene.cs new file mode 100644 index 0000000000..4dacaecf57 --- /dev/null +++ b/Scenes/MusicScenes/SCalGriefMusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SCalGriefMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas1"); + public override int VanillaMusic => MusicID.Boss2; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + + public override bool AdditionalCheck() => CalamityGlobalNPC.SCalGrief != -1; + } +} diff --git a/Scenes/MusicScenes/SCalLamentMusicScene.cs b/Scenes/MusicScenes/SCalLamentMusicScene.cs new file mode 100644 index 0000000000..17c749010a --- /dev/null +++ b/Scenes/MusicScenes/SCalLamentMusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SCalLamentMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas2"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyWoF; + + public override bool AdditionalCheck() => CalamityGlobalNPC.SCalLament != -1; + } +} diff --git a/Scenes/MusicScenes/SignusMusicScene.cs b/Scenes/MusicScenes/SignusMusicScene.cs new file mode 100644 index 0000000000..8fef7b42f7 --- /dev/null +++ b/Scenes/MusicScenes/SignusMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.Signus; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SignusMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Signus"); + public override int VanillaMusic => MusicID.Boss4; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + } +} diff --git a/Scenes/MusicScenes/SlimeGodMusicScene.cs b/Scenes/MusicScenes/SlimeGodMusicScene.cs new file mode 100644 index 0000000000..11aeb12d14 --- /dev/null +++ b/Scenes/MusicScenes/SlimeGodMusicScene.cs @@ -0,0 +1,17 @@ +using CalamityMod.NPCs.SlimeGod; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SlimeGodMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod"); + public override int VanillaMusic => MusicID.Boss1; + public override int OtherworldMusic => MusicID.OtherworldlyBoss1; + } +} diff --git a/Scenes/MusicScenes/StormWeaverMusicScene.cs b/Scenes/MusicScenes/StormWeaverMusicScene.cs new file mode 100644 index 0000000000..65ebb299b1 --- /dev/null +++ b/Scenes/MusicScenes/StormWeaverMusicScene.cs @@ -0,0 +1,22 @@ +using CalamityMod.NPCs.StormWeaver; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class StormWeaverMusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Weaver"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + public override int[] AdditionalNPCs => new int[] + { + ModContent.NPCType(), + ModContent.NPCType() + }; + } +} diff --git a/Scenes/MusicScenes/YharonPhase1MusicScene.cs b/Scenes/MusicScenes/YharonPhase1MusicScene.cs new file mode 100644 index 0000000000..7cee1b0a40 --- /dev/null +++ b/Scenes/MusicScenes/YharonPhase1MusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.Yharon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class YharonPhase1MusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("YharonP1"); + public override int VanillaMusic => MusicID.Boss3; + public override int OtherworldMusic => MusicID.OtherworldlyBoss2; + + public override bool AdditionalCheck() => CalamityGlobalNPC.yharon != -1 && CalamityGlobalNPC.yharonP2 == -1; + } +} diff --git a/Scenes/MusicScenes/YharonPhase2MusicScene.cs b/Scenes/MusicScenes/YharonPhase2MusicScene.cs new file mode 100644 index 0000000000..7379c7d9cf --- /dev/null +++ b/Scenes/MusicScenes/YharonPhase2MusicScene.cs @@ -0,0 +1,20 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.Yharon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class YharonPhase2MusicScene : BaseMusicSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + + public override int NPCType => ModContent.NPCType(); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("YharonP2"); + public override int VanillaMusic => MusicID.LunarBoss; + public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; + + public override bool AdditionalCheck() => CalamityGlobalNPC.yharonP2 != -1; + } +} diff --git a/Scenes/SulphurousSeaScene.cs b/Scenes/SulphurousSeaScene.cs deleted file mode 100644 index c8e26256c8..0000000000 --- a/Scenes/SulphurousSeaScene.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Systems -{ - public class SulphurousSeaScene : ModSceneEffect - { - public override bool IsSceneEffectActive(Player player) => player.Calamity().ZoneSulphur; - - public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"; - } -} diff --git a/Schematics/CalamitySchematicIO.cs b/Schematics/CalamitySchematicIO.cs index 74918c8183..4f206dab30 100644 --- a/Schematics/CalamitySchematicIO.cs +++ b/Schematics/CalamitySchematicIO.cs @@ -142,16 +142,16 @@ namespace CalamityMod.Schematics // Schematics assume 1024 or less unique tile definitions for their internal buffer. // In real schematics, this number usually doesn't go above about 800. // The buffer can be expanded up to 65536, as the indices used for it are 2 bytes. - // Note this would by definition require a schematic of size at least 256x256, so you should never really get to this point. + // Note this would by definition require a schematic of size at least 725x725, so you should never really get to this point. private const int DefaultUniqueTileCount = 1024; - public const int MaxUniqueTileCount = ushort.MaxValue + 1; + public const int MaxUniqueTileCount = 524288; private const int DefaultModTileCount = 256; private const int DefaultModWallCount = 32; public readonly IList uniqueTiles; public readonly IList modTileNames; public readonly IList modWallNames; - public readonly ushort[,] areaIndices; + public readonly uint[,] areaIndices; public SchematicData(int width, int height) { @@ -164,7 +164,7 @@ namespace CalamityMod.Schematics }; modTileNames = new List(DefaultModTileCount); modWallNames = new List(DefaultModWallCount); - areaIndices = new ushort[width, height]; + areaIndices = new uint[width, height]; } } @@ -179,8 +179,8 @@ namespace CalamityMod.Schematics public static class CalamitySchematicIO { - // A generous buffer of 1 megabyte is the default for schematics. If this somehow isn't big enough, they can get bigger. - private const int SchematicBufferStartingSize = 1048576; + // A generous buffer of 16 megabytes is the default for schematics. If this somehow isn't big enough, they can get bigger. + private const int SchematicBufferStartingSize = 16777216; // If true, written schematics will have all data GZip compressed except for the magic number header. public static bool UseCompression = true; @@ -210,6 +210,16 @@ namespace CalamityMod.Schematics public static ushort PreserveTileID = 0; public static ushort PreserveWallID = 0; + // Special magic header for determining if schematics must be made in a way that allows for extraordinarily large quantities of unique tiles (past the unsigned 16-bit limit). + // This is by default unused and is irrelevant to Calamity on its own, but exists for use by Infernum. + // 1F145C = "1NFERNUM 1.4 5CHEMATIC" + private static readonly byte[] SchematicMagicNumberHeader_Infernum14 = new byte[] + { + 0x1F, + 0x14, + 0x5C + }; + #region Direct Serialization Read/Write // TileWallWireStateData is a value type, so it must be passed as ref to make changes. internal static void AssignMiscState(ref TileWallWireStateData target, int source) @@ -362,7 +372,7 @@ namespace CalamityMod.Schematics } } - private static SchematicData ConstructSchematicData(Tile[,] tiles) + private static SchematicData ConstructSchematicData(Tile[,] tiles, bool infernum) { int width = tiles.GetLength(0); int height = tiles.GetLength(1); @@ -398,7 +408,10 @@ namespace CalamityMod.Schematics goto PostAreaIteration; // Update the area indices so that the tile at this position is the correct reference. - schematic.areaIndices[x, y] = (ushort)metaTileIndex; + if (infernum) + schematic.areaIndices[x, y] = (uint)metaTileIndex; + else + schematic.areaIndices[x, y] = (ushort)metaTileIndex; } PostAreaIteration: @@ -413,7 +426,7 @@ namespace CalamityMod.Schematics #endregion #region Export - public static ExportResult ExportSchematic(Rectangle area) + public static ExportResult ExportSchematic(Rectangle area, bool infernum) { if (area.Top < 0 || area.Left < 0 || area.Right >= Main.maxTilesX || area.Bottom >= Main.maxTilesY) return ExportResult.CornerOutOfWorld; @@ -424,6 +437,7 @@ namespace CalamityMod.Schematics Tile[,] tiles = GetTilesInRectangle(area); byte[] renderedStream; + byte[] magicHeader = infernum ? SchematicMagicNumberHeader_Infernum14 : SchematicMagicNumberHeader_TML14; using (MemoryStream stream = new MemoryStream(SchematicBufferStartingSize)) using (BinaryWriter writer = new BinaryWriter(stream, Encoding.UTF8)) { @@ -431,12 +445,12 @@ namespace CalamityMod.Schematics // This is only included here if compression is turned off if (!UseCompression) { - writer.Write(SchematicMagicNumberHeader_TML14); + writer.Write(magicHeader); writer.Write(UncompressedMagicNumber); } // Calculate the schematic's data. Fail immediately if the schematic has too many unique tiles. - SchematicData schematic = ConstructSchematicData(tiles); + SchematicData schematic = ConstructSchematicData(tiles, infernum); if (schematic.uniqueTiles.Count <= 0) { writer.Close(); @@ -444,29 +458,42 @@ namespace CalamityMod.Schematics } // 2: Length of list 3. - ushort numModTileNames = (ushort)schematic.modTileNames.Count; + uint numModTileNames; + if (infernum) + numModTileNames = (uint)schematic.modTileNames.Count; + else + numModTileNames = (ushort)schematic.modTileNames.Count; writer.Write(numModTileNames); // 3: List of fully qualified modded tile names. - for (ushort i = 0; i < numModTileNames; ++i) + for (int i = 0; i < numModTileNames; ++i) writer.Write(schematic.modTileNames[i]); // 4: Length of list 5. - ushort numModWallNames = (ushort)schematic.modWallNames.Count; + uint numModWallNames; + if (infernum) + numModWallNames = (uint)schematic.modWallNames.Count; + else + numModWallNames = (ushort)schematic.modWallNames.Count; writer.Write(numModWallNames); // 5: List of fully qualified modded wall names. - for (ushort i = 0; i < numModWallNames; ++i) + for (int i = 0; i < numModWallNames; ++i) writer.Write(schematic.modWallNames[i]); // 6: Length of list 7. - ushort numUniqueTiles = (ushort)schematic.uniqueTiles.Count; + uint numUniqueTiles; + if (infernum) + numUniqueTiles = (uint)schematic.uniqueTiles.Count; + else + numUniqueTiles = (ushort)schematic.uniqueTiles.Count; + writer.Write(numUniqueTiles); // 7: List of definitions of unique tiles. For modded tiles, their types are lookup indices to the mod tile and mod wall name arrays. // Specific tiles and walls from the CalamitySchematicExporter mod have hardcoded behavior at this step. // They will be replaced with preserve flags by overriding the tile and wall meta indices. - for (ushort i = 0; i < numUniqueTiles; ++i) + for (int i = 0; i < numUniqueTiles; ++i) writer.WriteSchematicMetaTile(schematic.uniqueTiles[i]); // 8: Width and height of array 9. @@ -478,7 +505,12 @@ namespace CalamityMod.Schematics // 9: Array of indices to unique tile definitions. for (ushort y = 0; y < tileHeight; ++y) for (ushort x = 0; x < tileWidth; ++x) - writer.Write(schematic.areaIndices[x, y]); + { + if (infernum) + writer.Write(schematic.areaIndices[x, y]); + else + writer.Write((ushort)schematic.areaIndices[x, y]); + } // Compile all serialized data into a byte array for writing. renderedStream = stream.ToArray(); @@ -491,7 +523,7 @@ namespace CalamityMod.Schematics // Write the magic number outside the compressed region of data if compression is enabled. // This is the only way for a reading algorithm to know this is a compressed schematic. - gzMem.Write(SchematicMagicNumberHeader_TML14, 0, SchematicMagicNumberHeader_TML14.Length); + gzMem.Write(magicHeader, 0, magicHeader.Length); gzMem.WriteByte(CompressedMagicNumber); using (GZipStream gz = new GZipStream(gzMem, CompressionLevel.Optimal)) @@ -566,6 +598,7 @@ namespace CalamityMod.Schematics bool isTML13Schematic = true; bool isTML14Schematic = true; + bool isInfernumSchematic = true; for (int i = 0; i < SchematicMagicNumberHeader_TML14.Length; ++i) { if (header[i] != SchematicMagicNumberHeader_TML13[i]) @@ -573,10 +606,13 @@ namespace CalamityMod.Schematics if (header[i] != SchematicMagicNumberHeader_TML14[i]) isTML14Schematic = false; + + if (header[i] != SchematicMagicNumberHeader_Infernum14[i]) + isInfernumSchematic = false; } - // If the schematic is neither TML 1.3 or TML 1.4 format, then it's crap. - if (!isTML13Schematic && !isTML14Schematic) + // If the schematic is neither TML 1.3, TML 1.4, or Infernum format, then it's crap. + if (!isTML13Schematic && !isTML14Schematic && !isInfernumSchematic) throw new InvalidDataException($"{InvalidFormatString} The magic number signature is invalid."); else if (isTML13Schematic) { @@ -607,7 +643,11 @@ namespace CalamityMod.Schematics using (BinaryReader reader = new BinaryReader(bufferStream, Encoding.UTF8)) { // 2: Length of list 3. - ushort numModTileNames = reader.ReadUInt16(); + uint numModTileNames; + if (isInfernumSchematic) + numModTileNames = reader.ReadUInt32(); + else + numModTileNames = reader.ReadUInt16(); // 3: List of fully qualified modded tile names. string[] modTileNames = new string[numModTileNames]; @@ -615,7 +655,11 @@ namespace CalamityMod.Schematics modTileNames[i] = reader.ReadString(); // 4: Length of list 5. - ushort numModWallNames = reader.ReadUInt16(); + uint numModWallNames; + if (isInfernumSchematic) + numModWallNames = reader.ReadUInt32(); + else + numModWallNames = reader.ReadUInt16(); string[] modWallNames = new string[numModWallNames]; // 5: List of fully qualified modded wall names. @@ -623,11 +667,16 @@ namespace CalamityMod.Schematics modWallNames[i] = reader.ReadString(); // 6: Length of list 7. - ushort numUniqueTiles = reader.ReadUInt16(); + uint numUniqueTiles; + if (isInfernumSchematic) + numUniqueTiles = reader.ReadUInt32(); + else + numUniqueTiles = reader.ReadUInt16(); + SchematicMetaTile[] uniqueTiles = new SchematicMetaTile[numUniqueTiles]; // 7: List of definitions of unique tiles. For modded tiles, their types are lookup indices to the mod tile and mod wall name arrays. - for (ushort i = 0; i < numUniqueTiles; ++i) + for (int i = 0; i < numUniqueTiles; ++i) { SchematicMetaTile smt = reader.ReadSchematicMetaTile(); ReplaceMetaIndicesWithLoadedIDs(ref smt, modTileNames, modWallNames); @@ -643,7 +692,12 @@ namespace CalamityMod.Schematics for (ushort y = 0; y < tileHeight; ++y) for (ushort x = 0; x < tileWidth; ++x) { - ushort tileIndex = reader.ReadUInt16(); + uint tileIndex; + if (isInfernumSchematic) + tileIndex = reader.ReadUInt32(); + else + tileIndex = reader.ReadUInt16(); + ret[x, y] = uniqueTiles[tileIndex]; } } diff --git a/Skies/MonolithScreenShaderData.cs b/Skies/MonolithScreenShaderData.cs new file mode 100644 index 0000000000..51f3666345 --- /dev/null +++ b/Skies/MonolithScreenShaderData.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Skies +{ + public class MonolithScreenShaderData : ScreenShaderData + { + public MonolithScreenShaderData(string passName) + : base(passName) + { + } + + public override void Apply() + { + Vector3 vec = Main.ColorOfTheSkies.ToVector3(); + vec *= 0.4f; + base.UseOpacity(Math.Max(vec.X, Math.Max(vec.Y, vec.Z))); + base.Apply(); + } + + public override void Update(GameTime gameTime) + { + if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1) + Filters.Scene["CalamityMod:MonolithAccursed"].Deactivate(Array.Empty()); + } + } +} diff --git a/Skies/MonolithSky.cs b/Skies/MonolithSky.cs new file mode 100644 index 0000000000..17c3cf6d43 --- /dev/null +++ b/Skies/MonolithSky.cs @@ -0,0 +1,135 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + public class MonolithSky : CustomSky + { + public class Cinder + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + public Cinder(int lifetime, int identity, float depth, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + } + } + + private bool skyActive; + private float opacity; + public List Cinders = new List(); + + public override void Deactivate(params object[] args) => skyActive = false; + + public override void Reset() => skyActive = false; + + public override bool IsActive() => skyActive || opacity > 0f; + + public override void Activate(Vector2 position, params object[] args) => skyActive = true; + + public override void Update(GameTime gameTime) + { + if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1) + skyActive = false; + + if (skyActive && opacity < 1f) + { + opacity += 0.02f; + } + else if (!skyActive && opacity > 0f) + { + opacity -= 0.02f; + } + + static Color selectCinderColor() + { + if (Main.rand.NextBool(3)) + return Color.Lerp(Color.DarkGray, Color.LightGray, Main.rand.NextFloat()); + + return Color.Lerp(Color.Red, Color.Yellow, Main.rand.NextFloat(0.9f)); + } + + // Randomly add cinders. + if (Main.rand.NextBool(12) && skyActive) + { + int lifetime = Main.rand.Next(285, 445); + float depth = Main.rand.NextFloat(1.8f, 5f); + Vector2 startingPosition = Main.screenPosition + new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f); + Vector2 startingVelocity = -Vector2.UnitY.RotatedByRandom(0.91f); + Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, selectCinderColor(), startingPosition, startingVelocity)); + } + + // Update all cinders. + if (skyActive) + { + float cinderSpeed = 5.6f; + for (int i = 0; i < Cinders.Count; i++) + { + Cinders[i].Scale = Utils.GetLerpValue(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true); + Cinders[i].Scale *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f); + + Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.94f, 0.94f, (float)Math.Sin(Cinders[i].Time / 36f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)) * cinderSpeed; + float movementInterpolant = MathHelper.Lerp(0.01f, 0.08f, Utils.GetLerpValue(45f, 145f, Cinders[i].Time, true)); + Cinders[i].Velocity = Vector2.Lerp(Cinders[i].Velocity, idealVelocity, movementInterpolant); + Cinders[i].Velocity = Cinders[i].Velocity.SafeNormalize(-Vector2.UnitY) * cinderSpeed; + Cinders[i].Time++; + + Cinders[i].Center += Cinders[i].Velocity; + } + } + + // Clear away all dead cinders. + Cinders.RemoveAll(c => c.Time >= c.Lifetime); + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1) + return; + + if (maxDepth >= float.MaxValue && minDepth < float.MaxValue && Main.LocalPlayer.Calamity().monolithAccursedShader > 21) + { + Texture2D texture = ModContent.Request("CalamityMod/MainMenu/MenuBackground").Value; + int offset = Main.BackgroundEnabled ? 200 : 0; + spriteBatch.Draw(texture, new Rectangle(0, Math.Max(0, (int)((Main.worldSurface * 16 - Main.screenPosition.Y - texture.Height * 2) * 0.1f)) - offset, Main.screenWidth, Main.screenHeight), Color.White * Math.Min(1f, (Main.screenPosition.Y - 800f) / 1000f * opacity)); + } + + // Draw cinders. + Texture2D cinderTexture = ModContent.Request("CalamityMod/ExtraTextures/CalamitasCinder").Value; + for (int i = 0; i < Cinders.Count; i++) + { + Vector2 drawPosition = Cinders[i].Center - Main.screenPosition; + for (int j = 0; j < 3; j++) + { + Vector2 offsetDrawPosition = drawPosition + (MathHelper.TwoPi * j / 3f).ToRotationVector2() * 1.4f; + Color offsetDrawColor = Color.Red * 0.56f; + offsetDrawColor.A = 0; + spriteBatch.Draw(cinderTexture, offsetDrawPosition, null, offsetDrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale * 1.5f, SpriteEffects.None, 0f); + } + spriteBatch.Draw(cinderTexture, drawPosition, null, Cinders[i].DrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale, SpriteEffects.None, 0f); + } + } + + public override Color OnTileColor(Color color) => Color.Lerp(color, new Color(205, 100, 100), opacity); + + public override float GetCloudAlpha() => (1f - opacity) * 0.3f + 0.7f; + } +} diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index f17f4a11c8..32730dedf3 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -40,6 +40,13 @@ namespace CalamityMod.Skies private float intensity = 0f; private int SCalIndex = -1; public List Cinders = new List(); + + public static bool RitualDramaProjectileIsPresent + { + get; + internal set; + } + public static int CinderReleaseChance { get @@ -161,7 +168,7 @@ namespace CalamityMod.Skies private float GetIntensity() { - if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) + if (RitualDramaProjectileIsPresent) return OverridingIntensity; OverridingIntensity = 0f; @@ -170,7 +177,7 @@ namespace CalamityMod.Skies float x = 0f; if (SCalIndex != -1) x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); - float intensityFactor = BossRushEvent.BossRushActive ? -0.2f : intensity; + float intensityFactor = BossRushEvent.BossRushActive ? -0.2f : 1f; return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityFactor; } diff --git a/Sounds/CommonCalamitySounds.cs b/Sounds/CommonCalamitySounds.cs index 2640b25e1c..2547385f6c 100644 --- a/Sounds/CommonCalamitySounds.cs +++ b/Sounds/CommonCalamitySounds.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Sounds public static readonly SoundStyle AstralNPCHitSound = new("CalamityMod/Sounds/NPCHit/AstralEnemyHit", 3); public static readonly SoundStyle AstralNPCDeathSound = new("CalamityMod/Sounds/NPCKilled/AstralEnemyDeath") { Volume = 0.7f }; + public static readonly SoundStyle WulfrumNPCDeathSound = new("CalamityMod/Sounds/NPCKilled/WulfrumDeath"); public static readonly SoundStyle PlagueBoomSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); @@ -37,5 +38,8 @@ namespace CalamityMod.Sounds public static readonly SoundStyle ScissorGuillotineSnapSound = new("CalamityMod/Sounds/Custom/ScissorGuillotineSnap"); public static readonly SoundStyle LouderPhantomPhoenix = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix", 3); + + public static readonly SoundStyle LouderSwingWoosh = new("CalamityMod/Sounds/Custom/LoudSwingWoosh"); + } } diff --git a/Sounds/Custom/AbilitySounds/DesertProwlerCDReset.ogg b/Sounds/Custom/AbilitySounds/DesertProwlerCDReset.ogg new file mode 100644 index 0000000000..349ed45c88 Binary files /dev/null and b/Sounds/Custom/AbilitySounds/DesertProwlerCDReset.ogg differ diff --git a/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBomb.ogg b/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBomb.ogg new file mode 100644 index 0000000000..886cdaecef Binary files /dev/null and b/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBomb.ogg differ diff --git a/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombEnd.ogg b/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombEnd.ogg new file mode 100644 index 0000000000..7024a28213 Binary files /dev/null and b/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombEnd.ogg differ diff --git a/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombReload.ogg b/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombReload.ogg new file mode 100644 index 0000000000..1fae571b7d Binary files /dev/null and b/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombReload.ogg differ diff --git a/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg b/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg new file mode 100644 index 0000000000..8805e86459 Binary files /dev/null and b/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg differ diff --git a/Sounds/Custom/AbilitySounds/WulfrumBastionBreak.ogg b/Sounds/Custom/AbilitySounds/WulfrumBastionBreak.ogg new file mode 100644 index 0000000000..0838420342 Binary files /dev/null and b/Sounds/Custom/AbilitySounds/WulfrumBastionBreak.ogg differ diff --git a/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely.ogg b/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely.ogg new file mode 100644 index 0000000000..54ebd12d5c Binary files /dev/null and b/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely.ogg differ diff --git a/Sounds/Custom/AbilitySounds/WulfrumBastionRecharge.ogg b/Sounds/Custom/AbilitySounds/WulfrumBastionRecharge.ogg new file mode 100644 index 0000000000..908b505102 Binary files /dev/null and b/Sounds/Custom/AbilitySounds/WulfrumBastionRecharge.ogg differ diff --git a/Sounds/Custom/AbyssDrown.ogg b/Sounds/Custom/AbyssDrown.ogg new file mode 100644 index 0000000000..cb89236908 Binary files /dev/null and b/Sounds/Custom/AbyssDrown.ogg differ diff --git a/Sounds/Custom/AbyssGravelMine1.ogg b/Sounds/Custom/AbyssGravelMine1.ogg new file mode 100644 index 0000000000..86b8ff961f Binary files /dev/null and b/Sounds/Custom/AbyssGravelMine1.ogg differ diff --git a/Sounds/Custom/AbyssGravelMine2.ogg b/Sounds/Custom/AbyssGravelMine2.ogg new file mode 100644 index 0000000000..2b6a62ab31 Binary files /dev/null and b/Sounds/Custom/AbyssGravelMine2.ogg differ diff --git a/Sounds/Custom/AbyssGravelMine3.ogg b/Sounds/Custom/AbyssGravelMine3.ogg new file mode 100644 index 0000000000..c8346c0cd1 Binary files /dev/null and b/Sounds/Custom/AbyssGravelMine3.ogg differ diff --git a/Sounds/Custom/AdrenalineMajorLoss.ogg b/Sounds/Custom/AdrenalineMajorLoss.ogg new file mode 100644 index 0000000000..f61237c07c Binary files /dev/null and b/Sounds/Custom/AdrenalineMajorLoss.ogg differ diff --git a/Sounds/Custom/AresGaussNukeArmCharge.ogg b/Sounds/Custom/AresGaussNukeArmCharge.ogg new file mode 100644 index 0000000000..f7e2de88b6 Binary files /dev/null and b/Sounds/Custom/AresGaussNukeArmCharge.ogg differ diff --git a/Sounds/Custom/AresLaserArmCharge.ogg b/Sounds/Custom/AresLaserArmCharge.ogg new file mode 100644 index 0000000000..d0df21ad6d Binary files /dev/null and b/Sounds/Custom/AresLaserArmCharge.ogg differ diff --git a/Sounds/Custom/AresPlasmaArmCharge.ogg b/Sounds/Custom/AresPlasmaArmCharge.ogg new file mode 100644 index 0000000000..c1d3e61f70 Binary files /dev/null and b/Sounds/Custom/AresPlasmaArmCharge.ogg differ diff --git a/Sounds/Custom/AresTeslaArmCharge.ogg b/Sounds/Custom/AresTeslaArmCharge.ogg new file mode 100644 index 0000000000..65cf772b08 Binary files /dev/null and b/Sounds/Custom/AresTeslaArmCharge.ogg differ diff --git a/Sounds/Custom/AstralStarFall.ogg b/Sounds/Custom/AstralStarFall.ogg new file mode 100644 index 0000000000..b7cf9cfd6d Binary files /dev/null and b/Sounds/Custom/AstralStarFall.ogg differ diff --git a/Sounds/Custom/AuricMine1.ogg b/Sounds/Custom/AuricMine1.ogg new file mode 100644 index 0000000000..61c9bb5c81 Binary files /dev/null and b/Sounds/Custom/AuricMine1.ogg differ diff --git a/Sounds/Custom/AuricMine2.ogg b/Sounds/Custom/AuricMine2.ogg new file mode 100644 index 0000000000..6188a7a776 Binary files /dev/null and b/Sounds/Custom/AuricMine2.ogg differ diff --git a/Sounds/Custom/AuricMine3.ogg b/Sounds/Custom/AuricMine3.ogg new file mode 100644 index 0000000000..fe6b937655 Binary files /dev/null and b/Sounds/Custom/AuricMine3.ogg differ diff --git a/Sounds/Custom/BloodPactCrit.ogg b/Sounds/Custom/BloodPactCrit.ogg new file mode 100644 index 0000000000..75739fb53c Binary files /dev/null and b/Sounds/Custom/BloodPactCrit.ogg differ diff --git a/Sounds/Custom/CeaselessVoidDeathBuild.ogg b/Sounds/Custom/CeaselessVoidDeathBuild.ogg new file mode 100644 index 0000000000..44760455da Binary files /dev/null and b/Sounds/Custom/CeaselessVoidDeathBuild.ogg differ diff --git a/Sounds/Custom/Codebreaker/AdvancedDisplayInstall.ogg b/Sounds/Custom/Codebreaker/AdvancedDisplayInstall.ogg new file mode 100644 index 0000000000..4a65902933 Binary files /dev/null and b/Sounds/Custom/Codebreaker/AdvancedDisplayInstall.ogg differ diff --git a/Sounds/Custom/Codebreaker/AresIconHover.ogg b/Sounds/Custom/Codebreaker/AresIconHover.ogg new file mode 100644 index 0000000000..7ca4c9e2a7 Binary files /dev/null and b/Sounds/Custom/Codebreaker/AresIconHover.ogg differ diff --git a/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg b/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg new file mode 100644 index 0000000000..8af3763f64 Binary files /dev/null and b/Sounds/Custom/Codebreaker/ArtemisApolloIconHover.ogg differ diff --git a/Sounds/Custom/Codebreaker/AuricQuantumCoolingCellInstallNew.ogg b/Sounds/Custom/Codebreaker/AuricQuantumCoolingCellInstallNew.ogg new file mode 100644 index 0000000000..cd260a6d97 Binary files /dev/null and b/Sounds/Custom/Codebreaker/AuricQuantumCoolingCellInstallNew.ogg differ diff --git a/Sounds/Custom/Codebreaker/DecryptionComputerInstall.ogg b/Sounds/Custom/Codebreaker/DecryptionComputerInstall.ogg new file mode 100644 index 0000000000..898ef6ac3b Binary files /dev/null and b/Sounds/Custom/Codebreaker/DecryptionComputerInstall.ogg differ diff --git a/Sounds/Custom/Codebreaker/ExoMechsIconSelect.ogg b/Sounds/Custom/Codebreaker/ExoMechsIconSelect.ogg new file mode 100644 index 0000000000..dff2ab9f61 Binary files /dev/null and b/Sounds/Custom/Codebreaker/ExoMechsIconSelect.ogg differ diff --git a/Sounds/Custom/Codebreaker/LongRangeSensorArrayInstall.ogg b/Sounds/Custom/Codebreaker/LongRangeSensorArrayInstall.ogg new file mode 100644 index 0000000000..7651db0470 Binary files /dev/null and b/Sounds/Custom/Codebreaker/LongRangeSensorArrayInstall.ogg differ diff --git a/Sounds/Custom/Codebreaker/ThanatosIconHover.ogg b/Sounds/Custom/Codebreaker/ThanatosIconHover.ogg new file mode 100644 index 0000000000..88afe0144c Binary files /dev/null and b/Sounds/Custom/Codebreaker/ThanatosIconHover.ogg differ diff --git a/Sounds/Custom/Codebreaker/VoltageRegulationSystemInstall.ogg b/Sounds/Custom/Codebreaker/VoltageRegulationSystemInstall.ogg new file mode 100644 index 0000000000..80d1900b22 Binary files /dev/null and b/Sounds/Custom/Codebreaker/VoltageRegulationSystemInstall.ogg differ diff --git a/Sounds/Custom/ExoTwinsEject.ogg b/Sounds/Custom/ExoTwinsEject.ogg new file mode 100644 index 0000000000..2f898a3a26 Binary files /dev/null and b/Sounds/Custom/ExoTwinsEject.ogg differ diff --git a/Sounds/Custom/HeavenlyGaleLightningStrike.ogg b/Sounds/Custom/HeavenlyGaleLightningStrike.ogg new file mode 100644 index 0000000000..0a164a5e2b Binary files /dev/null and b/Sounds/Custom/HeavenlyGaleLightningStrike.ogg differ diff --git a/Sounds/Custom/HiveMindRoar.ogg b/Sounds/Custom/HiveMindRoar.ogg new file mode 100644 index 0000000000..e7ed02cbef Binary files /dev/null and b/Sounds/Custom/HiveMindRoar.ogg differ diff --git a/Sounds/Custom/HiveMindRoarFast.ogg b/Sounds/Custom/HiveMindRoarFast.ogg new file mode 100644 index 0000000000..2f7339fb68 Binary files /dev/null and b/Sounds/Custom/HiveMindRoarFast.ogg differ diff --git a/Sounds/Custom/IjiDies.ogg b/Sounds/Custom/IjiDies.ogg new file mode 100644 index 0000000000..c8af0e0dae Binary files /dev/null and b/Sounds/Custom/IjiDies.ogg differ diff --git a/Sounds/Custom/LeviathanEmerge.ogg b/Sounds/Custom/LeviathanEmerge.ogg new file mode 100644 index 0000000000..bef4021fef Binary files /dev/null and b/Sounds/Custom/LeviathanEmerge.ogg differ diff --git a/Sounds/Custom/LeviathanRumble.ogg b/Sounds/Custom/LeviathanRumble.ogg new file mode 100644 index 0000000000..1dd50f9d97 Binary files /dev/null and b/Sounds/Custom/LeviathanRumble.ogg differ diff --git a/Sounds/Custom/LoudSwingWoosh.ogg b/Sounds/Custom/LoudSwingWoosh.ogg new file mode 100644 index 0000000000..1717add456 Binary files /dev/null and b/Sounds/Custom/LoudSwingWoosh.ogg differ diff --git a/Sounds/Custom/ORDER.ogg b/Sounds/Custom/ORDER.ogg new file mode 100644 index 0000000000..a644aa2417 Binary files /dev/null and b/Sounds/Custom/ORDER.ogg differ diff --git a/Sounds/Custom/PlagueUnleash.ogg b/Sounds/Custom/PlagueUnleash.ogg new file mode 100644 index 0000000000..958aaf14d5 Binary files /dev/null and b/Sounds/Custom/PlagueUnleash.ogg differ diff --git a/Sounds/Custom/PlantyMushMine1.ogg b/Sounds/Custom/PlantyMushMine1.ogg new file mode 100644 index 0000000000..9a5ed86910 Binary files /dev/null and b/Sounds/Custom/PlantyMushMine1.ogg differ diff --git a/Sounds/Custom/PlantyMushMine2.ogg b/Sounds/Custom/PlantyMushMine2.ogg new file mode 100644 index 0000000000..cc40083a16 Binary files /dev/null and b/Sounds/Custom/PlantyMushMine2.ogg differ diff --git a/Sounds/Custom/PlantyMushMine3.ogg b/Sounds/Custom/PlantyMushMine3.ogg new file mode 100644 index 0000000000..64660a667e Binary files /dev/null and b/Sounds/Custom/PlantyMushMine3.ogg differ diff --git a/Sounds/Custom/PoltergastPhantomSpawn.ogg b/Sounds/Custom/PoltergastPhantomSpawn.ogg new file mode 100644 index 0000000000..4dfa75e09b Binary files /dev/null and b/Sounds/Custom/PoltergastPhantomSpawn.ogg differ diff --git a/Sounds/Custom/PolterghastP2Transition.ogg b/Sounds/Custom/PolterghastP2Transition.ogg new file mode 100644 index 0000000000..fec9a89d4b Binary files /dev/null and b/Sounds/Custom/PolterghastP2Transition.ogg differ diff --git a/Sounds/Custom/PolterghastP3Transition.ogg b/Sounds/Custom/PolterghastP3Transition.ogg new file mode 100644 index 0000000000..de5c1a0f0d Binary files /dev/null and b/Sounds/Custom/PolterghastP3Transition.ogg differ diff --git a/Sounds/Custom/PolterghastSpawn.ogg b/Sounds/Custom/PolterghastSpawn.ogg new file mode 100644 index 0000000000..ff998096ee Binary files /dev/null and b/Sounds/Custom/PolterghastSpawn.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerJump1.ogg b/Sounds/Custom/Ravager/RavagerJump1.ogg new file mode 100644 index 0000000000..e24840aeee Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerJump1.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerJump2.ogg b/Sounds/Custom/Ravager/RavagerJump2.ogg new file mode 100644 index 0000000000..0967171d6f Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerJump2.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerMissileExplosion.ogg b/Sounds/Custom/Ravager/RavagerMissileExplosion.ogg new file mode 100644 index 0000000000..f7c36a81c9 Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerMissileExplosion.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerMissileLaunch.ogg b/Sounds/Custom/Ravager/RavagerMissileLaunch.ogg new file mode 100644 index 0000000000..2dec4fc301 Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerMissileLaunch.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerPillarSummon.ogg b/Sounds/Custom/Ravager/RavagerPillarSummon.ogg new file mode 100644 index 0000000000..7f85284286 Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerPillarSummon.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerPunch1.ogg b/Sounds/Custom/Ravager/RavagerPunch1.ogg new file mode 100644 index 0000000000..6ed8b9847b Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerPunch1.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerPunch2.ogg b/Sounds/Custom/Ravager/RavagerPunch2.ogg new file mode 100644 index 0000000000..9773b1435b Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerPunch2.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerStomp1.ogg b/Sounds/Custom/Ravager/RavagerStomp1.ogg new file mode 100644 index 0000000000..413bb13202 Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerStomp1.ogg differ diff --git a/Sounds/Custom/Ravager/RavagerStomp2.ogg b/Sounds/Custom/Ravager/RavagerStomp2.ogg new file mode 100644 index 0000000000..2cae5c0eab Binary files /dev/null and b/Sounds/Custom/Ravager/RavagerStomp2.ogg differ diff --git a/Sounds/Custom/RoverDriveActivate.ogg b/Sounds/Custom/RoverDriveActivate.ogg new file mode 100644 index 0000000000..127d7e65a3 Binary files /dev/null and b/Sounds/Custom/RoverDriveActivate.ogg differ diff --git a/Sounds/Custom/RoverDriveBreak.ogg b/Sounds/Custom/RoverDriveBreak.ogg new file mode 100644 index 0000000000..c829baf37d Binary files /dev/null and b/Sounds/Custom/RoverDriveBreak.ogg differ diff --git a/Sounds/Custom/RoverDriveHit.ogg b/Sounds/Custom/RoverDriveHit.ogg new file mode 100644 index 0000000000..726ef852e6 Binary files /dev/null and b/Sounds/Custom/RoverDriveHit.ogg differ diff --git a/Sounds/Custom/SCalAltarSummon.ogg b/Sounds/Custom/SCalAltarSummon.ogg new file mode 100644 index 0000000000..b99de29122 Binary files /dev/null and b/Sounds/Custom/SCalAltarSummon.ogg differ diff --git a/Sounds/Custom/SlimeGodBigShot1.ogg b/Sounds/Custom/SlimeGodBigShot1.ogg new file mode 100644 index 0000000000..3879d5aa29 Binary files /dev/null and b/Sounds/Custom/SlimeGodBigShot1.ogg differ diff --git a/Sounds/Custom/SlimeGodBigShot2.ogg b/Sounds/Custom/SlimeGodBigShot2.ogg new file mode 100644 index 0000000000..f265ff7bd6 Binary files /dev/null and b/Sounds/Custom/SlimeGodBigShot2.ogg differ diff --git a/Sounds/Custom/SlimeGodShot1.ogg b/Sounds/Custom/SlimeGodShot1.ogg new file mode 100644 index 0000000000..cd7bb988c7 Binary files /dev/null and b/Sounds/Custom/SlimeGodShot1.ogg differ diff --git a/Sounds/Custom/SlimeGodShot2.ogg b/Sounds/Custom/SlimeGodShot2.ogg new file mode 100644 index 0000000000..26a0bde19a Binary files /dev/null and b/Sounds/Custom/SlimeGodShot2.ogg differ diff --git a/Sounds/Custom/Ultrabling.ogg b/Sounds/Custom/Ultrabling.ogg new file mode 100644 index 0000000000..d40455a713 Binary files /dev/null and b/Sounds/Custom/Ultrabling.ogg differ diff --git a/Sounds/Custom/UltrablingHit.ogg b/Sounds/Custom/UltrablingHit.ogg new file mode 100644 index 0000000000..e0e2baf802 Binary files /dev/null and b/Sounds/Custom/UltrablingHit.ogg differ diff --git a/Sounds/Custom/WeaponEnchant.ogg b/Sounds/Custom/WeaponEnchant.ogg new file mode 100644 index 0000000000..4394c086ae Binary files /dev/null and b/Sounds/Custom/WeaponEnchant.ogg differ diff --git a/Sounds/Custom/WeaponExhume.ogg b/Sounds/Custom/WeaponExhume.ogg new file mode 100644 index 0000000000..2ffd07ecd3 Binary files /dev/null and b/Sounds/Custom/WeaponExhume.ogg differ diff --git a/Sounds/Custom/WulfrumDroidChirp1.ogg b/Sounds/Custom/WulfrumDroidChirp1.ogg new file mode 100644 index 0000000000..874e122f60 Binary files /dev/null and b/Sounds/Custom/WulfrumDroidChirp1.ogg differ diff --git a/Sounds/Custom/WulfrumDroidChirp2.ogg b/Sounds/Custom/WulfrumDroidChirp2.ogg new file mode 100644 index 0000000000..2a7dde01fc Binary files /dev/null and b/Sounds/Custom/WulfrumDroidChirp2.ogg differ diff --git a/Sounds/Custom/WulfrumDroidChirp3.ogg b/Sounds/Custom/WulfrumDroidChirp3.ogg new file mode 100644 index 0000000000..847313cd6d Binary files /dev/null and b/Sounds/Custom/WulfrumDroidChirp3.ogg differ diff --git a/Sounds/Custom/WulfrumDroidChirp4.ogg b/Sounds/Custom/WulfrumDroidChirp4.ogg new file mode 100644 index 0000000000..e033b0f0b3 Binary files /dev/null and b/Sounds/Custom/WulfrumDroidChirp4.ogg differ diff --git a/Sounds/Custom/WulfrumDroidFire.ogg b/Sounds/Custom/WulfrumDroidFire.ogg new file mode 100644 index 0000000000..d9f5eaa407 Binary files /dev/null and b/Sounds/Custom/WulfrumDroidFire.ogg differ diff --git a/Sounds/Custom/WulfrumDroidHurry1.ogg b/Sounds/Custom/WulfrumDroidHurry1.ogg new file mode 100644 index 0000000000..c5fa53dc3d Binary files /dev/null and b/Sounds/Custom/WulfrumDroidHurry1.ogg differ diff --git a/Sounds/Custom/WulfrumDroidHurry2.ogg b/Sounds/Custom/WulfrumDroidHurry2.ogg new file mode 100644 index 0000000000..a7a108538f Binary files /dev/null and b/Sounds/Custom/WulfrumDroidHurry2.ogg differ diff --git a/Sounds/Custom/WulfrumDroidRepair.ogg b/Sounds/Custom/WulfrumDroidRepair.ogg new file mode 100644 index 0000000000..c058461278 Binary files /dev/null and b/Sounds/Custom/WulfrumDroidRepair.ogg differ diff --git a/Sounds/Custom/WulfrumDroidSpawnBeep.ogg b/Sounds/Custom/WulfrumDroidSpawnBeep.ogg new file mode 100644 index 0000000000..bc1ba987b1 Binary files /dev/null and b/Sounds/Custom/WulfrumDroidSpawnBeep.ogg differ diff --git a/Sounds/Custom/WulfrumExtraDrop.ogg b/Sounds/Custom/WulfrumExtraDrop.ogg new file mode 100644 index 0000000000..32a86163dd Binary files /dev/null and b/Sounds/Custom/WulfrumExtraDrop.ogg differ diff --git a/Sounds/Custom/WulfrumHookDisengage.ogg b/Sounds/Custom/WulfrumHookDisengage.ogg new file mode 100644 index 0000000000..7963a56faa Binary files /dev/null and b/Sounds/Custom/WulfrumHookDisengage.ogg differ diff --git a/Sounds/Custom/WulfrumHookGrapple.ogg b/Sounds/Custom/WulfrumHookGrapple.ogg new file mode 100644 index 0000000000..02b4739614 Binary files /dev/null and b/Sounds/Custom/WulfrumHookGrapple.ogg differ diff --git a/Sounds/Custom/WulfrumHookShoot.ogg b/Sounds/Custom/WulfrumHookShoot.ogg new file mode 100644 index 0000000000..ea5e4c62d9 Binary files /dev/null and b/Sounds/Custom/WulfrumHookShoot.ogg differ diff --git a/Sounds/Custom/WulfrumMachineBreak.ogg b/Sounds/Custom/WulfrumMachineBreak.ogg new file mode 100644 index 0000000000..0d1280f640 Binary files /dev/null and b/Sounds/Custom/WulfrumMachineBreak.ogg differ diff --git a/Sounds/Custom/WulfrumSawCutting.ogg b/Sounds/Custom/WulfrumSawCutting.ogg new file mode 100644 index 0000000000..c0dcbb75c0 Binary files /dev/null and b/Sounds/Custom/WulfrumSawCutting.ogg differ diff --git a/Sounds/Custom/WulfrumSawIdle.ogg b/Sounds/Custom/WulfrumSawIdle.ogg new file mode 100644 index 0000000000..6ceeb9b0cc Binary files /dev/null and b/Sounds/Custom/WulfrumSawIdle.ogg differ diff --git a/Sounds/Custom/YharonFire.ogg b/Sounds/Custom/Yharon/YharonFire.ogg similarity index 100% rename from Sounds/Custom/YharonFire.ogg rename to Sounds/Custom/Yharon/YharonFire.ogg diff --git a/Sounds/Custom/Yharon/YharonFireOrb.ogg b/Sounds/Custom/Yharon/YharonFireOrb.ogg new file mode 100644 index 0000000000..d650fe6179 Binary files /dev/null and b/Sounds/Custom/Yharon/YharonFireOrb.ogg differ diff --git a/Sounds/Custom/Yharon/YharonFireball1.ogg b/Sounds/Custom/Yharon/YharonFireball1.ogg new file mode 100644 index 0000000000..dbc1b96cce Binary files /dev/null and b/Sounds/Custom/Yharon/YharonFireball1.ogg differ diff --git a/Sounds/Custom/Yharon/YharonFireball2.ogg b/Sounds/Custom/Yharon/YharonFireball2.ogg new file mode 100644 index 0000000000..c01dc5af41 Binary files /dev/null and b/Sounds/Custom/Yharon/YharonFireball2.ogg differ diff --git a/Sounds/Custom/Yharon/YharonFireball3.ogg b/Sounds/Custom/Yharon/YharonFireball3.ogg new file mode 100644 index 0000000000..806b8bcf22 Binary files /dev/null and b/Sounds/Custom/Yharon/YharonFireball3.ogg differ diff --git a/Sounds/Custom/Yharon/YharonInfernado.ogg b/Sounds/Custom/Yharon/YharonInfernado.ogg new file mode 100644 index 0000000000..d314e12c6a Binary files /dev/null and b/Sounds/Custom/Yharon/YharonInfernado.ogg differ diff --git a/Sounds/Custom/YharonRoar.ogg b/Sounds/Custom/Yharon/YharonRoar.ogg similarity index 100% rename from Sounds/Custom/YharonRoar.ogg rename to Sounds/Custom/Yharon/YharonRoar.ogg diff --git a/Sounds/Custom/YharonRoarShort.ogg b/Sounds/Custom/Yharon/YharonRoarShort.ogg similarity index 100% rename from Sounds/Custom/YharonRoarShort.ogg rename to Sounds/Custom/Yharon/YharonRoarShort.ogg diff --git a/Sounds/Item/AnomalysNanogunMPFBExplosion.ogg b/Sounds/Item/AnomalysNanogunMPFBExplosion.ogg new file mode 100644 index 0000000000..b3a4460831 Binary files /dev/null and b/Sounds/Item/AnomalysNanogunMPFBExplosion.ogg differ diff --git a/Sounds/Item/AnomalysNanogunMPFBShot.ogg b/Sounds/Item/AnomalysNanogunMPFBShot.ogg new file mode 100644 index 0000000000..aa20115ba8 Binary files /dev/null and b/Sounds/Item/AnomalysNanogunMPFBShot.ogg differ diff --git a/Sounds/Item/AnomalysNanogunPlasmaCharge.ogg b/Sounds/Item/AnomalysNanogunPlasmaCharge.ogg new file mode 100644 index 0000000000..b0a24bc813 Binary files /dev/null and b/Sounds/Item/AnomalysNanogunPlasmaCharge.ogg differ diff --git a/Sounds/Item/AnomalysNanogunPlasmaShot.ogg b/Sounds/Item/AnomalysNanogunPlasmaShot.ogg new file mode 100644 index 0000000000..a9324c6546 Binary files /dev/null and b/Sounds/Item/AnomalysNanogunPlasmaShot.ogg differ diff --git a/Sounds/Item/BloodOrangeConsume.ogg b/Sounds/Item/BloodOrangeConsume.ogg new file mode 100644 index 0000000000..ac17b91016 Binary files /dev/null and b/Sounds/Item/BloodOrangeConsume.ogg differ diff --git a/Sounds/Item/CeaselessVoidSpawn.ogg b/Sounds/Item/CeaselessVoidSpawn.ogg new file mode 100644 index 0000000000..e98f810026 Binary files /dev/null and b/Sounds/Item/CeaselessVoidSpawn.ogg differ diff --git a/Sounds/Item/CrackshotColtShot.ogg b/Sounds/Item/CrackshotColtShot.ogg new file mode 100644 index 0000000000..9ca350fafc Binary files /dev/null and b/Sounds/Item/CrackshotColtShot.ogg differ diff --git a/Sounds/Item/DragonfruitConsume.ogg b/Sounds/Item/DragonfruitConsume.ogg new file mode 100644 index 0000000000..d2d40b97be Binary files /dev/null and b/Sounds/Item/DragonfruitConsume.ogg differ diff --git a/Sounds/Item/ElderberryConsume.ogg b/Sounds/Item/ElderberryConsume.ogg new file mode 100644 index 0000000000..dce891ca7d Binary files /dev/null and b/Sounds/Item/ElderberryConsume.ogg differ diff --git a/Sounds/Item/ExobladeBeamSlash.ogg b/Sounds/Item/ExobladeBeamSlash.ogg new file mode 100644 index 0000000000..d165cf5c95 Binary files /dev/null and b/Sounds/Item/ExobladeBeamSlash.ogg differ diff --git a/Sounds/Item/ExobladeBigHit.ogg b/Sounds/Item/ExobladeBigHit.ogg new file mode 100644 index 0000000000..700ba1b465 Binary files /dev/null and b/Sounds/Item/ExobladeBigHit.ogg differ diff --git a/Sounds/Item/ExobladeBigSwing.ogg b/Sounds/Item/ExobladeBigSwing.ogg new file mode 100644 index 0000000000..27c295f56f Binary files /dev/null and b/Sounds/Item/ExobladeBigSwing.ogg differ diff --git a/Sounds/Item/ExobladeDash.ogg b/Sounds/Item/ExobladeDash.ogg new file mode 100644 index 0000000000..5ae42d81bf Binary files /dev/null and b/Sounds/Item/ExobladeDash.ogg differ diff --git a/Sounds/Item/ExobladeDashImpact.ogg b/Sounds/Item/ExobladeDashImpact.ogg new file mode 100644 index 0000000000..731c934f33 Binary files /dev/null and b/Sounds/Item/ExobladeDashImpact.ogg differ diff --git a/Sounds/Item/ExobladeSwing.ogg b/Sounds/Item/ExobladeSwing.ogg new file mode 100644 index 0000000000..04202acad1 Binary files /dev/null and b/Sounds/Item/ExobladeSwing.ogg differ diff --git a/Sounds/Item/HadalUrnClose.ogg b/Sounds/Item/HadalUrnClose.ogg new file mode 100644 index 0000000000..652463fbf6 Binary files /dev/null and b/Sounds/Item/HadalUrnClose.ogg differ diff --git a/Sounds/Item/HadalUrnOpen.ogg b/Sounds/Item/HadalUrnOpen.ogg new file mode 100644 index 0000000000..5e9dff1cbf Binary files /dev/null and b/Sounds/Item/HadalUrnOpen.ogg differ diff --git a/Sounds/Item/HeavenlyGaleFire.ogg b/Sounds/Item/HeavenlyGaleFire.ogg new file mode 100644 index 0000000000..f35697c0c5 Binary files /dev/null and b/Sounds/Item/HeavenlyGaleFire.ogg differ diff --git a/Sounds/Item/MarniteLiftHumm.ogg b/Sounds/Item/MarniteLiftHumm.ogg new file mode 100644 index 0000000000..0e784f6eb6 Binary files /dev/null and b/Sounds/Item/MarniteLiftHumm.ogg differ diff --git a/Sounds/Item/MarniteLiftSummon.ogg b/Sounds/Item/MarniteLiftSummon.ogg new file mode 100644 index 0000000000..bf9ddb0cb8 Binary files /dev/null and b/Sounds/Item/MarniteLiftSummon.ogg differ diff --git a/Sounds/Item/MarniteLiftUnsummon.ogg b/Sounds/Item/MarniteLiftUnsummon.ogg new file mode 100644 index 0000000000..acfb139d90 Binary files /dev/null and b/Sounds/Item/MarniteLiftUnsummon.ogg differ diff --git a/Sounds/Item/MarniteObliteratorUse.ogg b/Sounds/Item/MarniteObliteratorUse.ogg new file mode 100644 index 0000000000..00b1994a79 Binary files /dev/null and b/Sounds/Item/MarniteObliteratorUse.ogg differ diff --git a/Sounds/Item/MiracleFruitConsume.ogg b/Sounds/Item/MiracleFruitConsume.ogg new file mode 100644 index 0000000000..4c51c2569e Binary files /dev/null and b/Sounds/Item/MiracleFruitConsume.ogg differ diff --git a/Sounds/Item/PBGSummon.ogg b/Sounds/Item/PBGSummon.ogg new file mode 100644 index 0000000000..a7570a4a65 Binary files /dev/null and b/Sounds/Item/PBGSummon.ogg differ diff --git a/Sounds/Item/SevensStrikerBust.ogg b/Sounds/Item/SevensStrikerBust.ogg new file mode 100644 index 0000000000..714d84a934 Binary files /dev/null and b/Sounds/Item/SevensStrikerBust.ogg differ diff --git a/Sounds/Item/SevensStrikerCoinShot.ogg b/Sounds/Item/SevensStrikerCoinShot.ogg new file mode 100644 index 0000000000..d845bb7dcb Binary files /dev/null and b/Sounds/Item/SevensStrikerCoinShot.ogg differ diff --git a/Sounds/Item/SevensStrikerDoubles.ogg b/Sounds/Item/SevensStrikerDoubles.ogg new file mode 100644 index 0000000000..f41ec9714d Binary files /dev/null and b/Sounds/Item/SevensStrikerDoubles.ogg differ diff --git a/Sounds/Item/SevensStrikerJackpot.ogg b/Sounds/Item/SevensStrikerJackpot.ogg new file mode 100644 index 0000000000..d257d2cb42 Binary files /dev/null and b/Sounds/Item/SevensStrikerJackpot.ogg differ diff --git a/Sounds/Item/SevensStrikerRoulette.ogg b/Sounds/Item/SevensStrikerRoulette.ogg new file mode 100644 index 0000000000..7d302e2e10 Binary files /dev/null and b/Sounds/Item/SevensStrikerRoulette.ogg differ diff --git a/Sounds/Item/SevensStrikerRouletteTick.ogg b/Sounds/Item/SevensStrikerRouletteTick.ogg new file mode 100644 index 0000000000..65d600b150 Binary files /dev/null and b/Sounds/Item/SevensStrikerRouletteTick.ogg differ diff --git a/Sounds/Item/SevensStrikerTriples.ogg b/Sounds/Item/SevensStrikerTriples.ogg new file mode 100644 index 0000000000..13fd366195 Binary files /dev/null and b/Sounds/Item/SevensStrikerTriples.ogg differ diff --git a/Sounds/Item/SignusSpawn.ogg b/Sounds/Item/SignusSpawn.ogg new file mode 100644 index 0000000000..69dc3cd9d5 Binary files /dev/null and b/Sounds/Item/SignusSpawn.ogg differ diff --git a/Sounds/Item/StormWeaverSpawn.ogg b/Sounds/Item/StormWeaverSpawn.ogg new file mode 100644 index 0000000000..f5aac236d2 Binary files /dev/null and b/Sounds/Item/StormWeaverSpawn.ogg differ diff --git a/Sounds/Item/WulfrumBlunderbussFire.ogg b/Sounds/Item/WulfrumBlunderbussFire.ogg new file mode 100644 index 0000000000..b2e0e2c4e0 Binary files /dev/null and b/Sounds/Item/WulfrumBlunderbussFire.ogg differ diff --git a/Sounds/Item/WulfrumBlunderbussFireAndReload.ogg b/Sounds/Item/WulfrumBlunderbussFireAndReload.ogg new file mode 100644 index 0000000000..7d829ce601 Binary files /dev/null and b/Sounds/Item/WulfrumBlunderbussFireAndReload.ogg differ diff --git a/Sounds/Item/WulfrumKnifeThrowFull.ogg b/Sounds/Item/WulfrumKnifeThrowFull.ogg new file mode 100644 index 0000000000..77999341ba Binary files /dev/null and b/Sounds/Item/WulfrumKnifeThrowFull.ogg differ diff --git a/Sounds/Item/WulfrumKnifeThrowSingle.ogg b/Sounds/Item/WulfrumKnifeThrowSingle.ogg new file mode 100644 index 0000000000..c858481a92 Binary files /dev/null and b/Sounds/Item/WulfrumKnifeThrowSingle.ogg differ diff --git a/Sounds/Item/WulfrumKnifeThrowTwo.ogg b/Sounds/Item/WulfrumKnifeThrowTwo.ogg new file mode 100644 index 0000000000..d893171d42 Binary files /dev/null and b/Sounds/Item/WulfrumKnifeThrowTwo.ogg differ diff --git a/Sounds/Item/WulfrumKnifeTileHit1.ogg b/Sounds/Item/WulfrumKnifeTileHit1.ogg new file mode 100644 index 0000000000..00b7508be6 Binary files /dev/null and b/Sounds/Item/WulfrumKnifeTileHit1.ogg differ diff --git a/Sounds/Item/WulfrumKnifeTileHit2.ogg b/Sounds/Item/WulfrumKnifeTileHit2.ogg new file mode 100644 index 0000000000..8ba62c1739 Binary files /dev/null and b/Sounds/Item/WulfrumKnifeTileHit2.ogg differ diff --git a/Sounds/Item/WulfrumPing.ogg b/Sounds/Item/WulfrumPing.ogg new file mode 100644 index 0000000000..9fe52766f9 Binary files /dev/null and b/Sounds/Item/WulfrumPing.ogg differ diff --git a/Sounds/Item/WulfrumPingBreak.ogg b/Sounds/Item/WulfrumPingBreak.ogg new file mode 100644 index 0000000000..b598685edc Binary files /dev/null and b/Sounds/Item/WulfrumPingBreak.ogg differ diff --git a/Sounds/Item/WulfrumPingReady.ogg b/Sounds/Item/WulfrumPingReady.ogg new file mode 100644 index 0000000000..8fb52e8c50 Binary files /dev/null and b/Sounds/Item/WulfrumPingReady.ogg differ diff --git a/Sounds/Item/WulfrumProsthesisHit.ogg b/Sounds/Item/WulfrumProsthesisHit.ogg new file mode 100644 index 0000000000..46c85757bc Binary files /dev/null and b/Sounds/Item/WulfrumProsthesisHit.ogg differ diff --git a/Sounds/Item/WulfrumProsthesisShoot.ogg b/Sounds/Item/WulfrumProsthesisShoot.ogg new file mode 100644 index 0000000000..12a62ad09b Binary files /dev/null and b/Sounds/Item/WulfrumProsthesisShoot.ogg differ diff --git a/Sounds/Item/WulfrumProsthesisSucc.ogg b/Sounds/Item/WulfrumProsthesisSucc.ogg new file mode 100644 index 0000000000..36e48a17ea Binary files /dev/null and b/Sounds/Item/WulfrumProsthesisSucc.ogg differ diff --git a/Sounds/Item/WulfrumProsthesisSuccStop.ogg b/Sounds/Item/WulfrumProsthesisSuccStop.ogg new file mode 100644 index 0000000000..7907885f0b Binary files /dev/null and b/Sounds/Item/WulfrumProsthesisSuccStop.ogg differ diff --git a/Sounds/Item/WulfrumScrewdriverScrewGet.ogg b/Sounds/Item/WulfrumScrewdriverScrewGet.ogg new file mode 100644 index 0000000000..281bbf3dbd Binary files /dev/null and b/Sounds/Item/WulfrumScrewdriverScrewGet.ogg differ diff --git a/Sounds/Item/WulfrumScrewdriverScrewHit.ogg b/Sounds/Item/WulfrumScrewdriverScrewHit.ogg new file mode 100644 index 0000000000..b5ad5af9b1 Binary files /dev/null and b/Sounds/Item/WulfrumScrewdriverScrewHit.ogg differ diff --git a/Sounds/Item/WulfrumScrewdriverThrust.ogg b/Sounds/Item/WulfrumScrewdriverThrust.ogg new file mode 100644 index 0000000000..d8de50ab0c Binary files /dev/null and b/Sounds/Item/WulfrumScrewdriverThrust.ogg differ diff --git a/Sounds/Item/WulfrumScrewdriverThud.ogg b/Sounds/Item/WulfrumScrewdriverThud.ogg new file mode 100644 index 0000000000..cbffa078e6 Binary files /dev/null and b/Sounds/Item/WulfrumScrewdriverThud.ogg differ diff --git a/Sounds/Music/DraedonAmbience.ogg b/Sounds/Music/DraedonAmbience.ogg index 888cfff0eb..7269bd6383 100644 Binary files a/Sounds/Music/DraedonAmbience.ogg and b/Sounds/Music/DraedonAmbience.ogg differ diff --git a/Sounds/NPCHit/AstrumAureusHit.ogg b/Sounds/NPCHit/AstrumAureusHit.ogg deleted file mode 100644 index 4239538235..0000000000 Binary files a/Sounds/NPCHit/AstrumAureusHit.ogg and /dev/null differ diff --git a/Sounds/NPCHit/AureusHit1.ogg b/Sounds/NPCHit/AureusHit1.ogg new file mode 100644 index 0000000000..cce104f4d9 Binary files /dev/null and b/Sounds/NPCHit/AureusHit1.ogg differ diff --git a/Sounds/NPCHit/AureusHit2.ogg b/Sounds/NPCHit/AureusHit2.ogg new file mode 100644 index 0000000000..e48bc7914c Binary files /dev/null and b/Sounds/NPCHit/AureusHit2.ogg differ diff --git a/Sounds/NPCHit/AureusHit3.ogg b/Sounds/NPCHit/AureusHit3.ogg new file mode 100644 index 0000000000..4df4e112f2 Binary files /dev/null and b/Sounds/NPCHit/AureusHit3.ogg differ diff --git a/Sounds/NPCHit/AureusHit4.ogg b/Sounds/NPCHit/AureusHit4.ogg new file mode 100644 index 0000000000..007f693594 Binary files /dev/null and b/Sounds/NPCHit/AureusHit4.ogg differ diff --git a/Sounds/NPCHit/PolterghastHit.ogg b/Sounds/NPCHit/PolterghastHit.ogg new file mode 100644 index 0000000000..b5c91ce5bc Binary files /dev/null and b/Sounds/NPCHit/PolterghastHit.ogg differ diff --git a/Sounds/NPCHit/RavagerHurt1.ogg b/Sounds/NPCHit/RavagerHurt1.ogg new file mode 100644 index 0000000000..2c5339e798 Binary files /dev/null and b/Sounds/NPCHit/RavagerHurt1.ogg differ diff --git a/Sounds/NPCHit/RavagerHurt2.ogg b/Sounds/NPCHit/RavagerHurt2.ogg new file mode 100644 index 0000000000..df4e74de93 Binary files /dev/null and b/Sounds/NPCHit/RavagerHurt2.ogg differ diff --git a/Sounds/NPCHit/RavagerHurt3.ogg b/Sounds/NPCHit/RavagerHurt3.ogg new file mode 100644 index 0000000000..4251d50d59 Binary files /dev/null and b/Sounds/NPCHit/RavagerHurt3.ogg differ diff --git a/Sounds/NPCHit/RavagerHurt4.ogg b/Sounds/NPCHit/RavagerHurt4.ogg new file mode 100644 index 0000000000..005400eb20 Binary files /dev/null and b/Sounds/NPCHit/RavagerHurt4.ogg differ diff --git a/Sounds/NPCHit/RavagerRockPillarHit1.ogg b/Sounds/NPCHit/RavagerRockPillarHit1.ogg new file mode 100644 index 0000000000..65f225a6b9 Binary files /dev/null and b/Sounds/NPCHit/RavagerRockPillarHit1.ogg differ diff --git a/Sounds/NPCHit/RavagerRockPillarHit2.ogg b/Sounds/NPCHit/RavagerRockPillarHit2.ogg new file mode 100644 index 0000000000..c59de8c241 Binary files /dev/null and b/Sounds/NPCHit/RavagerRockPillarHit2.ogg differ diff --git a/Sounds/NPCHit/RavagerRockPillarHit3.ogg b/Sounds/NPCHit/RavagerRockPillarHit3.ogg new file mode 100644 index 0000000000..68ba7f0104 Binary files /dev/null and b/Sounds/NPCHit/RavagerRockPillarHit3.ogg differ diff --git a/Sounds/NPCHit/ShieldHit1.ogg b/Sounds/NPCHit/ShieldHit1.ogg new file mode 100644 index 0000000000..8c30c298c0 Binary files /dev/null and b/Sounds/NPCHit/ShieldHit1.ogg differ diff --git a/Sounds/NPCHit/ShieldHit2.ogg b/Sounds/NPCHit/ShieldHit2.ogg new file mode 100644 index 0000000000..4a8f82ea8a Binary files /dev/null and b/Sounds/NPCHit/ShieldHit2.ogg differ diff --git a/Sounds/NPCHit/ShieldHit3.ogg b/Sounds/NPCHit/ShieldHit3.ogg new file mode 100644 index 0000000000..da7673beeb Binary files /dev/null and b/Sounds/NPCHit/ShieldHit3.ogg differ diff --git a/Sounds/NPCHit/YharonHurt.ogg b/Sounds/NPCHit/YharonHurt.ogg new file mode 100644 index 0000000000..3356ebe1eb Binary files /dev/null and b/Sounds/NPCHit/YharonHurt.ogg differ diff --git a/Sounds/NPCKilled/CeaselessVoidDeath.ogg b/Sounds/NPCKilled/CeaselessVoidDeath.ogg new file mode 100644 index 0000000000..8becc1e829 Binary files /dev/null and b/Sounds/NPCKilled/CeaselessVoidDeath.ogg differ diff --git a/Sounds/NPCKilled/ProvidenceDeath.ogg b/Sounds/NPCKilled/ProvidenceDeath.ogg index 53c7784400..8d6ae598f4 100644 Binary files a/Sounds/NPCKilled/ProvidenceDeath.ogg and b/Sounds/NPCKilled/ProvidenceDeath.ogg differ diff --git a/Sounds/NPCKilled/RavagerDeath1.ogg b/Sounds/NPCKilled/RavagerDeath1.ogg new file mode 100644 index 0000000000..95b7d6fe55 Binary files /dev/null and b/Sounds/NPCKilled/RavagerDeath1.ogg differ diff --git a/Sounds/NPCKilled/RavagerDeath2.ogg b/Sounds/NPCKilled/RavagerDeath2.ogg new file mode 100644 index 0000000000..71d33e8da3 Binary files /dev/null and b/Sounds/NPCKilled/RavagerDeath2.ogg differ diff --git a/Sounds/NPCKilled/RavagerLimbLoss1.ogg b/Sounds/NPCKilled/RavagerLimbLoss1.ogg new file mode 100644 index 0000000000..16ace80c7b Binary files /dev/null and b/Sounds/NPCKilled/RavagerLimbLoss1.ogg differ diff --git a/Sounds/NPCKilled/RavagerLimbLoss2.ogg b/Sounds/NPCKilled/RavagerLimbLoss2.ogg new file mode 100644 index 0000000000..60cfb780b8 Binary files /dev/null and b/Sounds/NPCKilled/RavagerLimbLoss2.ogg differ diff --git a/Sounds/NPCKilled/RavagerLimbLoss3.ogg b/Sounds/NPCKilled/RavagerLimbLoss3.ogg new file mode 100644 index 0000000000..921209efa8 Binary files /dev/null and b/Sounds/NPCKilled/RavagerLimbLoss3.ogg differ diff --git a/Sounds/NPCKilled/RavagerLimbLoss4.ogg b/Sounds/NPCKilled/RavagerLimbLoss4.ogg new file mode 100644 index 0000000000..c92f495dbb Binary files /dev/null and b/Sounds/NPCKilled/RavagerLimbLoss4.ogg differ diff --git a/Sounds/NPCKilled/WulfrumDeath.ogg b/Sounds/NPCKilled/WulfrumDeath.ogg new file mode 100644 index 0000000000..f89264d7d7 Binary files /dev/null and b/Sounds/NPCKilled/WulfrumDeath.ogg differ diff --git a/Sounds/NPCKilled/YharonDeath.ogg b/Sounds/NPCKilled/YharonDeath.ogg new file mode 100644 index 0000000000..2699692d5a Binary files /dev/null and b/Sounds/NPCKilled/YharonDeath.ogg differ diff --git a/Systems/AnyBossesOrEventsCheckSystem.cs b/Systems/AnyBossesOrEventsCheckSystem.cs index c4996a30f2..8ba8733673 100644 --- a/Systems/AnyBossesOrEventsCheckSystem.cs +++ b/Systems/AnyBossesOrEventsCheckSystem.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.NPCs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Skies; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -10,6 +12,9 @@ namespace CalamityMod.Systems { public override void PreUpdateEntities() { + // Bool for if the SCal ritual effect is ongoing. + SCalSky.RitualDramaProjectileIsPresent = CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0; + // Bool for any existing bosses, true if any boss NPC is active. CalamityPlayer.areThereAnyDamnBosses = CalamityUtils.AnyBossNPCS(); diff --git a/Systems/DifficultyModeSystem.cs b/Systems/DifficultyModeSystem.cs new file mode 100644 index 0000000000..854549b0ef --- /dev/null +++ b/Systems/DifficultyModeSystem.cs @@ -0,0 +1,351 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using System.Collections.Generic; +using System.Linq; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; +using System; +using Terraria.ID; +using ReLogic.Content; +using Terraria.Audio; +using Terraria.ModLoader.IO; +using CalamityMod.Items.Armor.Demonshade; + +namespace CalamityMod.Systems +{ + public class DifficultyModeSystem : ModSystem + { + internal static bool _hasCheckedItOutYet = false; //Simple variable to add a cool effect to the mode selector + + public static DifficultyMode[] Difficulties; //Difficulty modes ordered by ascending difficulty + public static List DifficultyTiers; //Difficulty modes grouped together by difficulty + public static int MostAlternateDifficulties; //The most alternate difficulties at any tier that exists. Used to know the widest space to take in the ui + + public override void Load() + { + MostAlternateDifficulties = 1; + Difficulties = new DifficultyMode[] { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty(), new WhereMalice()}; + + //All of this should happen after a hook happens which lets other mods add their own difficulties + Difficulties = Difficulties.OrderBy(d => d.DifficultyScale).ToArray(); + + DifficultyTiers = new List(); + float currentTier = -1; + int tierIndex = -1; + + for (int i = 0; i < Difficulties.Length; i++) + { + //if we are at a new tier, create a new list of difficulties at that tier. + if (currentTier != Difficulties[i].DifficultyScale) + { + DifficultyTiers.Add(new DifficultyMode[] { Difficulties[i] }); + currentTier = Difficulties[i].DifficultyScale; + tierIndex++; + } + + //if the tier already exists, just add it to the list of other difficulties at that tier. + else + { + //ugly + DifficultyTiers[tierIndex] = DifficultyTiers[tierIndex].Append(Difficulties[i]).ToArray(); + + MostAlternateDifficulties = Math.Max(DifficultyTiers[tierIndex].Length, MostAlternateDifficulties); + } + + Difficulties[i]._difficultyTier = tierIndex; + } + } + + public override void Unload() + { + Difficulties = null; + } + + public static DifficultyMode GetCurrentDifficulty + { + get + { + DifficultyMode mode = Difficulties[0]; + + for (int i = 1; i < Difficulties.Length; i++) + { + if (Difficulties[i].Enabled) + mode = Difficulties[i]; + } + + return mode; + } + } + + public override void SaveWorldData(TagCompound tag) + { + //Apparently this is ran after worldgen so it cant always be set to true + tag["hasCheckedOutTheCoolDifficultyUI"] = _hasCheckedItOutYet; + } + + public override void OnWorldLoad() + { + _hasCheckedItOutYet = false; + } + + public override void OnWorldUnload() + { + _hasCheckedItOutYet = false; + } + + public override void PostWorldGen() + { + _hasCheckedItOutYet = false; + } + + public override void LoadWorldData(TagCompound tag) + { + _hasCheckedItOutYet = tag.GetBool("hasCheckedOutTheCoolDifficultyUI"); + + //No need to check it out if rev is already on (Such as in old worlds) + if (CalamityWorld.revenge) + _hasCheckedItOutYet = true; + } + } + + public abstract class DifficultyMode + { + public abstract bool Enabled + { + get; set; + } + + public abstract Asset Texture { get; } + public virtual string ExpandedDescription => ""; + + public float DifficultyScale; + public string Name; + public string ShortDescription; + + public string ActivationTextKey; + public string DeactivationTextKey; + + public SoundStyle ActivationSound; + + public Color ChatTextColor; + + internal int _difficultyTier; + + /// + /// Used to know which difficulties to toggle on when selecting a particular difficulty. + /// + public virtual bool RequiresDifficulty(DifficultyMode mode) => false; + + public virtual int FavoredDifficultyAtTier(int tier) => 0; + } + + public class NoDifficulty : DifficultyMode + { + public override bool Enabled + { + get => true; + set { } + } + + private Asset _texture; + public override Asset Texture + { + get + { + if (_texture == null) + _texture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicator_None"); + + return _texture; + } + } + + public NoDifficulty() + { + DifficultyScale = 0; + Name = "None"; + ShortDescription = "The classic Terraria experience, with no Calamity difficulty changes"; + + ActivationTextKey = ""; + DeactivationTextKey = ""; + + ActivationSound = SoundID.MenuTick with { Volume = 1f}; + + ChatTextColor = Color.White; + } + } + + public class RevengeanceDifficulty : DifficultyMode + { + public override bool Enabled + { + get => CalamityWorld.revenge; + set => CalamityWorld.revenge = value; + } + + private Asset _texture; + public override Asset Texture + { + get + { + if (_texture == null) + _texture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicator_Rev"); + + return _texture; + } + } + + public override string ExpandedDescription + { + get + { + string mainColor = "B55362"; + + string rageKey = "[c/FFCE85:" + CalamityKeybinds.RageHotKey.TooltipHotkeyString() + "]"; + string adrenKey = "[c/79DFBF:" + CalamityKeybinds.AdrenalineHotKey.TooltipHotkeyString() + "]"; + + + return ("[c/"+mainColor+":Enables the][c/85FFE9: Adrenaline] [c/"+mainColor+":mechanic. You gain Adrenaline while fighting bosses. Getting hit drops Adrenaline back to 0] \n" + + "[c/"+mainColor+": When Adrenaline is maxed, press] " + adrenKey + " [c/"+mainColor+":for a large damage boost] \n" + + "[c/"+mainColor+":Enables the ][c/FF8B54:Rage][c/"+mainColor+": mechanic. You gain Rage when in proximity of enemies or by using certain items] \n" + + "[c/"+mainColor+": When Rage is maxed, press] " + rageKey + " [c/"+mainColor+":for a temporary damage boost] \n" + + "[c/"+mainColor+":Most foes have higher stats and deal more damage] \n" + + "[c/"+mainColor+":Bosses have new AI mechanics, new phases, and will drop Master Mode loot. Enemies spawn more frequently] \n" + + "[c/F7342A:This mode is more difficult than Expert. Be sure to prepare for the challenge]"); + + } + } + + public RevengeanceDifficulty() + { + DifficultyScale = 0.25f; + Name = "Revengeance"; + ShortDescription = "[c/F54254:The intended Calamity experience!]"; + + ActivationTextKey = "Mods.CalamityMod.RevengeText"; + DeactivationTextKey = "Mods.CalamityMod.RevengeText2"; + + ActivationSound = SoundID.Item119; + + ChatTextColor = Color.Crimson; + } + } + + public class DeathDifficulty : DifficultyMode + { + public override bool Enabled + { + get => CalamityWorld.death; + set => CalamityWorld.death = value; + } + + private Asset _texture; + public override Asset Texture + { + get + { + if (_texture == null) + _texture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicator_Death"); + + return _texture; + } + } + + public override string ExpandedDescription =>"[c/B834E0:All foes will pose a much larger threat with aggressive AI and increased damage] \n" + + "[c/B834E0:Bosses have substantially harder AI changes. Enemies are even more numerous and can easily overwhelm you] \n" + + "[c/B834E0:Debuffs are especially lethal and the Abyss is significantly more dangerous] \n" + + "[c/E945FF:Vigilance and tenacity are crucial to survival]"; + + public DeathDifficulty() + { + DifficultyScale = 0.5f; + Name = "Death"; + ShortDescription = "[c/C82DF7:A tougher challenge for the more experienced, or for those that want a step up from Revengeance Mode]"; + + ActivationTextKey = "Mods.CalamityMod.DeathText"; + DeactivationTextKey = "Mods.CalamityMod.DeathText2"; + + ActivationSound = DemonshadeHelm.ActivationSound; + + ChatTextColor = Color.MediumOrchid; + } + + public override int FavoredDifficultyAtTier(int tier) + { + DifficultyMode[] tierList = DifficultyModeSystem.DifficultyTiers[tier]; + + for (int i = 0; i < tierList.Length; i++) + { + if (tierList[i].Name == "Revengeance") + return i; + } + + return 0; + } + } + + public class WhereMalice : DifficultyMode + { + public override bool Enabled + { + get => false; + set { } + } + + private Asset _texture; + public override Asset Texture + { + get + { + if (_texture == null) + _texture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicator_WhereMalice"); + + return _texture; + } + } + + public override string ExpandedDescription + { + get + { + string realIntentionsHex = (Color.Lerp(Color.White, new Color(255, 148, 122), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly + 0.5f))).Hex3(); + string harderOptionsHex = (Color.Lerp(Color.White, Color.Gold, 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly))).Hex3(); + + return "[c/EDEDED:Malice originally came about from an idea to make obtaining Legendary items less RNG-based]\n" + + "[c/EDEDED:It was meant to allow the player to enrage specific bosses, giving them new phases or attacks, to guarantee the drop]\n" + + "[c/EDEDED:However, this was watered down to what Malice was on release, being a difficulty which affected all bosses, and included RIV(Rare Item Variants)]\n" + + "\n" + + "[c/EDEDED:At the time, Malice was received poorly by a lot of players due to the bosses being overtuned to the point of being unfair, while locking items behind them]\n" + + "[c/939393: ...No tester had beaten the Exo Mechs on Malice Mode when it released]\n" + + "[c/" + realIntentionsHex + ":The explanation was that it was meant to be a \"refight\" mode, but that was never the real intention]\n" + + "\n" + + "[c/EDEDED:Malice-exclusive drops were eventually removed, as we did not want players to feel obligated to play a poorly balanced difficulty]\n" + + "[c/EDEDED:Over time, Malice was balanced to be less unfair, but we realized that with the exclusive drops gone, it was not worth the effort]\n" + + "[c/EDEDED:This is why we came down to deleting Malice, so that dev time and effort may be spent elsewhere, notably Death Mode]\n" + + "\n" + + "[c/" + harderOptionsHex + ":We acknowledge that some players liked Malice because Death isn't challenging enough for their tastes]\n" + + "[c/" + harderOptionsHex + ":If you want more difficulty, try the Infernum Addon, Master Mode, higher Boss HP Config, or for amusement, For The Worthy]"; + + } + } + + public WhereMalice() + { + DifficultyScale = 1000000f; //So its always at the end of the list + Name = "Where's Malice?"; + ShortDescription = "[c/FB7152:Malice Mode has been removed from the mod, but its AI changes will live on in Boss Rush]\n" + + "[c/FB7152:We sincerely apologize for the disappointment if you were planning on a playthrough]"; + + ActivationTextKey = "Mods.CalamityMod.DeathText"; //Copy values from death since clicing on the icon enables death + DeactivationTextKey = ""; + + ActivationSound = DemonshadeHelm.ActivationSound; + + ChatTextColor = Color.MediumOrchid; + } + } +} diff --git a/Systems/EntityUpdateInterceptionSystem.cs b/Systems/EntityUpdateInterceptionSystem.cs index 7dca2a36eb..f3634046bc 100644 --- a/Systems/EntityUpdateInterceptionSystem.cs +++ b/Systems/EntityUpdateInterceptionSystem.cs @@ -1,5 +1,6 @@ using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Particles.Metaballs; using CalamityMod.TileEntities; using Terraria; using Terraria.ModLoader; diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index c669cc50be..3024723608 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -57,31 +57,10 @@ namespace CalamityMod spawnedCirrus = false; foundHomePermafrost = false; - anglerName = false; - armsDealerName = false; - clothierName = false; - cyborgName = false; - demolitionistName = false; - dryadName = false; - dyeTraderName = false; - goblinTinkererName = false; - guideName = false; - mechanicName = false; - merchantName = false; - nurseName = false; - painterName = false; - partyGirlName = false; - pirateName = false; - princessName = false; - skeletonMerchantName = false; - steampunkerName = false; - stylistName = false; - tavernkeepName = false; - taxCollectorName = false; - travelingMerchantName = false; - truffleName = false; - witchDoctorName = false; - wizardName = false; + catName = false; + dogName = false; + bunnyName = false; + onionMode = false; revenge = false; TalkedToDraedon = false; @@ -121,58 +100,14 @@ namespace CalamityMod if (foundHomePermafrost) downed.Add("archmageHome"); - #region Save NPC Names - if (anglerName) - downed.Add("anglerName"); - if (armsDealerName) - downed.Add("armsDealerName"); - if (clothierName) - downed.Add("clothierName"); - if (cyborgName) - downed.Add("cyborgName"); - if (demolitionistName) - downed.Add("demolitionistName"); - if (dryadName) - downed.Add("dryadName"); - if (dyeTraderName) - downed.Add("dyeTraderName"); - if (goblinTinkererName) - downed.Add("goblinTinkererName"); - if (guideName) - downed.Add("guideName"); - if (mechanicName) - downed.Add("mechanicName"); - if (merchantName) - downed.Add("merchantName"); - if (nurseName) - downed.Add("nurseName"); - if (painterName) - downed.Add("painterName"); - if (partyGirlName) - downed.Add("partyGirlName"); - if (pirateName) - downed.Add("pirateName"); - if (princessName) - downed.Add("princessName"); - if (skeletonMerchantName) - downed.Add("skeletonMerchantName"); - if (steampunkerName) - downed.Add("steampunkerName"); - if (stylistName) - downed.Add("stylistName"); - if (tavernkeepName) - downed.Add("tavernkeepName"); - if (taxCollectorName) - downed.Add("taxCollectorName"); - if (travelingMerchantName) - downed.Add("travelingMerchantName"); - if (truffleName) - downed.Add("truffleName"); - if (witchDoctorName) - downed.Add("witchDoctorName"); - if (wizardName) - downed.Add("wizardName"); - #endregion + #region Save Pet Names + if (catName) + downed.Add("catName"); + if (dogName) + downed.Add("dogName"); + if (bunnyName) + downed.Add("bunnyName"); + #endregion if (AcidRainEvent.HasTriedToSummonOldDuke) downed.Add("spawnedBoomer"); @@ -209,45 +144,22 @@ namespace CalamityMod public override void LoadWorldData(TagCompound tag) { var downed = tag.GetList("downed"); - TalkedToDraedon = downed.Contains("TalkedToDraedon"); onionMode = downed.Contains("onionMode"); + TalkedToDraedon = downed.Contains("TalkedToDraedon"); revenge = downed.Contains("revenge"); death = downed.Contains("death"); Abyss.AtLeftSideOfWorld = downed.Contains("abyssSide"); BossRushEvent.BossRushActive = downed.Contains("bossRushActive"); AcidRainEvent.AcidRainEventIsOngoing = downed.Contains("acidRain"); - spawnedBandit = downed.Contains("bandit"); spawnedCirrus = downed.Contains("drunkPrincess"); foundHomePermafrost = downed.Contains("archmageHome"); - #region Load NPC Names - anglerName = downed.Contains("anglerName"); - armsDealerName = downed.Contains("armsDealerName"); - clothierName = downed.Contains("clothierName"); - cyborgName = downed.Contains("cyborgName"); - demolitionistName = downed.Contains("demolitionistName"); - dryadName = downed.Contains("dryadName"); - dyeTraderName = downed.Contains("dyeTraderName"); - goblinTinkererName = downed.Contains("goblinTinkererName"); - guideName = downed.Contains("guideName"); - mechanicName = downed.Contains("mechanicName"); - merchantName = downed.Contains("merchantName"); - nurseName = downed.Contains("nurseName"); - painterName = downed.Contains("painterName"); - partyGirlName = downed.Contains("partyGirlName"); - pirateName = downed.Contains("pirateName"); - princessName = downed.Contains("princessName"); - skeletonMerchantName = downed.Contains("skeletonMerchantName"); - steampunkerName = downed.Contains("steampunkerName"); - stylistName = downed.Contains("stylistName"); - tavernkeepName = downed.Contains("tavernkeepName"); - taxCollectorName = downed.Contains("taxCollectorName"); - travelingMerchantName = downed.Contains("travelingMerchantName"); - truffleName = downed.Contains("truffleName"); - witchDoctorName = downed.Contains("witchDoctorName"); - wizardName = downed.Contains("wizardName"); - #endregion + #region Load Pet Names + catName = downed.Contains("catName"); + dogName = downed.Contains("dogName"); + bunnyName = downed.Contains("bunnyName"); + #endregion AcidRainEvent.HasTriedToSummonOldDuke = downed.Contains("spawnedBoomer"); AcidRainEvent.HasStartedAcidicDownpour = downed.Contains("startDownpour"); diff --git a/Systems/ORDERSystem.cs b/Systems/ORDERSystem.cs new file mode 100644 index 0000000000..6fac3e02fa --- /dev/null +++ b/Systems/ORDERSystem.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using ReLogic.Utilities; +using Terraria.Audio; + +namespace CalamityMod.Systems +{ + public class ORDERSystem : ModSystem + { + public static float DefaultOrderTime = 70f; + public static float DefaultResetTime = 200f; + + public static float OrderTime = 0f; + public static float ResetTimer = 0f; + public static SlotId OrderSoundSlot; + public static readonly SoundStyle ORDERTrack = new("CalamityMod/Sounds/Custom/ORDER"); + + public static bool OrderPlaying = false; + + public override void PreUpdateProjectiles() + { + if (OrderTime > 0) + OrderTime--; + + if (ResetTimer > 0) + ResetTimer--; + + if (ResetTimer == 0 && OrderPlaying) + { + OrderPlaying = false; + if (SoundEngine.TryGetActiveSound(OrderSoundSlot, out var orderResult)) + orderResult.Stop(); + OrderSoundSlot = SlotId.Invalid; + } + + else if (OrderPlaying) + { + if (SoundEngine.TryGetActiveSound(OrderSoundSlot, out var orderResult)) + { + orderResult.Volume = OrderTime / DefaultOrderTime; + if (!orderResult.IsPlaying) + OrderPlaying = false; + } + + else + OrderPlaying = false; + + } + } + + public static void ORDER() + { + if (!OrderPlaying) + OrderSoundSlot = SoundEngine.PlaySound(ORDERTrack); + + OrderPlaying = true; + OrderTime = DefaultOrderTime; + ResetTimer = DefaultResetTime; + } + } +} diff --git a/Systems/RecipeSystem.cs b/Systems/RecipeSystem.cs new file mode 100644 index 0000000000..e71963526e --- /dev/null +++ b/Systems/RecipeSystem.cs @@ -0,0 +1,23 @@ +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class RecipeSystem : ModSystem + { + #region Late Loading + public override void PostAddRecipes() + { + // This is placed here so that all tiles from all mods are guaranteed to be loaded at this point. + TileFraming.Load(); + } + #endregion + + #region Recipes + public override void AddRecipeGroups() => CalamityRecipes.AddRecipeGroups(); + + public override void AddRecipes() => CalamityRecipes.AddRecipes(); + #endregion + } +} diff --git a/Systems/TempTilesManagerSystem.cs b/Systems/TempTilesManagerSystem.cs new file mode 100644 index 0000000000..fdfa96f88f --- /dev/null +++ b/Systems/TempTilesManagerSystem.cs @@ -0,0 +1,164 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using CalamityMod.Items.Tools; +using CalamityMod.Systems; +using Terraria; +using CalamityMod.Items.Materials; +using System.Linq; +using Terraria.ID; +using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.Graphics.Effects; +using CalamityMod.Tiles; + +namespace CalamityMod.Systems +{ + /// + /// Useful for temporary tiles that may want to use custom drawing effects with a constant high update rate idependent of the lightning mode + /// + public interface ISpecialTempTileDraw + { + public void CoolDraw(int i, int j, SpriteBatch spriteBatch); + } + + public abstract class TemporaryTileManager + { + /// + /// All the tile types managed by this manager. + /// + public abstract int[] ManagedTypes { get; } + + /// + /// Called every frame. Use this to create special effects or update stuff + /// + /// + public virtual void UpdateEffect(TemporaryTile tile) { } + + /// + /// Creates a temporary tile + /// + /// + public abstract TemporaryTile Setup(Point pos); + + /// + /// Called when a tile runs out of time + /// + public virtual void EndEffect(TemporaryTile tile) { } + } + + public struct TemporaryTile + { + public Point position; + public int timeleft; + public TemporaryTileManager manager; + + public TemporaryTile(Point pos, TemporaryTileManager manager_, int timeLeft = 60) + { + position = pos; + manager = manager_; + timeleft = timeLeft; + } + } + + public class TempTilesManagerSystem : ModSystem + { + public static int[] TemporaryTileIDs; + + public static List ManagedTiles = new List(); + public static List DeletableTiles = new List(); + + public override void Load() + { + ManagedTiles = new List(); + DeletableTiles = new List(); + } + + public override void Unload() + { + ManagedTiles = null; + DeletableTiles = null; + } + public override void PostAddRecipes() + { + TemporaryTileIDs = new int[] { WulfrumScaffoldKit.PlacedTileType }; + } + + /// + /// Adds a temporary tile at the specified position with the specified tile manager + /// The temporary tile manager is used to manage all the effects and placement of the temporary tile. + /// + /// + /// + public static void AddTemporaryTile(Point position, TemporaryTileManager manager) + { + TemporaryTile tile = manager.Setup(position); + ManagedTiles.Add(tile); + } + + /// + /// Requests the time left for a temporary tile at a specified position. + /// + /// The position of the temporary tile + /// + public static int GetTemporaryTileTime(Point position) + { + return ManagedTiles.Find(t => t.position == position).timeleft; + } + + public override void OnWorldUnload() + { + ManagedTiles = new List(); + DeletableTiles = new List(); + } + + public override void PostDrawTiles() + { + if (ManagedTiles.Count <= 0) + return; + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + foreach (TemporaryTile tile in ManagedTiles) + { + if (TileLoader.GetTile(Main.tile[tile.position].TileType) is ISpecialTempTileDraw coolTile) + coolTile.CoolDraw(tile.position.X, tile.position.Y, Main.spriteBatch); + } + + Main.spriteBatch.End(); + } + + public override void PostUpdateEverything() + { + for (int i = 0; i < ManagedTiles.Count; i++) + { + TemporaryTile tile = ManagedTiles[i]; + TemporaryTileManager manager = tile.manager; + + if (!manager.ManagedTypes.Contains(Main.tile[tile.position].TileType)) + { + DeletableTiles.Add(tile); + continue; + } + + manager.UpdateEffect(tile); + tile.timeleft--; + + if (tile.timeleft < 0) + { + manager.EndEffect(tile); + WorldGen.KillTile(tile.position.X, tile.position.Y); + NetMessage.SendTileSquare(-1, tile.position.X, tile.position.Y, TileChangeType.None); + DeletableTiles.Add(tile); + } + + ManagedTiles[i] = tile; + } + + foreach (TemporaryTile deletableTile in DeletableTiles) + ManagedTiles.Remove(deletableTile); + + DeletableTiles.Clear(); + } + } +} diff --git a/Systems/TilePingerSystem.cs b/Systems/TilePingerSystem.cs new file mode 100644 index 0000000000..8a958df51a --- /dev/null +++ b/Systems/TilePingerSystem.cs @@ -0,0 +1,367 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.Audio; +using Terraria.ModLoader; +using CalamityMod.Items.Tools; +using Terraria.Graphics.Light; + +namespace CalamityMod.Systems +{ + public interface IPingedTileEffect + { + /// + /// The blend state of the tile effect's main shader. + /// + public BlendState BlendState => BlendState.AlphaBlend; + /// + /// Create and set up an effect to be drawn over all the registered tiles for this shader. + /// + /// The configured effect + public Effect SetupEffect(); + /// + /// Modifies the shader for each tile. Use this if your shader is using tile-specific data. + /// + /// The position of the tile + /// The effect being used + public void PerTileSetup(Point pos, ref Effect effect) { } + /// + /// Draws the tile, or an overlay for it. The shader is automatically applied. + /// + /// The position of the tile + public void DrawTile(Point pos); + /// + /// What happens when a ping for this effect gets requested. Return false if the ping couldn't get added. + /// + /// Position of the ping being requested + /// The player that initiated the ping + /// Wether or not the ping's setup was successful + public bool TryAddPing(Vector2 position, Player pinger); + /// + /// Wether or not this effect is active. + /// + public bool Active => true; + /// + /// Check to know if a tile needs to be drawn with this effect. This is only called if the effect is active. + /// + /// + /// + /// Wether or not the tile should be drawn with the effect + public bool ShouldRegisterTile(int x, int y); + /// + /// Called after a tile has been queued to be drawn with this effect. Can be used to edit the draw data of the tile. + /// + /// + /// + /// The tile's draw data + public void EditDrawData(int i, int j, ref TileDrawInfo drawData) { } + /// + /// Update call ran once per frame. + /// + public void UpdateEffect() { } + } + + public class TilePingerSystem : ModSystem + { + internal static Dictionary> pingedTiles; + internal static Dictionary> pingedNonSolidTiles; + internal static Dictionary> drawCache; + + internal static Dictionary tileEffects; + + public override void Load() + { + if (Main.dedServ) + return; + + drawCache = new Dictionary>(); + pingedTiles = new Dictionary>(); + pingedNonSolidTiles = new Dictionary>(); + tileEffects = new Dictionary(); + } + + public override void Unload() + { + drawCache = null; + pingedTiles = null; + pingedNonSolidTiles = null; + tileEffects = null; + } + + public static bool AddPing(string effectName, Vector2 position, Player pinger) + { + if (!Main.dedServ) + return AddPing(tileEffects[effectName], position, pinger); + + return false; + } + + public static bool AddPing(IPingedTileEffect effect, Vector2 position, Player pinger) => effect.TryAddPing(position, pinger); + + + public static void RegisterTileToDraw(Point tilePos, string effectName, bool solid = true) => RegisterTileToDraw(tilePos, tileEffects[effectName], solid); + public static void RegisterTileToDraw(Point tilePos, IPingedTileEffect effect, bool solid = true) + { + //Unless we are in color light mode, we do not need the distinction between solid and non solid tiles. + if (solid || !(Lighting.Mode == LightMode.Color)) + { + if (!pingedTiles.ContainsKey(effect)) + pingedTiles.Add(effect, new List()); + + if (!pingedTiles[effect].Contains(tilePos)) + pingedTiles[effect].Add(tilePos); + } + + else + { + if (!pingedNonSolidTiles.ContainsKey(effect)) + pingedNonSolidTiles.Add(effect, new List()); + + if (!pingedNonSolidTiles[effect].Contains(tilePos)) + pingedNonSolidTiles[effect].Add(tilePos); + + + } + } + + public override void PostUpdateEverything() + { + if (Main.dedServ || tileEffects is null) + return; + + foreach (IPingedTileEffect effect in tileEffects.Values) + { + effect.UpdateEffect(); + } + } + + public override void PostDrawTiles() + { + if (pingedTiles is null || (pingedTiles.Keys.Count + pingedNonSolidTiles.Count < 1)) + return; + + drawCache.Clear(); + + foreach (IPingedTileEffect solidEffect in pingedTiles.Keys) + { + drawCache.Add(solidEffect, pingedTiles[solidEffect].ConvertAll(position => new Point(position.X, position.Y))); + } + + if (Lighting.Mode == LightMode.Color) + { + foreach (IPingedTileEffect nonSolidEffect in pingedNonSolidTiles.Keys) + { + List clonedList = pingedNonSolidTiles[nonSolidEffect].ConvertAll(position => new Point(position.X, position.Y)); + + if (!drawCache.ContainsKey(nonSolidEffect)) + drawCache.Add(nonSolidEffect, clonedList); + + else + { + drawCache[nonSolidEffect].AddRange(clonedList); + } + } + } + + foreach (IPingedTileEffect tileEffect in drawCache.Keys) + //foreach (IPingedTileEffect tileEffect in pingedTiles.Keys) + { + Effect effect = tileEffect.SetupEffect(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, tileEffect.BlendState, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, effect, Main.GameViewMatrix.TransformationMatrix); + + foreach (Point tilePos in drawCache[tileEffect]) + //foreach (Point tilePos in pingedTiles[tileEffect]) + { + tileEffect.PerTileSetup(tilePos, ref effect); + tileEffect.DrawTile(tilePos); + + } + + Main.spriteBatch.End(); + } + } + + public static void ClearTiles() + { + ClearTiles(true); + ClearTiles(false); + } + public static void ClearTiles(bool solid) + { + if (solid) + pingedTiles.Clear(); + + else + pingedNonSolidTiles.Clear(); + } + } + + public class GlobalPingableTile : GlobalTile + { + public override void DrawEffects(int i, int j, int type, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + foreach(IPingedTileEffect effect in TilePingerSystem.tileEffects.Values) + { + if (effect.Active && effect.ShouldRegisterTile(i, j)) + { + int tileType = Main.tile[i, j].TileType; + bool solid = true; + + //Necessary separation in the color lighting mode. + if (Lighting.Mode == LightMode.Color) + { + if (TileID.Sets.DrawTileInSolidLayer[tileType].HasValue) + solid = TileID.Sets.DrawTileInSolidLayer[tileType].Value; + else + solid = Main.tileSolid[tileType]; + } + + TilePingerSystem.RegisterTileToDraw(new Point(i, j), effect, solid); + effect.EditDrawData(i, j, ref drawData); + } + } + } + } + + public class WulfrumPingTileEffect : IPingedTileEffect, ILoadable + { + internal static Texture2D emptyFrame; + const int MaxPingLife = 350; + const int MaxPingTravelTime = 60; + const float PingWaveThickness = 50f; + + const float MaxPingRadius = 1700f; + public static Vector2 PingCenter = Vector2.Zero; + public static int PingTimer = 0; + public static float PingProgress => (MaxPingLife - PingTimer) / (float)MaxPingLife; + + public bool Active => PingTimer > 0; + + public BlendState BlendState => BlendState.Additive; + + public bool TryAddPing(Vector2 position, Player pinger) + { + //Only one ping at a time + if (Active) + return false; + + PingCenter = position; + PingTimer = MaxPingLife; + return true; + } + + + public Effect SetupEffect() + { + if (emptyFrame == null) + emptyFrame = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; + + Effect tileEffect = Filters.Scene["WulfrumTilePing"].GetShader().Shader; + tileEffect.Parameters["pingCenter"].SetValue(PingCenter); + tileEffect.Parameters["pingRadius"].SetValue(MaxPingRadius); + tileEffect.Parameters["pingWaveThickness"].SetValue(PingWaveThickness); + tileEffect.Parameters["pingProgress"].SetValue(PingProgress); + tileEffect.Parameters["pingTravelTime"].SetValue(MaxPingTravelTime / (float)MaxPingLife); + tileEffect.Parameters["pingFadePoint"].SetValue(0.9f); + tileEffect.Parameters["edgeBlendStrength"].SetValue(1f); + tileEffect.Parameters["edgeBlendOutLenght"].SetValue(6f); + tileEffect.Parameters["tileEdgeBlendStrenght"].SetValue(2f); + + tileEffect.Parameters["waveColor"].SetValue(Color.GreenYellow.ToVector4()); + tileEffect.Parameters["baseTintColor"].SetValue(Color.DeepSkyBlue.ToVector4() * 0.5f); + tileEffect.Parameters["scanlineColor"].SetValue(Color.YellowGreen.ToVector4() * 1f); + tileEffect.Parameters["tileEdgeColor"].SetValue(Color.GreenYellow.ToVector3()); + tileEffect.Parameters["Resolution"].SetValue(8f); + + tileEffect.Parameters["time"].SetValue(Main.GameUpdateCount); + Vector4[] scanLines = new Vector4[] + { + new Vector4(0f, 4f, 0.1f, 0.5f), + new Vector4(1f, 4f, 0.1f, 0.5f), + new Vector4(37f, 60f, 0.4f, 1f), + new Vector4(2f, 6f, -0.2f, 0.3f), + new Vector4(0f, 4f, 0.1f, 0.5f), //vertical start + new Vector4(1f, 4f, 0.1f, 0.5f), + new Vector4(2f, 6f, -0.2f, 0.3f) + }; + + tileEffect.Parameters["ScanLines"].SetValue(scanLines); + tileEffect.Parameters["ScanLinesCount"].SetValue(scanLines.Length); + tileEffect.Parameters["verticalScanLinesIndex"].SetValue(4); + + return tileEffect; + } + + public void PerTileSetup(Point pos, ref Effect effect) + { + //Up, left, right, down. + effect.Parameters["cardinalConnections"].SetValue(new bool[] { Connected(pos, 0, -1), Connected(pos, -1, 0), Connected(pos, 1, 0), Connected(pos, 0, 1) }); + effect.Parameters["tilePosition"].SetValue(pos.ToVector2() * 16f); + } + + public static bool Connected(Point pos, int displaceX, int displaceY) => Main.IsTileSpelunkable(pos.X + displaceX, pos.Y + displaceY) && Main.tile[pos].TileType == Main.tile[pos.X + displaceX, pos.Y + displaceY].TileType; + + public bool ShouldRegisterTile(int x, int y) + { + return Main.IsTileSpelunkable(x, y); + } + + public void DrawTile(Point pos) + { + Main.spriteBatch.Draw(emptyFrame, pos.ToWorldCoordinates() - Main.screenPosition, null, Color.White, 0, new Vector2(emptyFrame.Width / 2f, emptyFrame.Height / 2f), 16f, 0, 0); + } + + public void EditDrawData(int i, int j, ref TileDrawInfo drawData) + { + float distanceFromCenter = (new Point(i, j).ToWorldCoordinates() - PingCenter).Length(); + float currentExpansion = MathHelper.Clamp(PingProgress * MaxPingLife / (float)MaxPingTravelTime, 0f, 1f) * MaxPingRadius; + + if (distanceFromCenter - 8 > currentExpansion) + return; + + float brightness = 1f; + Tile tile = Framing.GetTileSafely(i, j); + //Counteracts slopes and half tiles being too bright + if (tile.Slope != SlopeType.Solid || tile.IsHalfBlock) + brightness = 0.64f; + + //Fade on the edges + if (distanceFromCenter + 8 > currentExpansion) + brightness *= 1 - (distanceFromCenter - currentExpansion + 8f) / 16f; + + //Fade away with the effect + brightness *= 1 - Math.Max(PingProgress - 0.9f, 0) / (0.1f); + + if (drawData.tileLight.R < 200 * brightness) drawData.tileLight.R = (byte)(200 * brightness); + if (drawData.tileLight.G < 200 * brightness) drawData.tileLight.G = (byte)(200 * brightness); + if (drawData.tileLight.B < 200 * brightness) drawData.tileLight.B = (byte)(200 * brightness); + } + + public void UpdateEffect() + { + if (PingTimer > 0) + { + PingTimer--; + + //if the effect ended (and the player has a treasure pigner in their inventory, of course), play a recharge beep + if (PingTimer == 0 && Main.LocalPlayer.InventoryHas(ModContent.ItemType())) + SoundEngine.PlaySound(WulfrumTreasurePinger.RechargeBeepSound); + } + } + + public void Load(Mod mod) + { + if (Main.dedServ) + return; + + TilePingerSystem.tileEffects.Add("WulfrumPing", this); + } + + public void Unload() { } + } +} diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index 5722837ed7..c8a983e6e4 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -44,13 +44,7 @@ namespace CalamityMod.Systems // Player variable, always finds the closest player relative to the center of the map int closestPlayer = Player.FindClosest(new Vector2(Main.maxTilesX / 2, (float)Main.worldSurface / 2f) * 16f, 0, 0); - Player player = null; - CalamityPlayer modPlayer = null; - if (closestPlayer > -1) - { - player = Main.player[closestPlayer]; - modPlayer = player.Calamity(); - } + Player player = Main.player[closestPlayer]; // Force boss rush to off if necessary. if (!BossRushEvent.DeactivateStupidFuckingBullshit) @@ -80,8 +74,9 @@ namespace CalamityMod.Systems BossRushEvent.Update(); // Handle conditional summons. - if (player is not null) + if (player is not null && player.active) { + CalamityPlayer modPlayer = player.Calamity(); TrySpawnArmoredDigger(player, modPlayer); TrySpawnDungeonGuardian(player); TrySpawnAEoW(player, modPlayer); @@ -410,10 +405,14 @@ namespace CalamityMod.Systems #region Handle Dungeon Guardian Spawns public static void TrySpawnDungeonGuardian(Player player) { - if (Main.netMode == NetmodeID.MultiplayerClient || !player.ZoneDungeon || NPC.downedBoss3 || player.dead) + if (Main.netMode == NetmodeID.MultiplayerClient || !player.ZoneDungeon || player.dead) return; - if (!NPC.AnyNPCs(NPCID.DungeonGuardian)) + bool spawn = !NPC.downedBoss3; + if (Main.drunkWorld && player.position.Y / 16f < (float)(Main.dungeonY + 40)) + spawn = false; + + if (!NPC.AnyNPCs(NPCID.DungeonGuardian) && spawn) NPC.SpawnOnPlayer(player.whoAmI, NPCID.DungeonGuardian); //your hell is as vast as my bonergrin, pray your life ends quickly } #endregion diff --git a/Systems/WorldSyncingSystem.cs b/Systems/WorldSyncingSystem.cs index 3479844d15..93716eeea5 100644 --- a/Systems/WorldSyncingSystem.cs +++ b/Systems/WorldSyncingSystem.cs @@ -91,26 +91,26 @@ namespace CalamityMod.Systems flags8[2] = downedSecondSentinels; flags8[3] = foundHomePermafrost; flags8[4] = downedCLAMHardMode; - flags8[5] = guideName; - flags8[6] = wizardName; - flags8[7] = steampunkerName; + flags8[5] = catName; + flags8[6] = dogName; + flags8[7] = bunnyName; BitsByte flags9 = new BitsByte(); - flags9[0] = stylistName; - flags9[1] = witchDoctorName; - flags9[2] = taxCollectorName; - flags9[3] = pirateName; - flags9[4] = mechanicName; - flags9[5] = armsDealerName; - flags9[6] = dryadName; - flags9[7] = nurseName; + flags9[0] = false; + flags9[1] = false; + flags9[2] = false; + flags9[3] = false; + flags9[4] = false; + flags9[5] = false; + flags9[6] = false; + flags9[7] = false; BitsByte flags10 = new BitsByte(); - flags10[0] = anglerName; - flags10[1] = clothierName; + flags10[0] = false; + flags10[1] = false; flags10[2] = AcidRainEvent.OldDukeHasBeenEncountered; - flags10[3] = travelingMerchantName; - flags10[4] = princessName; + flags10[3] = false; + flags10[4] = false; flags10[5] = false; flags10[6] = false; flags10[7] = false; @@ -234,26 +234,26 @@ namespace CalamityMod.Systems downedSecondSentinels = flags8[2]; foundHomePermafrost = flags8[3]; downedCLAMHardMode = flags8[4]; - guideName = flags8[5]; - wizardName = flags8[6]; - steampunkerName = flags8[7]; + catName = flags8[5]; + dogName = flags8[6]; + bunnyName = flags8[7]; BitsByte flags9 = reader.ReadByte(); - stylistName = flags9[0]; - witchDoctorName = flags9[1]; - taxCollectorName = flags9[2]; - pirateName = flags9[3]; - mechanicName = flags9[4]; - armsDealerName = flags9[5]; - dryadName = flags9[6]; - nurseName = flags9[7]; + _ = flags9[0]; + _ = flags9[1]; + _ = flags9[2]; + _ = flags9[3]; + _ = flags9[4]; + _ = flags9[5]; + _ = flags9[6]; + _ = flags9[7]; BitsByte flags10 = reader.ReadByte(); - anglerName = flags10[0]; - clothierName = flags10[1]; + _ = flags10[0]; + _ = flags10[1]; AcidRainEvent.OldDukeHasBeenEncountered = flags10[2]; - travelingMerchantName = flags10[3]; - princessName = flags10[4]; + _ = flags10[3]; + _ = flags10[4]; _ = flags10[5]; _ = flags10[6]; _ = flags10[7]; diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 2e9c0eaa06..ab675b9354 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -7,6 +7,7 @@ using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; +using CalamityMod.Items.SummonItems; using static CalamityMod.World.CalamityWorld; namespace CalamityMod.Systems @@ -219,17 +220,30 @@ namespace CalamityMod.Systems #region PostWorldGen public override void PostWorldGen() { - // Replace Suspicious Looking Eyes in Chests with random useful early game potions. for (int chestIndex = 0; chestIndex < Main.maxChests; chestIndex++) { Chest chest = Main.chest[chestIndex]; - if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers) + if (chest != null) { - bool isGoldChest = Main.tile[chest.x, chest.y].TileFrameX == 36; - bool isMahoganyChest = Main.tile[chest.x, chest.y].TileFrameX == 8 * 36; - bool isIvyChest = Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; - bool isIceChest = Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; - if (isGoldChest || isMahoganyChest || isIvyChest || isIceChest) + //Checks which sheet a chest belongs to + bool isContainer1 = Main.tile[chest.x, chest.y].TileType == TileID.Containers; + bool isContainer2 = Main.tile[chest.x, chest.y].TileType == TileID.Containers2; + + //Pre-1.4 chests + bool isBrownChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 0; + bool isGoldChest = isContainer1 && (Main.tile[chest.x, chest.y].TileFrameX == 36 || Main.tile[chest.x, chest.y].TileFrameX == 2*36); //Includes Locked Gold Chests + bool isMahoganyChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 8 * 36; + bool isIvyChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; + bool isIceChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; + bool isMushroomChest = isContainer1 && Main.tile[chest.x, chest.y].TileFrameX == 32 * 36; + bool isMarniteChest = isContainer1 && (Main.tile[chest.x, chest.y].TileFrameX == 50 * 36 || Main.tile[chest.x, chest.y].TileFrameX == 51 * 36); + + //1.4 chests + bool isDeadManChest = isContainer2 && Main.tile[chest.x, chest.y].TileFrameX == 4 * 36; + bool isSandstoneChest = isContainer2 && Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; + + // Replace Suspicious Looking Eyes in Chests with random useful early game potions. + if (isBrownChest || isGoldChest || isMahoganyChest || isIvyChest || isIceChest || isMushroomChest || isMarniteChest || isDeadManChest || isSandstoneChest) { for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) { @@ -258,6 +272,25 @@ namespace CalamityMod.Systems } } } + + // Adds Desert Medallion to Sandstone Chests at a 20% chance + if (isSandstoneChest) + { + float rng = WorldGen.genRand.NextFloat(); + if (rng < 0.2f) + { + for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) + { + if (chest.item[inventoryIndex].IsAir) + { + chest.item[inventoryIndex].SetDefaults(ModContent.ItemType()); + chest.item[inventoryIndex].stack = 1; + break; + } + } + } + } + } } diff --git a/TileEntities/TECalamityPylon.cs b/TileEntities/TECalamityPylon.cs new file mode 100644 index 0000000000..c7d419d917 --- /dev/null +++ b/TileEntities/TECalamityPylon.cs @@ -0,0 +1,14 @@ +using Terraria.ModLoader.Default; + +namespace CalamityMod.TileEntities +{ + /// Copied from ExampleMod for documentation if needed for later -pixl + /// + /// This is an empty child class that acts exactly like the default implementation of the abstract + /// class, which itself acts nearly identical to vanilla pylon TEs. This inheritance only exists so that modded pylon entities + /// will properly have their "Mod" property set, for I/O purposes. Has the sealed modifier since this TE acts identical to its parent. + /// + public sealed class TECalamityPylon : TEModdedPylon { + + } +} diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 82a64eb9aa..23ed514fdf 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -1,6 +1,7 @@  using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,7 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssGravel : ModTile { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -19,9 +21,9 @@ namespace CalamityMod.Tiles.Abyss ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(25, 28, 54)); - MineResist = 10f; + MineResist = 5f; MinPick = 65; - HitSound = SoundID.Tink; + HitSound = MineSound; DustType = 33; } diff --git a/Tiles/Abyss/AbyssGravel.png b/Tiles/Abyss/AbyssGravel.png index 1ce3ac3347..c51a8c09ea 100644 Binary files a/Tiles/Abyss/AbyssGravel.png and b/Tiles/Abyss/AbyssGravel.png differ diff --git a/Tiles/Abyss/AbyssalPots.cs b/Tiles/Abyss/AbyssalPots.cs index f67d0116ad..2a8022a563 100644 --- a/Tiles/Abyss/AbyssalPots.cs +++ b/Tiles/Abyss/AbyssalPots.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.TreasureBags.MiscGrabBags; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -26,6 +28,40 @@ namespace CalamityMod.Tiles.Abyss HitSound = SoundID.Shatter; } + public override bool Drop(int i, int j) + { + Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); + if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) + { + // 1 in 400 for a Coin Portal + if (Player.GetClosestRollLuck(i, j, 400) == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 16, 0f, -12f, ProjectileID.CoinPortal, 0, 0f, Main.myPlayer); + } + // Followed by a 1 in 4 for a bomb in For The Worthy worlds + else if (Main.getGoodWorld && Main.rand.Next(4) == 0) + { + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 8, (float)Main.rand.Next(-100, 101) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(i * 16, j * 16), 16, 16)); + } + else + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); + } + + if (Main.netMode != NetmodeID.Server) + { + int goreAmt = Main.rand.Next(1, 2 + 1); + for (int k = 0; k < goreAmt; k++) + { + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("AbyssPotGore1").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("AbyssPotGore2").Type); + } + } + } + return true; + } + public override bool CreateDust(int i, int j, ref int type) { if (Main.rand.NextBool(2)) diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index 89676521e4..8d962c32f2 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -1,9 +1,17 @@ using CalamityMod.Dusts; +using CalamityMod.Gores.Trees; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.NPCs.AcidRain; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.ModLoader; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { @@ -39,5 +47,76 @@ namespace CalamityMod.Tiles.Abyss style = 0; return ModContent.TileType(); } + + public override int TreeLeaf() => ModContent.GoreType(); + + // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); + + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + int dropItem = 0; + WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; + + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); + + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int type = ModContent.NPCType(); + NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = -1; + if (DownedBossSystem.downedEoCAcidRain) + type = ModContent.ItemType(); + if (DownedBossSystem.downedAquaticScourgeAcidRain && Main.rand.NextBool()) + type = ModContent.ItemType(); + if (type != -1) + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/Abyss/AcidWoodTreeSapling.cs b/Tiles/Abyss/AcidWoodTreeSapling.cs index 7e0f855cba..f663acb9af 100644 --- a/Tiles/Abyss/AcidWoodTreeSapling.cs +++ b/Tiles/Abyss/AcidWoodTreeSapling.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,6 +24,8 @@ namespace CalamityMod.Tiles.Abyss Main.tileLavaDeath[Type] = true; TileID.Sets.CommonSapling[Type] = true; TileID.Sets.TreeSapling[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -39,7 +42,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sapling"); + name.SetDefault("MapObject.Sapling"); AddMapEntry(new Color(113, 90, 71), name); DustType = (int)CalamityDusts.SulfurousSeaAcid; AdjTiles = new int[] { TileID.Saplings }; diff --git a/Tiles/Abyss/AcidwoodTile.cs b/Tiles/Abyss/AcidwoodTile.cs index 6394c89f01..d116456dee 100644 --- a/Tiles/Abyss/AcidwoodTile.cs +++ b/Tiles/Abyss/AcidwoodTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +14,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index a8873709e9..d70ada41b0 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -1,6 +1,7 @@ using CalamityMod.Walls; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,7 @@ namespace CalamityMod.Tiles.Abyss { public class PlantyMush : ModTile { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -23,7 +25,7 @@ namespace CalamityMod.Tiles.Abyss name.SetDefault("Planty Mush"); AddMapEntry(new Color(0, 120, 0), name); MineResist = 1f; - HitSound = SoundID.Dig; + HitSound = MineSound; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Abyss/SulphurousPots.cs b/Tiles/Abyss/SulphurousPots.cs index da4b7817b6..2f2e9752e1 100644 --- a/Tiles/Abyss/SulphurousPots.cs +++ b/Tiles/Abyss/SulphurousPots.cs @@ -1,6 +1,8 @@ using CalamityMod.Dusts; +using CalamityMod.Items.TreasureBags.MiscGrabBags; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -30,6 +32,40 @@ namespace CalamityMod.Tiles.Abyss HitSound = SoundID.Shatter; } + public override bool Drop(int i, int j) + { + Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); + if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) + { + // 1 in 400 for a Coin Portal + if (Player.GetClosestRollLuck(i, j, 400) == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 16, 0f, -12f, ProjectileID.CoinPortal, 0, 0f, Main.myPlayer); + } + // Followed by a 1 in 4 for a bomb in For The Worthy worlds + else if (Main.getGoodWorld && Main.rand.Next(4) == 0) + { + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 16, j * 16 + 8, (float)Main.rand.Next(-100, 101) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(i * 16, j * 16), 16, 16)); + } + else + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); + } + + if (Main.netMode != NetmodeID.Server) + { + int goreAmt = Main.rand.Next(1, 2 + 1); + for (int k = 0; k < goreAmt; k++) + { + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore1").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore2").Type); + } + } + } + return true; + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 9624c119af..72836b8cfa 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); + TileID.Sets.CanBeDugByShovel[Type] = true; + DustType = 32; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(150, 100, 50)); diff --git a/Tiles/Abyss/SulphurousSandNoWater.cs b/Tiles/Abyss/SulphurousSandNoWater.cs index f267ac4af9..76edcb0598 100644 --- a/Tiles/Abyss/SulphurousSandNoWater.cs +++ b/Tiles/Abyss/SulphurousSandNoWater.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); + TileID.Sets.CanBeDugByShovel[Type] = true; + DustType = 32; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(150, 100, 50)); diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 8a8efab045..1d774c15fe 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -20,6 +21,11 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(0, 50, 0), name); HitSound = SoundID.Grass; DustType = 2; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.ReplaceTileBreakDown[Type] = true; + TileID.Sets.VineThreads[Type] = true; + TileID.Sets.DrawFlipMode[Type] = 1; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index e480aa5b69..cab04cb330 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Skies; namespace CalamityMod.Tiles { @@ -33,7 +34,7 @@ namespace CalamityMod.Tiles { if (closer) { - if (!NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(ModContent.NPCType()) && !SCalSky.RitualDramaProjectileIsPresent) { WorldGen.KillTile(i, j, false, false, false); if (!Main.tile[i, j].HasTile && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index 2d0523f6e3..92e8eb708f 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 2b6924b20f..44c4c62156 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -1,7 +1,7 @@ - -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +13,7 @@ namespace CalamityMod.Tiles.Astral { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Dirt"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index 3cf854d50a..8fd26c3032 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +14,7 @@ namespace CalamityMod.Tiles.Astral Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Grass"]); CalamityUtils.SetMerge(Type, ModContent.TileType()); CalamityUtils.SetMerge(Type, TileID.Grass); @@ -31,6 +33,7 @@ namespace CalamityMod.Tiles.Astral //Grass framing (<3 terraria devs) TileID.Sets.NeedsGrassFraming[Type] = true; TileID.Sets.NeedsGrassFramingDirt[Type] = ModContent.TileType(); + TileID.Sets.CanBeDugByShovel[Type] = true; } public override void NumDust(int i, int j, bool fail, ref int Type) diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index a7a60a7de0..efcdbebc43 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +18,7 @@ namespace CalamityMod.Tiles.Astral { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); diff --git a/Tiles/Astral/AstralNormalLargePiles.cs b/Tiles/Astral/AstralNormalLargePiles.cs index 0a4f6600b6..cda376ca8a 100644 --- a/Tiles/Astral/AstralNormalLargePiles.cs +++ b/Tiles/Astral/AstralNormalLargePiles.cs @@ -1,7 +1,8 @@ - -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -34,5 +35,18 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 4; } + + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } } } diff --git a/Tiles/Astral/AstralNormalMediumPiles.cs b/Tiles/Astral/AstralNormalMediumPiles.cs index b8addfc6ca..5772be900a 100644 --- a/Tiles/Astral/AstralNormalMediumPiles.cs +++ b/Tiles/Astral/AstralNormalMediumPiles.cs @@ -1,7 +1,8 @@ - -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -34,5 +35,18 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 4; } + + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } } } diff --git a/Tiles/Astral/AstralNormalSmallPiles.cs b/Tiles/Astral/AstralNormalSmallPiles.cs index c6ebc00d29..d9b0d7ddc9 100644 --- a/Tiles/Astral/AstralNormalSmallPiles.cs +++ b/Tiles/Astral/AstralNormalSmallPiles.cs @@ -1,7 +1,8 @@ - -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral @@ -29,5 +30,18 @@ namespace CalamityMod.Tiles.Astral { num = fail ? 1 : 4; } + + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(6)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } } } diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index 01966559ca..b8cd5e3c8d 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -1,9 +1,10 @@ - -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { @@ -18,6 +19,9 @@ namespace CalamityMod.Tiles.Astral Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); DustType = ModContent.DustType(); @@ -32,5 +36,18 @@ namespace CalamityMod.Tiles.Astral { offsetY = 2; } + + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(400)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } } } diff --git a/Tiles/Astral/AstralStone.png b/Tiles/Astral/AstralStone.png index cbdcd6750a..0dd03a3af6 100644 Binary files a/Tiles/Astral/AstralStone.png and b/Tiles/Astral/AstralStone.png differ diff --git a/Tiles/Astral/AstralTallPlants.cs b/Tiles/Astral/AstralTallPlants.cs index fa68daa4ec..801b244c8d 100644 --- a/Tiles/Astral/AstralTallPlants.cs +++ b/Tiles/Astral/AstralTallPlants.cs @@ -1,9 +1,10 @@ - -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Astral { @@ -18,6 +19,9 @@ namespace CalamityMod.Tiles.Astral Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = true; Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); DustType = ModContent.DustType(); @@ -27,5 +31,18 @@ namespace CalamityMod.Tiles.Astral base.SetStaticDefaults(); } + + public override void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance) + { + if (NPC.CountNPCS(NPCID.EnchantedNightcrawler) < 5 && Main.rand.NextBool(200)) + { + int worm = NPC.NewNPC(new EntitySource_TileBreak(i, j), i * 16 + 10, j * 16, NPCID.EnchantedNightcrawler); + Main.npc[worm].TargetClosest(); + Main.npc[worm].velocity.Y = Main.rand.NextFloat(-5f, -2.1f); + Main.npc[worm].velocity.X = Main.rand.NextFloat(0f, 2.6f) * (float)(-Main.npc[worm].direction); + Main.npc[worm].direction *= -1; + Main.npc[worm].netUpdate = true; + } + } } } diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 31c6451efa..9711463f61 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -1,9 +1,16 @@ using CalamityMod.Dusts; +using CalamityMod.Gores.Trees; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.Astral; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ModLoader; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; +using Terraria.ID; namespace CalamityMod.Tiles.Astral { @@ -43,5 +50,79 @@ namespace CalamityMod.Tiles.Astral style = 0; return ModContent.TileType(); } + + public override int TreeLeaf() => ModContent.GoreType(); + + // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(7)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.Acorn, randAmt); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + int dropItem = 0; + WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; + + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); + + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int type = ModContent.NPCType(); + if (Main.raining) + type = NPCID.EnchantedNightcrawler; + NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = ModContent.ItemType(); + if (!Main.dayTime && Main.rand.NextBool()) + type = ItemID.FallenStar; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/Astral/AstralTreeSapling.cs b/Tiles/Astral/AstralTreeSapling.cs index 5b8437d556..a8c4ab9ed3 100644 --- a/Tiles/Astral/AstralTreeSapling.cs +++ b/Tiles/Astral/AstralTreeSapling.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -22,6 +23,8 @@ namespace CalamityMod.Tiles.Astral Main.tileLavaDeath[Type] = true; TileID.Sets.CommonSapling[Type] = true; TileID.Sets.TreeSapling[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -38,7 +41,7 @@ namespace CalamityMod.Tiles.Astral TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sapling"); + name.SetDefault("MapObject.Sapling"); AddMapEntry(new Color(200, 200, 200), name); DustType = ModContent.DustType(); AdjTiles = new int[] { TileID.Saplings }; diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 396e1989bb..6ad3b3e71b 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +16,11 @@ namespace CalamityMod.Tiles.Astral Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.ReplaceTileBreakDown[Type] = true; + TileID.Sets.VineThreads[Type] = true; + TileID.Sets.DrawFlipMode[Type] = 1; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); DustType = ModContent.DustType(); diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index 8f0fba779a..f2cad769e7 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/AstralDesert/AstralPalmSapling.cs b/Tiles/AstralDesert/AstralPalmSapling.cs index 622cfa45aa..7a0f2f685f 100644 --- a/Tiles/AstralDesert/AstralPalmSapling.cs +++ b/Tiles/AstralDesert/AstralPalmSapling.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -22,6 +23,8 @@ namespace CalamityMod.Tiles.AstralDesert Main.tileLavaDeath[Type] = true; TileID.Sets.CommonSapling[Type] = true; TileID.Sets.TreeSapling[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -38,7 +41,7 @@ namespace CalamityMod.Tiles.AstralDesert TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sapling"); + name.SetDefault("MapObject.Sapling"); AddMapEntry(new Color(200, 200, 200), name); DustType = ModContent.DustType(); AdjTiles = new int[] { TileID.Saplings }; diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 479c9e5a43..95ba47bd7b 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -1,8 +1,15 @@ using CalamityMod.Dusts; +using CalamityMod.Gores.Trees; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria.ModLoader; using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralDesert { @@ -41,5 +48,67 @@ namespace CalamityMod.Tiles.AstralDesert style = 0; return ModContent.TileType(); } + + public override int TreeLeaf() => ModContent.GoreType(); + + // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); + + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + int dropItem = 0; + WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; + + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); + + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = ModContent.ItemType(); + if (!Main.dayTime && Main.rand.NextBool()) + type = ItemID.FallenStar; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 05c5dcbd81..db773b22b1 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -1,9 +1,9 @@ - -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,7 @@ namespace CalamityMod.Tiles.AstralDesert Main.tileBlockLight[Type] = true; Main.tileSand[Type] = true; Main.tileBrick[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); diff --git a/Tiles/AstralDesert/AstralSand.png b/Tiles/AstralDesert/AstralSand.png index fcfaf5ab9c..a535a94cce 100644 Binary files a/Tiles/AstralDesert/AstralSand.png and b/Tiles/AstralDesert/AstralSand.png differ diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index 5f1fde3e6d..ea8a5c72b5 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +13,7 @@ namespace CalamityMod.Tiles.AstralSnow Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Ice"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSnow(Type); diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index ed515d8b95..4708b7110b 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -1,7 +1,7 @@ - -using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +14,7 @@ namespace CalamityMod.Tiles.AstralSnow Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Snow"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSnow(Type); diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index 81c7c2491f..e7482845fd 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -1,8 +1,16 @@ -using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Gores.Trees; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.Astral; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.AstralSnow { @@ -36,20 +44,87 @@ namespace CalamityMod.Tiles.AstralSnow public override Asset GetTexture() => ModContent.Request("CalamityMod/Tiles/AstralSnow/AstralSnowTree"); - public override int DropWood() - { - return ModContent.ItemType(); - } + public override int DropWood() => ModContent.ItemType(); - public override int CreateDust() - { - return ModContent.DustType(); - } + public override int CreateDust() => ModContent.DustType(); public override int SaplingGrowthType(ref int style) { style = 0; return ModContent.TileType(); } + + public override int TreeLeaf() => ModContent.GoreType(); + + // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies + public override bool Shake(int x, int y, ref bool createLeaves) + { + int randAmt = Main.rand.Next(1, 3); + + if (Main.getGoodWorld && Main.rand.NextBool(15)) + { + Projectile.NewProjectile(new EntitySource_ShakeTree(x, y), x * 16, y * 16, Main.rand.NextFloat(-100f, 100f) * 0.002f, 0f, ProjectileID.Bomb, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16)); + } + else if (Main.rand.NextBool(7)) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.Acorn, randAmt); + } + else if (Main.rand.NextBool(35) && Main.halloween) + { + createLeaves = true; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt); + } + else if (Main.rand.NextBool(12)) + { + createLeaves = true; + int dropItem = 0; + WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4)); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int coin = ItemID.CopperCoin; + int amount = Main.rand.Next(50, 100); + if (Main.rand.NextBool(30)) + { + coin = ItemID.GoldCoin; + amount = 1; + if (Main.rand.NextBool(5)) + amount++; + + if (Main.rand.NextBool(10)) + amount++; + } + else if (Main.rand.NextBool(10)) + { + coin = ItemID.SilverCoin; + amount = Main.rand.Next(1, 21); + if (Main.rand.NextBool(3)) + amount += Main.rand.Next(1, 21); + + if (Main.rand.NextBool(4)) + amount += Main.rand.Next(1, 21); + } + + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, coin, amount); + } + else if (Main.rand.NextBool(20)) + { + createLeaves = true; + int type = ModContent.NPCType(); + NPC.NewNPC(new EntitySource_ShakeTree(x, y), x * 16, y * 16, type); + } + else if (Main.rand.NextBool(15)) + { + createLeaves = true; + int type = ModContent.ItemType(); + if (!Main.dayTime && Main.rand.NextBool()) + type = ItemID.FallenStar; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); + } + return false; + } } } diff --git a/Tiles/AstralSnow/AstralSnowTreeSapling.cs b/Tiles/AstralSnow/AstralSnowTreeSapling.cs index 6daee5c91d..b1e81074c2 100644 --- a/Tiles/AstralSnow/AstralSnowTreeSapling.cs +++ b/Tiles/AstralSnow/AstralSnowTreeSapling.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -22,6 +23,8 @@ namespace CalamityMod.Tiles.AstralSnow Main.tileLavaDeath[Type] = true; TileID.Sets.TreeSapling[Type] = true; TileID.Sets.CommonSapling[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); TileObjectData.newTile.Width = 1; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(0, 1); @@ -38,7 +41,7 @@ namespace CalamityMod.Tiles.AstralSnow TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sapling"); + name.SetDefault("MapObject.Sapling"); AddMapEntry(new Color(200, 200, 200), name); DustType = ModContent.DustType(); AdjTiles = new int[] { TileID.Saplings }; diff --git a/Tiles/BaseTiles/BaseBossRelic.cs b/Tiles/BaseTiles/BaseBossRelic.cs index e985a82d83..ccbdd0b207 100644 --- a/Tiles/BaseTiles/BaseBossRelic.cs +++ b/Tiles/BaseTiles/BaseBossRelic.cs @@ -9,7 +9,7 @@ using Terraria.Enums; using System; using ReLogic.Content; using Terraria.Localization; - +using CalamityMod.ForegroundDrawing; namespace CalamityMod.Tiles.BaseTiles { diff --git a/Tiles/BaseTiles/BasePylonTile.cs b/Tiles/BaseTiles/BasePylonTile.cs new file mode 100644 index 0000000000..a8299516ad --- /dev/null +++ b/Tiles/BaseTiles/BasePylonTile.cs @@ -0,0 +1,166 @@ +using System; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Map; +using Terraria.ModLoader; +using Terraria.ModLoader.Default; + +namespace CalamityMod.Tiles.BaseTiles +{ + public abstract class BasePylonTile : ModPylon + { + public const int CrystalHorizontalFrameCount = 1; + public const int CrystalVerticalFrameCount = 8; + public const int CrystalFrameHeight = 64; + + public Asset crystalTexture; + public Asset mapIcon; + + //The type of dust created by the pylon + public virtual int DustID => 43; + public virtual Color DustColor => Color.White; + public virtual Color LightColor => Color.White; + public abstract int AssociatedItem { get; } + public abstract string PylonMapText { get; } + public abstract Color PylonMapColor { get; } + + public override void Load() + { + // Pre-loading textures + crystalTexture = ModContent.Request(Texture + "_Crystal"); + mapIcon = ModContent.Request(Texture + "_MapIcon"); + } + + public override void Unload() + { + crystalTexture = null; + mapIcon = null; + } + + public override void SetStaticDefaults() + { + TEModdedPylon moddedPylon = ModContent.GetInstance(); + this.SetUpPylon(moddedPylon, true); + + TileID.Sets.InteractibleByNPCs[Type] = true; + TileID.Sets.PreventsSandfall[Type] = true; + + ModTranslation pylonName = CreateMapEntryName(); + AddMapEntry(PylonMapColor, pylonName); + } + + public override void MouseOver(int i, int j) + { + // Uses the pylon item as an icon when hovering over it. + Main.LocalPlayer.cursorItemIconEnabled = true; + Main.LocalPlayer.cursorItemIconID = AssociatedItem; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + ModContent.GetInstance().Kill(i, j); + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 2, 3, AssociatedItem); + } + + public override bool CreateDust(int i, int j, ref int type) => false; + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = LightColor.R / 255f; + g = LightColor.G / 255f; + b = LightColor.B / 255f; + } + } + + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + Vector2 offScreen = new Vector2(Main.offScreenRange); + if (Main.drawToScreen) + { + offScreen = Vector2.Zero; + } + + Point p = new Point(i, j); + Tile tile = Main.tile[p.X, p.Y]; + if (tile == null || !tile.HasTile) + return; + + Texture2D crystalTex = crystalTexture.Value; + + int frameY = (Main.tileFrameCounter[597] + p.X + p.Y) % CrystalFrameHeight / CrystalVerticalFrameCount; + Rectangle frame = crystalTexture.Frame(CrystalHorizontalFrameCount, CrystalVerticalFrameCount, 0, frameY); + Vector2 origin = frame.Size() / 2f; + + //Used to make the crystal bob, and the 6-way glow pulse a bit + float sineOffset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi / 5f); + + Vector2 tilePosition = p.ToWorldCoordinates(24f, 64f); + Vector2 drawCenter = tilePosition + offScreen + Vector2.UnitY * (-40f + sineOffset * 4f); + drawCenter -= Vector2.One; //This isn't vanilla, but since our sheets lack the extra side 2 pixels, it makes our pylons offset by one pixel in each direction (imperceptible). This makes our pylons 100% aligned with vanilla + + //Vanilla just has a nextbool(4) but thats because vanilla doesnt care about the update rate. We do this because in the updateEveryFrame lightning mode, the game runs the draw calls 4x as often + bool frameToSpawnDust = !Lighting.UpdateEveryFrame || Main.rand.NextBool(4); + if (!Main.gamePaused && Main.instance.IsActive && frameToSpawnDust && Main.rand.NextBool(10)) + { + //Important to remember to remove the offscreen vector. Vanilla drawing doesn't have this vector, but we do. If we don't remove it, the dust just gets spawned offscreen + Rectangle dustBox = Utils.CenteredRectangle(drawCenter - offScreen, frame.Size()); + + int dust = Dust.NewDust(dustBox.TopLeft(), dustBox.Width, dustBox.Height, DustID, 0f, 0f, 254, DustColor, 0.5f); + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].velocity.Y -= 0.2f; + } + + //Crystal is 80% fullbright + Color crystalColor = Color.Lerp(Lighting.GetColor(p.X, p.Y), Color.White, 0.8f); + spriteBatch.Draw(crystalTex, drawCenter - Main.screenPosition, frame, crystalColor * 0.7f, 0f, origin, 1f, 0f, 0f); + + //Draw a 6-way glowing effect + float glowOpacity = (float)Math.Sin((double)Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) * 0.2f + 0.8f; + Color glowColor = new Color(255, 255, 255, 0) * 0.1f * glowOpacity; + for (float k = 0f; k < 1f; k += 1 / 6f) + { + spriteBatch.Draw(crystalTex, drawCenter - Main.screenPosition + (MathHelper.TwoPi * k).ToRotationVector2() * (6f + sineOffset * 2f), frame, glowColor, 0f, origin, 1f, 0f, 0f); + } + + int tileSelectionTier = 0; + if (Main.InSmartCursorHighlightArea(p.X, p.Y, out var actuallySelected)) + { + tileSelectionTier = 1; + if (actuallySelected) + { + tileSelectionTier = 2; + } + } + + //Draw the selection glow + if (tileSelectionTier != 0) + { + int averageBrightness = (crystalColor.R + crystalColor.G + crystalColor.B) / 3; + if (averageBrightness > 10) + { + //Use the vanilla crystal sheet to get the autoselect outline + Texture2D vanillaCrystalSheet = TextureAssets.Extra[181].Value; + Rectangle smartCursorGlowFrame = vanillaCrystalSheet.Frame(12, 8, 2, frameY); + + Color selectionGlowColor = Colors.GetSelectionGlowColor(tileSelectionTier == 2, averageBrightness); + spriteBatch.Draw(vanillaCrystalSheet, drawCenter - Main.screenPosition, smartCursorGlowFrame, selectionGlowColor, 0f, origin, 1f, SpriteEffects.None, 0f); + } + } + } + + public override void DrawMapIcon(ref MapOverlayDrawContext context, ref string mouseOverText, TeleportPylonInfo pylonInfo, bool isNearPylon, Color drawColor, float deselectedScale, float selectedScale) + { + // Just like in SpecialDraw, we want things to be handled the EXACT same way vanilla would handle it, which ModPylon also has built in methods for: + bool mouseOver = DefaultDrawMapIcon(ref context, mapIcon, pylonInfo.PositionInTiles.ToVector2() + new Vector2(1.5f, 2f), drawColor, deselectedScale, selectedScale); + DefaultMapClickHandle(mouseOver, pylonInfo, PylonMapText, ref mouseOverText); + } + } +} diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 84c1733215..c9f67922dd 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,13 +1,12 @@ using CalamityMod.Events; -using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; -using CalamityMod.Tiles.Furniture; -using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -232,42 +231,28 @@ namespace CalamityMod.Tiles player.breath += 20; if (player.breath > player.breathMax) player.breath = player.breathMax; + } + // Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse + if (player.Calamity().miningSet && player.Calamity().miningSetCooldown <= 0 && !fail) + { + int item = tile.GetOreItemID(); + Vector2 pos = new Vector2(i, j) * 16; + // 25% chance for additional ore + if (Main.rand.NextBool(MiningArmorSetChange.BonusOreChance) && item != -1) + { + Item.NewItem(new EntitySource_TileBreak(i, j), pos, item); + // Cooldown varies between 3 and 6 seconds + player.Calamity().miningSetCooldown = Main.rand.Next(MiningArmorSetChange.CooldownMin, MiningArmorSetChange.CooldownMax + 1); + } } } - // LATER -- clean up copied decompiled pot code here public override bool Drop(int i, int j, int type) { Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { - if (type == ModContent.TileType()) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); - - if (Main.netMode != NetmodeID.Server) - { - for (int k = 0; k < Main.rand.Next(1, 2 + 1); k++) - { - Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("AbyssPotGore1").Type); - Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("AbyssPotGore2").Type); - } - } - } - else if (type == ModContent.TileType()) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); - - if (Main.netMode != NetmodeID.Server) - { - for (int k = 0; k < Main.rand.Next(1, 2 + 1); k++) - { - Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore1").Type); - Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find("SulphPotGore2").Type); - } - } - } - else if (type == TileID.DemonAltar && Main.hardMode) + if (type == TileID.DemonAltar && Main.hardMode) { Vector2 pos = new Vector2(i, j) * 16; if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) @@ -289,27 +274,6 @@ namespace CalamityMod.Tiles return true; } - public override int[] AdjTiles (int type) - { - // Ashen, Ancient and Profaned Sinks all count as a lava source instead of a water source - // Exo Sinks count as a water, lava, and honey source - if (type == ModContent.TileType() || - type == ModContent.TileType() || - type == ModContent.TileType() || - type == ModContent.TileType()) - { - Main.LocalPlayer.adjLava = true; - } - // Botanic Sink counts as a honey source instead of a water source - if (type == ModContent.TileType() || - type == ModContent.TileType()) - { - Main.LocalPlayer.adjHoney = true; - } - - return new int[0]; - } - public static bool ShouldNotBreakDueToAboveTile(int x, int y) { int[] invincibleTiles = new int[] diff --git a/Tiles/ChaoticBrick.png b/Tiles/ChaoticBrick.png deleted file mode 100644 index 5affdec8d0..0000000000 Binary files a/Tiles/ChaoticBrick.png and /dev/null differ diff --git a/Tiles/DraedonStructures/HazardChevronPanels.cs b/Tiles/DraedonStructures/HazardChevronPanels.cs index 8672eccc3e..abfbed9581 100644 --- a/Tiles/DraedonStructures/HazardChevronPanels.cs +++ b/Tiles/DraedonStructures/HazardChevronPanels.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.SetMerge(Type, ModContent.TileType()); CalamityUtils.SetMerge(Type, ModContent.TileType()); CalamityUtils.SetMerge(Type, ModContent.TileType()); + CalamityUtils.SetMerge(Type, ModContent.TileType()); HitSound = SoundID.Tink; DustType = 19; diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs index a8f653b5e2..6c71829597 100644 --- a/Tiles/DraedonStructures/LaboratoryPanels.cs +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Tiles.DraedonStructures Main.tileMergeDirt[Type] = true; CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.SetMerge(Type, ModContent.TileType()); HitSound = SoundID.Tink; DustType = 109; diff --git a/Tiles/Furniture/AuricToiletTile.cs b/Tiles/Furniture/AuricToiletTile.cs index 9193284b7f..673bf0408d 100644 --- a/Tiles/Furniture/AuricToiletTile.cs +++ b/Tiles/Furniture/AuricToiletTile.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 4; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.Origin = new Point16(1, 1); diff --git a/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs b/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs new file mode 100644 index 0000000000..9751a42a72 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class AnahitaTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.png b/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.png new file mode 100644 index 0000000000..41c852317f Binary files /dev/null and b/Tiles/Furniture/BossTrophies/AnahitaTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs b/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs new file mode 100644 index 0000000000..a7a0d472b8 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/ApolloTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class ApolloTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/ApolloTrophyTile.png b/Tiles/Furniture/BossTrophies/ApolloTrophyTile.png new file mode 100644 index 0000000000..cb4d9cf505 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/ApolloTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs b/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs new file mode 100644 index 0000000000..de132d879b --- /dev/null +++ b/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class AquaticScourgeTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.png b/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.png new file mode 100644 index 0000000000..d289a77833 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/AquaticScourgeTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/AresTrophyTile.cs b/Tiles/Furniture/BossTrophies/AresTrophyTile.cs new file mode 100644 index 0000000000..965576967b --- /dev/null +++ b/Tiles/Furniture/BossTrophies/AresTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class AresTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/AresTrophyTile.png b/Tiles/Furniture/BossTrophies/AresTrophyTile.png new file mode 100644 index 0000000000..b414ac62f6 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/AresTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs b/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs new file mode 100644 index 0000000000..fa23898646 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class ArtemisTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.png b/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.png new file mode 100644 index 0000000000..a34bf2572b Binary files /dev/null and b/Tiles/Furniture/BossTrophies/ArtemisTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs b/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs new file mode 100644 index 0000000000..31860f2f17 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class AstrumAureusTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.png b/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.png new file mode 100644 index 0000000000..2a9c72e3ef Binary files /dev/null and b/Tiles/Furniture/BossTrophies/AstrumAureusTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs b/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs new file mode 100644 index 0000000000..1b88fb1069 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class AstrumDeusTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.png b/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.png new file mode 100644 index 0000000000..b555867bdd Binary files /dev/null and b/Tiles/Furniture/BossTrophies/AstrumDeusTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs b/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs new file mode 100644 index 0000000000..49cbdfec68 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class BrimstoneElementalTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.png b/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.png new file mode 100644 index 0000000000..1a5a92caaf Binary files /dev/null and b/Tiles/Furniture/BossTrophies/BrimstoneElementalTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.cs b/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.cs new file mode 100644 index 0000000000..7796e9f8b5 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CalamitasTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.png b/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.png new file mode 100644 index 0000000000..ccd4084ba0 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs b/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs new file mode 100644 index 0000000000..561cfa9478 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CataclysmTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.png b/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.png new file mode 100644 index 0000000000..654d175c5e Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CataclysmTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs b/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs new file mode 100644 index 0000000000..7ffc7f7328 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CatastropheTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.png b/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.png new file mode 100644 index 0000000000..201e62b92c Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CatastropheTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs b/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs new file mode 100644 index 0000000000..624f1312a4 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CeaselessVoidTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.png b/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.png new file mode 100644 index 0000000000..4c38c46997 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CeaselessVoidTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs b/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs new file mode 100644 index 0000000000..24555c4c2b --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CrabulonTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.png b/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.png new file mode 100644 index 0000000000..7dfbcde84b Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CrabulonTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs b/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs new file mode 100644 index 0000000000..a3a40e9328 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CragmawMireTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.png b/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.png new file mode 100644 index 0000000000..0458db923f Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CragmawMireTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs b/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs new file mode 100644 index 0000000000..c27aea3b99 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/CryogenTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class CryogenTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/CryogenTrophyTile.png b/Tiles/Furniture/BossTrophies/CryogenTrophyTile.png new file mode 100644 index 0000000000..b867e97d10 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/CryogenTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs new file mode 100644 index 0000000000..f5555ce2aa --- /dev/null +++ b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class DesertScourgeTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png new file mode 100644 index 0000000000..92d487c939 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/DesertScourgeTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs b/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs new file mode 100644 index 0000000000..71dc132e11 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class DevourerofGodsTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.png b/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.png new file mode 100644 index 0000000000..3fc23d52dd Binary files /dev/null and b/Tiles/Furniture/BossTrophies/DevourerofGodsTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs b/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs new file mode 100644 index 0000000000..90c50d02ee --- /dev/null +++ b/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class DragonfollyTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.png b/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.png new file mode 100644 index 0000000000..c8b50ae14d Binary files /dev/null and b/Tiles/Furniture/BossTrophies/DragonfollyTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs b/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs new file mode 100644 index 0000000000..a6f0818e00 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class GiantClamTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.png b/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.png new file mode 100644 index 0000000000..c63f955859 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/GiantClamTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs b/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs new file mode 100644 index 0000000000..89333118cf --- /dev/null +++ b/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class GreatSandSharkTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.png b/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.png new file mode 100644 index 0000000000..6270950385 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/GreatSandSharkTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs b/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs new file mode 100644 index 0000000000..c32382ef4d --- /dev/null +++ b/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class HiveMindTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.png b/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.png new file mode 100644 index 0000000000..17c918c147 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/HiveMindTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs b/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs new file mode 100644 index 0000000000..5a81af7a2a --- /dev/null +++ b/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class LeviathanTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.png b/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.png new file mode 100644 index 0000000000..cc73ec8745 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/LeviathanTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs b/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs new file mode 100644 index 0000000000..535fff91eb --- /dev/null +++ b/Tiles/Furniture/BossTrophies/MaulerTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class MaulerTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/MaulerTrophyTile.png b/Tiles/Furniture/BossTrophies/MaulerTrophyTile.png new file mode 100644 index 0000000000..1346c14807 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/MaulerTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs b/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs new file mode 100644 index 0000000000..2186270329 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class NuclearTerrorTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.png b/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.png new file mode 100644 index 0000000000..4e271af95a Binary files /dev/null and b/Tiles/Furniture/BossTrophies/NuclearTerrorTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs b/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs new file mode 100644 index 0000000000..d19ab042a0 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class OldDukeTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.png b/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.png new file mode 100644 index 0000000000..93e8176ac6 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/OldDukeTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs b/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs new file mode 100644 index 0000000000..78c0ef56ad --- /dev/null +++ b/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class PerforatorTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.png b/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.png new file mode 100644 index 0000000000..246932779f Binary files /dev/null and b/Tiles/Furniture/BossTrophies/PerforatorTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs b/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs new file mode 100644 index 0000000000..2f6b704e5e --- /dev/null +++ b/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class PlaguebringerGoliathTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.png b/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.png new file mode 100644 index 0000000000..a16f45d405 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/PlaguebringerGoliathTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs b/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs new file mode 100644 index 0000000000..c36991f04a --- /dev/null +++ b/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class PolterghastTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.png b/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.png new file mode 100644 index 0000000000..d159eed383 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/PolterghastTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs b/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs new file mode 100644 index 0000000000..531cce2d86 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class ProfanedGuardianTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.png b/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.png new file mode 100644 index 0000000000..76fda3d259 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/ProfanedGuardianTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs b/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs new file mode 100644 index 0000000000..d66f30068d --- /dev/null +++ b/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class ProvidenceTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.png b/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.png new file mode 100644 index 0000000000..d9dd05e96a Binary files /dev/null and b/Tiles/Furniture/BossTrophies/ProvidenceTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs b/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs new file mode 100644 index 0000000000..2c3db61a24 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/RavagerTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class RavagerTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/RavagerTrophyTile.png b/Tiles/Furniture/BossTrophies/RavagerTrophyTile.png new file mode 100644 index 0000000000..4b836b846f Binary files /dev/null and b/Tiles/Furniture/BossTrophies/RavagerTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs b/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs new file mode 100644 index 0000000000..4b18c9a44e --- /dev/null +++ b/Tiles/Furniture/BossTrophies/SignusTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class SignusTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/SignusTrophyTile.png b/Tiles/Furniture/BossTrophies/SignusTrophyTile.png new file mode 100644 index 0000000000..e5ce5b705e Binary files /dev/null and b/Tiles/Furniture/BossTrophies/SignusTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs b/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs new file mode 100644 index 0000000000..9960461e21 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class SlimeGodTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.png b/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.png new file mode 100644 index 0000000000..cd47b2d511 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/SlimeGodTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs b/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs new file mode 100644 index 0000000000..768c5b05c5 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class StormWeaverTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.png b/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.png new file mode 100644 index 0000000000..41d18696d6 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/StormWeaverTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs b/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs new file mode 100644 index 0000000000..432207aad8 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class SupremeCalamitasTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.png b/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.png new file mode 100644 index 0000000000..1fcffbba02 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/SupremeCalamitasTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs b/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs new file mode 100644 index 0000000000..3b4e0eb9c5 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class SupremeCataclysmTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.png b/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.png new file mode 100644 index 0000000000..8fa89992dc Binary files /dev/null and b/Tiles/Furniture/BossTrophies/SupremeCataclysmTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs b/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs new file mode 100644 index 0000000000..26035d4ecb --- /dev/null +++ b/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class SupremeCatastropheTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.png b/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.png new file mode 100644 index 0000000000..d959bbb4f9 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/SupremeCatastropheTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs b/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs new file mode 100644 index 0000000000..4c4fdedaf6 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class ThanatosTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.png b/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.png new file mode 100644 index 0000000000..c8385fe0ad Binary files /dev/null and b/Tiles/Furniture/BossTrophies/ThanatosTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs b/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs new file mode 100644 index 0000000000..31e5e3e739 --- /dev/null +++ b/Tiles/Furniture/BossTrophies/YharonTrophyTile.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.BossTrophies +{ + public class YharonTrophyTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTrophy(); + AddMapEntry(new Color(120, 85, 60), Language.GetText("MapObject.Trophy")); + DustType = 7; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/BossTrophies/YharonTrophyTile.png b/Tiles/Furniture/BossTrophies/YharonTrophyTile.png new file mode 100644 index 0000000000..88bfef0584 Binary files /dev/null and b/Tiles/Furniture/BossTrophies/YharonTrophyTile.png differ diff --git a/Tiles/Furniture/BossTrophy.png b/Tiles/Furniture/BossTrophy.png index 4d978b1a1b..ac4892259f 100644 Binary files a/Tiles/Furniture/BossTrophy.png and b/Tiles/Furniture/BossTrophy.png differ diff --git a/Tiles/Furniture/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs similarity index 91% rename from Tiles/Furniture/SCalAltar.cs rename to Tiles/Furniture/CraftingStations/SCalAltar.cs index 6399d21565..c2d9ed478b 100644 --- a/Tiles/Furniture/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -1,6 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.Furniture.CraftingStations; using CalamityMod.Items.SummonItems; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Boss; @@ -13,17 +13,19 @@ using Terraria.ModLoader; using Terraria.ObjectData; using Terraria.Audio; -namespace CalamityMod.Tiles.Furniture +namespace CalamityMod.Tiles.Furniture.CraftingStations { public class SCalAltar : ModTile { + public static readonly SoundStyle SummonSound = new("CalamityMod/Sounds/Custom/SCalAltarSummon"); + public const int Width = 4; public const int Height = 3; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; - Main.tileSpelunker[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.newTile.Width = 4; TileObjectData.newTile.Height = 3; @@ -44,8 +46,8 @@ namespace CalamityMod.Tiles.Furniture public override bool CreateDust(int i, int j, ref int type) { - // Fire dust. - type = 6; + // Red torch dust. + type = 60; return true; } @@ -78,7 +80,7 @@ namespace CalamityMod.Tiles.Furniture Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); ritualSpawnPosition += new Vector2(-10f, -24f); - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, ritualSpawnPosition); + SoundEngine.PlaySound(SummonSound, ritualSpawnPosition); Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); if (!usingSpecialItem) diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.png b/Tiles/Furniture/CraftingStations/SCalAltar.png new file mode 100644 index 0000000000..02c8df7cfc Binary files /dev/null and b/Tiles/Furniture/CraftingStations/SCalAltar.png differ diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index 9bbf7463ab..597f60a3f1 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void SetStaticDefaults() { this.SetUpFountain(); - AddMapEntry(new Color(104, 195, 255), Language.GetText("MapObject.WaterFountain")); + AddMapEntry(new Color(141, 121, 77), Language.GetText("MapObject.WaterFountain")); AnimationFrameHeight = 72; } diff --git a/Tiles/Furniture/SCalAltar.png b/Tiles/Furniture/SCalAltar.png deleted file mode 100644 index 430144741e..0000000000 Binary files a/Tiles/Furniture/SCalAltar.png and /dev/null differ diff --git a/Tiles/Furniture/ThaumaticChairTile.cs b/Tiles/Furniture/ThaumaticChairTile.cs index d3a166c349..83a658c433 100644 --- a/Tiles/Furniture/ThaumaticChairTile.cs +++ b/Tiles/Furniture/ThaumaticChairTile.cs @@ -12,14 +12,10 @@ namespace CalamityMod.Tiles.Furniture { public class ThaumaticChairTile : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(236, 123, 89), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -39,55 +35,11 @@ namespace CalamityMod.Tiles.Furniture Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/Furniture/ThaumaticChairTile_Highlight.png b/Tiles/Furniture/ThaumaticChairTile_Highlight.png new file mode 100644 index 0000000000..7c87c50dd8 Binary files /dev/null and b/Tiles/Furniture/ThaumaticChairTile_Highlight.png differ diff --git a/Tiles/Furniture/WulfrumLure.cs b/Tiles/Furniture/WulfrumLure.cs new file mode 100644 index 0000000000..4f1ab9b8d6 --- /dev/null +++ b/Tiles/Furniture/WulfrumLure.cs @@ -0,0 +1,125 @@ +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.Items.Tools; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.Audio; +using Terraria.ID; +using ReLogic.Content; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Projectiles.Typeless; +using System.Linq; + +namespace CalamityMod.Tiles.Furniture +{ + public class WulfrumLure : ModTile + { + public const int Width = 2; + public const int Height = 2; + + public Asset CogTexture; + public Asset CoverTexture; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Wulfrum Lure"); + AddMapEntry(new Color(194, 255, 67), name); + TileID.Sets.DisableSmartCursor[Type] = true; + + DustType = 83; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType()); + } + + public override bool RightClick(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int left = i - tile.TileFrameX / 18; + int top = j - tile.TileFrameY / 18; + + if (!Main.LocalPlayer.HasItem(ModContent.ItemType())) + return true; + + if (Main.projectile.Any(p => p.active && p.type == ModContent.ProjectileType() && (p.Center - Main.LocalPlayer.Center).Length() < 2000)) + return true; + + Vector2 lurePosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); + lurePosition += new Vector2(0f, -24f); + + SoundEngine.PlaySound(WulfrumTreasurePinger.ScanBeepSound, lurePosition); + Projectile.NewProjectile(new EntitySource_WorldEvent(), lurePosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + + return true; + } + + public override void MouseOver(int i, int j) + { + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.cursorItemIconEnabled = true; + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (drawData.tileFrameX % (Width * 18) == 0 && drawData.tileFrameY % (Height * 18 ) == 0) + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + } + + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + Vector2 offScreen = new Vector2(Main.offScreenRange); + if (Main.drawToScreen) + { + offScreen = Vector2.Zero; + } + + Point p = new Point(i, j); + Tile tile = Main.tile[p.X, p.Y]; + if (tile == null || !tile.HasTile) + { + return; + } + + if (CogTexture == null) + CogTexture = ModContent.Request("CalamityMod/Tiles/Furniture/WulfrumLureCog"); + Texture2D cogTexture = CogTexture.Value; + + if (CoverTexture == null) + CoverTexture = ModContent.Request("CalamityMod/Tiles/Furniture/WulfrumLureCover"); + Texture2D coverTex = CoverTexture.Value; + + Vector2 worldPos = p.ToWorldCoordinates(16f, 16f); + + Color color = Lighting.GetColor(p.X, p.Y); + + bool direction = tile.TileFrameY / (Height * 16) != 0; + + SpriteEffects effects = direction ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 drawPos = worldPos + offScreen - Main.screenPosition; + spriteBatch.Draw(cogTexture, drawPos, null, color, Main.GlobalTimeWrappedHourly * 1.5f * (direction ? -1 : 1), cogTexture.Size() / 2f, 1f, effects, 0f); + + spriteBatch.Draw(coverTex, p.ToWorldCoordinates(0f, 0f) + Vector2.UnitY * 2 + offScreen - Main.screenPosition, null, color, 0f, Vector2.Zero, 1f, effects, 0f); + } + } +} diff --git a/Tiles/Furniture/WulfrumLure.png b/Tiles/Furniture/WulfrumLure.png new file mode 100644 index 0000000000..ac99f82cdf Binary files /dev/null and b/Tiles/Furniture/WulfrumLure.png differ diff --git a/Tiles/Furniture/WulfrumLureCog.png b/Tiles/Furniture/WulfrumLureCog.png new file mode 100644 index 0000000000..4dda0f3ef2 Binary files /dev/null and b/Tiles/Furniture/WulfrumLureCog.png differ diff --git a/Tiles/Furniture/WulfrumLureCover.png b/Tiles/Furniture/WulfrumLureCover.png new file mode 100644 index 0000000000..b58405e58e Binary files /dev/null and b/Tiles/Furniture/WulfrumLureCover.png differ diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index 5c85937788..6e785b4e3d 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -37,17 +37,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index 8fdadde235..6020954af7 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public class AbyssChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -38,55 +34,11 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index ad477f2be9..3adc610c5d 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -49,5 +49,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index 42c5b7d94b..c35814641d 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAbyss { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -29,5 +31,16 @@ namespace CalamityMod.Tiles.FurnitureAbyss { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index 4157836cbb..2438d1a944 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Tiles.FurnitureAbyss Tile tile = Main.tile[i, j]; if (tile.TileFrameX < 66) { - r = 0.9f; - g = 0.9f; - b = 0.9f; + r = 0.6f; + g = 0.6f; + b = 2.3f; } } @@ -81,5 +81,11 @@ namespace CalamityMod.Tiles.FurnitureAbyss CalamityUtils.RightClickBreak(i, j); return true; } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneAbyss ? 1f : -1f; // Abyss Torch gives positive luck when in the Abyss, otherwise some negative luck + } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs index ca69e359b3..ba3f5ee33a 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs @@ -40,12 +40,6 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs index 24495568cb..9a267fe469 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs @@ -2,6 +2,10 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAcidwood { @@ -10,9 +14,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void SetStaticDefaults() { this.SetUpSofa(); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -30,5 +32,16 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs index 5a70a71839..d70bbceedc 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodChairTile : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -41,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); TileID.Sets.CanBeSatOnForNPCs[Type] = true; TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.HasOutlines[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -61,58 +60,11 @@ namespace CalamityMod.Tiles.FurnitureAcidwood Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - info.DirectionOffset = 0; - info.VisualOffset = new Vector2(-8f, 0f); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, 40, true, true); - Tile tile = Framing.GetTileSafely(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.TargetDirection = + 1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } - - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs index 4c1949a85e..d8ffef1e95 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs @@ -46,5 +46,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index c39f27be28..3b6d6b6dfb 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -76,12 +76,7 @@ namespace CalamityMod.Tiles.FurnitureAncient return true; } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index b32c43f381..19be0f5651 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -39,55 +35,11 @@ namespace CalamityMod.Tiles.FurnitureAncient Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index e93e2d2535..4ff2a04a19 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -79,5 +79,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAncient/AncientSink.cs b/Tiles/FurnitureAncient/AncientSink.cs index b709d366b6..8f9c6106ac 100644 --- a/Tiles/FurnitureAncient/AncientSink.cs +++ b/Tiles/FurnitureAncient/AncientSink.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAncient { public override void SetStaticDefaults() { - this.SetUpSink(true); + this.SetUpSink(true, false, true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); } diff --git a/Tiles/FurnitureAncient/AncientSofa.cs b/Tiles/FurnitureAncient/AncientSofa.cs index 17c202d905..066cd21198 100644 --- a/Tiles/FurnitureAncient/AncientSofa.cs +++ b/Tiles/FurnitureAncient/AncientSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -30,5 +32,16 @@ namespace CalamityMod.Tiles.FurnitureAncient { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index e4eeaa1d92..036a65a297 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -37,17 +37,8 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index 4e527b5049..9322a031c5 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -39,55 +35,11 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index cef99afa49..32930c6588 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -60,6 +60,8 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { //This is used to draw the eye, where the frame is changed depending on the player's position relative to the eye's centre. diff --git a/Tiles/FurnitureAshen/AshenSink.cs b/Tiles/FurnitureAshen/AshenSink.cs index 9445cd2a97..4625eecc17 100644 --- a/Tiles/FurnitureAshen/AshenSink.cs +++ b/Tiles/FurnitureAshen/AshenSink.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { public override void SetStaticDefaults() { - this.SetUpSink(true); + this.SetUpSink(true, false, true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); } diff --git a/Tiles/FurnitureAshen/AshenSofa.cs b/Tiles/FurnitureAshen/AshenSofa.cs index 3fd1124080..8ffe4cfd8d 100644 --- a/Tiles/FurnitureAshen/AshenSofa.cs +++ b/Tiles/FurnitureAshen/AshenSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAshen { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -30,5 +32,16 @@ namespace CalamityMod.Tiles.FurnitureAshen { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index 751a0557c3..eda0b417a8 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -38,17 +38,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureBotanic/BotanicBench.cs b/Tiles/FurnitureBotanic/BotanicBench.cs index bbb719c3f2..764f026e1c 100644 --- a/Tiles/FurnitureBotanic/BotanicBench.cs +++ b/Tiles/FurnitureBotanic/BotanicBench.cs @@ -2,6 +2,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureBotanic { @@ -10,9 +14,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -31,5 +33,16 @@ namespace CalamityMod.Tiles.FurnitureBotanic { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index b245221321..791fc48a97 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -12,14 +12,10 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -40,55 +36,11 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index e9fae82c19..43db20d5b2 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -50,5 +50,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureBotanic/BotanicSink.cs b/Tiles/FurnitureBotanic/BotanicSink.cs index 397972b7c1..3f7b8b8cc8 100644 --- a/Tiles/FurnitureBotanic/BotanicSink.cs +++ b/Tiles/FurnitureBotanic/BotanicSink.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetStaticDefaults() { - this.SetUpSink(true); + this.SetUpSink(true, false, false, true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index 70d170905e..fad2dbc4a8 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -37,17 +37,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index 18d63459ce..df1a9f3ee1 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -26,11 +26,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return false; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - return TileFraming.BrimstoneFraming(i, j, resetFrame); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].TileFrameX; diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.png b/Tiles/FurnitureCosmilite/CosmiliteBrick.png index b2c51767b9..bcb0baf31a 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteBrick.png and b/Tiles/FurnitureCosmilite/CosmiliteBrick.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrickGlow.png b/Tiles/FurnitureCosmilite/CosmiliteBrickGlow.png index fcdac0945d..9aabaa0370 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteBrickGlow.png and b/Tiles/FurnitureCosmilite/CosmiliteBrickGlow.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index 5d2b94facc..dadd3f3bd1 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -39,55 +35,11 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index e129f4909c..a1185223d3 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -49,5 +49,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index 7f1d28c9b9..e95f4eeb8e 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureCosmilite { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -30,5 +32,16 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index d857e825db..cd1f2d0d20 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -36,17 +36,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.cs b/Tiles/FurnitureEutrophic/EutrophicBench.cs index 2cad2b91dc..03f1f0fc47 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBench.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureEutrophic { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override void SetStaticDefaults() { this.SetUpSofa(); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -29,5 +31,16 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureEutrophic/EutrophicChair.cs index 6487451a72..dd88ef6ff8 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public class EutrophicChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -38,55 +34,11 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureEutrophic/EutrophicClock.cs index 7504e24c39..d6c6af3bc6 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureEutrophic/EutrophicClock.cs @@ -64,5 +64,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index 467db41a76..c064364c17 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -42,13 +42,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureExo/ExoChairTile.cs b/Tiles/FurnitureExo/ExoChairTile.cs index ee63ce0cc3..9bceca5208 100644 --- a/Tiles/FurnitureExo/ExoChairTile.cs +++ b/Tiles/FurnitureExo/ExoChairTile.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoChairTile : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -42,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureExo AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Chair")); TileID.Sets.CanBeSatOnForNPCs[Type] = true; TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.HasOutlines[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -79,58 +78,11 @@ namespace CalamityMod.Tiles.FurnitureExo Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - info.DirectionOffset = 0; - info.VisualOffset = new Vector2(-8f, 0f); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, 40, true, true); - Tile tile = Framing.GetTileSafely(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } - - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureExo/ExoChestTile.cs b/Tiles/FurnitureExo/ExoChestTile.cs index ed2c623aa7..ad82e471af 100644 --- a/Tiles/FurnitureExo/ExoChestTile.cs +++ b/Tiles/FurnitureExo/ExoChestTile.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public override void SetStaticDefaults() { - this.SetUpChest(true); + this.SetUpChest(true, 2); ModTranslation name = CreateMapEntryName(); name.SetDefault("Exo Chest"); AddMapEntry(new Color(71, 95, 114), name, MapChestName); @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.FurnitureExo int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChestGlow").Value; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - Vector2 drawPosition = new Vector2(i * 16 - (int)Main.screenPosition.X / 2f, j * 16 - (int)Main.screenPosition.Y + yOffset) + drawOffset; + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + drawOffset; Color drawColour = Color.White; Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } diff --git a/Tiles/FurnitureExo/ExoClockTile.cs b/Tiles/FurnitureExo/ExoClockTile.cs index 823e49cede..6e5972a454 100644 --- a/Tiles/FurnitureExo/ExoClockTile.cs +++ b/Tiles/FurnitureExo/ExoClockTile.cs @@ -50,6 +50,8 @@ namespace CalamityMod.Tiles.FurnitureExo Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xFrameOffset = Main.tile[i, j].TileFrameX; diff --git a/Tiles/FurnitureExo/ExoSinkTile.cs b/Tiles/FurnitureExo/ExoSinkTile.cs index 0cf7245dee..84da9931af 100644 --- a/Tiles/FurnitureExo/ExoSinkTile.cs +++ b/Tiles/FurnitureExo/ExoSinkTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public override void SetStaticDefaults() { - this.SetUpSink(true); + this.SetUpSink(true, true, true, true); AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Sink")); AdjTiles = new int[] { TileID.Sinks }; } diff --git a/Tiles/FurnitureExo/ExoSofaTile.cs b/Tiles/FurnitureExo/ExoSofaTile.cs index 0afa521297..3b61d8bf6c 100644 --- a/Tiles/FurnitureExo/ExoSofaTile.cs +++ b/Tiles/FurnitureExo/ExoSofaTile.cs @@ -3,6 +3,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureExo { @@ -11,9 +15,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(71, 95, 114), name); + AddMapEntry(new Color(71, 95, 114), Language.GetText("Bench")); } public override bool CanExplode(int i, int j) => false; @@ -34,6 +36,17 @@ namespace CalamityMod.Tiles.FurnitureExo Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xFrameOffset = Main.tile[i, j].TileFrameX; diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index 802eafbfdc..2c3a4b68e7 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoToiletTile : ModTile { - public const int NextStyleHeight = 40; + public const int NextStyleHeight = 40; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureExo AddMapEntry(new Color(71, 95, 114), name); TileID.Sets.CanBeSatOnForNPCs[Type] = true; TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.HasOutlines[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -81,54 +81,11 @@ namespace CalamityMod.Tiles.FurnitureExo spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, NextStyleHeight, true); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMonolith/MonolithBed.cs b/Tiles/FurnitureMonolith/MonolithBed.cs index def60a15ef..5cbe4675b2 100644 --- a/Tiles/FurnitureMonolith/MonolithBed.cs +++ b/Tiles/FurnitureMonolith/MonolithBed.cs @@ -62,17 +62,8 @@ namespace CalamityMod.Tiles.FurnitureMonolith Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureMonolith/MonolithBench.cs b/Tiles/FurnitureMonolith/MonolithBench.cs index 5265426f26..0f913ba24d 100644 --- a/Tiles/FurnitureMonolith/MonolithBench.cs +++ b/Tiles/FurnitureMonolith/MonolithBench.cs @@ -3,6 +3,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureMonolith { @@ -11,9 +15,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -55,5 +57,16 @@ namespace CalamityMod.Tiles.FurnitureMonolith { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureMonolith/MonolithChair.cs b/Tiles/FurnitureMonolith/MonolithChair.cs index 301e13c547..4bf907852b 100644 --- a/Tiles/FurnitureMonolith/MonolithChair.cs +++ b/Tiles/FurnitureMonolith/MonolithChair.cs @@ -13,14 +13,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith { public class MonolithChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -63,55 +59,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMonolith/MonolithClock.cs b/Tiles/FurnitureMonolith/MonolithClock.cs index 9054628e6d..77d2d292d6 100644 --- a/Tiles/FurnitureMonolith/MonolithClock.cs +++ b/Tiles/FurnitureMonolith/MonolithClock.cs @@ -74,5 +74,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs b/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs index f059ff6074..73b23ca817 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs @@ -39,17 +39,8 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs index 2d59ac791a..dbd2a8b6fc 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs @@ -13,14 +13,10 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly [LegacyName("OccultChair")] public class OtherworldlyChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -41,55 +37,11 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs b/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs index c90e810974..52f031ff6d 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs @@ -51,5 +51,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs b/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs index 11c124f3a1..22e085dbb1 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs @@ -2,6 +2,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly { @@ -11,9 +15,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -32,5 +34,16 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs index dd5f32d86d..e07885b4bf 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs @@ -2,8 +2,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureOtherworldly { @@ -36,17 +37,16 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly return false; } - /* - * TODO -- Find some way to make this work again with the new parameters. - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { - if ((Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || - Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) && - nextSpecialDrawIndex < Main.specX.Length) + if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || + Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) { - Main.specX[nextSpecialDrawIndex] = i; - Main.specY[nextSpecialDrawIndex] = j; - nextSpecialDrawIndex++; + try + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + catch {} } } @@ -55,13 +55,12 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j); - Texture2D cloth = ModContent.Request("CalamityMod/Tiles/FurnitureOtherworldly/OtherworldlyStone_Cloth"); + Texture2D cloth = ModContent.Request("CalamityMod/Tiles/FurnitureOtherworldly/OtherworldlyStone_Cloth").Value; DrawExtraTop(i, j, cloth, drawOffset, drawColour); DrawExtraWallEnds(i, j, cloth, drawOffset, drawColour); DrawExtraDrapes(i, j, cloth, drawOffset, drawColour); } - */ #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index aee73b111d..a6b52e25f3 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -67,12 +67,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return true; } - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index 542ecafa61..03deec95fe 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlateChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -38,55 +34,11 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index a59e425a38..81fbb25b45 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -48,5 +48,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs index df84b6d786..e4429b34fc 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurniturePlaguedPlate { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -29,5 +31,16 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index fb9e7c3f6c..5574cc4a55 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -38,17 +38,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index 537510eb08..8e048511a5 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -2,6 +2,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureProfaned { @@ -10,9 +14,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -31,5 +33,16 @@ namespace CalamityMod.Tiles.FurnitureProfaned { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index 58402ff41e..c224da9500 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -12,14 +12,10 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -40,55 +36,11 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index f4982c16fd..5fd839688d 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -50,5 +50,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureProfaned/ProfanedSink.cs b/Tiles/FurnitureProfaned/ProfanedSink.cs index 99eedebcf5..f25f06992a 100644 --- a/Tiles/FurnitureProfaned/ProfanedSink.cs +++ b/Tiles/FurnitureProfaned/ProfanedSink.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetStaticDefaults() { - this.SetUpSink(true); + this.SetUpSink(true, false, true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Sink")); } diff --git a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs new file mode 100644 index 0000000000..dd845815b6 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class EyeOfTheAccursedBannerTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = -2; + TileObjectData.addTile(Type); + + DustType = -1; + TileID.Sets.DisableSmartCursor[Type] = true; + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Banner")); + } + + 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()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.png b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.png new file mode 100644 index 0000000000..78c35ff08a Binary files /dev/null and b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.png differ diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs new file mode 100644 index 0000000000..3f31abe58d --- /dev/null +++ b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs @@ -0,0 +1,86 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class LargeRitualCandleTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 6; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.Origin = new Point16(0, 4); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(43, 19, 42), Language.GetText("Large Ritual Candle")); + + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Lamps }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 54) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 4, 6); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png new file mode 100644 index 0000000000..c308ab6c18 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.png differ diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png b/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png new file mode 100644 index 0000000000..a2af2ce410 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/LargeRitualCandleTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs new file mode 100644 index 0000000000..927638cdad --- /dev/null +++ b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs @@ -0,0 +1,167 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class MonolithOfTheAccursedTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + TileID.Sets.HasOutlines[Type] = true; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Monolith of the Accursed"); + AddMapEntry(new Color(43, 19, 42), name); + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX > 36) + { + r = 1.2f; + g = 0.2f; + b = 0.2f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + private void ToggleMode(int i, int j) + { + int tileX = 2; + int tileY = 3; + + int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; + int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; + for (int l = x; l < x + tileX; l++) + { + for (int m = y; m < y + tileY; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == Type) + { + if (Main.tile[l, m].TileFrameX < (36 * tileX)) + { + Main.tile[l, m].TileFrameX += (short)(18 * tileX); + } + else + { + Main.tile[l, m].TileFrameX -= (short)(36 * tileX); + } + } + } + } + if (Wiring.running) + { + for (int k = 0; k < tileX; k++) + { + for (int l = 0; l < tileY; l++) + { + Wiring.SkipWire(x + k, y + l); + } + } + } + } + + public override bool RightClick(int i, int j) + { + ToggleMode(i, j); + SoundEngine.PlaySound(SoundID.MenuTick); + return true; + } + + public override void HitWire(int i, int j) => ToggleMode(i, j); + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].TileFrameX < 36) + return; + + Player player = Main.LocalPlayer; + if (player is null) + return; + if (player.active) + { + int resetAmt = Main.tile[i, j].TileFrameX < 72 ? 20 : 40; + player.Calamity().monolithAccursedShader = resetAmt; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); + } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + + // For drawing the floating icon + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].TileFrameX < 36) + return; + + Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight").Value; + Tile tile = Main.tile[i, j]; + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + float xOffset = Main.tile[i, j].TileFrameX > 70 ? 52f : 16f; + Vector2 correction = new Vector2(xOffset , -10f); + float yOffset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi / 5f) * 2f; + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + zero + correction; + + Rectangle rect = new Rectangle(xPos, yPos, texture.Width, texture.Height); + Color color = new Color(100, 100, 100, 0); + Vector2 origin = rect.Size() / 2f; + + for (int c = 0; c < 5; c++) + { + spriteBatch.Draw(texture, drawOffset, rect, color, 0f, origin, 1f, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.png b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.png new file mode 100644 index 0000000000..819f66a0ee Binary files /dev/null and b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.png differ diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_Highlight.png b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_Highlight.png new file mode 100644 index 0000000000..d9cd089629 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight.png b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight.png new file mode 100644 index 0000000000..6d6471f1d9 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight.png differ diff --git a/Tiles/ChaoticBrick.cs b/Tiles/FurnitureSacrilegious/OccultBrickTile.cs similarity index 53% rename from Tiles/ChaoticBrick.cs rename to Tiles/FurnitureSacrilegious/OccultBrickTile.cs index 09d03c1638..c3bb487acd 100644 --- a/Tiles/ChaoticBrick.cs +++ b/Tiles/FurnitureSacrilegious/OccultBrickTile.cs @@ -1,20 +1,21 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.FurnitureSacrilegious { - public class ChaoticBrick : ModTile + public class OccultBrickTile : ModTile { public override void SetStaticDefaults() { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - DustType = 105; - ItemDrop = ModContent.ItemType(); - AddMapEntry(new Color(255, 0, 0)); + DustType = 8; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(63, 69, 71)); HitSound = SoundID.Tink; } @@ -22,12 +23,5 @@ namespace CalamityMod.Tiles { num = fail ? 1 : 3; } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.04f; - g = 0.00f; - b = 0.00f; - } } } diff --git a/Tiles/FurnitureSacrilegious/OccultBrickTile.png b/Tiles/FurnitureSacrilegious/OccultBrickTile.png new file mode 100644 index 0000000000..4038ab1a68 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/OccultBrickTile.png differ diff --git a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs new file mode 100644 index 0000000000..76ccb2288b --- /dev/null +++ b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class OccultLegionnaireBannerTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = -2; + TileObjectData.addTile(Type); + + DustType = -1; + TileID.Sets.DisableSmartCursor[Type] = true; + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Banner")); + } + + 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()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.png b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.png new file mode 100644 index 0000000000..591b5fe233 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.png differ diff --git a/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs b/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs new file mode 100644 index 0000000000..9812ffea07 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/OccultPlatformTile.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class OccultPlatformTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpPlatform(true); + AddMapEntry(new Color(85, 98, 99)); + ItemDrop = ModContent.ItemType(); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Platforms }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureSacrilegious/OccultPlatformTile.png b/Tiles/FurnitureSacrilegious/OccultPlatformTile.png new file mode 100644 index 0000000000..3d7b0ffc17 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/OccultPlatformTile.png differ diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs new file mode 100644 index 0000000000..2c6c0c5ee4 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs @@ -0,0 +1,83 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class RitualCandleTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16 + }; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(43, 19, 42), Language.GetText("Ritual Candle")); + + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Candles }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 54) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 4, 2); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/RitualCandleTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTile.png b/Tiles/FurnitureSacrilegious/RitualCandleTile.png new file mode 100644 index 0000000000..79a1010eeb Binary files /dev/null and b/Tiles/FurnitureSacrilegious/RitualCandleTile.png differ diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png b/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png new file mode 100644 index 0000000000..2136a81be0 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/RitualCandleTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs new file mode 100644 index 0000000000..f0eb7e9324 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousBathtubTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpBathtub(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Bathtub"); + AddMapEntry(new Color(43, 19, 42), name); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.png new file mode 100644 index 0000000000..b68ea5c586 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousBathtubTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs new file mode 100644 index 0000000000..afe6aaba99 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousBedTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpBed(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Bed"); + AddMapEntry(new Color(43, 19, 42), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Beds }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); + } + + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.png new file mode 100644 index 0000000000..151d90beeb Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile_Highlight.png new file mode 100644 index 0000000000..5db6792cae Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs new file mode 100644 index 0000000000..8a18eacc80 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs @@ -0,0 +1,47 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousBenchTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpSofa(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("Bench")); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.png new file mode 100644 index 0000000000..a76bcc4862 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile_Highlight.png new file mode 100644 index 0000000000..ce9a22ed6c Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs new file mode 100644 index 0000000000..ec4a805eaf --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousBookcaseTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpBookcase(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Bookcase"); + AddMapEntry(new Color(43, 19, 42), name); + AnimationFrameHeight = 54; + AdjTiles = new int[] { TileID.Bookcases }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.png new file mode 100644 index 0000000000..c0ce0cca32 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousBookcaseTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs new file mode 100644 index 0000000000..31aae3a65c --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs @@ -0,0 +1,65 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousCandelabraTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpCandelabra(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Candelabra"); + AddMapEntry(new Color(43, 19, 42), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Candelabras }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + 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 HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.png new file mode 100644 index 0000000000..f4db27c005 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTileFlame.png b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTileFlame.png new file mode 100644 index 0000000000..db4ebe3a0d Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs new file mode 100644 index 0000000000..beff17db54 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs @@ -0,0 +1,75 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousCandleTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpCandle(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Candle"); + AddMapEntry(new Color(43, 19, 42), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Candles }; + ItemDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousCandleTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.png new file mode 100644 index 0000000000..99e7f4a8eb Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTileFlame.png b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTileFlame.png new file mode 100644 index 0000000000..438655e52d Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs new file mode 100644 index 0000000000..63b1dd860a --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs @@ -0,0 +1,49 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousChairTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpChair(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Chair")); + AdjTiles = new int[] { TileID.Chairs }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.png new file mode 100644 index 0000000000..ee259ac301 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile_Highlight.png new file mode 100644 index 0000000000..75e9322bc7 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs new file mode 100644 index 0000000000..0461e20c8e --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs @@ -0,0 +1,64 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousChandelierTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpChandelier(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Chandelier")); + AdjTiles = new int[] { TileID.Chandeliers }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png new file mode 100644 index 0000000000..e6de2c0e0f Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTileFlame.png b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTileFlame.png new file mode 100644 index 0000000000..011ab51438 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs new file mode 100644 index 0000000000..06ea2bd2dd --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs @@ -0,0 +1,142 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousChestTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpChest(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sacrilegious Chest"); + AddMapEntry(new Color(43, 19, 42), name, MapChestName); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Containers }; + ContainerName.SetDefault("Sacrilegious Chest"); + ChestDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ChestDrop); + Chest.DestroyChest(i, j); + } + + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver("Sacrilegious Chest", i, j); + + public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar("Sacrilegious Chest", i, j); + + // Make the chest brighter the more stuff it has + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int seed = 1; + int itemAmt = 0; + int index = FindChestIndex(i, j, ref seed); + if (index >= 0) + itemAmt = CountItems(Main.chest[index]); + + Tile tile = Main.tile[i, j]; + Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousChestTileGlow").Value; + + int x = i; + int y = j; + switch (seed) + { + case 2: + y = j - 1; + break; + case 3: + x = i - 1; + break; + case 4: + x = i - 1; + y = j - 1; + break; + } + ulong seeding = Main.TileFrameSeed ^ (ulong)((long)y << 32 | (long)(uint)x); + + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + drawOffset; + + int alpha = 255 - (int)(MathHelper.Lerp(0, 7, itemAmt / 40f) * 15); + Color color = new Color(120, 100, 100, alpha); + + int loopAmt = itemAmt > 0 ? (itemAmt - 1) / 10 + 4 : 4; + float shakeAmt = MathHelper.Lerp(0f, 0.3f, itemAmt / 40f); + if (itemAmt == 0) + loopAmt = 0; + + for (int c = 0; c < loopAmt; c++) + { + float shakeX = Utils.RandomInt(ref seeding, -5, 5) * shakeAmt; + float shakeY = Utils.RandomInt(ref seeding, -5, 5) * shakeAmt; + Vector2 shake = new Vector2(shakeX, shakeY); + spriteBatch.Draw(texture, drawPosition + shake, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), color, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + + private int FindChestIndex(int i, int j, ref int seed) + { + int index = Chest.FindChest(i, j); + if (index < 0 && Main.tile[i, j - 1].TileType == ModContent.TileType()) + { + index = Chest.FindChest(i, j - 1); + seed = 2; + } + if (index < 0 && Main.tile[i - 1, j].TileType == ModContent.TileType()) + { + index = Chest.FindChest(i - 1, j); + seed = 3; + } + if (index < 0 && Main.tile[i - 1, j - 1].TileType == ModContent.TileType()) + { + index = Chest.FindChest(i - 1, j - 1); + seed = 4; + } + return index; + } + + private int CountItems(Chest chest) + { + if (chest is null) + return -1; + int amt = 0; + for (int i = 0; i < Chest.maxItems; i++) + { + if (chest.item[i] is null || chest.item[i].IsAir) + continue; + if (chest.item[i].stack > 0) + amt++; + } + return amt; + } + + byte Average(byte a, byte b) => (byte)((a + b) / 2); + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.png new file mode 100644 index 0000000000..75819eef0a Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTileGlow.png b/Tiles/FurnitureSacrilegious/SacrilegiousChestTileGlow.png new file mode 100644 index 0000000000..ca0b29c687 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChestTileGlow.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile_Highlight.png new file mode 100644 index 0000000000..8d35eb3fc0 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs new file mode 100644 index 0000000000..f05b6000f6 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs @@ -0,0 +1,89 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousClockTile : ModTile + { + public override void SetStaticDefaults() + { + // This particular clock emits light + Main.tileLighted[Type] = true; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + + this.SetUpClock(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Grandfather Clock"); + AddMapEntry(new Color(43, 19, 42), name); + AdjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 1.2f; + g = 0.2f; + b = 0.2f; + } + + public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.SceneMetrics.HasClock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); + } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + + // For drawing the floating clock icon + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Icon").Value; + Tile tile = Main.tile[i, j]; + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + float yOffset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi / 5f) * 2f; + Vector2 correction = new Vector2(16f , -10f); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + zero + correction; + + Rectangle rect = new Rectangle(xPos, yPos, texture.Width, texture.Height); + Color color = new Color(100, 100, 100, 0); + Vector2 origin = rect.Size() / 2f; + + for (int c = 0; c < 5; c++) + { + spriteBatch.Draw(texture, drawOffset, rect, color, 0f, origin, 1f, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.png new file mode 100644 index 0000000000..c93b433bb5 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Highlight.png new file mode 100644 index 0000000000..c2c3327463 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Icon.png b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Icon.png new file mode 100644 index 0000000000..9ecc8b875a Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Icon.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs new file mode 100644 index 0000000000..93ba36bb19 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.cs @@ -0,0 +1,49 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousDoorClosed : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorClosed(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Door")); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.ClosedDoor }; + OpenDoorID = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 48, ModContent.ItemType()); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.png b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.png new file mode 100644 index 0000000000..654eb795a6 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed_Highlight.png new file mode 100644 index 0000000000..ec755e7d84 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs new file mode 100644 index 0000000000..f46fba7130 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.cs @@ -0,0 +1,49 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousDoorOpen : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorOpen(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Door")); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.OpenDoor }; + CloseDoorID = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.png b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.png new file mode 100644 index 0000000000..9062c72eba Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen_Highlight.png new file mode 100644 index 0000000000..be4f5e487d Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs new file mode 100644 index 0000000000..745f60cc53 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousDresserTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDresser(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sacrilegious Dresser"); + AddMapEntry(new Color(43, 19, 42), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Dressers }; + ContainerName.SetDefault("Sacrilegious Dresser"); + DresserDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + + public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(ContainerName.GetDefault()); + + public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(ContainerName.GetDefault()); + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, DresserDrop); + Chest.DestroyChest(i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.png new file mode 100644 index 0000000000..14960e9c94 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile_Highlight.png b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile_Highlight.png new file mode 100644 index 0000000000..04c961ac2e Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile_Highlight.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs new file mode 100644 index 0000000000..23ec23c32c --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs @@ -0,0 +1,66 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousLampTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpLamp(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.FloorLamp")); + + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Lamps }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 3); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousLampTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.png new file mode 100644 index 0000000000..8b5026f797 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLampTileFlame.png b/Tiles/FurnitureSacrilegious/SacrilegiousLampTileFlame.png new file mode 100644 index 0000000000..541962150f Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousLampTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs new file mode 100644 index 0000000000..670f63ac24 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs @@ -0,0 +1,66 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousLanternTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpLantern(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Lantern")); + + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.HangingLanterns }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 3f; + g = 0.6f; + b = 0.6f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 2); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousLanternTileFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.png new file mode 100644 index 0000000000..452adc7ba9 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTileFlame.png b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTileFlame.png new file mode 100644 index 0000000000..07a92d066e Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTileFlame.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs new file mode 100644 index 0000000000..54fed773ba --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.cs @@ -0,0 +1,43 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousOrganTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This piano has bookcase dimensions + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Piano"); + AddMapEntry(new Color(43, 19, 42), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.png new file mode 100644 index 0000000000..f73bf03b47 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousOrganTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs new file mode 100644 index 0000000000..11f0066b67 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousSinkTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpSink(true, true, true, true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Sink")); + AdjTiles = new int[] { TileID.Sinks }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.png new file mode 100644 index 0000000000..20c78423fb Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousSinkTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs new file mode 100644 index 0000000000..bde5bec3bf --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousTableTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTable(true); + AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Table")); + AdjTiles = new int[] { TileID.Tables }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.png new file mode 100644 index 0000000000..c692ef71b7 Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousTableTile.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs new file mode 100644 index 0000000000..389f316257 --- /dev/null +++ b/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureSacrilegious; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureSacrilegious +{ + public class SacrilegiousWorkBenchTile : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpWorkBench(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Work Bench"); + AddMapEntry(new Color(43, 19, 42), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.WorkBenches }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 8, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 16, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.png new file mode 100644 index 0000000000..63317869ba Binary files /dev/null and b/Tiles/FurnitureSacrilegious/SacrilegiousWorkBenchTile.png differ diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index fee7a8b199..41d4f99f46 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -38,17 +38,8 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index bae9210434..353e3ca104 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -2,6 +2,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureSilva { @@ -10,9 +14,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -31,5 +33,16 @@ namespace CalamityMod.Tiles.FurnitureSilva { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index 15d4ed3e65..12d871e70e 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -12,14 +12,10 @@ namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -40,55 +36,11 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index 107891e975..4540d2e446 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -50,5 +50,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index d786759cc1..8fa445c1f7 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -36,17 +36,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index a83861181a..1960f6712f 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -38,55 +34,11 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index a9dfc73347..f0d184e781 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -48,5 +48,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStatigel/StatigelSofa.cs b/Tiles/FurnitureStatigel/StatigelSofa.cs index 95f1b633f6..47a7651ead 100644 --- a/Tiles/FurnitureStatigel/StatigelSofa.cs +++ b/Tiles/FurnitureStatigel/StatigelSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStatigel { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void SetStaticDefaults() { this.SetUpSofa(); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -29,5 +31,16 @@ namespace CalamityMod.Tiles.FurnitureStatigel { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index 74a3044499..58a3a0ee4d 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -37,17 +37,8 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 261f91aacc..b3bf07c257 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -39,55 +35,11 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 808455dd45..9a5bc0db6e 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -49,5 +49,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStratus/StratusSofa.cs b/Tiles/FurnitureStratus/StratusSofa.cs index d49b69082c..b73764ffb3 100644 --- a/Tiles/FurnitureStratus/StratusSofa.cs +++ b/Tiles/FurnitureStratus/StratusSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureStratus { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -30,5 +32,16 @@ namespace CalamityMod.Tiles.FurnitureStratus { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index 06acc713cf..5cf6656fb7 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -36,17 +36,8 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); } - public override bool RightClick(int i, int j) - { - return CalamityUtils.BedRightClick(i, j); - } + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - } + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index 70f1d01350..f249de7294 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -11,14 +11,10 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class VoidChair : ModTile { - public const int NextStyleHeight = 40; public override void SetStaticDefaults() { this.SetUpChair(true); AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Chair")); - TileID.Sets.CanBeSatOnForNPCs[Type] = true; - TileID.Sets.CanBeSatOnForPlayers[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -38,55 +34,11 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) - { - Tile tile = Framing.GetTileSafely(i, j); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); - info.TargetDirection = -1; - if (tile.TileFrameX != 0) - { - info.TargetDirection = 1; - } + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % NextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public override bool RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); - } - return true; - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); - - if (Main.tile[i, j].TileFrameX / 18 < 1) - { - player.cursorItemIconReversed = true; - } - } + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index de424aee3e..4991c370de 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -59,5 +59,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index a5d395a393..a1a206c145 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -1,6 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureVoid { @@ -9,9 +13,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void SetStaticDefaults() { this.SetUpSofa(true); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Bench"); - AddMapEntry(new Color(191, 142, 111), name); + AddMapEntry(new Color(191, 142, 111), Language.GetText("Bench")); } public override bool CreateDust(int i, int j, ref int type) @@ -29,5 +31,16 @@ namespace CalamityMod.Tiles.FurnitureVoid { Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } } } diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index 52a4d08ac2..b35e5024cd 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -15,6 +15,9 @@ namespace CalamityMod.Tiles.Ores Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + CalamityUtils.MergeWithGeneral(Type); ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 78b2eb5e33..3237365afd 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -21,6 +21,9 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeAstralTiles(Type); + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + MinPick = 210; DustType = 173; ItemDrop = ModContent.ItemType(); diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index e11e894063..31de72297d 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; @@ -7,6 +8,7 @@ namespace CalamityMod.Tiles.Ores { public class AuricOre : ModTile { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -18,6 +20,9 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + DustType = 55; ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); @@ -25,7 +30,7 @@ namespace CalamityMod.Tiles.Ores AddMapEntry(new Color(255, 200, 0), name); MineResist = 10f; MinPick = 250; - HitSound = SoundID.Tink; + HitSound = MineSound; } public override bool CanExplode(int i, int j) diff --git a/Tiles/Ores/ChaoticOre.cs b/Tiles/Ores/ChaoticOre.cs index 774a192afd..a78a100c17 100644 --- a/Tiles/Ores/ChaoticOre.cs +++ b/Tiles/Ores/ChaoticOre.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); + TileID.Sets.Ore[Type] = true; + DustType = 105; ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/Ores/CharredOre.cs b/Tiles/Ores/CharredOre.cs index 7fac5544ed..532653c361 100644 --- a/Tiles/Ores/CharredOre.cs +++ b/Tiles/Ores/CharredOre.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithHell(Type); + TileID.Sets.Ore[Type] = true; + ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Charred Ore"); diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index 3029781827..456e23b51e 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSnow(Type); + TileID.Sets.Ore[Type] = true; + ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cryonic"); diff --git a/Tiles/Ores/ExodiumOre.cs b/Tiles/Ores/ExodiumOre.cs index 8a6a892d06..6238cb575f 100644 --- a/Tiles/Ores/ExodiumOre.cs +++ b/Tiles/Ores/ExodiumOre.cs @@ -17,6 +17,9 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithSet(Type, TileID.LunarOre); + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + ModTranslation name = CreateMapEntryName(); name.SetDefault("Exodium"); AddMapEntry(new Color(51, 48, 68), name); diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 1f78592ca8..889a46d151 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -15,6 +15,9 @@ namespace CalamityMod.Tiles.Ores Main.tileBlockLight[Type] = true; Main.tileOreFinderPriority[Type] = 690; + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + CalamityUtils.MergeWithGeneral(Type); ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index eea95a35de..20c7dec5ee 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -18,6 +18,9 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Perennial Ore"); diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index c4b99b9a00..a71244560b 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -16,6 +16,9 @@ namespace CalamityMod.Tiles.Ores CalamityUtils.MergeWithGeneral(Type); + TileID.Sets.Ore[Type] = true; + TileID.Sets.OreMergesWithMud[Type] = true; + ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Uelibloom"); diff --git a/Tiles/Pylons/AstralPylonTile.cs b/Tiles/Pylons/AstralPylonTile.cs new file mode 100644 index 0000000000..bc4a3cec11 --- /dev/null +++ b/Tiles/Pylons/AstralPylonTile.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.Pylons; +using CalamityMod.Systems; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Pylons +{ + public class AstralPylonTile : BasePylonTile + { + public override Color LightColor => new Color(0.8f, 0.5f, 0.8f); + public override string PylonMapText => "Mods.CalamityMod.ItemName.AstralPylon"; + public override int AssociatedItem => ModContent.ItemType(); + public override Color PylonMapColor => Color.Coral; + public override Color DustColor => Main.rand.NextBool() ? Color.Coral : Color.MediumTurquoise; + + + public override int? IsPylonForSale(int npcType, Player player, bool isNPCHappyEnough) + { + return isNPCHappyEnough && player.Calamity().ZoneAstral ? AssociatedItem : null; + } + + + public override bool ValidTeleportCheck_BiomeRequirements(TeleportPylonInfo pylonInfo, SceneMetrics sceneData) => BiomeTileCounterSystem.AstralTiles >= 100; + } +} diff --git a/Tiles/Pylons/AstralPylonTile.png b/Tiles/Pylons/AstralPylonTile.png new file mode 100644 index 0000000000..bd721bbafe Binary files /dev/null and b/Tiles/Pylons/AstralPylonTile.png differ diff --git a/Tiles/Pylons/AstralPylonTile_Crystal.png b/Tiles/Pylons/AstralPylonTile_Crystal.png new file mode 100644 index 0000000000..8aef21429f Binary files /dev/null and b/Tiles/Pylons/AstralPylonTile_Crystal.png differ diff --git a/Tiles/Pylons/AstralPylonTile_MapIcon.png b/Tiles/Pylons/AstralPylonTile_MapIcon.png new file mode 100644 index 0000000000..3af3c6e5a3 Binary files /dev/null and b/Tiles/Pylons/AstralPylonTile_MapIcon.png differ diff --git a/Tiles/Pylons/CragsPylonTile.cs b/Tiles/Pylons/CragsPylonTile.cs new file mode 100644 index 0000000000..8b5bc7c9b6 --- /dev/null +++ b/Tiles/Pylons/CragsPylonTile.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.Placeables.Pylons; +using CalamityMod.Systems; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Pylons +{ + + public class CragsPylonTile : BasePylonTile + { + public override Color LightColor => new Color(1f, 0.3f, 0f); + public override string PylonMapText => "Mods.CalamityMod.ItemName.CragsPylon"; + public override int AssociatedItem => ModContent.ItemType(); + public override Color PylonMapColor => Color.OrangeRed; + public override Color DustColor => Color.OrangeRed; + + public override int? IsPylonForSale(int npcType, Player player, bool isNPCHappyEnough) + { + //Purchaseable regardless of happiness, therefore, these NPCs need to be checked + if (npcType == NPCID.TravellingMerchant || npcType == NPCID.SkeletonMerchant) + return null; + return player.Calamity().ZoneCalamity ? AssociatedItem : null; + } + + //Doesnt require npcs to function + public override bool ValidTeleportCheck_NPCCount(TeleportPylonInfo pylonInfo, int defaultNecessaryNPCCount) => true; + + public override bool ValidTeleportCheck_BiomeRequirements(TeleportPylonInfo pylonInfo, SceneMetrics sceneData) => BiomeTileCounterSystem.BrimstoneCragTiles >= 100; + } +} diff --git a/Tiles/Pylons/CragsPylonTile.png b/Tiles/Pylons/CragsPylonTile.png new file mode 100644 index 0000000000..6610778b47 Binary files /dev/null and b/Tiles/Pylons/CragsPylonTile.png differ diff --git a/Tiles/Pylons/CragsPylonTile_Crystal.png b/Tiles/Pylons/CragsPylonTile_Crystal.png new file mode 100644 index 0000000000..72e98f3592 Binary files /dev/null and b/Tiles/Pylons/CragsPylonTile_Crystal.png differ diff --git a/Tiles/Pylons/CragsPylonTile_MapIcon.png b/Tiles/Pylons/CragsPylonTile_MapIcon.png new file mode 100644 index 0000000000..aecd15e974 Binary files /dev/null and b/Tiles/Pylons/CragsPylonTile_MapIcon.png differ diff --git a/Tiles/Pylons/SulphurPylonTile.cs b/Tiles/Pylons/SulphurPylonTile.cs new file mode 100644 index 0000000000..b11bb080ff --- /dev/null +++ b/Tiles/Pylons/SulphurPylonTile.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.Pylons; +using CalamityMod.Systems; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Pylons +{ + + public class SulphurPylonTile : BasePylonTile + { + public override int AssociatedItem => ModContent.ItemType(); + public override string PylonMapText => "Mods.CalamityMod.ItemName.SulphurPylon"; + public override Color PylonMapColor => Color.YellowGreen; + public override Color DustColor => Color.GreenYellow; + public override Color LightColor => new Color(1f, 0.8f, 0f); + + public override int? IsPylonForSale(int npcType, Player player, bool isNPCHappyEnough) + { + return isNPCHappyEnough && player.Calamity().ZoneSulphur ? AssociatedItem : null; + } + + public override bool ValidTeleportCheck_BiomeRequirements(TeleportPylonInfo pylonInfo, SceneMetrics sceneData) => BiomeTileCounterSystem.SulphurTiles >= 100; + } +} diff --git a/Tiles/Pylons/SulphurPylonTile.png b/Tiles/Pylons/SulphurPylonTile.png new file mode 100644 index 0000000000..6258714b74 Binary files /dev/null and b/Tiles/Pylons/SulphurPylonTile.png differ diff --git a/Tiles/Pylons/SulphurPylonTile_Crystal.png b/Tiles/Pylons/SulphurPylonTile_Crystal.png new file mode 100644 index 0000000000..132fbdd4a9 Binary files /dev/null and b/Tiles/Pylons/SulphurPylonTile_Crystal.png differ diff --git a/Tiles/Pylons/SulphurPylonTile_MapIcon.png b/Tiles/Pylons/SulphurPylonTile_MapIcon.png new file mode 100644 index 0000000000..064793a73c Binary files /dev/null and b/Tiles/Pylons/SulphurPylonTile_MapIcon.png differ diff --git a/Tiles/Pylons/SunkenPylonTile.cs b/Tiles/Pylons/SunkenPylonTile.cs new file mode 100644 index 0000000000..7e7008f500 --- /dev/null +++ b/Tiles/Pylons/SunkenPylonTile.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.Pylons; +using CalamityMod.Systems; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Pylons +{ + + public class SunkenPylonTile : BasePylonTile + { + public override Color LightColor => new Color(0.2f, 0.8f, 1f); + public override string PylonMapText => "Mods.CalamityMod.ItemName.SunkenPylon"; + public override int AssociatedItem => ModContent.ItemType(); + public override Color PylonMapColor => Color.Turquoise; + public override Color DustColor => Color.Cyan; + + public override int? IsPylonForSale(int npcType, Player player, bool isNPCHappyEnough) + { + return isNPCHappyEnough && player.Calamity().ZoneSunkenSea ? AssociatedItem : null; + } + + public override bool ValidTeleportCheck_BiomeRequirements(TeleportPylonInfo pylonInfo, SceneMetrics sceneData) => BiomeTileCounterSystem.SunkenSeaTiles >= 100; + } +} diff --git a/Tiles/Pylons/SunkenPylonTile.png b/Tiles/Pylons/SunkenPylonTile.png new file mode 100644 index 0000000000..c655af00f3 Binary files /dev/null and b/Tiles/Pylons/SunkenPylonTile.png differ diff --git a/Tiles/Pylons/SunkenPylonTile_Crystal.png b/Tiles/Pylons/SunkenPylonTile_Crystal.png new file mode 100644 index 0000000000..684cc9ed5d Binary files /dev/null and b/Tiles/Pylons/SunkenPylonTile_Crystal.png differ diff --git a/Tiles/Pylons/SunkenPylonTile_MapIcon.png b/Tiles/Pylons/SunkenPylonTile_MapIcon.png new file mode 100644 index 0000000000..86c0da568a Binary files /dev/null and b/Tiles/Pylons/SunkenPylonTile_MapIcon.png differ diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs new file mode 100644 index 0000000000..0e0933ed20 --- /dev/null +++ b/Tiles/ScoriaBrick.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent.Metadata; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles +{ + [LegacyName("ChaoticBrick")] + public class ScoriaBrick : ModTile + { + int subsheetHeight = 72; + int subsheetWidth = 216; + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/ScoriaBrickGlow", AssetRequestMode.ImmediateLoad).Value; + } + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + DustType = 105; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(255, 0, 0)); + HitSound = SoundID.Tink; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.04f; + g = 0.00f; + b = 0.00f; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int frameOffset = (i + j) % 2; + frameYOffset = frameOffset * AnimationFrameHeight; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CompactFraming(i, j, resetFrame); + return false; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null) + return; + + Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + int xPos = tile.TileFrameX; + int frameOffset = (i + j) % 2 * AnimationFrameHeight; + int yPos = tile.TileFrameY + frameOffset; + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; + + if (!tile.IsHalfBlock && tile.Slope == 0) + { + spriteBatch.Draw(GlowTexture, drawPosition, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + else if (tile.IsHalfBlock) + { + spriteBatch.Draw(GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Tiles/ScoriaBrick.png b/Tiles/ScoriaBrick.png new file mode 100644 index 0000000000..b3f6557161 Binary files /dev/null and b/Tiles/ScoriaBrick.png differ diff --git a/Tiles/ScoriaBrickGlow.png b/Tiles/ScoriaBrickGlow.png new file mode 100644 index 0000000000..4747dd9cb3 Binary files /dev/null and b/Tiles/ScoriaBrickGlow.png differ diff --git a/Tiles/SunkenSea/BrainCoral.cs b/Tiles/SunkenSea/BrainCoral.cs index d762b8c749..62d79b213a 100644 --- a/Tiles/SunkenSea/BrainCoral.cs +++ b/Tiles/SunkenSea/BrainCoral.cs @@ -32,6 +32,10 @@ namespace CalamityMod.Tiles.SunkenSea public override void NearbyEffects(int i, int j, bool closer) { + if (Main.gamePaused) + { + return; + } if (closer) { if (Main.rand.NextBool(300)) diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 5ffa2ff467..137ec91434 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.SunkenSea name.SetDefault("Eutrophic Sand"); AddMapEntry(new Color(100, 100, 150), name); MineResist = 2f; - TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; //TODO -- Temporary, allow tile to be swapped when DS is dead. } public override bool CanKillTile(int i, int j, ref bool blockDamaged) diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 15d9bb75f4..87f79a3e6f 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Tiles.SunkenSea AddMapEntry(new Color(0, 90, 90), name); MineResist = 2f; HitSound = SoundID.Tink; - TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; //TODO -- Temporary, allow tile to be swapped when DS is dead. } public override bool CanKillTile(int i, int j, ref bool blockDamaged) diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 6e5fd0e981..3707ddcf61 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.SunkenSea MineResist = 3f; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; - TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; //TODO -- Temporary, allow tile to be swapped when DS is dead. } public override bool CanKillTile(int i, int j, ref bool blockDamaged) diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index eb4573ddf4..5800acbab9 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 67; ItemDrop = ModContent.ItemType(); Main.tileSpelunker[Type] = true; - TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; //TODO -- Temporary, allow tile to be swapped when DS is dead. } public override bool CanKillTile(int i, int j, ref bool blockDamaged) diff --git a/Tiles/SunkenSea/SmallBrainCoral.cs b/Tiles/SunkenSea/SmallBrainCoral.cs index a25456992e..e74dafe6d3 100644 --- a/Tiles/SunkenSea/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/SmallBrainCoral.cs @@ -32,6 +32,10 @@ namespace CalamityMod.Tiles.SunkenSea public override void NearbyEffects(int i, int j, bool closer) { + if (Main.gamePaused) + { + return; + } if (closer) { if (Main.rand.NextBool(300)) diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index a2b39658eb..96c051a829 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -1,10 +1,10 @@ - -using CalamityMod.Dusts.Furniture; +using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; +using Terraria.DataStructures; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles { @@ -35,18 +35,16 @@ namespace CalamityMod.Tiles return false; } - // TODO -- Fix the drapes from these. This uses specialized drawing hooks which appear to currently be private in 1.4. - // This may require either gross reflection or contacting TML developers to make the necessary information for this public again. - /* - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { - if ((Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || - Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) && - nextSpecialDrawIndex < Main.specX.Length) + if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || + Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) { - Main.specX[nextSpecialDrawIndex] = i; - Main.specY[nextSpecialDrawIndex] = j; - nextSpecialDrawIndex++; + try + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + catch {} } } @@ -61,7 +59,6 @@ namespace CalamityMod.Tiles DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); } - */ public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { diff --git a/Tiles/WulfrumPipes.cs b/Tiles/WulfrumPipes.cs new file mode 100644 index 0000000000..1c7b8f45ed --- /dev/null +++ b/Tiles/WulfrumPipes.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria.DataStructures; +using System; +using CalamityMod.Systems; +using CalamityMod.Items.Tools; +using Terraria.GameContent; + +namespace CalamityMod.Tiles +{ + public class WulfrumPipes : ModTile, ISpecialTempTileDraw + { + public static int PlaceTimeMax = 10; + //public float PlaceProgress(Point pos) => Math.Clamp((PlaceTimeStart - Main.GameUpdateCount) / (pos.GetTileRNG() * 5f + 5f), 0, 1); + //public float PlaceProgress(Point pos) => Math.Clamp((PlaceTimeStart - Main.GameUpdateCount) / (pos.GetTileRNG() * 5f + 5f), 0, 1); + + public static Vector2 DisplaceStart(Point pos) => new Vector2(0, -(pos.GetTileRNG() * 10f + 7f)); + public static float RotationStart(Point pos) => - MathHelper.PiOver4 * 0.8f + MathHelper.PiOver4 * 1.6f * pos.GetTileRNG(1); + + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + HitSound = SoundID.Item52; + DustType = 83; + AddMapEntry(new Color(128, 90, 77)); + Main.tileLighted[Type] = true; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.00f; + g = 0.6f; + b = 0.3f; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = Main.rand.NextBool(3) ? 3 : Main.rand.NextBool(3) ? 1 : 2; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + SoundEngine.PlaySound(SoundID.Item52 with { Volume = SoundID.Item52.Volume * 0.75f, Pitch = SoundID.Item52.Pitch - 0.5f }, new Vector2( i * 16, j * 16 )); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + return false; + } + + public void CoolDraw(int i, int j, SpriteBatch spriteBatch) + { + Point pos = new Point(i, j); + Tile tile = Main.tile[pos]; + + float timeToGo = pos.GetTileRNG(2) * 22; + float animProgress = (float)Math.Pow(MathHelper.Clamp((TempTilesManagerSystem.GetTemporaryTileTime(pos) - (WulfrumScaffoldKit.TileTime - timeToGo)) / timeToGo, 0, 1), 2); + + Vector2 position = pos.ToWorldCoordinates() + DisplaceStart(pos) * animProgress - Main.screenPosition; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + Color tileColor = Lighting.GetColor(pos) * (1 - animProgress); + + Main.spriteBatch.Draw(TextureAssets.Tile[Type].Value, position, frame, tileColor, RotationStart(pos) * animProgress, frame.Size() / 2f, 1f, 0, 0); + } + } +} diff --git a/Tiles/WulfrumPipes.png b/Tiles/WulfrumPipes.png new file mode 100644 index 0000000000..79ab1441f9 Binary files /dev/null and b/Tiles/WulfrumPipes.png differ diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 1d80b63532..66d51d1e24 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -164,9 +164,10 @@ namespace CalamityMod.UI OneToMany[NPCType()] = Rav; OneToMany[NPCType()] = Rav; - int[] Slimes = new int[] { NPCType(), NPCType(), NPCType(), + int[] SlimeGod = new int[] { NPCType(), NPCType(), NPCType(), NPCType() }; - OneToMany[NPCType()] = Slimes; + OneToMany[NPCType()] = SlimeGod; + OneToMany[NPCType()] = SlimeGod; SetupBossExclusionList(); SetupMinibossHPBarList(); @@ -193,6 +194,7 @@ namespace CalamityMod.UI NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -230,6 +232,7 @@ namespace CalamityMod.UI NPCID.BigMimicCorruption, NPCID.BigMimicCrimson, NPCID.BigMimicHallow, + NPCID.BloodNautilus, // Moon Events. NPCID.MourningWood, @@ -282,7 +285,6 @@ namespace CalamityMod.UI [NPCID.PirateShip] = new BossEntityExtension("Cannons", NPCID.PirateShipCannon), [NPCType()] = new BossEntityExtension("Dark Energy", NPCType()), [NPCType()] = new BossEntityExtension("Body Parts", NPCType(), NPCType(), NPCType(), NPCType()), - [NPCType()] = new BossEntityExtension("Large Slimes", NPCType(), NPCType(), NPCType(), NPCType()), }; } diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 188ca92bb1..29b8f9bfdb 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -27,6 +27,9 @@ namespace CalamityMod.UI.CalamitasEnchants public static readonly Vector2 ReforgeUITopLeft = new Vector2(68f, 320f); public static readonly float ResolutionRatio = Main.screenHeight / 1440f; + public static readonly SoundStyle EnchSound = new("CalamityMod/Sounds/Custom/WeaponEnchant"); + public static readonly SoundStyle EXSound = new("CalamityMod/Sounds/Custom/WeaponExhume"); + public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); public static bool InRangeOfNPC() @@ -402,10 +405,10 @@ namespace CalamityMod.UI.CalamitasEnchants // Reset the enchantment index to prevent index problems on a different item. EnchantIndex = 0; - SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); - if (SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, Main.LocalPlayer.Center); + SoundEngine.PlaySound(EXSound, Main.LocalPlayer.Center); + else + SoundEngine.PlaySound(EnchSound, Main.LocalPlayer.Center); } } } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index cd7ebf8c6d..ca9924f527 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; using CalamityMod.Projectiles.Melee; @@ -196,7 +197,8 @@ namespace CalamityMod.UI.CalamitasEnchants "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral", null, player => player.Calamity().dischargingItemEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && !item.CountsAsClass() && !item.channel && !item.CountsAsClass()), + item => item.IsEnchantable() && item.damage > 0 && !item.CountsAsClass() && !item.CountsAsClass() && + !item.channel && item.type != ModContent.ItemType()), new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer.\nOnce it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", 700, diff --git a/UI/ChargeMeterUI.cs b/UI/ChargeMeterUI.cs index 064decaeeb..e482e2881b 100644 --- a/UI/ChargeMeterUI.cs +++ b/UI/ChargeMeterUI.cs @@ -86,64 +86,65 @@ namespace CalamityMod.UI return; } + DrawChargeBar(spriteBatch, modItem, screenPos); + + Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); + Rectangle chargeBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale); + + MouseState ms = Mouse.GetState(); + Vector2 mousePos = Main.MouseScreen; + + if (chargeBar.Intersects(mouseHitbox)) + { + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; + + // If the mouse is on top of the meter, show the exact numeric charge. + string percentString = (100f * modItem.ChargeRatio).ToString("n2"); + // Tooltip only goes to one decimal place, but the meter displays two. This doesn't help the player much at all but hey, it's a thing. + Main.instance.MouseText($"Current Charge: {percentString}%", 0, 0, -1, -1, -1, -1); + + Vector2 newScreenRatioPosition = screenRatioPosition; + // Handle mouse dragging + if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + { + // If the drag offset doesn't exist yet, create it. + if (!dragOffset.HasValue) + dragOffset = mousePos - screenPos; + + // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. + Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); + + // Convert the new corner position into a screen ratio position. + newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; + newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; + } + + // Compute the change in position. If it is large enough, actually move the meter + Vector2 delta = newScreenRatioPosition - screenRatioPosition; + if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) + { + CalamityConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; + CalamityConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y; + } + + // When the mouse is released, save the config and destroy the drag offset. + if (ms.LeftButton == ButtonState.Released) + { + dragOffset = null; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + } + } + + private static void DrawChargeBar(SpriteBatch spriteBatch, CalamityGlobalItem modItem, Vector2 screenPos) + { + float uiScale = Main.UIScale; float offset = (edgeTexture.Width - barTexture.Width) * 0.5f; spriteBatch.Draw(edgeTexture, screenPos, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * modItem.ChargeRatio), barTexture.Width); spriteBatch.Draw(barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); - - Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); - Rectangle chargeBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale); - - // If the mouse is on top of the meter, show the exact numeric charge. - if (chargeBar.Intersects(mouseHitbox)) - { - Main.LocalPlayer.mouseInterface = true; - string percentString = (100f * modItem.ChargeRatio).ToString("n2"); - // Tooltip only goes to one decimal place, but the meter displays two. This doesn't help the player much at all but hey, it's a thing. - Main.instance.MouseText($"Current Charge: {percentString}%", 0, 0, -1, -1, -1, -1); - } - - // Handle mouse dragging - if (!CalamityConfig.Instance.MeterPosLock) - { - Vector2 newScreenRatioPosition = screenRatioPosition; - if (chargeBar.Intersects(mouseHitbox)) - { - MouseState ms = Mouse.GetState(); - Vector2 mousePos = new Vector2(ms.X, ms.Y); - - // As long as the mouse button is held down, drag the meter along with an offset. - if (ms.LeftButton == ButtonState.Pressed) - { - // If the drag offset doesn't exist yet, create it. - if (!dragOffset.HasValue) - dragOffset = mousePos - screenPos; - - // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. - Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); - - // Convert the new corner position into a screen ratio position. - newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; - newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; - } - - // Compute the change in position. If it is large enough, actually move the meter - Vector2 delta = newScreenRatioPosition - screenRatioPosition; - if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) - { - CalamityConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y; - } - - // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) - { - dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); - } - } - } - } + } } } diff --git a/UI/ChargingStationUI.cs b/UI/ChargingStationUI.cs index 5f97b3c9f7..1111ebc762 100644 --- a/UI/ChargingStationUI.cs +++ b/UI/ChargingStationUI.cs @@ -109,7 +109,6 @@ namespace CalamityMod.UI // If the player is holding shift and has space for the item, just spawn it on his or her face. if (Main.keyState.PressingShift() && p.ItemSpace(pluggedItem).CanTakeItemToPersonalInventory) { - // This does not use DropHelper because it has to clone an existing item, not create one from nothing. p.QuickSpawnClonedItem(new EntitySource_TileEntity(charger), pluggedItem, pluggedItem.stack); // Destroy the original plugged item because a clone of it was just spawned. @@ -157,7 +156,7 @@ namespace CalamityMod.UI // If the player is holding shift and has space for the power cells, just spawn all of them on his or her face. if (Main.keyState.PressingShift() && p.ItemSpace(powercell).CanTakeItemToPersonalInventory) { - DropHelper.DropItem(p.GetSource_TileInteraction(te.Position.X, te.Position.Y), p, powercellID, powercell.stack); + p.QuickSpawnItem(p.GetSource_TileInteraction(te.Position.X, te.Position.Y), powercellID, powercell.stack); chargerStackDiff = (short)-powercell.stack; // Do not play a sound in this situation. The player is going to pick up the dropped cells in a few frames, which will make sound. diff --git a/UI/CodebreakerUI.cs b/UI/CodebreakerUI.cs index 6f4551beed..c0b154676c 100644 --- a/UI/CodebreakerUI.cs +++ b/UI/CodebreakerUI.cs @@ -1,18 +1,18 @@ -using CalamityMod.Items.DraedonMisc; +using System; +using System.Linq; +using System.Text; +using CalamityMod.Items.DraedonMisc; using CalamityMod.TileEntities; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Linq; -using System.Text; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.UI.Chat; -using Terraria.Audio; -using Terraria.GameContent; namespace CalamityMod.UI { @@ -150,7 +150,7 @@ namespace CalamityMod.UI if (Main.mouseLeft && Main.mouseLeftRelease && codebreakerTileEntity.DecryptionCountdown <= 0) { - int powerCellID = ModContent.ItemType(); + int powercellID = ModContent.ItemType(); short cellStackDiff = 0; bool shouldPlaySound = true; @@ -160,7 +160,7 @@ namespace CalamityMod.UI cellStackDiff = (short)-Math.Min(temporaryItem.stack, temporaryItem.maxStack); Player p = Main.LocalPlayer; var source = p.GetSource_TileInteraction(codebreakerTileEntity.Position.X, codebreakerTileEntity.Position.Y); - DropHelper.DropItem(source, p, powerCellID, -cellStackDiff); + p.QuickSpawnItem(source, powercellID, -cellStackDiff); // Do not play a sound in this situation. The player is going to pick up the dropped cells in a few frames, which will make sound. shouldPlaySound = false; @@ -169,7 +169,7 @@ namespace CalamityMod.UI // If the slot is normally clicked, behavior depends on whether the player is holding power cells. else { - bool holdingPowercell = playerHandItem.type == powerCellID; + bool holdingPowercell = playerHandItem.type == powercellID; // If the player's held power cells can be stacked on top of what's already in the codeberaker, then stack them. if (holdingPowercell && temporaryItem.stack < TECodebreaker.MaxCellCapacity) diff --git a/UI/CooldownRackUI.cs b/UI/CooldownRackUI.cs index 76f9be5999..477c3d768f 100644 --- a/UI/CooldownRackUI.cs +++ b/UI/CooldownRackUI.cs @@ -1,4 +1,4 @@ -using CalamityMod.Cooldowns; +using CalamityMod.Cooldowns; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -34,6 +34,9 @@ namespace CalamityMod.UI public static Vector2 BaseDrawPosition => new Vector2(32, 100) + Spacing / 2f + (Main.LocalPlayer.CountBuffs() > 0 ? Vector2.UnitY * 50 : Vector2.Zero) + (Main.LocalPlayer.CountBuffs() > 11 ? Vector2.UnitY * 50 : Vector2.Zero); + public static bool DebugFullDisplay = false; + public static float DebugForceCompletion = 0f; + public static void Draw(SpriteBatch spriteBatch) { // Don't draw cooldowns under the following conditions: @@ -69,6 +72,9 @@ namespace CalamityMod.UI iconOpacity = MathHelper.Clamp((float)Math.Sin(Main.GlobalTimeWrappedHourly % MathHelper.Pi) * 2f, 0, 1) * 0.1f + 0.9f; } + if (DebugFullDisplay) + iconOpacity = 1f; + if (CompactIcons) handler.DrawCompact(spriteBatch, displayPosition, iconOpacity, uiScale); else diff --git a/UI/DraedonSchematicHellGUI.cs b/UI/DraedonSchematicHellGUI.cs new file mode 100644 index 0000000000..9dfc2fb11b --- /dev/null +++ b/UI/DraedonSchematicHellGUI.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class DraedonSchematicHellGUI : DraedonsLogGUI + { + public override int TotalPages => 1; + public override string GetTextByPage() + { + return "Only the highest ranking in the battalions of the Yharim's army held these weapons.\n"+ + "However these are still not my most potent tools. Those...characters could not be trusted with them.\n" + +"Addendum: The final piece remains. Travel now from the hottest fire this land has to offer, to the most frigid cold. I cannot deny having some sense of poetic symmetry."; + } + public override Texture2D GetTextureByPage() + { + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogCragsBiome").Value; + } + } +} diff --git a/UI/DraedonSchematicIceGUI.cs b/UI/DraedonSchematicIceGUI.cs new file mode 100644 index 0000000000..d08987859b --- /dev/null +++ b/UI/DraedonSchematicIceGUI.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class DraedonSchematicIceGUI : DraedonsLogGUI + { + public override int TotalPages => 1; + public override string GetTextByPage() + { + return "I have since made progress to even greater weapons than these, but they remain creations to be proud of.\n" + + "No progress can be made without a desire that comes from dissatisfaction.\n" + + "Addendum: The time has come. You are ready."; + } + public override Texture2D GetTextureByPage() + { + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogIceBiome").Value; + } + } +} diff --git a/UI/DraedonSchematicJungleGUI.cs b/UI/DraedonSchematicJungleGUI.cs new file mode 100644 index 0000000000..fa0bf0a4c2 --- /dev/null +++ b/UI/DraedonSchematicJungleGUI.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class DraedonSchematicJungleGUI : DraedonsLogGUI + { + public override int TotalPages => 1; + public override string GetTextByPage() + { + return "As rank progresses, so often does the lethality of equipment. In the hands of competent soldiers, the weapons have the ability to make change.\n" + + "However, competent soldiers take no action but orders from above.\n" + + "Addendum: If you read this, you have come far. Do not disappoint.\n" + + "Go now to Hell, for the next component stored in what were once my forges."; + } + public override Texture2D GetTextureByPage() + { + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogJungleBiome").Value; + } + } +} diff --git a/UI/DraedonSchematicPlanetoidGUI.cs b/UI/DraedonSchematicPlanetoidGUI.cs new file mode 100644 index 0000000000..05f88c552e --- /dev/null +++ b/UI/DraedonSchematicPlanetoidGUI.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class DraedonSchematicPlanetoidGUI : DraedonsLogGUI + { + public override int TotalPages => 1; + public override string GetTextByPage() + { + return "Within an army, as weapons do, the soldiers serve different purposes.\n" + + "That distinction is crucial, as the wrong tool in the wrong hands—no matter how potent—may as well be a wooden club.\n" + + "Addendum: Seek out my base of operations closest to the Lihzahrd’s home.\n" + + "I wish you the best of luck with all sincerity, for it has been a long time since I have had a worthy test subject."; + } + public override Texture2D GetTextureByPage() + { + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogPlanetoid").Value; + } + } +} diff --git a/UI/DraedonSchematicSunkenSeaGUI.cs b/UI/DraedonSchematicSunkenSeaGUI.cs new file mode 100644 index 0000000000..bfba6868e8 --- /dev/null +++ b/UI/DraedonSchematicSunkenSeaGUI.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class DraedonSchematicSunkenSeaGUI : DraedonsLogGUI + { + public override int TotalPages => 1; + public override string GetTextByPage() + { + return "The weaponry I supply to the workers of the laboratories is weak. Hardly suited for battle.\n" + + "However, they suffice for self defense against any lab mechanisms or creations which may have gone rogue.\n" + + "Addendum: For those who think themselves powerful, search the upper bounds of this planet’s atmosphere for a structure similar to that of the Sunken Seas.\n" + + "I will know by the end if you are worthy of battling my creations.\n"; + } + public override Texture2D GetTextureByPage() + { + return ModContent.Request("CalamityMod/ExtraTextures/UI/DraedonsLogSunkenSeaBiome").Value; + } + } +} diff --git a/UI/ModeIndicatorUI.cs b/UI/ModeIndicatorUI.cs index 542eab5f42..21ed9608da 100644 --- a/UI/ModeIndicatorUI.cs +++ b/UI/ModeIndicatorUI.cs @@ -3,48 +3,456 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using System.Collections.Generic; +using System.Linq; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; +using System; +using Terraria.ID; +using Terraria.Audio; +using CalamityMod.Systems; +using static CalamityMod.Systems.DifficultyModeSystem; +using Terraria.GameInput; +using Terraria.UI.Chat; +using System.Text.RegularExpressions; +using static Terraria.GameContent.FontAssets; namespace CalamityMod.UI { public class ModeIndicatorUI { + public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + + public static Vector2 FrameSize => new Vector2(30f, 38f); + public static Rectangle MainClickArea => Utils.CenteredRectangle(DrawCenter, FrameSize * MainIconScale); + public static bool ClickingMouse => Main.mouseLeft && Main.mouseLeftRelease; + public static Vector2 DrawCenter => new Vector2(Main.screenWidth - 400f - WidthForTier(MostAlternateDifficulties) * 0.5f, 82f) + FrameSize * 0.5f; + + private static int GlowFadeAnimLenght = 40; + public static int GlowFadeTime = 0; + //Lock icon + internal const int LockAnimLenght = 30; + private static int lockClickTime = 0; + private static bool previousLockStatus = false; + //Expand and shrink on hover + internal const float MaxIconHoverScaleBoost = 0.3f; + internal const float IconHoverScaleIncrement = MaxIconHoverScaleBoost / 6f; + internal const float IconHoverScaleDecrement = MaxIconHoverScaleBoost / 10f; + private static float iconHoverScaleBoost = 0f; + private static bool previouslyHoveringMainIcon = false; + public static float MainIconScale => 1f + iconHoverScaleBoost; + //Menu state + private static bool menuOpen = false; + internal static int MenuAnimLenght => MostAlternateDifficulties > 1 ? 60 : 40; + private static int menuOpenTransitionTime = 0; + private static DifficultyMode previouslyHoveredMode = null; + public static float WidthForTier(int alts) => (alts - 1) * 40f; + + private static void ClearVariables() + { + GlowFadeTime = 0; + lockClickTime = 0; + menuOpenTransitionTime = 0; + previousLockStatus = false; + iconHoverScaleBoost = 0f; + menuOpen = false; + previouslyHoveringMainIcon = false; + previouslyHoveredMode = null; + } + + public static void TickVariables() + { + if (lockClickTime > 0) + lockClickTime--; + + if (menuOpenTransitionTime > 0) + menuOpenTransitionTime--; + + if (iconHoverScaleBoost > 0) + iconHoverScaleBoost -= IconHoverScaleDecrement; + + if (!menuOpen || menuOpenTransitionTime > 0) + previouslyHoveredMode = null; + + if (GlowFadeTime > 0) + GlowFadeTime--; + } + public static void Draw(SpriteBatch spriteBatch) { // The mode indicator should only be displayed when the inventory is open, to prevent obstruction. if (!Main.playerInventory) - return; - - Texture2D indicatorTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicator").Value; - int indicatorFrame = 0; - if (CalamityWorld.revenge) - indicatorFrame = 1; - if (CalamityWorld.death) - indicatorFrame = 2; - - Rectangle mouseRectangle = Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); - Rectangle indicatorFrameArea = indicatorTexture.Frame(1, 4, 0, indicatorFrame); - Vector2 drawCenter = new Vector2(Main.screenWidth - 400f, 72f) + indicatorFrameArea.Size() * 0.5f; - - spriteBatch.Draw(indicatorTexture, drawCenter, indicatorFrameArea, Color.White, 0f, indicatorFrameArea.Size() * 0.5f, 1f, SpriteEffects.None, 0f); - - // Draw active indication text. - bool renderingText = false; - if (mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter, indicatorFrameArea.Size()))) { - string modeToDisplay = "Revengeance"; - bool modeIsActive = CalamityWorld.revenge; - if (CalamityWorld.death) - { - modeToDisplay = "Death"; - modeIsActive = CalamityWorld.death; - } - - Main.instance.MouseText($"{modeToDisplay} Mode is {(modeIsActive ? "active" : "not active")}."); - renderingText = true; + ClearVariables(); + return; } - if (renderingText) - Main.instance.MouseTextHackZoom(string.Empty); + Texture2D indicatorTexture = GetCurrentDifficulty.Texture.Value; + + GetDifficultyStatus(out string difficultyText); + GetLockStatus(out string lockText, out bool locked); + + //Grows the icon when hovering it. + if (MouseScreenArea.Intersects(MainClickArea)) + { + if (!_hasCheckedItOutYet) + { + GlowFadeTime = GlowFadeAnimLenght; + _hasCheckedItOutYet = true; + } + + if (!previouslyHoveringMainIcon) + { + previouslyHoveringMainIcon = true; + SoundEngine.PlaySound(SoundID.MenuTick); + } + + if (iconHoverScaleBoost < MaxIconHoverScaleBoost) + { + iconHoverScaleBoost = Math.Min(iconHoverScaleBoost + IconHoverScaleIncrement + IconHoverScaleDecrement, MaxIconHoverScaleBoost); + + if (ClickingMouse && menuOpenTransitionTime == 0 && !locked) + { + SoundEngine.PlaySound(menuOpen ? SoundID.MenuClose : SoundID.MenuOpen); + menuOpenTransitionTime = MenuAnimLenght; + menuOpen = !menuOpen; + } + } + } + else + previouslyHoveringMainIcon = false; + + if (!_hasCheckedItOutYet || GlowFadeTime > 0) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + Texture2D bloomTex = ModContent.Request("CalamityMod/ExtraTextures/BloomFlare").Value; + float opacity = !_hasCheckedItOutYet ? 1f : 1f * GlowFadeTime / (float)GlowFadeAnimLenght; + float scale = 0.4f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.05f; + float rot = Main.GlobalTimeWrappedHourly * 0.5f; + + spriteBatch.Draw(bloomTex, DrawCenter, null, Color.Crimson * opacity, rot, new Vector2(123, 124), scale, SpriteEffects.None, 0f); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); + + + Texture2D outlineTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicatorOutline").Value; + spriteBatch.Draw(outlineTexture, DrawCenter, null, Color.White * opacity, 0f, outlineTexture.Size() * 0.5f, MainIconScale, SpriteEffects.None, 0f); + } + + string extraDescText = ""; + if (menuOpenTransitionTime > 0 || menuOpen) + ManageHexIcons(spriteBatch, out extraDescText); + + //Draw the indicator itself. + spriteBatch.Draw(indicatorTexture, DrawCenter, null, Color.White, 0f, indicatorTexture.Size() * 0.5f, MainIconScale, SpriteEffects.None, 0f); + + if (locked) + DrawLock(spriteBatch); + + if (difficultyText != "" || extraDescText != "") + { + string textToDisplay = difficultyText; + if (difficultyText != "") + { + if (lockText != "") + textToDisplay += "\n" + lockText; + } + + else + textToDisplay = extraDescText; + + //Get the size of the textbox + Vector2 boxSize = MouseText.Value.MeasureString(textToDisplay); + + //Get a "regexed" size which matches the text properly. + //Indeed, there is some scuffery in the code that makes it so that chat tags still get accounted as extra size, so we have to use 2 different values + //One for the displacement, which is the improper size vanilla uses, and another for the actual visual size, which is the one the textbox will use + int numLines = Regex.Matches(textToDisplay, "\n").Count; //It's inconsistent. Adding one by default makes some textboxes too large, not adding one can make some too small + string heightCalculator = string.Concat(Enumerable.Repeat("mis nuevos los gatos \n", numLines)); + Vector2 regexedBoxSize = new Vector2(ChatManager.GetStringSize(MouseText.Value, textToDisplay, Vector2.One).X, ChatManager.GetStringSize(MouseText.Value, heightCalculator, Vector2.One).Y); + + Vector2 textboxStart = new Vector2(Main.mouseX, Main.mouseY) + Vector2.One * 14; + if (Main.ThickMouse) + textboxStart += Vector2.One * 6; + + if (!Main.mouseItem.IsAir) + textboxStart.X += 34; + + if (textboxStart.X + boxSize.X + 4f > (float)Main.screenWidth) + textboxStart.X = Main.screenWidth - boxSize.X - 4f; + + if (textboxStart.Y + regexedBoxSize.Y + 4f > (float)Main.screenHeight) + textboxStart.Y = Main.screenHeight - regexedBoxSize.Y - 4f; + + //It'd be great to be able to add a background to it but i don't think i know how to get the position of the text for that. + //Also the "get string size" thing breaks with colored lines so :( + Utils.DrawInvBG(spriteBatch, new Rectangle((int)textboxStart.X - 10, (int)textboxStart.Y - 10, (int)regexedBoxSize.X + 20, (int)regexedBoxSize.Y + 16), new Color(50, 20, 35) * 0.925f); + + //Add the hover text. + Main.LocalPlayer.mouseInterface = true; + Main.instance.MouseText(textToDisplay); + } + + + + + TickVariables(); } + + public static void GetDifficultyStatus(out string text) + { + text = ""; + if (MouseScreenArea.Intersects(MainClickArea)) + { + //Display the first non-none difficulty by default + string modeToDisplay = Difficulties[1].Name; + bool anyActiveMode = false; + + for (int i = 1; i < Difficulties.Length; i++) + { + if (GetCurrentDifficulty == Difficulties[i]) + { + modeToDisplay = Difficulties[i].Name; + anyActiveMode = true; + } + } + + text = $"{modeToDisplay} Mode is {(anyActiveMode ? "active" : "not active")}."; + } + } + + //Checks if the mode change is available or not, and jiggles the lock icon if the player clicks on it. + public static void GetLockStatus(out string text, out bool locked) + { + locked = false; + text = "[c/919191:Click to select a difficulty mode]"; + if (!Main.expertMode && GetCurrentDifficulty == Difficulties[0]) + { + locked = true; + text = "[c/919191:Higher difficulty modes can only be toggled in Expert Mode or above]"; + } + else if (CalamityPlayer.areThereAnyDamnBosses || BossRushEvent.BossRushActive) + { + locked = true; + text = "[c/919191:"+ Language.GetTextValue("Mods.CalamityMod.ChangingTheRules") + "]"; + } + + //Shakes the lock if it automatically changed, because a boss was summoned + if (locked != previousLockStatus && lockClickTime == 0) + lockClickTime = LockAnimLenght; + + previousLockStatus = locked; + + //Close the menu if its locked + if (locked && menuOpen) + { + menuOpen = false; + menuOpenTransitionTime = MenuAnimLenght - menuOpenTransitionTime; + } + + //Click handling + if (locked && ClickingMouse && lockClickTime == 0) + { + if (MouseScreenArea.Intersects(MainClickArea)) + { + lockClickTime = LockAnimLenght; + SoundEngine.PlaySound(SoundID.MenuTick); + } + } + } + + #region Cool drawing stuff + private static CurveSegment lockGrow = new CurveSegment(SineOutEasing, 0f, 1f, 0.4f); + private static CurveSegment lockShrink = new CurveSegment(SineInEasing, 0.6f, 1.4f, -0.4f); + private static CurveSegment lockBump = new CurveSegment(SineBumpEasing, 0.9f, 1f, -0.2f); + internal static float LockShakeScale => PiecewiseAnimation(lockClickTime / (float)LockAnimLenght, new CurveSegment[] { lockGrow, lockShrink, lockBump }); + + private static CurveSegment barExpand = new CurveSegment(SineInOutEasing, 0f, 0f, 1f); + internal static float BarExpansionProgress + { + get + { + float animLenght = MostAlternateDifficulties == 1 ? (float)MenuAnimLenght : MenuAnimLenght * 2 / 3f; + float progress = (menuOpenTransitionTime / animLenght); + if (menuOpen) + progress = 1 - progress; + + return PiecewiseAnimation(progress, new CurveSegment[] { barExpand }); + } + } + + + private static CurveSegment barWidthExpand = new CurveSegment(SineInOutEasing, 0f, 0f, 1.2f); + private static CurveSegment barWidthRetract = new CurveSegment(SineInEasing, 0.6f, 1.2f, -0.2f); + + internal static float BarWidthExpansionProgress + { + get + { + float progress = Math.Max(menuOpenTransitionTime - MenuAnimLenght * 2 / 3f, 0f) / (MenuAnimLenght / 3f); + if (menuOpen) + progress = 1 - progress; + + return PiecewiseAnimation(progress, new CurveSegment[] { barWidthExpand, barWidthRetract }); + } + } + + public static void ManageHexIcons(SpriteBatch spriteBatch, out string text) + { + int tiers = DifficultyTiers.Count(); + float barLenght = 60 * tiers * BarExpansionProgress; + float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLenght : menuOpenTransitionTime / (float)MenuAnimLenght; + Vector2 basePosition = DrawCenter + (barLenght / (float)(tiers + 1f)) * Vector2.UnitY; + + Texture2D outlineTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicatorOutline").Value; + + text = ""; + bool modeHovered = false; + + for (int i = 0; i < tiers; i++) + { + int modesAtTier = DifficultyTiers[i].Length; + for (int j = 0; j < modesAtTier; j++) + { + DifficultyMode mode = DifficultyTiers[i][j]; + Texture2D hexIcon = mode.Texture.Value; + + //Get position + Vector2 iconPosition = basePosition + (barLenght / (float)(tiers + 1f)) * Vector2.UnitY * i; + if (modesAtTier > 1) + iconPosition += Vector2.UnitX * MathHelper.Lerp(WidthForTier(modesAtTier) * -0.5f, WidthForTier(modesAtTier) * 0.5f, j / (float)(modesAtTier - 1)) * BarWidthExpansionProgress; + + bool hovered = MouseScreenArea.Intersects(Utils.CenteredRectangle(iconPosition, hexIcon.Size())); + + float usedOpacity = mode.Enabled ? 0.85f : 0.55f; + + if (hovered) + usedOpacity = MathHelper.Lerp(usedOpacity, 1f, 0.7f); + + //outline the currently selected difficulty. + if (mode == GetCurrentDifficulty) + { + usedOpacity = 1f; + spriteBatch.Draw(outlineTexture, iconPosition, null, mode.ChatTextColor * 0.8f * progress, 0f, outlineTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + } + spriteBatch.Draw(hexIcon, iconPosition, null, Color.White * usedOpacity * progress, 0f, hexIcon.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + + if (menuOpenTransitionTime == 0 && hovered) + { + if (previouslyHoveredMode != mode) + SoundEngine.PlaySound(SoundID.MenuTick); + + previouslyHoveredMode = mode; + modeHovered = true; + + text = GetDifficultyText(mode); + if (ClickingMouse) + SwitchToDifficulty(mode); + } + } + } + + if (!modeHovered) + previouslyHoveredMode = null; + } + + public static void DrawLock(SpriteBatch spriteBatch) + { + Texture2D lockTexture = ModContent.Request("CalamityMod/ExtraTextures/UI/ModeIndicatorLock").Value; + float rotationShift = lockClickTime == 0 ? 0f : (float)Math.Sin((1 - lockClickTime / (float)LockAnimLenght) * MathHelper.TwoPi * 2f) * 0.5f * (lockClickTime / (float)LockAnimLenght); + spriteBatch.Draw(lockTexture, DrawCenter + Vector2.UnitY * 12 * MainIconScale, null, Color.White, 0f + rotationShift, lockTexture.Size() * 0.5f, LockShakeScale * MainIconScale, SpriteEffects.None, 0f); + } + #endregion + + #region Difficulty toggling + public static string GetDifficultyText(DifficultyMode mode) + { + string preface = ""; + if (mode == GetCurrentDifficulty) + preface = "Currently Selected : "; + + string text = mode.Name + "\n" + mode.ShortDescription; + + //Not scuffed anymore + if (mode.ExpandedDescription != "") + { + //Show the description either if the player is holding shift. + if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift)) + text += "\n" + mode.ExpandedDescription; + + else + text += "\n[c/737373:Hold the 'Shift' key for more information]"; + } + + return preface + text; + } + + public static void SwitchToDifficulty(DifficultyMode mode) + { + //No swap on server (although this doesn't matter anymore since it's not an item but dnc. + //No swap if the requested difficulty is the same as the current one + if (mode == GetCurrentDifficulty) + return; + + //Todo, maybe in the future having a way to have multiple difficulty options on the same tier that can coexist, and it works in branching pathes? Not very necessary for cal & addons + //But would be super useful so other mods can let their own difficulties go there. + + //Disable difficulties + for (int i = 0; i < Difficulties.Length; i++) + { + //Disable all difficulties at the same tier / at a tier above itself + if (Difficulties[i]._difficultyTier >= mode._difficultyTier && Difficulties[i] != mode) + { + if (Difficulties[i].Enabled) + { + if (Difficulties[i].DeactivationTextKey != "") + DisplayLocalizedText(Difficulties[i].DeactivationTextKey, Difficulties[i].ChatTextColor); + Difficulties[i].Enabled = false; + } + } + } + + //Look at all the lower tiers. + for (int i = 0; i < mode._difficultyTier; i++) + { + //If there are no alternate difficulties at that tier, no need to ask, just choose that one. + if (DifficultyTiers[i].Length == 1) + { + DifficultyTiers[i][0].Enabled = true; + } + + //if there are alternate difficulties, we ask nicely to know which one is the preffered one. + else + { + //First off, disable them all to avoid conflicts if one was already selected before. + for (int j = 0; j < DifficultyTiers[i].Length; j++) + { + DifficultyTiers[i][j].Enabled = false; + } + + //Enable the one favored by the mode. + DifficultyTiers[i][mode.FavoredDifficultyAtTier(i)].Enabled = true; + } + } + + if (mode.ActivationTextKey != "") + DisplayLocalizedText(mode.ActivationTextKey, mode.ChatTextColor); + + mode.Enabled = true; + + SoundEngine.PlaySound(mode.ActivationSound); + CalamityNetcode.SyncCalamityWorldDifficulties(Main.myPlayer); + + menuOpen = false; + menuOpenTransitionTime = MenuAnimLenght; + } + + #endregion } } diff --git a/UI/PowerCellFactoryUI.cs b/UI/PowerCellFactoryUI.cs index 59132fbb39..e6a0ef9b4a 100644 --- a/UI/PowerCellFactoryUI.cs +++ b/UI/PowerCellFactoryUI.cs @@ -96,7 +96,7 @@ namespace CalamityMod.UI { cellsGrabbed = powercell.stack; shiftClicked = true; - DropHelper.DropItem(p.GetSource_TileInteraction(te.Position.X, te.Position.Y), p, powercellID, cellsGrabbed); + p.QuickSpawnItem(p.GetSource_TileInteraction(te.Position.X, te.Position.Y), powercellID, cellsGrabbed); } else { diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 4d43be5df0..d7c58e85cf 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Input; using ReLogic.Content; using Terraria; using Terraria.ModLoader; +using static Microsoft.Xna.Framework.Input.Keys; namespace CalamityMod.UI { @@ -56,7 +57,11 @@ namespace CalamityMod.UI CalamityPlayer modPlayer = player.Calamity(); // If not drawing the stealth meter, save its latest position to config and leave. - if (modPlayer.stealthUIAlpha <= 0f || !CalamityConfig.Instance.StealthMeter || modPlayer.rogueStealthMax <= 0f || !modPlayer.wearingRogueArmor) + if (modPlayer.stealthUIAlpha > 0f && CalamityConfig.Instance.StealthMeter && modPlayer.rogueStealthMax > 0f && modPlayer.wearingRogueArmor) + { + DrawStealthBar(spriteBatch, modPlayer, screenPos); + } + else { bool changed = false; if (CalamityConfig.Instance.StealthMeterPosX != screenRatioPosition.X) @@ -72,9 +77,81 @@ namespace CalamityMod.UI if (changed) CalamityMod.SaveConfig(CalamityConfig.Instance); - return; } + Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); + Rectangle stealthBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale); + + MouseState ms = Mouse.GetState(); + Vector2 mousePos = Main.MouseScreen; + + // Handle mouse dragging + if (stealthBar.Intersects(mouseHitbox)) + { + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; + + // If the mouse is on top of the meter, show the player's exact numeric stealth. + if (modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f) + { + string stealthStr = (100f * modPlayer.rogueStealth).ToString("n2"); + string maxStealthStr = (100f * modPlayer.rogueStealthMax).ToString("n2"); + string textToDisplay = $"Stealth: {stealthStr}/{maxStealthStr}\n"; + + if (!Main.keyState.IsKeyDown(LeftShift)) + { + textToDisplay += "Hold SHIFT for more information on Rogue stealth"; + } + else + { + textToDisplay += "Rogue stealth builds while not attacking and slower while moving\n" + + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage and crit\n" + + "Having more stealth regeneration slightly decreases the damage bonus from stealth\n" + + "This is offset by you being able to use stealth strikes far more often"; + } + + Main.instance.MouseText(textToDisplay, 0, 0, -1, -1, -1, -1); + modPlayer.stealthUIAlpha = MathHelper.Lerp(modPlayer.stealthUIAlpha, 0.25f, 0.035f); + } + + Vector2 newScreenRatioPosition = screenRatioPosition; + // As long as the mouse button is held down, drag the meter along with an offset. + if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + { + // If the drag offset doesn't exist yet, create it. + if (!dragOffset.HasValue) + dragOffset = mousePos - screenPos; + + // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. + Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); + + // Convert the new corner position into a screen ratio position. + newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; + newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; + } + + // Compute the change in position. If it is large enough, actually move the meter + Vector2 delta = newScreenRatioPosition - screenRatioPosition; + if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) + { + CalamityConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; + CalamityConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y; + } + + // When the mouse is released, save the config and destroy the drag offset. + if (ms.LeftButton == ButtonState.Released) + { + dragOffset = null; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + } + } + + private static void DrawStealthBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Vector2 screenPos) + { + float uiScale = Main.UIScale; float offset = (edgeTexture.Width - barTexture.Width) * 0.5f; spriteBatch.Draw(edgeTexture, screenPos, null, Color.White * modPlayer.stealthUIAlpha, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); @@ -86,60 +163,6 @@ namespace CalamityMod.UI Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * completionRatio), barTexture.Width); bool full = (modPlayer.rogueStealthMax > 0f) && (modPlayer.rogueStealth >= modPlayer.rogueStealthMax); spriteBatch.Draw(full ? fullBarTexture : barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); - - Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); - Rectangle stealthBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale); - - // If the mouse is on top of the meter, show the player's exact numeric stealth. - if (stealthBar.Intersects(mouseHitbox) && modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f) - { - Main.LocalPlayer.mouseInterface = true; - string stealthStr = (100f * modPlayer.rogueStealth).ToString("n2"); - string maxStealthStr = (100f * modPlayer.rogueStealthMax).ToString("n2"); - Main.instance.MouseText($"Stealth: {stealthStr}/{maxStealthStr}", 0, 0, -1, -1, -1, -1); - modPlayer.stealthUIAlpha = MathHelper.Lerp(modPlayer.stealthUIAlpha, 0.25f, 0.035f); - } - - // Handle mouse dragging - if (!CalamityConfig.Instance.MeterPosLock) - { - Vector2 newScreenRatioPosition = screenRatioPosition; - if (stealthBar.Intersects(mouseHitbox)) - { - MouseState ms = Mouse.GetState(); - Vector2 mousePos = new Vector2(ms.X, ms.Y); - - // As long as the mouse button is held down, drag the meter along with an offset. - if (ms.LeftButton == ButtonState.Pressed) - { - // If the drag offset doesn't exist yet, create it. - if (!dragOffset.HasValue) - dragOffset = mousePos - screenPos; - - // Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset. - Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero); - - // Convert the new corner position into a screen ratio position. - newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth; - newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight; - } - - // Compute the change in position. If it is large enough, actually move the meter - Vector2 delta = newScreenRatioPosition - screenRatioPosition; - if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) - { - CalamityConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y; - } - - // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) - { - dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); - } - } - } } } } diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 62c4f20f9d..edeb19ce2e 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod @@ -23,11 +24,11 @@ namespace CalamityMod { #region Recipe Group Definitions public static int HardmodeAnvil, HardmodeForge, AnyLargeGem, AnyFood; - public static int AnyCopperBar, AnySilverBar, AnyGoldOre, AnyGoldBar, AnyEvilBar, AnyCobaltBar, AnyMythrilBar, AnyAdamantiteBar; + public static int AnyCopperBar, AnySilverBar, AnyGoldBar, AnyEvilBar, AnyCobaltBar, AnyMythrilBar, AnyAdamantiteBar; public static int EvilPowder, Boss2Material, CursedFlameIchor, AnyEvilWater, AnyEvilFlask; public static int AnyStoneBlock, AnySnowBlock, AnyIceBlock, SiltGroup, AnyEvilBlock, AnyGoodBlock; - public static int AnyWoodenSword, AnyZapinator, AnyHallowedHelmet, AnyHallowedPlatemail, AnyHallowedGreaves, LunarPickaxe, LunarHamaxe; - public static int ManaFlowersGroup, QuiversGroup, WingsGroup; + public static int AnyWoodenSword, AnyHallowedHelmet, AnyHallowedPlatemail, AnyHallowedGreaves, AnyGoldCrown, LunarPickaxe, LunarHamaxe; + public static int ManaFlowersGroup, QuiversGroup, WingsGroup, TombstonesGroup; private static void ModifyVanillaRecipeGroups() { @@ -175,7 +176,7 @@ namespace CalamityMod private static void AddOreAndBarRecipeGroups() { // Copper and Tin - RecipeGroup group = new RecipeGroup(() => "Any Copper Bar", new int[] + RecipeGroup group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.CopperBar)}", new int[] { ItemID.CopperBar, ItemID.TinBar @@ -183,23 +184,15 @@ namespace CalamityMod AnyCopperBar = RecipeGroup.RegisterGroup("AnyCopperBar", group); // Silver and Tungsten - group = new RecipeGroup(() => "Any Silver Bar", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.SilverBar)}", new int[] { ItemID.SilverBar, ItemID.TungstenBar, }); AnySilverBar = RecipeGroup.RegisterGroup("AnySilverBar", group); - // Gold and Platinum Ore - group = new RecipeGroup(() => "Any Gold Ore", new int[] - { - ItemID.GoldOre, - ItemID.PlatinumOre - }); - AnyGoldOre = RecipeGroup.RegisterGroup("AnyGoldOre", group); - // Gold and Platinum - group = new RecipeGroup(() => "Any Gold Bar", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.GoldBar)}", new int[] { ItemID.GoldBar, ItemID.PlatinumBar @@ -215,7 +208,7 @@ namespace CalamityMod AnyEvilBar = RecipeGroup.RegisterGroup("AnyEvilBar", group); // Cobalt and Palladium - group = new RecipeGroup(() => "Any Cobalt Bar", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.CobaltBar)}", new int[] { ItemID.CobaltBar, ItemID.PalladiumBar @@ -223,7 +216,7 @@ namespace CalamityMod AnyCobaltBar = RecipeGroup.RegisterGroup("AnyCobaltBar", group); // Mythril and Orichalcum - group = new RecipeGroup(() => "Any Mythril Bar", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.MythrilBar)}", new int[] { ItemID.MythrilBar, ItemID.OrichalcumBar @@ -231,7 +224,7 @@ namespace CalamityMod AnyMythrilBar = RecipeGroup.RegisterGroup("AnyMythrilBar", group); // Adamantite and Titanium - group = new RecipeGroup(() => "Any Adamantite Bar", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.AdamantiteBar)}", new int[] { ItemID.AdamantiteBar, ItemID.TitaniumBar @@ -285,7 +278,7 @@ namespace CalamityMod private static void AddBiomeBlockRecipeGroups() { // Vanilla Stone and Astral Stone - RecipeGroup group = new RecipeGroup(() => "Any Stone Block", new int[] + RecipeGroup group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.StoneBlock)}", new int[] { ItemID.StoneBlock, ItemID.EbonstoneBlock, @@ -296,7 +289,7 @@ namespace CalamityMod AnyStoneBlock = RecipeGroup.RegisterGroup("AnyStoneBlock", group); // Vanilla Snow and Astral Snow - group = new RecipeGroup(() => "Any Snow Block", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.SnowBlock)}", new int[] { ItemID.SnowBlock, ModContent.ItemType() @@ -304,7 +297,7 @@ namespace CalamityMod AnySnowBlock = RecipeGroup.RegisterGroup("AnySnowBlock", group); // Vanilla Ice and Astral Ice - group = new RecipeGroup(() => "Any Ice Block", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.IceBlock)}", new int[] { ItemID.IceBlock, ItemID.PurpleIceBlock, @@ -314,8 +307,8 @@ namespace CalamityMod }); AnyIceBlock = RecipeGroup.RegisterGroup("AnyIceBlock", group); - // Silt, Slush, and Astral Silt - group = new RecipeGroup(() => "Any Silt", new int[] + // Silt, Slush, and Astral Silt, for Ancient Fossil + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.SiltBlock)}", new int[] { ItemID.SiltBlock, ItemID.SlushBlock, @@ -323,7 +316,7 @@ namespace CalamityMod }); SiltGroup = RecipeGroup.RegisterGroup("SiltGroup", group); - // Set of all generic Corruption/Crimson blocks + // Set of all generic Corruption/Crimson blocks, for Overloaded Sludge group = new RecipeGroup(() => "Any Evil Block", new int[] { ItemID.EbonstoneBlock, @@ -339,7 +332,7 @@ namespace CalamityMod }); AnyEvilBlock = RecipeGroup.RegisterGroup("AnyEvilBlock", group); - // Set of all generic Hallow blocks + // Set of all generic Hallow blocks, this recipe group is unused group = new RecipeGroup(() => "Any Good Block", new int[] { ItemID.PearlstoneBlock, @@ -353,8 +346,8 @@ namespace CalamityMod private static void AddEquipmentRecipeGroups() { - // Wooden Swords - RecipeGroup group = new RecipeGroup(() => "Any Wooden Sword", new int[] + // Wooden Swords for Broken Biome Blade + RecipeGroup group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.WoodenSword)}", new int[] { ItemID.WoodenSword, ItemID.BorealWoodSword, @@ -366,16 +359,8 @@ namespace CalamityMod }); AnyWoodenSword = RecipeGroup.RegisterGroup("AnyWoodenSword", group); - // Zapinators - group = new RecipeGroup(() => "Any Zapinator", new int[] - { - ItemID.ZapinatorGray, - ItemID.ZapinatorOrange - }); - AnyZapinator = RecipeGroup.RegisterGroup("AnyZapinator", group); - - // Hallowed Helmets - group = new RecipeGroup(() => "Any Hallowed Helmet", new int[] + // Hallowed Helmets for Angelic Alliance + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.HallowedHelmet)}", new int[] { ItemID.HallowedHelmet, ItemID.HallowedHeadgear, @@ -389,7 +374,7 @@ namespace CalamityMod AnyHallowedHelmet = RecipeGroup.RegisterGroup("AnyHallowedHelmet", group); // Hallowed Plate Mails - group = new RecipeGroup(() => "Any Hallowed Platemail", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.HallowedPlateMail)}", new int[] { ItemID.HallowedPlateMail, ItemID.AncientHallowedPlateMail @@ -397,14 +382,22 @@ namespace CalamityMod AnyHallowedPlatemail = RecipeGroup.RegisterGroup("AnyHallowedPlatemail", group); // Hallowed Greaves - group = new RecipeGroup(() => "Any Hallowed Greaves", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.HallowedGreaves)}", new int[] { ItemID.HallowedGreaves, ItemID.AncientHallowedGreaves }); AnyHallowedGreaves = RecipeGroup.RegisterGroup("AnyHallowedGreaves", group); - // Vanilla Luminite Pickaxes and Genesis Pickaxe + // Gold and Platinum Crowns for Feather Crown + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.GoldCrown)}", new int[] + { + ItemID.GoldCrown, + ItemID.PlatinumCrown + }); + AnyGoldCrown = RecipeGroup.RegisterGroup("AnyGoldCrown", group); + + // Vanilla Luminite Pickaxes and Genesis Pickaxe for Crystyl Crusher group = new RecipeGroup(() => "Any Lunar Pickaxe", new int[] { ItemID.SolarFlarePickaxe, @@ -415,7 +408,7 @@ namespace CalamityMod }); LunarPickaxe = RecipeGroup.RegisterGroup("LunarPickaxe", group); - // Luminite Hamaxes + // Luminite Hamaxes for Grax group = new RecipeGroup(() => "Any Lunar Hamaxe", new int[] { ItemID.LunarHamaxeSolar, @@ -426,7 +419,7 @@ namespace CalamityMod LunarHamaxe = RecipeGroup.RegisterGroup("LunarHamaxe", group); // Mana Flower+ for Ethereal Talisman - group = new RecipeGroup(() => "Any Mana Flower", new int[] + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.ManaFlower)}", new int[] { ItemID.ManaFlower, ItemID.ArcaneFlower, @@ -444,7 +437,24 @@ namespace CalamityMod }); QuiversGroup = RecipeGroup.RegisterGroup("QuiversGroup", group); - // Wings + // Tombstones for Grave Grimreaver + group = new RecipeGroup(() => $"{Language.GetTextValue("LegacyMisc.37")} {Lang.GetItemNameValue(ItemID.Tombstone)}", new int[] + { + ItemID.Tombstone, + ItemID.GraveMarker, + ItemID.CrossGraveMarker, + ItemID.Headstone, + ItemID.Gravestone, + ItemID.Obelisk, + ItemID.RichGravestone1, + ItemID.RichGravestone2, + ItemID.RichGravestone3, + ItemID.RichGravestone4, + ItemID.RichGravestone5 + }); + QuiversGroup = RecipeGroup.RegisterGroup("TombstonesGroup", group); + + // Wings for Seraph Tracers group = new RecipeGroup(() => "Any Wings", new int[] { ItemID.DemonWings, @@ -642,6 +652,66 @@ namespace CalamityMod AddCondition(Recipe.Condition.InGraveyardBiome). Register(); + Recipe.Create(ItemID.TendonHook). + AddIngredient(ItemID.WormHook). + AddTile(TileID.TinkerersWorkbench). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.WormHook). + AddIngredient(ItemID.TendonHook). + AddTile(TileID.TinkerersWorkbench). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.DartPistol). + AddIngredient(ItemID.DartRifle). + AddTile(TileID.Anvils). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.DartRifle). + AddIngredient(ItemID.DartPistol). + AddTile(TileID.Anvils). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.ChainGuillotines). + AddIngredient(ItemID.FetidBaghnakhs). + AddTile(TileID.Anvils). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.FetidBaghnakhs). + AddIngredient(ItemID.ChainGuillotines). + AddTile(TileID.Anvils). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.ClingerStaff). + AddIngredient(ItemID.SoulDrain). + AddTile(TileID.Anvils). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.SoulDrain). + AddIngredient(ItemID.ClingerStaff). + AddTile(TileID.Anvils). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.PutridScent). + AddIngredient(ItemID.FleshKnuckles). + AddTile(TileID.TinkerersWorkbench). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + + Recipe.Create(ItemID.FleshKnuckles). + AddIngredient(ItemID.PutridScent). + AddTile(TileID.TinkerersWorkbench). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + AddAstralClayRecipes(); AddBloodOrbPotionRecipes(); AddCookedFood(); @@ -711,9 +781,8 @@ namespace CalamityMod { Vanilla(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, { Vanilla(ItemID.TrueNightsEdge), TrueNightsEdgeRecipeEdit }, { Vanilla(ItemID.TrueExcalibur), ChangeIngredientStack(ItemID.ChlorophyteBar, 12) }, - { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 7) }, + { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 12) }, { Vanilla(ItemID.Zenith), AddIngredient(ModContent.ItemType(), 5) }, - { Vanilla(ItemID.Magiluminescence), MagiluminescenceRecipeEdit }, { Vanilla(ItemID.FireGauntlet), AddIngredient(ModContent.ItemType(), 5) }, { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, { VanillaEach(ItemID.BeetleHelmet, ItemID.BeetleScaleMail, ItemID.BeetleShell, ItemID.BeetleLeggings), SwapIngredients(0, 1) }, @@ -848,14 +917,6 @@ namespace CalamityMod r.ChangeIngredientStack(ItemID.SoulofFright, intendedStack); } - // Change Magiluminescence's recipe to require more ingredients - private static void MagiluminescenceRecipeEdit(Recipe r) - { - r.ChangeIngredientStack(ItemID.DemoniteBar, 20); - r.ChangeIngredientStack(ItemID.CrimtaneBar, 20); - r.ChangeIngredientStack(ItemID.Topaz, 15); - } - private static void WormFoodRecipeEdit(Recipe r) { r.ChangeIngredientStack(ItemID.VilePowder, 20); @@ -872,6 +933,8 @@ namespace CalamityMod #region Astral Clay private static void AddAstralClayRecipes() { + // Intentionally excluding Red Brick and Red Stucco recipes + // Bowl Recipe r = Recipe.Create(ItemID.Bowl); r.AddIngredient(ModContent.ItemType(), 2); @@ -880,15 +943,35 @@ namespace CalamityMod // Clay Pot r = Recipe.Create(ItemID.ClayPot); - r.AddIngredient(ModContent.ItemType(), 2); + r.AddIngredient(ModContent.ItemType(), 5); r.AddTile(TileID.Furnaces); r.Register(); // Pink Vase r = Recipe.Create(ItemID.PinkVase); + r.AddIngredient(ModContent.ItemType(), 4); + r.AddTile(TileID.Furnaces); + r.Register(); + + // Plate + r = Recipe.Create(ItemID.FoodPlatter); r.AddIngredient(ModContent.ItemType(), 2); r.AddTile(TileID.Furnaces); r.Register(); + + // Teapot + r = Recipe.Create(ItemID.TeaKettle); + r.AddIngredient(ModContent.ItemType(), 12); + r.AddIngredient(ItemID.Bone, 12); + r.AddTile(TileID.Furnaces); + r.Register(); + + // Wandering Jingasa + r = Recipe.Create(ItemID.RoninHat); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ItemID.Firefly, 3); // Does not use the recipe group in Vanilla + r.AddTile(TileID.Furnaces); + r.Register(); } #endregion @@ -939,18 +1022,32 @@ namespace CalamityMod ItemID.GenderChangePotion, ItemID.LovePotion, ItemID.StinkPotion, - ItemID.RecallPotion + ItemID.RecallPotion, + ItemID.PotionOfReturn, + ItemID.LuckPotionLesser }; Recipe r; foreach (var potion in potions) { r = Recipe.Create(potion); - r.AddIngredient(ModContent.ItemType(), 10); r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(ModContent.ItemType(), 10); r.AddTile(TileID.AlchemyTable); r.Register(); } + + r = Recipe.Create(ItemID.LuckPotion); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(ModContent.ItemType(), 20); + r.AddTile(TileID.AlchemyTable); + r.Register(); + + r = Recipe.Create(ItemID.LuckPotionGreater); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(ModContent.ItemType(), 30); + r.AddTile(TileID.AlchemyTable); + r.Register(); } #endregion @@ -967,14 +1064,9 @@ namespace CalamityMod r.AddTile(TileID.CookingPots); r.Register(); - r = Recipe.Create(ItemID.CookedFish); + r = Recipe.Create(ItemID.Sashimi); r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.CookingPots); - r.Register(); - - r = Recipe.Create(ItemID.CookedFish); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.CookingPots); + r.AddTile(TileID.WorkBenches); r.Register(); r = Recipe.Create(ItemID.CookedShrimp); @@ -982,10 +1074,51 @@ namespace CalamityMod r.AddTile(TileID.CookingPots); r.Register(); + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.SeafoodDinner); + r.AddIngredient(ModContent.ItemType(), 2); + r.AddTile(TileID.CookingPots); + r.Register(); + r = Recipe.Create(ItemID.Bacon); r.AddIngredient(ModContent.ItemType()); r.AddTile(TileID.CookingPots); r.Register(); + + r = Recipe.Create(ItemID.BowlofSoup); + r.AddIngredient(ItemID.Mushroom); + r.AddIngredient(ModContent.ItemType()); + r.AddTile(TileID.CookingPots); + r.Register(); } #endregion @@ -1154,11 +1287,18 @@ namespace CalamityMod r.AddTile(TileID.Anvils); r.Register(); + // Finch Staff + r = Recipe.Create(ItemID.BabyBirdStaff); + r.AddIngredient(ItemID.Bird); + r.AddRecipeGroup("Wood", 8); + r.AddTile(TileID.WorkBenches); + r.Register(); + // Starfury w/ Gold Broadsword r = Recipe.Create(ItemID.Starfury); r.AddIngredient(ItemID.GoldBroadsword); r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(ModContent.ItemType(), 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1166,21 +1306,21 @@ namespace CalamityMod r = Recipe.Create(ItemID.Starfury); r.AddIngredient(ItemID.PlatinumBroadsword); r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(ModContent.ItemType(), 3); r.AddTile(TileID.Anvils); r.Register(); // Enchanted Boomerang r = Recipe.Create(ItemID.EnchantedBoomerang); r.AddIngredient(ItemID.WoodenBoomerang); - r.AddIngredient(ModContent.ItemType(), 6); + r.AddIngredient(ModContent.ItemType(), 6); r.AddRecipeGroup(AnyGoldBar, 8); r.AddTile(TileID.Anvils); r.Register(); // Enchanted Sword r = Recipe.Create(ItemID.EnchantedSword); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ModContent.ItemType(), 10); r.AddRecipeGroup(AnyGoldBar, 12); r.AddIngredient(ItemID.Diamond); r.AddIngredient(ItemID.Ruby); @@ -1189,7 +1329,8 @@ namespace CalamityMod // Muramasa r = Recipe.Create(ItemID.Muramasa); - r.AddRecipeGroup(AnyCobaltBar, 15); + r.AddIngredient(ModContent.ItemType(), 7); + r.AddIngredient(ItemID.Bone, 10); r.AddTile(TileID.Anvils); r.Register(); @@ -1205,12 +1346,12 @@ namespace CalamityMod r = Recipe.Create(ItemID.SlimeStaff); r.AddRecipeGroup("Wood", 6); r.AddIngredient(ItemID.Gel, 40); - r.AddIngredient(ItemID.PinkGel, 10); r.AddTile(TileID.Anvils); r.Register(); // Ice Boomerang r = Recipe.Create(ItemID.IceBoomerang); + r.AddIngredient(ItemID.WoodenBoomerang); r.AddRecipeGroup(AnyIceBlock, 20); r.AddRecipeGroup(AnySnowBlock, 10); r.AddIngredient(ItemID.Shiverthorn); @@ -1230,16 +1371,22 @@ namespace CalamityMod r.AddTile(TileID.Anvils); r.Register(); + // Step Stool + r = Recipe.Create(ItemID.PortableStool); + r.AddRecipeGroup("Wood", 15); + r.AddTile(TileID.Sawmill); + r.Register(); + // Hermes Boots r = Recipe.Create(ItemID.HermesBoots); r.AddIngredient(ItemID.Silk, 10); - r.AddIngredient(ItemID.SwiftnessPotion, 2); + r.AddIngredient(ItemID.SwiftnessPotion, 5); r.AddTile(TileID.Loom); r.Register(); // Blizzard in a Bottle r = Recipe.Create(ItemID.BlizzardinaBottle); - r.AddIngredient(ItemID.Feather, 4); + r.AddIngredient(ItemID.Feather, 3); r.AddIngredient(ItemID.Bottle); r.AddRecipeGroup(AnySnowBlock, 50); r.AddTile(TileID.Anvils); @@ -1248,7 +1395,7 @@ namespace CalamityMod // Sandstorm in a Bottle r = Recipe.Create(ItemID.SandstorminaBottle); r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ItemID.Feather, 6); + r.AddIngredient(ItemID.Feather, 3); r.AddIngredient(ItemID.Bottle); r.AddIngredient(ItemID.SandBlock, 70); r.AddTile(TileID.Anvils); @@ -1264,7 +1411,7 @@ namespace CalamityMod r = Recipe.Create(ItemID.FlyingCarpet); r.AddIngredient(ItemID.Silk, 10); r.AddIngredient(ModContent.ItemType(), 3); - r.AddIngredient(ModContent.ItemType(), 5); + r.AddIngredient(ModContent.ItemType(), 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1285,7 +1432,7 @@ namespace CalamityMod // Water Walking Boots r = Recipe.Create(ItemID.WaterWalkingBoots); r.AddIngredient(ItemID.Leather, 5); - r.AddIngredient(ItemID.WaterWalkingPotion, 8); + r.AddIngredient(ItemID.WaterWalkingPotion, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1313,14 +1460,14 @@ namespace CalamityMod // Shiny Red Balloon r = Recipe.Create(ItemID.ShinyRedBalloon); r.AddIngredient(ItemID.WhiteString); - r.AddIngredient(ItemID.Gel, 80); - r.AddIngredient(ItemID.Cloud, 40); + r.AddIngredient(ItemID.Gel, 60); + r.AddIngredient(ItemID.Cloud, 20); r.AddTile(TileID.Solidifier); r.Register(); // Lava Charm r = Recipe.Create(ItemID.LavaCharm); - r.AddIngredient(ItemID.LavaBucket, 5); + r.AddIngredient(ItemID.LavaBucket, 3); r.AddIngredient(ItemID.Obsidian, 25); r.AddRecipeGroup(AnyGoldBar, 5); r.AddTile(TileID.Anvils); @@ -1349,10 +1496,9 @@ namespace CalamityMod // Metal Detector r = Recipe.Create(ItemID.MetalDetector); r.AddIngredient(ItemID.Wire, 10); - r.AddIngredient(ItemID.GoldDust, 5); r.AddIngredient(ItemID.SpelunkerGlowstick, 5); - r.AddRecipeGroup(AnyGoldBar, 5); - r.AddTile(TileID.MythrilAnvil); + r.AddRecipeGroup(AnyCopperBar, 5); + r.AddTile(TileID.Anvils); r.Register(); // DPS Meter @@ -1459,63 +1605,54 @@ namespace CalamityMod r = Recipe.Create(ItemID.ShroomiteHelmet); r.AddIngredient(ItemID.ChlorophyteHelmet); r.AddIngredient(ItemID.GlowingMushroom, 60); - r.AddIngredient(); - r.AddTile(TileID.MythrilAnvil); + r.AddTile(TileID.Autohammer); r.Register(); r = Recipe.Create(ItemID.ShroomiteHeadgear); r.AddIngredient(ItemID.ChlorophyteHelmet); r.AddIngredient(ItemID.GlowingMushroom, 60); - r.AddIngredient(); - r.AddTile(TileID.MythrilAnvil); + r.AddTile(TileID.Autohammer); r.Register(); r = Recipe.Create(ItemID.ShroomiteMask); r.AddIngredient(ItemID.ChlorophyteHelmet); r.AddIngredient(ItemID.GlowingMushroom, 60); - r.AddIngredient(); - r.AddTile(TileID.MythrilAnvil); + r.AddTile(TileID.Autohammer); r.Register(); r = Recipe.Create(ItemID.ShroomiteBreastplate); r.AddIngredient(ItemID.ChlorophytePlateMail); r.AddIngredient(ItemID.GlowingMushroom, 120); - r.AddIngredient(); - r.AddTile(TileID.MythrilAnvil); + r.AddTile(TileID.Autohammer); r.Register(); r = Recipe.Create(ItemID.ShroomiteLeggings); r.AddIngredient(ItemID.ChlorophyteGreaves); r.AddIngredient(ItemID.GlowingMushroom, 80); - r.AddIngredient(); - r.AddTile(TileID.MythrilAnvil); + r.AddTile(TileID.Autohammer); r.Register(); r = Recipe.Create(ItemID.SpectreHood); r.AddIngredient(ItemID.ChlorophyteHeadgear); r.AddIngredient(ItemID.Ectoplasm, 6); - r.AddIngredient(); r.AddTile(TileID.MythrilAnvil); r.Register(); r = Recipe.Create(ItemID.SpectreMask); r.AddIngredient(ItemID.ChlorophyteHeadgear); r.AddIngredient(ItemID.Ectoplasm, 6); - r.AddIngredient(); r.AddTile(TileID.MythrilAnvil); r.Register(); r = Recipe.Create(ItemID.SpectreRobe); r.AddIngredient(ItemID.ChlorophytePlateMail); r.AddIngredient(ItemID.Ectoplasm, 12); - r.AddIngredient(); r.AddTile(TileID.MythrilAnvil); r.Register(); r = Recipe.Create(ItemID.SpectrePants); r.AddIngredient(ItemID.ChlorophyteGreaves); r.AddIngredient(ItemID.Ectoplasm, 9); - r.AddIngredient(); r.AddTile(TileID.MythrilAnvil); r.Register(); @@ -1548,8 +1685,8 @@ namespace CalamityMod // Bezoar (poison) r = Recipe.Create(ItemID.Bezoar); - r.AddIngredient(ItemID.Stinger, 15); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(ItemID.Stinger, 7); r.AddTile(TileID.Anvils); r.Register(); @@ -1653,11 +1790,8 @@ namespace CalamityMod { // Celestial Magnet Recipe r = Recipe.Create(ItemID.CelestialMagnet); - r.AddIngredient(ItemID.FallenStar, 20); - r.AddIngredient(ItemID.SoulofMight, 10); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddIngredient(ItemID.SoulofNight, 5); - r.AddRecipeGroup(AnyCobaltBar, 3); + r.AddIngredient(ItemID.TreasureMagnet); + r.AddIngredient(ItemID.FallenStar, 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1682,7 +1816,7 @@ namespace CalamityMod r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ItemID.TrueExcalibur); r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(ModContent.ItemType(), 7); + r.AddIngredient(ModContent.ItemType(), 12); r.AddTile(TileID.MythrilAnvil); r.Register(); diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 5f2a6fd842..0ac1ae059b 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -319,7 +319,7 @@ namespace CalamityMod start -= Main.screenPosition; end -= Main.screenPosition; - Texture2D line = ModContent.Request("InfernumMode/ExtraTextures/Line").Value; + Texture2D line = ModContent.Request("CalamityMod/ExtraTextures/Line").Value; float rotation = (end - start).ToRotation(); Vector2 scale = new Vector2(Vector2.Distance(start, end) / line.Width, width); @@ -674,5 +674,75 @@ namespace CalamityMod 1); } } + + /// + /// Draws an item in the inventory with a new texture to replace a previous one. + /// Useful in situations where for example, a different sprite is used for the "real" inventory sprite so it may appear when the player is using it. + /// + /// + /// + /// + /// + /// + /// + /// + public static void DrawNewInventorySprite(this SpriteBatch spriteBatch, Texture2D newTexture, Vector2 originalSize, Vector2 position, Color drawColor, Vector2 origin, float scale, Vector2? offset = null) + { + Vector2 extraOffset; + if (offset == null) + extraOffset = Vector2.Zero; + else + extraOffset = offset.GetValueOrDefault(); + + float largestDimensionOriginal = Math.Max(originalSize.X, originalSize.Y); + float largestDimensionNew = Math.Max(newTexture.Width, newTexture.Height); + + //Scale the sprite so it will account for the dimension of the new sprite if it is larger than the old one (As in, we need to scale down the scale or else it will be too large) + float scaleRatio = Math.Min(largestDimensionOriginal / largestDimensionNew, 1); + + //Offset the jellyfish sprite properly, since the fishing rod is larger than the jellyfish (Jellyfish width : 28px, Fishing rod width : 42) + Vector2 positionOffset = Vector2.Zero; + + if (originalSize.X > newTexture.Width) + positionOffset.X = (originalSize.X - newTexture.Width) / 2f; + + positionOffset *= scale; + + spriteBatch.Draw(newTexture, position + positionOffset + extraOffset, null, drawColor, 0f, origin, scale * scaleRatio, 0, 0); + } + + + public delegate void ChromaAberrationDelegate(Vector2 offset, Color colorMult); + //Thanks spirit <3 + /// + /// Draws a chromatic abberation effect. + /// + /// The direction of the abberation + /// The strenght of the abberation + /// The draw call itself. + public static void DrawChromaticAberration(Vector2 direction, float strength, ChromaAberrationDelegate drawCall) + { + for (int i = -1; i <= 1; i++) + { + Color aberrationColor = Color.White; + switch (i) + { + case -1: + aberrationColor = new Color(255, 0, 0, 0); + break; + case 0: + aberrationColor = new Color(0, 255, 0, 0); + break; + case 1: + aberrationColor = new Color(0, 0, 255, 0); + break; + } + + Vector2 offset = direction.RotatedBy(MathHelper.PiOver2) * i; + offset *= strength; + + drawCall.Invoke(offset, aberrationColor); + } + } } } diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 887b21c37f..7dc03fdc21 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -2,13 +2,16 @@ using System.Collections.Generic; using CalamityMod.Items.Accessories; using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.Items.Potions; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.ItemDropRules; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Utilities; namespace CalamityMod { @@ -63,7 +66,14 @@ namespace CalamityMod maxQuantity = max; } - internal int ChooseQuantity() => Main.rand.Next(minQuantity, maxQuantity + 1); + internal int ChooseQuantity(UnifiedRandom rng) => rng.Next(minQuantity, maxQuantity + 1); + + // Allow for implicitly casting integer item IDs into weighted item stacks. + // Stack size is assumed to be 1. Weight is assumed to be default. + public static implicit operator WeightedItemStack(int id) + { + return new WeightedItemStack(id, DefaultWeight, 1); + } } #endregion @@ -101,16 +111,28 @@ namespace CalamityMod public static readonly Fraction BagWeaponDropRateFraction = new(1, BagWeaponDropRateInt); #endregion + #region Bestiary Text + public static string FirstKillText = "Drops only on the first kill"; + public static string BloodMoonText = "Drops during the Blood Moon"; + public static string MechBossText = "Drops on the first kill of the final Mechanical Boss"; + public static string SentinelText = "Drops on the first kill of the final Sentinel of the Devourer"; + public static string ProvidenceHallowText = "Drops if Providence was summoned in the Hallow\nor if Providence is only attacked during nighttime"; + public static string ProvidenceUnderworldText = "Drops if Providence was summoned in the Underworld\nor if Providence is only attacked during nighttime"; + public static string ProvidenceNightText = "Drops if Providence is only attacked during nighttime"; + public static string ProvidenceChallengeText = $"Drops if Providence was defeated only with the [i:{ModContent.ItemType()}] Profaned Soul Artifact\nThis is an Expert Mode drop rate"; + #endregion + #region Block Drops private static int[] AllLoadedItemIDs = null; /// /// Adds the specified items to TML's blockLoot list. Items on the list cannot spawn in the world via any means.
/// You should only use this function in the following places:
- /// - GlobalItem.PreOpenVanillaBag (blocking items from treasure bags, fishing crates, etc.)
- /// - GlobalNPC.PreKill or GlobalNPC.OnKill (blocking items from NPCs based on temporary conditions)

+ /// - ModNPC.PreKill and GlobalNPC.PreKill
+ /// - ModNPC.OnKill and GlobalNPC.OnKill

+ /// This function is intended to block items from dropping from NPCs based on TEMPORARY CONDITIONS.
/// If you want to permanently remove a drop from an NPC, this is not the function you want.
- /// In those cases, use GlobalNPC.ModifyLoot, an if statement for that NPC, and npcLoot.Remove or npcLoot.RemoveWhere.
+ /// In those cases, use GlobalNPC.ModifyLoot, an if statement for that NPC, and loot.Remove or loot.RemoveWhere.
/// This will ensure that the drops are removed from the bestiary as well. ///
/// The item IDs to prevent from spawning. @@ -209,15 +231,17 @@ namespace CalamityMod /// Shorthand for shorthand: Registers an item to drop per-player on the specified condition.
/// Intended for lore items, but can be used generally for instanced drops. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which evaluates in real-time to the condition that needs to be checked. /// The item ID to drop. + /// Whether drops registered with this condition appear in the Bestiary. Defaults to true. + /// The description of this condition in the Bestiary. Defaults to null. /// A LeadingConditionRule which you can attach more PerPlayer or other rules to as you want. - public static LeadingConditionRule AddConditionalPerPlayer(this NPCLoot npcLoot, Func lambda, int itemID) + public static LeadingConditionRule AddConditionalPerPlayer(this ILoot loot, Func lambda, int itemID, bool ui = true, string desc = null) { - LeadingConditionRule lcr = new(If(lambda)); + LeadingConditionRule lcr = new(If(lambda, ui, desc)); lcr.Add(PerPlayer(itemID)); - npcLoot.Add(lcr); + loot.Add(lcr); return lcr; } @@ -225,15 +249,17 @@ namespace CalamityMod /// Shorthand for shorthand: Registers an item to drop per-player on the specified condition.
/// Intended for lore items, but can be used generally for instanced drops. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which evaluates in real-time to the condition that needs to be checked. /// The item ID to drop. + /// Whether drops registered with this condition appear in the Bestiary. Defaults to true. + /// The description of this condition in the Bestiary. Defaults to null. /// A LeadingConditionRule which you can attach more PerPlayer or other rules to as you want. - public static LeadingConditionRule AddConditionalPerPlayer(this NPCLoot npcLoot, Func lambda, int itemID) + public static LeadingConditionRule AddConditionalPerPlayer(this ILoot loot, Func lambda, int itemID, bool ui = true, string desc = null) { - LeadingConditionRule lcr = new(If(lambda)); + LeadingConditionRule lcr = new(If(lambda, ui, desc)); lcr.Add(PerPlayer(itemID)); - npcLoot.Add(lcr); + loot.Add(lcr); return lcr; } @@ -244,16 +270,57 @@ namespace CalamityMod return new DropBasedOnExpertMode(normalRule, expertRule); } - public static bool DropRevBagAccessories(IEntitySource source, Player p) + /// + /// Adds the Revengeance Mode bag accessories to the given loot table. + /// + /// The ILoot interface for the loot table. + public static void AddRevBagAccessories(this ILoot loot) { - return DropItemFromSetCondition(source, p, CalamityWorld.revenge, 0.05f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); + var lcr = new LeadingConditionRule(If(() => CalamityWorld.revenge)); + lcr.Add(new OneFromOptionsDropRule(20, 1, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType())); + loot.Add(lcr); + } + + /// + /// Adds all the common potions for fishing crates, alongside scaling mana and regen potions + /// + /// The ILoot interface for the loot table. + public static void AddCratePotionRules(this ILoot loot) + { + loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3); + loot.Add(ItemID.SwiftnessPotion, 10, 1, 3); + loot.Add(ItemID.IronskinPotion, 10, 1, 3); + loot.Add(ItemID.NightOwlPotion, 10, 1, 3); + loot.Add(ItemID.ShinePotion, 10, 1, 3); + loot.Add(ItemID.MiningPotion, 10, 1, 3); + loot.Add(ItemID.HeartreachPotion, 10, 1, 3); + loot.Add(ItemID.TrapsightPotion, 10, 1, 3); // Dangersense Potion + + // Define all the loot rules for the potion types + var supremePots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ModContent.ItemType(), ModContent.ItemType()); + var superPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.SuperHealingPotion, ItemID.SuperManaPotion); + var greaterPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.GreaterHealingPotion, ItemID.GreaterManaPotion); + var regularPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.HealingPotion, ItemID.ManaPotion); + var lesserPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.LesserHealingPotion, ItemID.LesserManaPotion); + + // Chained LeadingConditionRules achieve the equivalent of "if killed X, else if killed Y, else if killed Z, else..." + var lcrSupremePotion = loot.DefineConditionalDropSet(() => DownedBossSystem.downedDoG); + var lcrSuperPotion = new LeadingConditionRule(If(() => DownedBossSystem.downedProvidence)); + var lcrGreaterPotion = new LeadingConditionRule(If(() => NPC.downedMechBossAny)); + var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3)); + + // Actually chain all the LCRs together + lcrSupremePotion.Add(supremePots); + lcrSupremePotion.OnFailedConditions(lcrSuperPotion); + lcrSuperPotion.Add(superPots); + lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); + lcrGreaterPotion.Add(greaterPots); + lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + lcrRegularPotion.Add(regularPots); + lcrRegularPotion.OnFailedConditions(lesserPots); } #endregion - // - // FOLLOWING SECTION: 1.4 LOOT CODE (bestiary compatible) - // - #region Recursive Drop Rate Mutator private static int RecursivelyMutateDropRate(this IItemDropRule rule, int itemID, int newNumerator, int newDenominator) { @@ -306,6 +373,42 @@ namespace CalamityMod public string GetConditionDescription() => description; } + internal class LambdaDropRuleCondition2 : IItemDropRuleCondition + { + private readonly Func conditionLambda; + private readonly Func visibleInUI; + private readonly string description; + + internal LambdaDropRuleCondition2(Func lambda, Func ui, string desc = null) + { + conditionLambda = lambda; + visibleInUI = ui; + description = desc; + } + + public bool CanDrop(DropAttemptInfo info) => conditionLambda(info); + public bool CanShowItemDropInUI() => visibleInUI(); + public string GetConditionDescription() => description; + } + + internal class LambdaDropRuleCondition3 : IItemDropRuleCondition + { + private readonly Func conditionLambda; + private readonly Func visibleInUI; + private readonly Func description; + + internal LambdaDropRuleCondition3(Func lambda, Func ui, Func desc) + { + conditionLambda = lambda; + visibleInUI = ui; + description = desc; + } + + public bool CanDrop(DropAttemptInfo info) => conditionLambda(info); + public bool CanShowItemDropInUI() => visibleInUI(); + public string GetConditionDescription() => description(); + } + /// /// Creates a new LambdaDropRuleCondition which executes the code of your choosing to decide whether this item drop should occur.
/// This version of "If" does NOT use the DropAttemptInfo struct that is available.
@@ -329,6 +432,16 @@ namespace CalamityMod bool LambdaInfoWrapper(DropAttemptInfo _) => lambda(); return new LambdaDropRuleCondition(LambdaInfoWrapper, ui, desc); } + public static IItemDropRuleCondition If(Func lambda, Func ui, string desc = null) + { + bool LambdaInfoWrapper(DropAttemptInfo _) => lambda(); + return new LambdaDropRuleCondition2(LambdaInfoWrapper, ui, desc); + } + public static IItemDropRuleCondition If(Func lambda, Func ui, Func desc) + { + bool LambdaInfoWrapper(DropAttemptInfo _) => lambda(); + return new LambdaDropRuleCondition3(LambdaInfoWrapper, ui, desc); + } /// /// Creates a new LambdaDropRuleCondition which executes the code of your choosing to decide whether this item drop should occur.
@@ -350,6 +463,14 @@ namespace CalamityMod { return new LambdaDropRuleCondition(lambda, ui, desc); } + public static IItemDropRuleCondition If(Func lambda, Func ui, string desc = null) + { + return new LambdaDropRuleCondition2(lambda, ui, desc); + } + public static IItemDropRuleCondition If(Func lambda, Func ui, Func desc) + { + return new LambdaDropRuleCondition3(lambda, ui, desc); + } #endregion #region Drop Rule Conditions @@ -474,6 +595,71 @@ namespace CalamityMod } return trasherNearby; }); + // The text is a separate rule so it doesn't show up on the non-Trasher Fishing Rod drop which only occurs if the Angler is not fed to a Trasher + public static IItemDropRuleCondition TrasherText = If((info) => true, true, "Drops if fed to a Trasher"); + + public static IItemDropRuleCondition RevNoMaster = If((info) => !Main.masterMode && CalamityWorld.revenge, () => !Main.masterMode && CalamityWorld.revenge, "This is a Revengeance Mode drop rate"); + public static IItemDropRuleCondition RevAndMaster = If((info) => Main.masterMode || CalamityWorld.revenge, () => Main.masterMode || CalamityWorld.revenge, () => + { + return Main.masterMode ? Language.GetTextValue("Bestiary_ItemDropConditions.IsMasterMode") : "This is a Revengeance Mode drop rate"; + }); + + #region Boss Defeat Conditionals + public static IItemDropRuleCondition PostKS(bool ui = true) => If(() => NPC.downedSlimeKing, ui, "Drops after defeating King Slime"); + public static IItemDropRuleCondition PostDS(bool ui = true) => If(() => DownedBossSystem.downedDesertScourge, ui, "Drops after defeating the Desert Scourge"); + public static IItemDropRuleCondition PostEoC(bool ui = true) => If(() => NPC.downedBoss1, ui, "Drops after defeating the Eye of Cthulhu"); + public static IItemDropRuleCondition PostCrab(bool ui = true) => If(() => DownedBossSystem.downedCrabulon, ui, "Drops after defeating Crabulon"); + public static IItemDropRuleCondition PostEvil1(bool ui = true) => If(() => NPC.downedBoss2, ui, "Drops after defeating the " + (WorldGen.crimson ? "Brain of Cthulhu" : "Eater of Worlds")); + public static IItemDropRuleCondition PostHM(bool ui = true) => If(() => DownedBossSystem.downedHiveMind, ui, "Drops after defeating the Hive Mind"); + public static IItemDropRuleCondition PostPerfs(bool ui = true) => If(() => DownedBossSystem.downedPerforator, ui, "Drops after defeating the Perforators"); + public static IItemDropRuleCondition PostEvil2(bool ui = true) => If(() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator, ui, "Drops after defeating the " + (WorldGen.crimson ? "Perforators" : "Hive Mind")); + public static IItemDropRuleCondition PostQB(bool ui = true) => If(() => NPC.downedQueenBee, ui, "Drops after defeating the Queen Bee"); + public static IItemDropRuleCondition PostDeer(bool ui = true) => If(() => NPC.downedDeerclops, ui, "Drops after defeating Deerclops"); + public static IItemDropRuleCondition PostSkele(bool ui = true) => If(() => NPC.downedBoss3, ui, "Drops after defeating Skeletron"); + public static IItemDropRuleCondition PostSG(bool ui = true) => If(() => DownedBossSystem.downedSlimeGod, ui, "Drops after defeating the Slime God"); + public static IItemDropRuleCondition Hardmode(bool ui = true) => If(() => Main.hardMode, ui, "Drops in Hardmode"); + public static IItemDropRuleCondition PostQS(bool ui = true) => If(() => NPC.downedQueenSlime, ui, "Drops after defeating Queen Slime"); + public static IItemDropRuleCondition PostCryo(bool ui = true) => If(() => DownedBossSystem.downedCryogen, ui, "Drops after defeating Cryogen"); + public static IItemDropRuleCondition PostAS(bool ui = true) => If(() => DownedBossSystem.downedAquaticScourge, ui, "Drops after defeating the Aquatic Scourge"); + public static IItemDropRuleCondition PostBrim(bool ui = true) => If(() => DownedBossSystem.downedBrimstoneElemental, ui, "Drops after defeating the Brimstone Elemental"); + public static IItemDropRuleCondition PostDest(bool ui = true) => If(() => NPC.downedMechBoss1, ui, "Drops after defeating the Destroyer"); + public static IItemDropRuleCondition PostTwins(bool ui = true) => If(() => NPC.downedMechBoss2, ui, "Drops after defeating the Twins"); + public static IItemDropRuleCondition PostSP(bool ui = true) => If(() => NPC.downedMechBoss3, ui, "Drops after defeating Skeletron Prime"); + public static IItemDropRuleCondition Post1Mech(bool ui = true) => If(() => NPC.downedMechBossAny, ui, "Drops after defeating a Mechanical Boss"); + public static IItemDropRuleCondition Post3Mechs(bool ui = true) => If(() => NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3, ui, "Drops after defeating all three Mechanical Bosses"); + public static IItemDropRuleCondition PostCal(bool ui = true) => If(() => DownedBossSystem.downedCalamitas, ui, "Drops after defeating Calamitas"); + public static IItemDropRuleCondition PostPlant(bool ui = true) => If(() => NPC.downedPlantBoss, ui, "Drops after defeating Plantera"); + public static IItemDropRuleCondition PostCalPlant(bool ui = true) => If(() => DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, ui, "Drops after defeating Calamitas or Plantera"); + public static IItemDropRuleCondition PostLevi(bool ui = true) => If(() => DownedBossSystem.downedLeviathan, ui, "Drops after defeating the Leviathan and Anahita"); + public static IItemDropRuleCondition PostAureus(bool ui = true) => If(() => DownedBossSystem.downedAstrumAureus, ui, "Drops after defeating Astrum Aureus"); + public static IItemDropRuleCondition PostGolem(bool ui = true) => If(() => NPC.downedGolemBoss, ui, "Drops after defeating Golem"); + public static IItemDropRuleCondition PostPBG(bool ui = true) => If(() => DownedBossSystem.downedPlaguebringer, ui, "Drops after defeating the Plaguebringer Goliath"); + public static IItemDropRuleCondition PostEoL(bool ui = true) => If(() => NPC.downedEmpressOfLight, ui, "Drops after defeating the Empress of Light"); + public static IItemDropRuleCondition PostFish(bool ui = true) => If(() => NPC.downedFishron, ui, "Drops after defeating Duke Fishron"); + public static IItemDropRuleCondition PostRav(bool ui = true) => If(() => DownedBossSystem.downedRavager, ui, "Drops after defeating the Ravager"); + public static IItemDropRuleCondition PostLC(bool ui = true) => If(() => NPC.downedAncientCultist, ui, "Drops after defeating the Lunatic Cultist"); + public static IItemDropRuleCondition PostAD(bool ui = true) => If(() => DownedBossSystem.downedAstrumDeus, ui, "Drops after defeating Astrum Deus"); + public static IItemDropRuleCondition PostML(bool ui = true) => If(() => NPC.downedMoonlord, ui, "Drops after defeating the Moon Lord"); + public static IItemDropRuleCondition PostGuard(bool ui = true) => If(() => DownedBossSystem.downedGuardians, ui, "Drops after defeating the Profaned Guardian"); + public static IItemDropRuleCondition PostBirb(bool ui = true) => If(() => DownedBossSystem.downedDragonfolly, ui, "Drops after defeating the Dragonfolly"); + public static IItemDropRuleCondition PostProv(bool ui = true) => If(() => DownedBossSystem.downedProvidence, ui, "Drops after defeating Providence"); + public static IItemDropRuleCondition PostSig(bool ui = true) => If(() => DownedBossSystem.downedSignus, ui, "Drops after defeating Signus"); + public static IItemDropRuleCondition PostSW(bool ui = true) => If(() => DownedBossSystem.downedStormWeaver, ui, "Drops after defeating the Storm Weaver"); + public static IItemDropRuleCondition PostCV(bool ui = true) => If(() => DownedBossSystem.downedCeaselessVoid, ui, "Drops after defeating the Ceaseless Void"); + public static IItemDropRuleCondition PostPolter(bool ui = true) => If(() => DownedBossSystem.downedPolterghast, ui, "Drops after defeating the Polterghast"); + public static IItemDropRuleCondition PostOD(bool ui = true) => If(() => DownedBossSystem.downedBoomerDuke, ui, "Drops after defeating the Old Duke"); + public static IItemDropRuleCondition PostDoG(bool ui = true) => If(() => DownedBossSystem.downedDoG, ui, "Drops after defeating the Devourer of Gods"); + public static IItemDropRuleCondition PostYharon(bool ui = true) => If(() => DownedBossSystem.downedYharon, ui, "Drops after defeating Yharon"); + public static IItemDropRuleCondition PostExos(bool ui = true) => If(() => DownedBossSystem.downedExoMechs, ui, "Drops after defeating the Exo Mechs"); + public static IItemDropRuleCondition PostSCal(bool ui = true) => If(() => DownedBossSystem.downedSCal, ui, "Drops after defeating Supreme Calamitas"); + public static IItemDropRuleCondition PostAEW(bool ui = true) => If(() => DownedBossSystem.downedAdultEidolonWyrm, ui, "Drops after defeating the Adult Eidolon Wyrm"); + public static IItemDropRuleCondition PostClam(bool ui = true) => If(() => DownedBossSystem.downedCLAM, ui, "Drops after defeating the Giant Clam"); + public static IItemDropRuleCondition PostClamHM(bool ui = true) => If(() => DownedBossSystem.downedCLAMHardMode, ui, "Drops after defeating the Giant Clam in Hardmode"); + public static IItemDropRuleCondition PostGSS(bool ui = true) => If(() => DownedBossSystem.downedGSS, ui, "Drops after defeating the Great Sand Shark"); + public static IItemDropRuleCondition PostBetsy(bool ui = true) => If(() => DownedBossSystem.downedBetsy, ui, "Drops after defeating Betsy"); + public static IItemDropRuleCondition PostT1AR(bool ui = true) => If(() => DownedBossSystem.downedEoCAcidRain, ui, "Drops after defeating the first tier of Acid Rain"); + public static IItemDropRuleCondition PostT2AR(bool ui = true) => If(() => DownedBossSystem.downedAquaticScourgeAcidRain, ui, "Drops after defeating the second tier of Acid Rain"); + #endregion #endregion #region Leading Condition Rule Extensions @@ -518,148 +704,298 @@ namespace CalamityMod { return mainRule.OnSuccess(new CommonDrop(itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator), hideLootReport); } + + /// + /// Shorthand to add an arbitrary conditional drop to the given LeadingConditionRule. + /// + /// The LeadingConditionRule which should drop this item as one of its chains. + /// A lambda which evaluates in real-time to the condition that needs to be checked. + /// The item to drop. + /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// Set to true for this drop to not appear in the Bestiary. + /// The description of this condition in the Bestiary. Defaults to null. + /// The item drop rule registered. + public static IItemDropRule AddIf(this LeadingConditionRule mainRule, Func lambda, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1, bool hideLootReport = false, string desc = null) + { + return mainRule.OnSuccess(ItemDropRule.ByCondition(If(lambda, true, desc), itemID, dropRateInt, minQuantity, maxQuantity), hideLootReport); + } + + /// + /// Shorthand to add an arbitrary conditional drop to the given LeadingConditionRule using a Fraction drop rate. + /// + /// The LeadingConditionRule which should drop this item as one of its chains. + /// A lambda which evaluates in real-time to the condition that needs to be checked. + /// The item to drop. + /// The chance that the item will drop as a DropHelper Fraction. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// Set to true for this drop to not appear in the Bestiary. + /// The description of this condition in the Bestiary. Defaults to null. + /// The item drop rule registered. + public static IItemDropRule AddIf(this LeadingConditionRule mainRule, Func lambda, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1, bool hideLootReport = false, string desc = null) + { + return mainRule.OnSuccess(ItemDropRule.ByCondition(If(lambda, true, desc), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator), hideLootReport); + } + + /// + /// Shorthand to add an arbitrary conditional drop to the given LeadingConditionRule.
+ /// This version requires a lambda which uses DropAttemptInfo. + ///
+ /// The LeadingConditionRule which should drop this item as one of its chains. + /// A lambda which takes a DropAttemptInfo struct and evaluates in real-time to the condition that needs to be checked. + /// The item to drop. + /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// Set to true for this drop to not appear in the Bestiary. + /// The description of this condition in the Bestiary. Defaults to null. + /// The item drop rule registered. + public static IItemDropRule AddIf(this LeadingConditionRule mainRule, Func lambda, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1, bool hideLootReport = false, string desc = null) + { + return mainRule.OnSuccess(ItemDropRule.ByCondition(If(lambda, true, desc), itemID, dropRateInt, minQuantity, maxQuantity), hideLootReport); + } + + /// + /// Shorthand to add an arbitrary conditional drop to the given LeadingConditionRule using a Fraction drop rate.
+ /// This version requires a lambda which uses DropAttemptInfo. + ///
+ /// The LeadingConditionRule which should drop this item as one of its chains. + /// A lambda which takes a DropAttemptInfo struct and evaluates in real-time to the condition that needs to be checked. + /// The item to drop. + /// The chance that the item will drop as a DropHelper Fraction. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// Set to true for this drop to not appear in the Bestiary. + /// The description of this condition in the Bestiary. Defaults to null. + /// The item drop rule registered. + public static IItemDropRule AddIf(this LeadingConditionRule mainRule, Func lambda, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1, bool hideLootReport = false, string desc = null) + { + return mainRule.OnSuccess(ItemDropRule.ByCondition(If(lambda, true, desc), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator), hideLootReport); + } + + /// + /// Adds any given drop rule as a chained rule to the given LeadingConditionRule. + /// + /// The LeadingConditionRule which should have another drop rule registered as one of its chains. + /// The drop rule which should occur given this leading condition. + /// Set to true for this drop to not appear in the Bestiary. + /// The LeadingConditionRule (first parameter). + public static IItemDropRule AddFail(this LeadingConditionRule mainRule, IItemDropRule chainedRule, bool hideLootReport = false) + { + return mainRule.OnFailedConditions(chainedRule, hideLootReport); + } + + /// + /// Shorthand to add a simple drop to the given LeadingConditionRule. + /// + /// The LeadingConditionRule which should drop this item as one of its chains. + /// The item to drop. + /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// Set to true for this drop to not appear in the Bestiary. + /// The LeadingConditionRule (first parameter). + public static IItemDropRule AddFail(this LeadingConditionRule mainRule, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1, bool hideLootReport = false) + { + return mainRule.OnFailedConditions(ItemDropRule.Common(itemID, dropRateInt, minQuantity, maxQuantity), hideLootReport); + } + + /// + /// Shorthand to add a simple drop to the given LeadingConditionRule using a Fraction drop rate. + /// + /// The LeadingConditionRule which should drop this item as one of its chains. + /// The item to drop. + /// The chance that the item will drop as a DropHelper Fraction. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// Set to true for this drop to not appear in the Bestiary. + /// The LeadingConditionRule (first parameter). + public static IItemDropRule AddFail(this LeadingConditionRule mainRule, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1, bool hideLootReport = false) + { + return mainRule.OnFailedConditions(new CommonDrop(itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator), hideLootReport); + } #endregion - #region NPCLoot Extensions + #region ILoot Extensions /// - /// Shorthand to add a simple drop to an NPC. + /// Shorthand to add a simple drop to a loot table. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The item to drop. /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. /// The item drop rule registered. - public static IItemDropRule Add(this NPCLoot npcLoot, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule Add(this ILoot loot, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) { - return npcLoot.Add(ItemDropRule.Common(itemID, dropRateInt, minQuantity, maxQuantity)); + return loot.Add(ItemDropRule.Common(itemID, dropRateInt, minQuantity, maxQuantity)); } /// - /// Shorthand to add a simple drop to an NPC using a Fraction drop rate. + /// Shorthand to add a simple drop to a loot table using a Fraction drop rate. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The item to drop. /// The chance that the item will drop as a DropHelper Fraction. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. /// The item drop rule registered. - public static IItemDropRule Add(this NPCLoot npcLoot, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule Add(this ILoot loot, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) { - return npcLoot.Add(new CommonDrop(itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); + return loot.Add(new CommonDrop(itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); } /// - /// Shorthand to add an arbitrary conditional drop to an NPC. + /// Shorthand to add an arbitrary conditional drop to a loot table. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. + /// An IItemDropRuleCondition which encapsulates the condition which needs to be checked in real-time. + /// The item to drop. + /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// The item drop rule registered. + public static IItemDropRule AddIf(this ILoot loot, IItemDropRuleCondition cond, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) + { + return loot.Add(ItemDropRule.ByCondition(cond, itemID, dropRateInt, minQuantity, maxQuantity)); + } + + /// + /// Shorthand to add an arbitrary conditional drop to a loot table using a Fraction drop rate. + /// + /// The ILoot interface for the loot table. + /// An IItemDropRuleCondition which encapsulates the condition which needs to be checked in real-time. + /// The item to drop. + /// The chance that the item will drop as a DropHelper Fraction. + /// The minimum number of items to drop. Defaults to 1. + /// The maximum number of items to drop. Defaults to 1. + /// The item drop rule registered. + public static IItemDropRule AddIf(this ILoot loot, IItemDropRuleCondition cond, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) + { + return loot.Add(ItemDropRule.ByCondition(cond, itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); + } + + /// + /// Shorthand to add an arbitrary conditional drop to a loot table. + /// + /// The ILoot interface for the loot table. /// A lambda which evaluates in real-time to the condition that needs to be checked. /// The item to drop. /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. + /// Whether drops registered with this condition appear in the Bestiary. Defaults to true. + /// The description of this condition in the Bestiary. Defaults to null. /// The item drop rule registered. - public static IItemDropRule AddIf(this NPCLoot npcLoot, Func lambda, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule AddIf(this ILoot loot, Func lambda, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1, bool ui = true, string desc = null) { - return npcLoot.Add(ItemDropRule.ByCondition(If(lambda), itemID, dropRateInt, minQuantity, maxQuantity)); + return loot.Add(ItemDropRule.ByCondition(If(lambda, ui, desc), itemID, dropRateInt, minQuantity, maxQuantity)); } /// - /// Shorthand to add an arbitrary conditional drop to an NPC using a Fraction drop rate. + /// Shorthand to add an arbitrary conditional drop to a loot table using a Fraction drop rate. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which evaluates in real-time to the condition that needs to be checked. /// The item to drop. /// The chance that the item will drop as a DropHelper Fraction. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. + /// Whether drops registered with this condition appear in the Bestiary. Defaults to true. + /// The description of this condition in the Bestiary. Defaults to null. /// The item drop rule registered. - public static IItemDropRule AddIf(this NPCLoot npcLoot, Func lambda, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule AddIf(this ILoot loot, Func lambda, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1, bool ui = true, string desc = null) { - return npcLoot.Add(ItemDropRule.ByCondition(If(lambda), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); + return loot.Add(ItemDropRule.ByCondition(If(lambda, ui, desc), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); } /// - /// Shorthand to add an arbitrary conditional drop to an NPC.
+ /// Shorthand to add an arbitrary conditional drop to a loot table.
/// This version requires a lambda which uses DropAttemptInfo. ///
- /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which takes a DropAttemptInfo struct and evaluates in real-time to the condition that needs to be checked. /// The item to drop. /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. + /// Whether drops registered with this condition appear in the Bestiary. Defaults to true. + /// The description of this condition in the Bestiary. Defaults to null. /// The item drop rule registered. - public static IItemDropRule AddIf(this NPCLoot npcLoot, Func lambda, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule AddIf(this ILoot loot, Func lambda, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1, bool ui = true, string desc = null) { - return npcLoot.Add(ItemDropRule.ByCondition(If(lambda), itemID, dropRateInt, minQuantity, maxQuantity)); + return loot.Add(ItemDropRule.ByCondition(If(lambda, ui, desc), itemID, dropRateInt, minQuantity, maxQuantity)); } /// - /// Shorthand to add an arbitrary conditional drop to an NPC using a Fraction drop rate.
+ /// Shorthand to add an arbitrary conditional drop to a loot table using a Fraction drop rate.
/// This version requires a lambda which uses DropAttemptInfo. ///
- /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which takes a DropAttemptInfo struct and evaluates in real-time to the condition that needs to be checked. /// The item to drop. /// The chance that the item will drop as a DropHelper Fraction. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. + /// Whether drops registered with this condition appear in the Bestiary. Defaults to true. + /// The description of this condition in the Bestiary. Defaults to null. /// The item drop rule registered. - public static IItemDropRule AddIf(this NPCLoot npcLoot, Func lambda, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule AddIf(this ILoot loot, Func lambda, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1, bool ui = true, string desc = null) { - return npcLoot.Add(ItemDropRule.ByCondition(If(lambda), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); + return loot.Add(ItemDropRule.ByCondition(If(lambda, ui, desc), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); } /// - /// Shorthand to add a simple normal-only drop to an NPC. + /// Shorthand to add a simple normal-only drop to a loot table. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The item to drop. /// The chance that the item will drop is 1 in this number. For example, 5 gives a 1 in 5 chance. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. /// The item drop rule registered. - public static IItemDropRule AddNormalOnly(this NPCLoot npcLoot, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule AddNormalOnly(this ILoot loot, int itemID, int dropRateInt = 1, int minQuantity = 1, int maxQuantity = 1) { - return npcLoot.Add(ItemDropRule.ByCondition(new Conditions.NotExpert(), itemID, dropRateInt, minQuantity, maxQuantity)); + return loot.Add(ItemDropRule.ByCondition(new Conditions.NotExpert(), itemID, dropRateInt, minQuantity, maxQuantity)); } /// - /// Shorthand to add a simple normal-only drop to an NPC. + /// Shorthand to add a simple normal-only drop to a loot table. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The item to drop. /// The chance that the item will drop as a DropHelper Fraction. /// The minimum number of items to drop. Defaults to 1. /// The maximum number of items to drop. Defaults to 1. /// The item drop rule registered. - public static IItemDropRule AddNormalOnly(this NPCLoot npcLoot, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) + public static IItemDropRule AddNormalOnly(this ILoot loot, int itemID, Fraction dropRate, int minQuantity = 1, int maxQuantity = 1) { - return npcLoot.Add(ItemDropRule.ByCondition(new Conditions.NotExpert(), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); + return loot.Add(ItemDropRule.ByCondition(new Conditions.NotExpert(), itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator)); } /// - /// Shorthand to add an arbitrary drop rule as a normal-only drop to an NPC. + /// Shorthand to add an arbitrary drop rule as a normal-only drop to a loot table. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The IItemDropRule to add. - public static void AddNormalOnly(this NPCLoot npcLoot, IItemDropRule rule) + public static void AddNormalOnly(this ILoot loot, IItemDropRule rule) { - LeadingConditionRule normalOnly = npcLoot.DefineNormalOnlyDropSet(); + LeadingConditionRule normalOnly = loot.DefineNormalOnlyDropSet(); normalOnly.Add(rule); } /// - /// Registers a LeadingConditionRule for an NPC and returns it so you can add drops to that rule. + /// Registers a LeadingConditionRule for a loot table and returns it so you can add drops to that rule. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The condition behind which you want to gate several drop rules. /// The LeadingConditionRule which encapsulates the given condition. - public static LeadingConditionRule DefineConditionalDropSet(this NPCLoot npcLoot, IItemDropRuleCondition condition) + public static LeadingConditionRule DefineConditionalDropSet(this ILoot loot, IItemDropRuleCondition condition) { LeadingConditionRule rule = new LeadingConditionRule(condition); - npcLoot.Add(rule); + loot.Add(rule); return rule; } @@ -667,58 +1003,58 @@ namespace CalamityMod /// Shorthand for registering a LeadingConditionRule using DropHelper.If.
/// This version does NOT use the DropAttemptInfo struct that is available. ///
- /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which evaluates in real-time to the condition that needs to be checked. /// The LeadingConditionRule which encapsulates the given lambda. - public static LeadingConditionRule DefineConditionalDropSet(this NPCLoot npcLoot, Func lambda) => npcLoot.DefineConditionalDropSet(If(lambda)); + public static LeadingConditionRule DefineConditionalDropSet(this ILoot loot, Func lambda) => loot.DefineConditionalDropSet(If(lambda)); /// /// Shorthand for registering a LeadingConditionRule using DropHelper.If.
/// This version DOES use the DropAttemptInfo struct, and thus the provided lambda requires 1 argument. ///
- /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A lambda which evaluates in real-time to the condition that needs to be checked. /// The LeadingConditionRule which encapsulates the given lambda. - public static LeadingConditionRule DefineConditionalDropSet(this NPCLoot npcLoot, Func lambda) => npcLoot.DefineConditionalDropSet(If(lambda)); + public static LeadingConditionRule DefineConditionalDropSet(this ILoot loot, Func lambda) => loot.DefineConditionalDropSet(If(lambda)); /// - /// Shorthand for shorthand: Registers a Normal Mode only LeadingConditionRule for an NPC and returns it to you. + /// Shorthand for shorthand: Registers a Normal Mode only LeadingConditionRule for a loot table and returns it to you. /// - /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// A Normal Mode only LeadingConditionRule. - public static LeadingConditionRule DefineNormalOnlyDropSet(this NPCLoot npcLoot) => npcLoot.DefineConditionalDropSet(new Conditions.NotExpert()); + public static LeadingConditionRule DefineNormalOnlyDropSet(this ILoot loot) => loot.DefineConditionalDropSet(new Conditions.NotExpert()); /// - /// This function does its best to replace all instances of the given item in the given NPC's drops with the specified chance.
+ /// This function does its best to replace all instances of the given item in the given loot table's entries with the specified chance.
/// It tries to affect as many types of drop rule as possible. ///
- /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The item to drop. /// The new numerator to use. /// The new denominator to use. /// Whether or not to include global loot rules. Defaults to false. Generally, you should leave this as false. /// The number of changes made. - public static int ChangeDropRate(this NPCLoot npcLoot, int itemID, int newNumerator, int newDenominator, bool includeGlobalDrops = false) + public static int ChangeDropRate(this ILoot loot, int itemID, int newNumerator, int newDenominator, bool includeGlobalDrops = false) { int numChanges = 0; - var rules = npcLoot.Get(includeGlobalDrops); + var rules = loot.Get(includeGlobalDrops); foreach (IItemDropRule rule in rules) rule.RecursivelyMutateDropRate(itemID, newNumerator, newDenominator); return numChanges; } /// - /// This function does its best to replace all instances of the given item in the given NPC's drops with the specified chance.
+ /// This function does its best to replace all instances of the given item in the given loot table's entries with the specified chance.
/// It tries to affect as many types of drop rule as possible. ///
- /// The NPC's NPCLoot object. + /// The ILoot interface for the loot table. /// The item to drop. /// The new drop rate to use, as a DropHelper Fraction. /// Whether or not to include global loot rules. Defaults to false. Generally, you should leave this as false. /// The number of changes made. - public static int ChangeDropRate(this NPCLoot npcLoot, int itemID, Fraction dropRate, bool includeGlobalDrops = false) + public static int ChangeDropRate(this ILoot loot, int itemID, Fraction dropRate, bool includeGlobalDrops = false) { - return npcLoot.ChangeDropRate(itemID, dropRate.numerator, dropRate.denominator, includeGlobalDrops); + return loot.ChangeDropRate(itemID, dropRate.numerator, dropRate.denominator, includeGlobalDrops); } #endregion @@ -730,15 +1066,15 @@ namespace CalamityMod ///
public class AllOptionsAtOnceWithPityDropRule : IItemDropRule { - public int[] itemIDs; + public WeightedItemStack[] stacks; public Fraction dropRate; public bool usesLuck; public List ChainedRules { get; set; } - public AllOptionsAtOnceWithPityDropRule(int numerator, int denominator, bool luck, params int[] itemIDs) + public AllOptionsAtOnceWithPityDropRule(Fraction dropRate, bool luck, params WeightedItemStack[] stacks) { - dropRate = new Fraction(numerator, denominator); - this.itemIDs = itemIDs; + this.dropRate = dropRate; + this.stacks = stacks; usesLuck = luck; ChainedRules = new List(); } @@ -746,7 +1082,9 @@ namespace CalamityMod public AllOptionsAtOnceWithPityDropRule(Fraction dropRate, bool luck, params int[] itemIDs) { this.dropRate = dropRate; - this.itemIDs = itemIDs; + stacks = new WeightedItemStack[itemIDs.Length]; + for (int i = 0; i < stacks.Length; ++i) + stacks[i] = itemIDs[i]; // implicit conversion operator usesLuck = luck; ChainedRules = new List(); } @@ -758,19 +1096,19 @@ namespace CalamityMod bool droppedAnything = false; // Roll for each drop individually. - foreach (int itemID in itemIDs) + foreach (WeightedItemStack stack in stacks) { bool rngRoll = usesLuck ? info.player.RollLuck(dropRate.denominator) < dropRate.numerator : info.rng.NextFloat() < dropRate; droppedAnything |= rngRoll; if (rngRoll) - CommonCode.DropItemFromNPC(info.npc, itemID, 1); + CommonCode.DropItem(info, stack.itemID, stack.ChooseQuantity(info.rng)); } // If everything fails to drop, force drop one item from the set. if (!droppedAnything) { - int itemToDrop = itemIDs[info.rng.Next(itemIDs.Length)]; - CommonCode.DropItemFromNPC(info.npc, itemToDrop, 1); + WeightedItemStack stack = info.rng.NextFromList(stacks); + CommonCode.DropItem(info, stack.itemID, stack.ChooseQuantity(info.rng)); } // Calamity style drops cannot fail. You will always get at least one item. @@ -781,7 +1119,7 @@ namespace CalamityMod public void ReportDroprates(List drops, DropRateInfoChainFeed ratesInfo) { - int numDrops = itemIDs.Length; + int numDrops = stacks.Length; float rawDropRate = dropRate; // Combinatorics: // OPTION 1: [The item drops = Raw Drop Rate] @@ -791,17 +1129,17 @@ namespace CalamityMod float dropRateAdjustedForParent = dropRateWithPityRoll * ratesInfo.parentDroprateChance; // Report the drop rate of each individual item. This calculation includes the fact that each individual item can be guaranteed as pity. - foreach (int itemID in itemIDs) - drops.Add(new DropRateInfo(itemID, 1, 1, dropRateAdjustedForParent, ratesInfo.conditions)); + foreach (WeightedItemStack stack in stacks) + drops.Add(new DropRateInfo(stack.itemID, stack.minQuantity, stack.maxQuantity, dropRateAdjustedForParent, ratesInfo.conditions)); Chains.ReportDroprates(ChainedRules, rawDropRate, drops, ratesInfo); } } - public static IItemDropRule CalamityStyle(int numerator, int denominator, params int[] itemIDs) => CalamityStyle(numerator, denominator, true, itemIDs); - public static IItemDropRule CalamityStyle(int numerator, int denominator, bool luck, params int[] itemIDs) + public static IItemDropRule CalamityStyle(Fraction dropRateForEachItem, params WeightedItemStack[] stacks) => CalamityStyle(dropRateForEachItem, true, stacks); + public static IItemDropRule CalamityStyle(Fraction dropRateForEachItem, bool luck, params WeightedItemStack[] stacks) { - return new AllOptionsAtOnceWithPityDropRule(numerator, denominator, luck, itemIDs); + return new AllOptionsAtOnceWithPityDropRule(dropRateForEachItem, luck, stacks); } public static IItemDropRule CalamityStyle(Fraction dropRateForEachItem, params int[] itemIDs) => CalamityStyle(dropRateForEachItem, true, itemIDs); public static IItemDropRule CalamityStyle(Fraction dropRateForEachItem, bool luck, params int[] itemIDs) @@ -839,7 +1177,7 @@ namespace CalamityMod if (info.rng.Next(chanceDenominator) < chanceNumerator) { int stack = info.rng.Next(amountDroppedMinimum, amountDroppedMaximum + 1); - TryDropInternal(info.npc, itemId, stack); + TryDropInternal(info, itemId, stack); result.State = ItemDropAttemptResultState.Success; return result; } @@ -849,7 +1187,7 @@ namespace CalamityMod } // The contents of this method are more or less copied from CommonCode.DropItemLocalPerClientAndSetNPCMoneyTo0 - private void TryDropInternal(NPC npc, int itemId, int stack) + private void TryDropInternal(DropAttemptInfo info, int itemId, int stack) { if (itemId <= 0 || itemId >= ItemLoader.ItemCount) return; @@ -857,6 +1195,7 @@ namespace CalamityMod // If server-side, then the item must be spawned for each client individually. if (Main.netMode == NetmodeID.Server) { + NPC npc = info.npc; int idx = Item.NewItem(npc.GetSource_Loot(), npc.Center, itemId, stack, true, -1); Main.timeItemSlotCannotBeReusedFor[idx] = protectionTime; for (int i = 0; i < Main.maxPlayers; ++i) @@ -867,7 +1206,7 @@ namespace CalamityMod // Otherwise just drop the item. else - CommonCode.DropItemFromNPC(npc, itemId, stack); + CommonCode.DropItem(info, itemId, stack); } } @@ -880,325 +1219,5 @@ namespace CalamityMod return PerPlayer(itemID, dropRate.denominator, minQuantity, maxQuantity, dropRate.numerator); } #endregion - - // - // FOLLOWING SECTION: LEGACY 1.3 LOOT CODE (treasure bags, etc.) - // - - #region Player Item Spawns - /// - /// Spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItem(IEntitySource source, Player p, int itemID, int minQuantity = 1, int maxQuantity = 0) - { - int quantity; - - // If they're equal (or for some reason max is less??) then just drop the minimum amount. - if (maxQuantity <= minQuantity) - quantity = minQuantity; - - // Otherwise pick a random amount to drop, inclusive. - else - quantity = Main.rand.Next(minQuantity, maxQuantity + 1); - - // If the final quantity is 0 or less, don't bother. - if (quantity <= 0) - return 0; - - p.QuickSpawnItem(source, itemID, quantity); - return quantity; - } - - /// - /// At a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// The chance that the items will spawn. A decimal number <= 1.0. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemChance(IEntitySource source, Player p, int itemID, float chance, int minQuantity = 1, int maxQuantity = 0) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.NextFloat() > chance) - return 0; - - return DropItem(source, p, itemID, minQuantity, maxQuantity); - } - - /// - /// At a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemChance(IEntitySource source, Player p, int itemID, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.Next(oneInXChance) != 0) - return 0; - - return DropItem(source, p, itemID, minQuantity, maxQuantity); - } - #endregion - - #region Player Item Spawns Conditional - /// - /// With a condition, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemCondition(IEntitySource source, Player p, int itemID, bool condition, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItem(source, p, itemID, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The chance that the items will spawn. A decimal number <= 1.0. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemCondition(IEntitySource source, Player p, int itemID, bool condition, float chance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(source, p, itemID, chance, minQuantity, maxQuantity) : 0; - } - - /// - /// With a condition and at a chance, spawns a stack of one or more items for the given player. - /// - /// The player which should receive the item(s). - /// The ID of the item(s) to spawn. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The minimum number of items to spawn. Defaults to 1. - /// The maximum number of items to spawn. Defaults to 0, meaning the minimum quantity is always used. - /// The number of items spawned. - public static int DropItemCondition(IEntitySource source, Player p, int itemID, bool condition, int oneInXChance, int minQuantity = 1, int maxQuantity = 0) - { - return condition ? DropItemChance(source, p, itemID, oneInXChance, minQuantity, maxQuantity) : 0; - } - #endregion - - #region Player Item Set Spawns - /// - /// Chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSet(IEntitySource source, Player p, params int[] itemIDs) - { - // Can't choose anything from an empty array. - if (itemIDs is null || itemIDs.Length == 0) - return false; - - // Choose which item to drop. - int itemID = Main.rand.Next(itemIDs); - - p.QuickSpawnItem(source, itemID); - return true; - } - - /// - /// At a chance, chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// The chance that the item will spawn. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSetChance(IEntitySource source, Player p, float chance, params int[] itemIDs) - { - // If you fail the roll to get the drop, stop immediately. - if (Main.rand.NextFloat() > chance) - return false; - - return DropItemFromSet(source, p, itemIDs); - } - #endregion - - #region Player Item Set Spawns Conditional - /// - /// With a condition, chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSetCondition(IEntitySource source, Player p, bool condition, params int[] itemIDs) - { - return condition ? DropItemFromSet(source, p, itemIDs) : false; - } - - /// - /// With a condition and at a chance, chooses an item from an array and spawns it for the given player. - /// - /// The player which should receive the item. - /// Any arbitrary Boolean condition to gate this spawn. If false, nothing is spawned. - /// The chance that the items will spawn. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be spawned. - /// Whether an item was spawned. - public static bool DropItemFromSetCondition(IEntitySource source, Player p, bool condition, float chance, params int[] itemIDs) - { - return condition ? DropItemFromSetChance(source, p, chance, itemIDs) : false; - } - #endregion - - #region Player Entire Set Spawns - /// - /// Rolls for each item in an array to drop at a given chance. Always drops at least one item. - /// - /// The player which should receive the items. - /// The chance that an item will drop. A decimal number <= 1.0. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - /// The number of items dropped. - public static int DropEntireSet(IEntitySource source, Player p, float chance, params int[] itemIDs) - { - int numDrops = 0; - - // Can't choose anything from an empty array. - if (itemIDs is null || itemIDs.Length == 0) - return numDrops; - - // Tally the total number of items dropped as the drop set is iterated through. - for (int i = 0; i < itemIDs.Length; ++i) - numDrops += DropItemChance(source, p, itemIDs[i], chance); - - // If nothing at all was dropped, drop one thing at random. - numDrops += DropItemFromSetCondition(source, p, numDrops <= 0, itemIDs) ? 1 : 0; - return numDrops; - } - - /// - /// Rolls for each item in an array to drop at a given chance. Always drops at least one item. - /// - /// The player which should receive the items. - /// The chance that the items will spawn is 1 in this number. For example, 5 gives a 1 in 5 chance. - /// The array of items to choose from. If it's null or empty, nothing will be dropped. - /// The number of items dropped. - public static int DropEntireSet(IEntitySource source, Player p, int oneInXChance, params int[] itemIDs) - { - int numDrops = 0; - - // Can't choose anything from an empty array. - if (itemIDs is null || itemIDs.Length == 0) - return numDrops; - - // Tally the total number of items dropped as the drop set is iterated through. - for (int i = 0; i < itemIDs.Length; ++i) - numDrops += DropItemChance(source, p, itemIDs[i], oneInXChance); - - // If nothing at all was dropped, drop one thing at random. - numDrops += DropItemFromSetCondition(source, p, numDrops <= 0, itemIDs) ? 1 : 0; - return numDrops; - } - #endregion - - #region Weighted Item Sets/Stacks Supporting Code - // int itemID --> WeightedItemStack - public static WeightedItemStack WeightStack(this int itemID) => WeightStack(itemID, WeightedItemStack.DefaultWeight); - public static WeightedItemStack WeightStack(this int itemID, float weight) => new WeightedItemStack(itemID, weight); - public static WeightedItemStack WeightStack(this int itemID, int quantity) => WeightStack(itemID, WeightedItemStack.DefaultWeight, quantity); - public static WeightedItemStack WeightStack(this int itemID, float weight, int quantity) => new WeightedItemStack(itemID, weight, quantity); - public static WeightedItemStack WeightStack(this int itemID, int min, int max) => WeightStack(itemID, WeightedItemStack.DefaultWeight, min, max); - public static WeightedItemStack WeightStack(this int itemID, float weight, int min, int max) => new WeightedItemStack(itemID, weight, min, max); - - // ModItem generic parameter --> WeightedItemStack - public static WeightedItemStack WeightStack() where T : ModItem => WeightStack(WeightedItemStack.DefaultWeight); - public static WeightedItemStack WeightStack(float weight) where T : ModItem => WeightStack(ModContent.ItemType(), weight); - public static WeightedItemStack WeightStack(int quantity) where T : ModItem => WeightStack(WeightedItemStack.DefaultWeight, quantity); - public static WeightedItemStack WeightStack(float weight, int quantity) where T : ModItem => WeightStack(ModContent.ItemType(), weight, quantity); - public static WeightedItemStack WeightStack(int min, int max) where T : ModItem => WeightStack(WeightedItemStack.DefaultWeight, min, max); - public static WeightedItemStack WeightStack(float weight, int min, int max) where T : ModItem => WeightStack(ModContent.ItemType(), weight, min, max); - - // Separated implementation used so weighted random code isn't duplicated in two places. - public static WeightedItemStack RollWeightedRandom(WeightedItemStack[] stacks) - { - int i; - float[] breakpoints = new float[stacks.Length]; - float totalWeight = 0f; - - // Assign breakpoints based on the cumulative sum of weights thus far. - // Error check invalid weights by giving them an unbelievably small drop chance. - for (i = 0; i < stacks.Length; ++i) - { - float w = stacks[i].weight; - if (w <= 0f || float.IsNaN(w) || float.IsInfinity(w)) - w = WeightedItemStack.MinisiculeWeight; - breakpoints[i] = totalWeight += w; - } - - // Iterate through the breakpoints until you find the first one that is surpassed. Drop that item. - float needle = Main.rand.NextFloat(totalWeight); - i = 0; - while (needle > breakpoints[i]) - ++i; - return stacks[i]; - } - #endregion - - #region Player Weighted Set Spawns - /// - /// Chooses an item (or stack of items) from an array of drop definitions and spawns it for the given player.

- /// Each item is given a certain weight to spawn. - ///
- /// The player which should receive the item(s). - /// The array of drop definitions to choose from. If it's null or empty, nothing will be dropped. - /// The number of items dropped. - public static int DropItemFromWeightedSet(IEntitySource source, Player p, params WeightedItemStack[] stacks) - { - // Can't choose anything from an empty array. - if (stacks is null || stacks.Length == 0) - return 0; - - WeightedItemStack stk = RollWeightedRandom(stacks); - return DropItem(source, p, stk.itemID, stk.minQuantity, stk.maxQuantity); - } - - /// - /// Rolls for each item (or stack of items) in an array of drop definitions to drop at their defined chances.

- /// Always drops at least one of the defined stacks. - ///
- /// The player which should receive the item(s). - /// The array of drop definitions to choose from. If it's null or empty, nothing will be dropped. - /// The number of items dropped. - public static int DropEntireWeightedSet(IEntitySource source, Player p, params WeightedItemStack[] stacks) - { - int numDrops = 0; - - // Can't choose anything from an empty array. - if (stacks is null || stacks.Length == 0) - return numDrops; - - for (int i = 0; i < stacks.Length; ++i) - { - WeightedItemStack stk = stacks[i]; - numDrops += DropItemChance(source, p, stk.itemID, stk.weight, stk.minQuantity, stk.maxQuantity); - } - - // If nothing at all was dropped, drop one thing at (weighted) random. - if (numDrops <= 0) - numDrops += DropItemFromWeightedSet(source, p, stacks); - - return numDrops; - } - #endregion } } diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index 229f395895..6ce690284e 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -1,15 +1,16 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.Default; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; -using Terraria.Audio; -using Terraria.GameContent; namespace CalamityMod { @@ -65,6 +66,127 @@ namespace CalamityMod return true; } + #region Sitting in Chairs + // fat is for 2 tile chairs like Exo Chair and Exo Toilet + public static void ChairSitInfo(int i, int j, ref TileRestingInfo info, int nextStyleHeight = 40, bool fat = false, bool hasOffset = false) + { + if (hasOffset) + { + info.DirectionOffset = 0; + info.VisualOffset = new Vector2(-8f, 0f); + } + + Tile tile = Framing.GetTileSafely(i, j); + bool frameCheck = fat ? tile.TileFrameX >= 35 : tile.TileFrameX != 0; + + info.TargetDirection = -1; + if (frameCheck) + { + info.TargetDirection = 1; + } + + if (fat) + { + int xPos = tile.TileFrameX / 18; + if (xPos == 1) + i--; + if (xPos == 2) + i++; + } + + info.AnchorTilePosition.X = i; + info.AnchorTilePosition.Y = j; + + if (tile.TileFrameY % nextStyleHeight == 0) + { + info.AnchorTilePosition.Y++; + } + } + + public static bool ChairRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + + if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + player.GamepadEnableGrappleCooldown(); + player.sitting.SitDown(player, i, j); + } + return true; + } + + public static void ChairMouseOver(int i, int j, int itemID, bool fat = false) + { + Player player = Main.LocalPlayer; + + if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + return; + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = itemID; + + bool frameCheck = fat ? Main.tile[i, j].TileFrameX <= 35 : Main.tile[i, j].TileFrameX / 18 < 0; + if (frameCheck) + { + player.cursorItemIconReversed = true; + } + } + + public static void MouseOver(int i, int j, int itemID) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = itemID; + } + #endregion + + #region Sitting in Sofas/Benches + public static void BenchSitInfo(int i, int j, ref TileRestingInfo info, int nextStyleHeight = 40) + { + Tile tile = Framing.GetTileSafely(i, j); + Player player = Main.LocalPlayer; + + info.DirectionOffset = 0; + float offset = 0f; + if (tile.TileFrameX < 17 && player.direction == 1) + offset = 8f; + if (tile.TileFrameX < 17 && player.direction == -1) + offset = -8f; + if (tile.TileFrameX > 34 && player.direction == 1) + offset = -8f; + if (tile.TileFrameX > 34 && player.direction == -1) + offset = 8f; + info.VisualOffset = new Vector2(offset, 0f); + info.TargetDirection = player.direction; + + info.AnchorTilePosition.X = i; + info.AnchorTilePosition.Y = j; + + if (tile.TileFrameY % nextStyleHeight == 0) + { + info.AnchorTilePosition.Y++; + } + } + + public static void BenchMouseOver(int i, int j, int itemID) + { + Player player = Main.LocalPlayer; + + if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + return; + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = itemID; + } + #endregion + public static bool ChestRightClick(int i, int j) { Player player = Main.LocalPlayer; @@ -694,6 +816,9 @@ namespace CalamityMod Main.tileNoAttach[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.CanBeSatOnForNPCs[mt.Type] = true; + TileID.Sets.CanBeSatOnForPlayers[mt.Type] = true; + TileID.Sets.HasOutlines[mt.Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; @@ -741,7 +866,7 @@ namespace CalamityMod /// Extension which initializes a ModTile to be a chest. /// /// The ModTile which is being initialized. - internal static void SetUpChest(this ModTile mt, bool offset = false) + internal static void SetUpChest(this ModTile mt, bool offset = false, int offsetAmt = 4) { Main.tileSpelunker[mt.Type] = true; Main.tileContainer[mt.Type] = true; @@ -755,7 +880,7 @@ namespace CalamityMod TileID.Sets.DisableSmartCursor[mt.Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); if (offset) - TileObjectData.newTile.DrawYOffset = 4; + TileObjectData.newTile.DrawYOffset = offsetAmt; TileObjectData.newTile.Origin = new Point16(0, 1); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); @@ -1011,17 +1136,54 @@ namespace CalamityMod mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); } + /// + /// Extension which initializes a ModPylon to be a simple pylon.
+ /// ModPylon appears to make it easier to create a modded pylon extending ModTile.
+ ///
+ /// Note: This is used for pylons that follow general vanilla functionality.
+ /// Pylons that have vastly different custom behavior require a different setup (refer to ExamplePylonTileAdvanced in ExampleMod).
+ ///
+ /// The ModPylon which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpPylon(this ModPylon mp, TEModdedPylon pylonHook, bool lavaImmune = false, int offset = 2) + { + + Main.tileLighted[mp.Type] = true; + Main.tileFrameImportant[mp.Type] = true; + Main.tileLavaDeath[mp.Type] = !lavaImmune; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + + // These definitions allow for vanilla's pylon TileEntities to be placed. + // tModLoader has a built in Tile Entity specifically for modded pylons, which is extended through TECalamityPylon. + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(pylonHook.PlacementPreviewHook_CheckIfCanPlace, 1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(pylonHook.Hook_AfterPlacement, -1, 0, false); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newTile.DrawYOffset = offset; + TileObjectData.addTile(mp.Type); + + // Adds functionality for proximity of pylons; if this is true, then being near this tile will count as being near a pylon for the teleportation process. + mp.AddToArray(ref TileID.Sets.CountsAsPylon); + } + /// /// Extension which initializes a ModTile to be a sink. /// /// The ModTile which is being initialized. /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpSink(this ModTile mt, bool lavaImmune = false) + /// Whether this tile counts as a water source. Defaults to true. + /// Whether this tile counts as a lava source. Defaults to false. + /// Whether this tile counts as a honey source. Defaults to false. + internal static void SetUpSink(this ModTile mt, bool lavaImmune = false, bool water = true, bool lava = false, bool honey = false) { Main.tileLighted[mt.Type] = true; Main.tileFrameImportant[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.CountsAsWaterSource[mt.Type] = water; + TileID.Sets.CountsAsHoneySource[mt.Type] = lava; + TileID.Sets.CountsAsLavaSource[mt.Type] = honey; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.newTile.LavaDeath = !lavaImmune; TileObjectData.addTile(mt.Type); @@ -1038,6 +1200,8 @@ namespace CalamityMod Main.tileFrameImportant[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.CanBeSatOnForPlayers[mt.Type] = true; + TileID.Sets.HasOutlines[mt.Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.newTile.LavaDeath = !lavaImmune; TileObjectData.addTile(mt.Type); @@ -1156,7 +1320,7 @@ namespace CalamityMod } /// - /// Extension which initializes a ModTile to be a bed. + /// Extension which initializes a ModTile to be a bar. /// /// The ModTile which is being initialized. /// The color of the bar on the minimap. @@ -1176,5 +1340,19 @@ namespace CalamityMod // Vanilla bars are labeled as "Metal Bar" on the minimap mt.AddMapEntry(mapColor, Language.GetText("MapObject.MetalBar")); } + + /// + /// Extension which initializes a ModTile to be a trophy. + /// + /// The ModTile which is being initialized. + internal static void SetUpTrophy(this ModTile mt) + { + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.addTile(mt.Type); + TileID.Sets.DisableSmartCursor[mt.Type] = true; + TileID.Sets.FramesOnKillWall[mt.Type] = true; + } } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index afca5d800e..9f998a7363 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -1,12 +1,13 @@ -using CalamityMod.UI.CalamitasEnchants; -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; +using CalamityMod.UI.CalamitasEnchants; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; +using Terraria.Utilities; namespace CalamityMod { @@ -26,64 +27,9 @@ namespace CalamityMod /// The item to check. public static bool IsWhip(this Item item) => item.shoot > ProjectileID.None && ProjectileID.Sets.IsAWhip[item.shoot]; - #region Item Rarity Utilities - internal const int TurquoiseRarityValue = 12; - internal static readonly Color TurquoiseRarityColor = new Color(0, 255, 200); - internal const int PureGreenRarityValue = 13; - internal static readonly Color PureGreenRarityColor = new Color(0, 255, 0); - internal const int DarkBlueRarityValue = 14; - internal static readonly Color DarkBlueRarityColor = new Color(43, 96, 222); - internal const int VioletRarityValue = 15; - internal static readonly Color VioletRarityColor = new Color(108, 45, 199); - internal const int HotPinkRarityValue = 16; - internal static readonly Color HotPinkRarityColor = new Color(255, 0, 255); - internal const int RainbowRarityValue = 30; - // The rainbow rarity has an ever-shifting color, not a stored constant - internal const int DraedonRustRarityValue = 33; - internal static readonly Color DraedonRustRarityColor = new Color(204, 71, 35); - // The donator rarity isn't technically a rarity, but is a constant color used in tooltips + #region Color Constants + internal static readonly Color DevItemColor = new Color(255, 0, 255); internal static readonly Color DonatorItemColor = new Color(139, 0, 0); - - public static readonly CalamityRarity[] postMLRarities = - { - CalamityRarity.Turquoise, - CalamityRarity.PureGreen, - CalamityRarity.DarkBlue, - CalamityRarity.Violet, - CalamityRarity.HotPink - }; - - public static bool IsPostML(this CalamityRarity calrare) - { - for(int i = 0; i < postMLRarities.Length; ++i) - if (postMLRarities[i] == calrare) - return true; - return false; - } - - public static Color? GetRarityColor(CalamityRarity calrare) - { - switch (calrare) - { - default: - return null; - case CalamityRarity.Turquoise: - return TurquoiseRarityColor; - case CalamityRarity.PureGreen: - return PureGreenRarityColor; - case CalamityRarity.DarkBlue: - return DarkBlueRarityColor; - case CalamityRarity.Violet: - return VioletRarityColor; - case CalamityRarity.HotPink: - return HotPinkRarityColor; - - case CalamityRarity.Rainbow: - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - case CalamityRarity.DraedonRust: - return DraedonRustRarityColor; - } - } #endregion // TODO -- This probably isn't the best place to put this but it needs to be somewhere easily accessible. @@ -152,6 +98,180 @@ namespace CalamityMod } #endregion + #region Reforging Algorithm + internal static int GetReworkedReforge(Item item, UnifiedRandom rand, int currentPrefix) + { + CalamityMod mod = CalamityMod.Instance; + int GetCalPrefix(string name) + { + bool found = mod.TryFind(name, out ModPrefix ret); + return found ? ret.Type : 0; + } + + // This is the hardcoded value to "do nothing", and is thus the default choice. + int prefix = -1; + + // ACCESSORIES + if (item.accessory) + { + int[][] accessoryReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Hard, PrefixID.Jagged, PrefixID.Brisk, PrefixID.Wild, GetCalPrefix("Quiet") }, + /* 1 */ new int[] { PrefixID.Guarding, PrefixID.Spiked, PrefixID.Precise, PrefixID.Fleeting, PrefixID.Rash, GetCalPrefix("Cloaked") }, + /* 2 */ new int[] { PrefixID.Armored, PrefixID.Angry, PrefixID.Hasty2, PrefixID.Intrepid, PrefixID.Arcane, GetCalPrefix("Camouflaged") }, + /* 3 */ new int[] { PrefixID.Warding, PrefixID.Menacing, PrefixID.Lucky, PrefixID.Quick2, PrefixID.Violent, GetCalPrefix("Silent") }, + }; + prefix = IteratePrefix(rand, accessoryReforgeTiers, currentPrefix); + } + + // MELEE (includes tools and whips) + else if (item.CountsAsClass() || item.CountsAsClass()) + { + // Terrarian (has its own special "Legendary" for marketing reasons) + if (item.type == ItemID.Terrarian) + { + int[][] terrarianReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous }, + /* 2 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Godly }, + /* 3 */ new int[] { PrefixID.Legendary2 }, + }; + prefix = IteratePrefix(rand, terrarianReforgeTiers, currentPrefix); + } + + // Yoyos, Flails, Spears, etc. + // Spears actually work fine with Legendary, but vanilla doesn't give it to them, so we won't either. + // Zenith and rapiers are specifically excluded from this, so they get broadsword reforges despite not scaling with melee speed. + else if ((item.channel || item.noMelee) && item.type != ItemID.Zenith && item.useStyle != ItemUseStyleID.Rapier) + { + int[][] meleeNoSpeedReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous }, + /* 2 */ new int[] { PrefixID.Superior, PrefixID.Demonic }, + /* 3 */ new int[] { PrefixID.Godly } + }; + prefix = IteratePrefix(rand, meleeNoSpeedReforgeTiers, currentPrefix); + } + + // All other melee weapons + else + { + int[][] meleeReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Light, PrefixID.Heavy, PrefixID.Light, PrefixID.Forceful, PrefixID.Strong }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Pointy, PrefixID.Bulky }, + /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Large, PrefixID.Dangerous, PrefixID.Sharp }, + /* 3 */ new int[] { PrefixID.Massive, PrefixID.Unpleasant, PrefixID.Savage, PrefixID.Superior }, + /* 4 */ new int[] { PrefixID.Demonic, PrefixID.Deadly2, PrefixID.Godly }, + /* 5 */ new int[] { PrefixID.Legendary } // for non-tools, Light is a mediocre low-tier reforge + }; + int[][] toolReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Heavy, PrefixID.Light, PrefixID.Forceful, PrefixID.Strong }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Pointy, PrefixID.Bulky }, + /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Large, PrefixID.Dangerous, PrefixID.Sharp }, + /* 3 */ new int[] { PrefixID.Massive, PrefixID.Unpleasant, PrefixID.Savage, PrefixID.Superior }, + /* 4 */ new int[] { PrefixID.Demonic, PrefixID.Deadly2, PrefixID.Godly }, + /* 5 */ new int[] { PrefixID.Legendary, PrefixID.Light } // for some tools, light is better than legendary. for others, it's equal + }; + + var tierListToUse = (item.pick > 0 || item.axe > 0 || item.hammer > 0) ? toolReforgeTiers : meleeReforgeTiers; + prefix = IteratePrefix(rand, tierListToUse, currentPrefix); + } + } + + // RANGED + else if (item.CountsAsClass()) + { + int[][] rangedReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Powerful, PrefixID.Forceful, PrefixID.Strong }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Intimidating }, + /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Hasty, PrefixID.Staunch, PrefixID.Unpleasant }, + /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Sighted }, + /* 4 */ new int[] { PrefixID.Godly, PrefixID.Rapid, /* ranged Deadly */ PrefixID.Deadly, /* universal Deadly */ PrefixID.Deadly2 }, + /* 5 */ new int[] { PrefixID.Unreal } + }; + prefix = IteratePrefix(rand, rangedReforgeTiers, currentPrefix); + } + + // MAGIC + else if (item.CountsAsClass() || item.CountsAsClass()) + { + int[][] magicReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Furious, PrefixID.Forceful, PrefixID.Strong }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Taboo, PrefixID.Manic }, + /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Adept, PrefixID.Celestial, PrefixID.Unpleasant }, + /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Mystic }, + /* 4 */ new int[] { PrefixID.Godly, PrefixID.Masterful, PrefixID.Deadly2 }, + /* 5 */ new int[] { PrefixID.Mythical } + }; + prefix = IteratePrefix(rand, magicReforgeTiers, currentPrefix); + } + + // SUMMON (not whips) + else if (item.CountsAsClass()) + { + int[][] summonReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Nimble, PrefixID.Furious }, + /* 1 */ new int[] { PrefixID.Forceful, PrefixID.Strong, PrefixID.Quick, PrefixID.Taboo, PrefixID.Manic }, + /* 2 */ new int[] { PrefixID.Hurtful, PrefixID.Adept, PrefixID.Celestial }, + /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Mystic, PrefixID.Deadly2 }, + /* 4 */ new int[] { PrefixID.Masterful, PrefixID.Godly }, + /* 5 */ new int[] { PrefixID.Mythical, PrefixID.Ruthless } // you may want mythical early game for the knockback. + }; + prefix = IteratePrefix(rand, summonReforgeTiers, currentPrefix); + } + + // ROGUE (Calamity adds these reforges to all 1.4 TML throwing items) + else if (item.CountsAsClass()) + { + // Added appropriate universal reforges to rogue, so they don't ONLY get modded prefixes. + int[][] rogueReforgeTiers = new int[][] + { + /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Forceful, PrefixID.Strong, GetCalPrefix("Radical"), GetCalPrefix("Pointy") }, + /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, GetCalPrefix("Sharp"), GetCalPrefix("Glorious") }, + /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Unpleasant, GetCalPrefix("Feathered"), GetCalPrefix("Sleek"), GetCalPrefix("Hefty") }, + /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, GetCalPrefix("Mighty"), GetCalPrefix("Serrated") }, + /* 4 */ new int[] { PrefixID.Godly, PrefixID.Deadly2, GetCalPrefix("Vicious"), GetCalPrefix("Lethal") }, + /* 5 */ new int[] { GetCalPrefix("Flawless") } + }; + prefix = IteratePrefix(rand, rogueReforgeTiers, currentPrefix); + } + + return prefix; + } + + private static int GetPrefixTier(int[][] tiers, int currentPrefix) + { + for (int checkingTier = 0; checkingTier < tiers.Length; ++checkingTier) + { + int[] tierList = tiers[checkingTier]; + for (int i = 0; i < tierList.Length; ++i) + if (tierList[i] == currentPrefix) + return checkingTier; + } + + // If an invalid or modded prefix is detected, return -1. + // This will give a random tier 0 prefix (the "next tier"), starting fresh with a low-tier vanilla or Calamity prefix. + return -1; + } + + private static int IteratePrefix(UnifiedRandom rand, int[][] reforgeTiers, int currentPrefix) + { + int currentTier = GetPrefixTier(reforgeTiers, currentPrefix); + + // If max tier: give max tier reforges forever + // Otherwise: go up by 1 tier with every reforge, guaranteed + int newTier = currentTier == reforgeTiers.Length - 1 ? currentTier : currentTier + 1; + return rand.Next(reforgeTiers[newTier]); + } + #endregion + /// /// Converts the given ModKeybind into a string for insertion into item tooltips.

/// This allows the user's actual keybind choices to be shown to them in tooltips. @@ -262,6 +382,13 @@ namespace CalamityMod return item.Calamity().AppliedEnchantment.HasValue; } + public static bool CheckWoodenAmmo(int type, Player player) + { + if (player.hasMoltenQuiver && type == ProjectileID.FireArrow) + return true; + return type == ProjectileID.WoodenArrowFriendly; + } + public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) { Player player = Main.player[Main.myPlayer]; @@ -476,10 +603,7 @@ namespace CalamityMod { SoundEngine.PlaySound(item.UseSound.GetValueOrDefault(), player.Center); - double healMult = 1D + - (player.Calamity().coreOfTheBloodGod ? 0.25 : 0) + - (player.Calamity().bloodPactBoost ? 0.5 : 0); - int healAmt = (int)(item.healLife * healMult); + int healAmt = (int)(item.healLife * player.Calamity().healingPotBonus); if (healAmt > 0 && player.QuickHeal_GetItemToUse() != null) { if (player.QuickHeal_GetItemToUse().type != item.type) @@ -521,5 +645,93 @@ namespace CalamityMod Recipe.FindRecipes(); } } + + public static void TreasureBagLightAndDust(this Item item) + { + // Spawn some light and dust when dropped in the world + Lighting.AddLight(item.Center, Color.White.ToVector3() * 0.4f); + + if (item.timeSinceItemSpawned % 12 == 0) + { + Vector2 center = item.Center + new Vector2(0f, item.height * -0.1f); + + // This creates a randomly rotated vector of length 1, which gets it's components multiplied by the parameters + Vector2 direction = Main.rand.NextVector2CircularEdge(item.width * 0.6f, item.height * 0.6f); + float distance = 0.3f + Main.rand.NextFloat() * 0.5f; + Vector2 velocity = new Vector2(0f, -Main.rand.NextFloat() * 0.3f - 1.5f); + + Dust dust = Dust.NewDustPerfect(center + direction * distance, DustID.SilverFlame, velocity); + dust.scale = 0.5f; + dust.fadeIn = 1.1f; + dust.noGravity = true; + dust.noLight = true; + dust.alpha = 0; + } + } + + #region Rogue Prefixes + public static bool CanGetRoguePrefix(this Item item) => item.CountsAsClass() && item.maxStack == 1; + + public static int RandomRoguePrefix() + { + Mod mod = ModContent.GetInstance(); + int roguePrefix = Utils.SelectRandom(Main.rand, new int[] + { + mod.Find("Radical").Type, + mod.Find("Pointy").Type, + mod.Find("Sharp").Type, + mod.Find("Glorious").Type, + mod.Find("Feathered").Type, + mod.Find("Sleek").Type, + mod.Find("Hefty").Type, + mod.Find("Mighty").Type, + mod.Find("Serrated").Type, + mod.Find("Vicious").Type, + mod.Find("Lethal").Type, + mod.Find("Flawless").Type, + mod.Find("Blunt").Type, + mod.Find("Flimsy").Type, + mod.Find("Unbalanced").Type, + mod.Find("Atrocious").Type, + PrefixID.Keen, + PrefixID.Superior, + PrefixID.Forceful, + PrefixID.Broken, + PrefixID.Damaged, + PrefixID.Hurtful, + PrefixID.Strong, + PrefixID.Unpleasant, + PrefixID.Weak, + PrefixID.Ruthless, + PrefixID.Godly, + PrefixID.Demonic, + PrefixID.Zealous, + PrefixID.Quick, + PrefixID.Deadly2, + PrefixID.Agile, + PrefixID.Nimble, + PrefixID.Murderous, + PrefixID.Slow, + PrefixID.Sluggish, + PrefixID.Lazy, + PrefixID.Annoying, + PrefixID.Nasty + }); + return roguePrefix; + } + + public static bool NegativeRoguePrefix(int prefix) + { + Mod mod = ModContent.GetInstance(); + List badPrefixes = new List() + { + mod.Find("Blunt").Type, + mod.Find("Flimsy").Type, + mod.Find("Unbalanced").Type, + mod.Find("Atrocious").Type + }; + return badPrefixes.Contains(prefix); + } + #endregion } } diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 76999f398f..8e3e17d123 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -154,6 +154,67 @@ namespace CalamityMod return fireVelocity; } + /// + /// Calculates the shortest distance between a point and a line that passes through 2 specified points + /// + /// + /// + /// + /// + public static float ShortestDistanceToLine(this Vector2 point, Vector2 lineStart, Vector2 lineEnd) + { + Vector2 lineVector = lineEnd - lineStart; + Vector2 perpendicular = lineVector.RotatedBy(MathHelper.PiOver2); + Vector2 pointToOrigin = point - lineStart; + + return (float)Math.Abs((pointToOrigin.X * perpendicular.X + pointToOrigin.Y * perpendicular.Y)) / perpendicular.Length(); + } + + /// + /// Gets the closest point on a line from a point + /// + /// + /// + /// + /// + public static Vector2 ClosestPointOnLine(this Vector2 point, Vector2 lineStart, Vector2 lineEnd) + { + + Vector2 perpendicular = (lineEnd - lineStart).RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.Zero); + float distanceToLine = point.ShortestDistanceToLine(lineStart, lineEnd); + float lineSide = Math.Sign((point.X - lineStart.X) * ( -lineEnd.Y + lineStart.Y) + (point.Y - lineStart.Y) * (lineEnd.X - lineStart.X)); + + return point + distanceToLine * lineSide * perpendicular; + } + + /// + /// Gives the *real* modulo of a divided by a divisor. + /// This method is necessary because the % operator in c# keeps the sign of the dividend, making it Fake as Fuck. + /// + /// + /// + /// + public static float Modulo(this float dividend, float divisor) + { + return dividend - (float)Math.Floor(dividend / divisor) * divisor; + } + + /// + /// Clamps the magnitude of a vector via safe normalization. + /// + /// The vector. + /// The minimum magnitude. + /// The maximum magnitude. + public static Vector2 ClampMagnitude(this Vector2 v, float min, float max) => v.SafeNormalize(Vector2.UnitY) * MathHelper.Clamp(v.Length(), min, max); + + /// + /// Gives the angle in radians between two other angles + /// This function exists for vectors but somehow is missing for floats + /// + /// Your source angle + /// The target angle + /// + public static float AngleBetween(this float angle, float otherAngle) => ((otherAngle - angle) + MathHelper.Pi).Modulo(MathHelper.TwoPi) - MathHelper.Pi; #region Easings /// @@ -206,16 +267,16 @@ namespace CalamityMod /// /// This indicates when the segment starts on the animation /// - public float originX; + public float startingX; /// /// This indicates what the starting height of the segment is /// - public float originY; + public float startingHeight; /// /// This represents the elevation shift that will happen during the segment. Set this to 0 to turn the segment into a flat line. /// Usually this elevation shift is fully applied at the end of a segment, but the sinebump easing type makes it be reached at the apex of its curve. /// - public float displacement; + public float elevationShift; /// /// This is the degree of the polynomial, if the easing mode chosen is a polynomial one /// @@ -224,22 +285,17 @@ namespace CalamityMod /// /// Legacy constructor /// - public CurveSegment(EasingType MODE, float ORGX, float ORGY, float DISP, int DEG = 1) - { - easing = EasingTypeToFunction[(int)MODE]; - originX = ORGX; - originY = ORGY; - displacement = DISP; - degree = DEG; - } + public CurveSegment(EasingType MODE, float startX, float startHeight, float elevationShift, int degree = 1) : + this(EasingTypeToFunction[(int)MODE], startX, startHeight, elevationShift, degree) + { } - public CurveSegment(EasingFunction MODE, float ORGX, float ORGY, float DISP, int DEG = 1) + public CurveSegment(EasingFunction MODE, float startX, float startHeight, float elevationShift, int degree = 1) { easing = MODE; - originX = ORGX; - originY = ORGY; - displacement = DISP; - degree = DEG; + startingX = startX; + startingHeight = startHeight; + this.elevationShift = elevationShift; + this.degree = degree; } } @@ -250,13 +306,13 @@ namespace CalamityMod /// How far along the curve you are. Automatically clamped between 0 and 1 /// An array of curve segments making up the full animation curve /// - public static float PiecewiseAnimation(float progress, CurveSegment[] segments) + public static float PiecewiseAnimation(float progress, params CurveSegment[] segments) { if (segments.Length == 0) return 0f; - if (segments[0].originX != 0) //If for whatever reason you try to not play by the rules, get fucked - segments[0].originX = 0; + if (segments[0].startingX != 0) //If for whatever reason you try to not play by the rules, get fucked + segments[0].startingX = 0; progress = MathHelper.Clamp(progress, 0f, 1f); //Clamp the progress float ratio = 0f; @@ -264,29 +320,29 @@ namespace CalamityMod for (int i = 0; i <= segments.Length - 1; i++) { CurveSegment segment = segments[i]; - float startPoint = segment.originX; + float startPoint = segment.startingX; float endPoint = 1f; - if (progress < segment.originX) //Too early. This should never get reached, since by the time you'd have gotten there you'd have found the appropriate segment and broken out of the for loop + if (progress < segment.startingX) //Too early. This should never get reached, since by the time you'd have gotten there you'd have found the appropriate segment and broken out of the for loop continue; if (i < segments.Length - 1) { - if (segments[i + 1].originX <= progress) //Too late + if (segments[i + 1].startingX <= progress) //Too late continue; - endPoint = segments[i + 1].originX; + endPoint = segments[i + 1].startingX; } float segmentLenght = endPoint - startPoint; - float segmentProgress = (progress - segment.originX) / segmentLenght; //How far along the specific segment - ratio = segment.originY; + float segmentProgress = (progress - segment.startingX) / segmentLenght; //How far along the specific segment + ratio = segment.startingHeight; //Failsafe because somehow it can fail? what if (segment.easing != null) - ratio += segment.easing(segmentProgress, segment.degree) * segment.displacement; + ratio += segment.easing(segmentProgress, segment.degree) * segment.elevationShift; else - ratio += LinearEasing(segmentProgress, segment.degree) * segment.displacement; + ratio += LinearEasing(segmentProgress, segment.degree) * segment.elevationShift; break; } @@ -295,6 +351,7 @@ namespace CalamityMod #endregion + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function. // Due to its temporary state, this method will not receive an XML documentation comment. public static Rectangle ClampToWorld(Rectangle tileRectangle) diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 0ce0224941..5e1d1d60d8 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -8,7 +8,6 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; @@ -38,7 +37,7 @@ namespace CalamityMod if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Language.GetTextValue(key), textColor.Value); - else if (Main.netMode == NetmodeID.Server) + else if (Main.netMode == NetmodeID.Server || Main.netMode == NetmodeID.MultiplayerClient) ChatHelper.BroadcastChatMessage(NetworkText.FromKey(key), textColor.Value); } @@ -263,6 +262,24 @@ namespace CalamityMod public static void StartSandstorm() { + // If it's not windy enough, make it windy enough for a sandstorm + // 0.6f is the minimum for vanilla but Calamity changes it to 0.2f + // Windy days occur when wind speed is at least 0.5f (0.4f in vanilla) so this should never cause a windy day + float windSpeed = 0f; + if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) + { + windSpeed = Main.rand.NextFloat(0.2f, 0.4f); + } + else if (Main.windSpeedCurrent > -0.2f && Main.windSpeedCurrent < 0f) + { + windSpeed = Main.rand.NextFloat(-0.4f, -0.2f); + } + if (windSpeed != 0f) + { + Main.windSpeedCurrent = windSpeed < 0f ? -0.2f : 0.2f; + Main.windSpeedTarget = windSpeed; + } + Sandstorm.StartSandstorm(); } @@ -302,6 +319,61 @@ namespace CalamityMod CalamityNetcode.SyncWorld(); } + public static bool IntoMorseCode(string originalText, float completion) + { + int spaceLenght = 13; + int betweenLetterLenght = 7; + int betweenBlipLenght = 4; + int shortLenght = 3; + int longLenght = 8; + + char[] TextKeys = { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', + 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; + string[] MorseKeys = { " ", ".-|", "-...|", "-.-. |", "-..|", ".|", "..-.|" + , "--.|", "....|", "..|", ".---|","-.-|",".-..|","--|", + "-.|","---|",".--.|","--.-|",".-.|","...|","-|","..-|", + "...-|",".--|","-..-|","-.--|","--..|",".----|", + "..---|","...--|","....-|",".....|","-....|","--...|", + "---..|","----.|","-----|" }; + + string morseText = ""; + originalText = originalText.ToLower(); + + //Construct a string of text that replaces all the stuff with morse. + for (int i = 0; i < originalText.Length; i++) + { + for (int j = 0; j < 37; j++) + { + if (TextKeys[j] == originalText[i]) + { + morseText += MorseKeys[j]; + break; + } + } + } + + List morseState = new List(); + + for (int i = 0; i < morseText.Length; i++) + { + if (morseText[i] == " ".ToCharArray()[0]) + morseState.AddRange(Enumerable.Repeat(false, spaceLenght)); + + if (morseText[i] == "|".ToCharArray()[0]) + morseState.AddRange(Enumerable.Repeat(false, betweenLetterLenght)); + + if (morseText[i] == ".".ToCharArray()[0]) + morseState.AddRange(Enumerable.Repeat(true, shortLenght)); + + if (morseText[i] == "-".ToCharArray()[0]) + morseState.AddRange(Enumerable.Repeat(true, longLenght)); + + morseState.AddRange(Enumerable.Repeat(false, betweenBlipLenght)); + } + + return morseState[(int)((morseState.Count - 1) * completion)]; + } + public static int GetBannerItem(int style) { int item = -1; @@ -319,9 +391,6 @@ namespace CalamityMod case 4: item = ModContent.ItemType(); break; - case 5: - item = ModContent.ItemType(); - break; case 7: item = ModContent.ItemType(); break; @@ -484,9 +553,6 @@ namespace CalamityMod case 63: item = ModContent.ItemType(); break; - case 65: - item = ModContent.ItemType(); - break; case 66: item = ModContent.ItemType(); break; @@ -604,9 +670,6 @@ namespace CalamityMod case 106: item = ModContent.ItemType(); break; - case 107: - item = ModContent.ItemType(); - break; case 108: item = ModContent.ItemType(); break; @@ -662,7 +725,7 @@ namespace CalamityMod item = ModContent.ItemType(); break; case 126: - item = ModContent.ItemType(); + item = ModContent.ItemType(); break; default: break; @@ -687,9 +750,6 @@ namespace CalamityMod case 4: npc = ModContent.NPCType(); break; - case 5: - npc = ModContent.NPCType(); - break; case 7: npc = ModContent.NPCType(); break; @@ -787,7 +847,7 @@ namespace CalamityMod npc = ModContent.NPCType(); break; case 40: - npc = ModContent.NPCType(); + npc = ModContent.NPCType(); break; case 41: npc = ModContent.NPCType(); @@ -852,9 +912,6 @@ namespace CalamityMod case 63: npc = ModContent.NPCType(); break; - case 65: - npc = ModContent.NPCType(); - break; case 66: npc = ModContent.NPCType(); break; @@ -972,9 +1029,6 @@ namespace CalamityMod case 106: npc = ModContent.NPCType(); break; - case 107: - npc = ModContent.NPCType(); - break; case 108: npc = ModContent.NPCType(); break; @@ -1030,7 +1084,7 @@ namespace CalamityMod npc = ModContent.NPCType(); break; case 126: - npc = ModContent.NPCType(); + npc = ModContent.NPCType(); break; default: break; diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 326949cae5..4189f4264d 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -289,7 +289,7 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 4b175b4424..65e5489ab8 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -98,7 +98,7 @@ namespace CalamityMod CalamityPlayer mp = player.Calamity(); int light = mp.externalAbyssLight; bool underwater = player.IsUnderwater(); - bool miningHelmet = player.head == ArmorIDs.Head.MiningHelmet; + bool miningHelmet = player.head == ArmorIDs.Head.MiningHelmet || player.head == ArmorIDs.Head.UltraBrightHelmet; // The campfire bonus does not apply while in the Abyss. if (!mp.ZoneAbyss && (player.HasBuff(BuffID.Campfire) || Main.SceneMetrics.HasCampfire)) @@ -107,6 +107,8 @@ namespace CalamityMod light += 1; if (miningHelmet) light += 1; + if (player.hasMagiluminescence) + light += 1; if (player.lightOrb) light += 1; if (player.crimsonHeart) @@ -149,6 +151,12 @@ namespace CalamityMod light += 2; if (mp.sirenPet) light += underwater ? 3 : 1; + if (player.petFlagPumpkingPet) + light += 3; + if (player.petFlagGolemPet) + light += 3; + if (player.petFlagFairyQueenPet) + light += 3; if (player.wisp) light += 3; if (player.suspiciouslookingTentacle) @@ -159,6 +167,27 @@ namespace CalamityMod light += Main.dayTime || player.lavaWet ? 2 : 1; // not sure how you'd be in lava in the abyss but go ham I guess return light; } + + /// + /// Directly retrieves the best pickaxe power of the player. + /// + /// + /// + public static int GetBestPickPower(this Player player) + { + int highestPickPower = 35; //35% if you have no pickaxes. + for (int item = 0; item < Main.InventorySlotsTotal; item++) + { + if (player.inventory[item].pick <= 0) + continue; + if (player.inventory[item].pick > highestPickPower) + { + highestPickPower = player.inventory[item].pick; + } + } + + return highestPickPower; + } #endregion #region Movement and Controls @@ -282,6 +311,8 @@ namespace CalamityMod hasItem = true; if (player.bank3.item.Any(item => items.Contains(item.type))) hasItem = true; + if (player.bank4.item.Any(item => items.Contains(item.type))) + hasItem = true; return hasItem; } #endregion @@ -489,6 +520,21 @@ namespace CalamityMod #region Arms Control + /// + /// Gets an arm stretch amount from a number ranging from 0 to 1 + /// + public static CompositeArmStretchAmount ToStretchAmount(this float percent) + { + if (percent < 0.25f) + return CompositeArmStretchAmount.None; + if (percent < 0.5f) + return CompositeArmStretchAmount.Quarter; + if (percent < 0.75f) + return CompositeArmStretchAmount.ThreeQuarters; + + return CompositeArmStretchAmount.Full; + } + /// /// The exact same thing as Player.GetFrontHandPosition() except it properly accounts for gravity swaps instead of requiring the coders to do it manually afterwards. /// Additionally, it simply takes in the arm data instead of asking for the rotation and stretch separately. @@ -530,10 +576,14 @@ namespace CalamityMod /// The desired position of the item /// The size of the item sprite (used in calculations) /// The offset from the center of the sprite of the rotation origin + /// Should the swirly effect from the sandstorm jump be disabled /// Should the angle get flipped with the player, or should it be rotated by 180 degrees /// Should the item get displaced with the player's height during the walk anim? - public static void CleanHoldStyle(Player player, float desiredRotation, Vector2 desiredPosition, Vector2 spriteSize, Vector2? rotationOriginFromCenter = null, bool flipAngle = false, bool stepDisplace = true) + public static void CleanHoldStyle(Player player, float desiredRotation, Vector2 desiredPosition, Vector2 spriteSize, Vector2? rotationOriginFromCenter = null, bool noSandstorm = false, bool flipAngle = false, bool stepDisplace = true) { + if (noSandstorm) + player.sandStorm = false; + //Since Vector2.Zero isn't a compile-time constant, we can't use it directly as the default parameter if (rotationOriginFromCenter == null) rotationOriginFromCenter = Vector2.Zero; @@ -579,6 +629,33 @@ namespace CalamityMod } #endregion + #region visual layers + public static void HideAccessories(this Player player, bool hideHeadAccs = true, bool hideBodyAccs = true, bool hideLegAccs = true, bool hideShield = true) + { + if (hideHeadAccs) + player.face = -1; + + if (hideBodyAccs) + { + player.handon = -1; + player.handoff = -1; + + player.back = -1; + player.front = -1; + player.neck = -1; + } + + if (hideLegAccs) + { + player.shoe = -1; + player.waist = -1; + } + + if (hideShield) + player.shield = -1; + } + #endregion + /// /// Makes the given player send the given packet to all appropriate receivers.
/// If server is false, the packet is sent only to the multiplayer host.
diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 2a1478041d..fa02ddce21 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -24,10 +24,6 @@ namespace CalamityMod public static bool FinalExtraUpdate(this Projectile proj) => proj.numUpdates == -1; - // TODO -- Why does this not simply check if the projectile is summon damage class? - // Is it because of whips? We can make it "IsSummonNotWhip" if needed - public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityLists.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; - public static bool IsTrueMelee(this Projectile proj) { if (proj is null || !proj.active) @@ -65,6 +61,7 @@ namespace CalamityMod projectile.position -= projectile.Size * 0.5f; } public static void ExpandHitboxBy(this Projectile projectile, int newSize) => projectile.ExpandHitboxBy(newSize, newSize); + public static void ExpandHitboxBy(this Projectile projectile, Vector2 newSize) => projectile.ExpandHitboxBy((int)newSize.X, (int)newSize.Y); public static void ExpandHitboxBy(this Projectile projectile, float expandRatio) => projectile.ExpandHitboxBy((int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) @@ -317,7 +314,7 @@ namespace CalamityMod if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) if (projectile2.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile2].DamageType = DamageClass.Melee; + Main.projectile[projectile2].DamageType = DamageClass.MeleeNoSpeed; if (projectile.type == ProjectileType()) if (projectile2.WithinBounds(Main.maxProjectiles)) @@ -685,7 +682,6 @@ namespace CalamityMod { velocityMult = 1f; } - Mod mod = ModContent.GetInstance(); int type = Main.rand.Next(61, 64); int smoke = Gore.NewGore(projectile.GetSource_Death(), source, default, type, 1f); Gore gore = Main.gore[smoke]; diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index d713d80dc0..5739e95233 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -20,6 +20,8 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; +using System.Linq; +using System.Collections.Generic; namespace CalamityMod { @@ -504,5 +506,237 @@ namespace CalamityMod ///
/// The tile to check. public static bool IsTileSolid(this Tile tile) => tile != null && tile.HasUnactuatedTile && Main.tileSolid[tile.TileType] && !TileID.Sets.Platforms[tile.TileType]; + + /// + /// Determines if a tile is "full" based on if the tile is solid. This will count platforms and actuated tiles but no other non-solid ground tiles. + /// + /// The tile to check. + public static bool IsTileFull(this Tile tile) => tile != null && tile.HasTile && Main.tileSolid[tile.TileType]; + + /// + /// Returns a random number between 0 and 1 that always remains the same based on the tile's coordinates. + /// + /// The tile position to grab the rng from + /// An extra offset. Useful if you need multiple counts of rng for the same time + public static float GetTileRNG(this Point tilePos, int shift = 0) => (float)(Math.Sin(tilePos.X * 17.07947 + shift * 36) + Math.Sin(tilePos.Y * 25.13274)) * 0.25f + 0.5f; + + /// + /// Grabs the nearest tile point to the origin, in the specified direction + /// + /// + /// + /// + public static Point GetNearestPointInDirection(this Point origin, float direction) + { + return origin + new Point((int)Math.Round(Math.Cos(direction)), (int)Math.Round(Math.Sin(direction))); + } + + /// + /// Just like Vector2.ToTileCoordinates, but also clamps the position to the tile grid. + /// + /// + /// The tile coordinates + public static Point ToSafeTileCoordinates(this Vector2 vec) + { + return new Point((int)MathHelper.Clamp((int)vec.X >> 4, 0, Main.maxTilesX), (int)MathHelper.Clamp((int)vec.Y >> 4, 0, Main.maxTilesY)); + } + + /// + /// Is a tile valid to be grappled onto + /// A straight rip of the private method Projectile.AI_007_GrapplingHooks_CanTileBeLatchedOnTo() + /// + /// + /// Wether or not the tile may be grappled onto + public static bool CanTileBeLatchedOnTo(this Tile theTile, bool grappleOnTrees = false) => Main.tileSolid[theTile.TileType] | (theTile.TileType == 314) | (grappleOnTrees && TileID.Sets.IsATreeTrunk[theTile.TileType]) | (grappleOnTrees && theTile.TileType == 323); + + /// + /// Gets the required pickaxe power of a tile, accounting for both the ModTile and the vanilla tile pick requirements + /// + /// + /// The pickaxe power required to break a tile + public static int GetRequiredPickPower(this Tile tile, int i, int j) + { + int pickReq = 0; + + if (Main.tileNoFail[tile.TileType]) + return pickReq; + + ModTile moddedTile = TileLoader.GetTile(tile.TileType); + + //Getting the pickaxe requirement of a modded tile is shrimple. + if (moddedTile != null) + pickReq = moddedTile.MinPick; + + //Getting the pickaxe requirement of a vanilla tile is quite clamplicated + //This was lifted from code in onyx excavator, which likely was lifted from vanilla. It might need 1.4 updating. + else + { + switch (tile.TileType) + { + case TileID.Chlorophyte: + pickReq = 200; + break; + case TileID.Ebonstone: + case TileID.Crimstone: + case TileID.Pearlstone: + case TileID.DesertFossil: + case TileID.Obsidian: + case TileID.Hellstone: + pickReq = 65; + break; + case TileID.Meteorite: + pickReq = 50; + break; + case TileID.Demonite: + case TileID.Crimtane: + if (j > Main.worldSurface) + pickReq = 55; + break; + case TileID.LihzahrdBrick: + case TileID.LihzahrdAltar: + pickReq = 210; + break; + case TileID.Cobalt: + case TileID.Palladium: + pickReq = 100; + break; + case TileID.Mythril: + case TileID.Orichalcum: + pickReq = 110; + break; + case TileID.Adamantite: + case TileID.Titanium: + pickReq = 150; + break; + default: + break; + } + } + + if (Main.tileDungeon[tile.TileType]) + { + if (i < Main.maxTilesX * 0.35 || i > Main.maxTilesX * 0.65) + pickReq = 65; + } + + return pickReq; + } + + /// + /// Returns if a tile is safe to be mined in terms of it being "important" + /// + /// + /// If voidstone and abyss gravel should be considered unsafe to mine + /// + public static bool ShouldBeMined(this Tile tile, bool ignoreAbyss = true) + { + List tileExcludeList = new List() + { + TileID.DemonAltar, TileID.ElderCrystalStand, TileID.LihzahrdAltar, TileID.Dressers, TileID.Containers + }; + + if (ignoreAbyss) + { + tileExcludeList.Add(ModContent.TileType()); + tileExcludeList.Add(ModContent.TileType()); + } + + return !Main.tileContainer[tile.TileType] && !tileExcludeList.Contains(tile.TileType); + } + + /// + /// Gets the item drop of an ore tile + /// + /// + /// The item a tile breaks when drops if it's an ore + public static int GetOreItemID(this Tile tile) + { + int item = -1; + + // If it's not ore, then return + if (!TileID.Sets.Ore[tile.TileType]) + return item; + + ModTile moddedTile = TileLoader.GetTile(tile.TileType); + + //Getting the item drop of a modded tile is pretty easy. + if (moddedTile != null) + item = moddedTile.ItemDrop; + + //There is no easy way for getting vanilla item drops :( + else + { + switch (tile.TileType) + { + case TileID.LunarOre: + item = ItemID.LunarOre; + break; + case TileID.Chlorophyte: + item = ItemID.ChlorophyteOre; + break; + case TileID.Titanium: + item = ItemID.TitaniumOre; + break; + case TileID.Adamantite: + item = ItemID.AdamantiteOre; + break; + case TileID.Orichalcum: + item = ItemID.OrichalcumOre; + break; + case TileID.Mythril: + item = ItemID.MythrilOre; + break; + case TileID.Palladium: + item = ItemID.PalladiumOre; + break; + case TileID.Cobalt: + item = ItemID.CobaltOre; + break; + case TileID.Hellstone: + item = ItemID.Hellstone; + break; + case TileID.Obsidian: + item = ItemID.Obsidian; + break; + case TileID.Meteorite: + item = ItemID.Meteorite; + break; + case TileID.Demonite: + item = ItemID.DemoniteOre; + break; + case TileID.Crimtane: + item = ItemID.CrimtaneOre; + break; + case TileID.Platinum: + item = ItemID.PlatinumOre; + break; + case TileID.Gold: + item = ItemID.GoldOre; + break; + case TileID.Tungsten: + item = ItemID.TungstenOre; + break; + case TileID.Silver: + item = ItemID.SilverOre; + break; + case TileID.Lead: + item = ItemID.LeadOre; + break; + case TileID.Iron: + item = ItemID.IronOre; + break; + case TileID.Tin: + item = ItemID.TinOre; + break; + case TileID.Copper: + item = ItemID.CopperOre; + break; + default: + break; + } + } + + return item; + } } } diff --git a/Walls/AbyssGravelWall.png b/Walls/AbyssGravelWall.png index 3af77f5171..90a8303f16 100644 Binary files a/Walls/AbyssGravelWall.png and b/Walls/AbyssGravelWall.png differ diff --git a/Walls/AbyssGravelWallSafe.png b/Walls/AbyssGravelWallSafe.png index 3af77f5171..b486909ee3 100644 Binary files a/Walls/AbyssGravelWallSafe.png and b/Walls/AbyssGravelWallSafe.png differ diff --git a/Walls/AcidwoodWall.cs b/Walls/AcidwoodWall.cs new file mode 100644 index 0000000000..68d7ddc78a --- /dev/null +++ b/Walls/AcidwoodWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Walls; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class AcidwoodWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + ItemDrop = ModContent.ItemType(); + HitSound = SoundID.Dig; + AddMapEntry(new Color(96, 69, 39)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + } +} diff --git a/Walls/AcidwoodWall.png b/Walls/AcidwoodWall.png new file mode 100644 index 0000000000..efc5804fd6 Binary files /dev/null and b/Walls/AcidwoodWall.png differ diff --git a/Walls/AstralStoneWall.png b/Walls/AstralStoneWall.png index be42b977e1..d48d698189 100644 Binary files a/Walls/AstralStoneWall.png and b/Walls/AstralStoneWall.png differ diff --git a/Walls/AstralStoneWallSafe.png b/Walls/AstralStoneWallSafe.png index be42b977e1..d48d698189 100644 Binary files a/Walls/AstralStoneWallSafe.png and b/Walls/AstralStoneWallSafe.png differ diff --git a/Walls/ChaoticBrickWall.png b/Walls/ChaoticBrickWall.png deleted file mode 100644 index 778942e540..0000000000 Binary files a/Walls/ChaoticBrickWall.png and /dev/null differ diff --git a/Walls/CosmiliteBrickWall.png b/Walls/CosmiliteBrickWall.png index 5568c2f184..8e174c541a 100644 Binary files a/Walls/CosmiliteBrickWall.png and b/Walls/CosmiliteBrickWall.png differ diff --git a/Walls/FloralWall.cs b/Walls/FloralWall.cs new file mode 100644 index 0000000000..0b8b9195f3 --- /dev/null +++ b/Walls/FloralWall.cs @@ -0,0 +1,112 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class FloralWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(23, 39, 48)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite = ModContent.Request("CalamityMod/Walls/FloralWall").Value; + Color lightColor = GetWallColour(i, j); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + zero -= new Vector2(8, 8); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + return false; + } + + private int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 2, j % 3 }; + int xPos = i % 2; + int yPos = j % 3; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + sheetOffset = new int[2] { 0, 0 }; + break; + case 1: + sheetOffset = new int[2] { 0, 1 }; + break; + case 2: + sheetOffset = new int[2] { 0, 2 }; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + sheetOffset = new int[2] { 1, 0 }; + break; + case 1: + sheetOffset = new int[2] { 1, 1 }; + break; + case 2: + sheetOffset = new int[2] { 1, 2 }; + break; + } + break; + } + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return sheetOffset; + } + + private Color GetWallColour(int i, int j) + { + int colType = Main.tile[i, j].WallColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + } +} diff --git a/Walls/FloralWall.png b/Walls/FloralWall.png new file mode 100644 index 0000000000..07a41b82cf Binary files /dev/null and b/Walls/FloralWall.png differ diff --git a/Walls/OccultBrickWall.cs b/Walls/OccultBrickWall.cs new file mode 100644 index 0000000000..8806079020 --- /dev/null +++ b/Walls/OccultBrickWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Walls; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class OccultBrickWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + ItemDrop = ModContent.ItemType(); + HitSound = SoundID.Dig; + AddMapEntry(new Color(111, 95, 110)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + } +} diff --git a/Walls/OccultBrickWall.png b/Walls/OccultBrickWall.png new file mode 100644 index 0000000000..e8a9e167fd Binary files /dev/null and b/Walls/OccultBrickWall.png differ diff --git a/Walls/ChaoticBrickWall.cs b/Walls/ScoriaBrickWall.cs similarity index 82% rename from Walls/ChaoticBrickWall.cs rename to Walls/ScoriaBrickWall.cs index 5c2b662020..b5bb16b8c4 100644 --- a/Walls/ChaoticBrickWall.cs +++ b/Walls/ScoriaBrickWall.cs @@ -4,12 +4,13 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ChaoticBrickWall : ModWall + [LegacyName("ChaoticBrickWall")] + public class ScoriaBrickWall : ModWall { public override void SetStaticDefaults() { Main.wallHouse[Type] = true; - ItemDrop = ModContent.ItemType(); + ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(255, 0, 0)); DustType = 105; } diff --git a/Walls/ScoriaBrickWall.png b/Walls/ScoriaBrickWall.png new file mode 100644 index 0000000000..17b3942ad3 Binary files /dev/null and b/Walls/ScoriaBrickWall.png differ diff --git a/Waters/CustomLavaManagement.cs b/Waters/CustomLavaManagement.cs index 8006f2ed39..aefe882ece 100644 --- a/Waters/CustomLavaManagement.cs +++ b/Waters/CustomLavaManagement.cs @@ -44,8 +44,9 @@ namespace CalamityMod.Waters internal static void Unload() { - foreach (CustomLavaStyle lavaStyle in CustomLavaStyles) - lavaStyle?.Unload(); + if (CustomLavaStyles != null) + foreach (CustomLavaStyle lavaStyle in CustomLavaStyles) + lavaStyle?.Unload(); CustomLavaStyles = null; LavaBlockTexture = null; diff --git a/World/Abyss.cs b/World/Abyss.cs index c124ee0dcc..da590c6cdb 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -375,87 +375,72 @@ namespace CalamityMod.World #region Houses public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) { - int sizeMinSmall = sizeMin / 5; - int sizeMaxSmall = sizeMax / 5; - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; + float islandWidth = WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float smallIslandWidth = (float)WorldGen.genRand.Next(sizeMin, sizeMax) / (float)5; //20 30 + int islandPositionX = i; + int islandPositionXAgain = i; + int islandPositionY = j; + int islandPositionYAgain = j; + Vector2 islandOrigin; + islandOrigin.X = i; + islandOrigin.Y = j; Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + vector2.X = WorldGen.genRand.Next(-20, 21) * 0.2f; while (vector2.X > -2f && vector2.X < 2f) { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; //What the fuck is this loop for? Why not just use a nextFloat??? What } vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) + + while (islandWidth > 0f && smallIslandWidth > 0f) { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) + islandWidth -= WorldGen.genRand.Next(4); + smallIslandWidth -= 1f; + + int islandLeftX = Math.Clamp((int)(islandOrigin.X - islandWidth * 0.5), 0, Main.maxTilesX); + int islandRightX = Math.Clamp((int)(islandOrigin.X + islandWidth * 0.5), 0, Main.maxTilesX); + int islandTopY = Math.Clamp((int)(islandOrigin.Y - islandWidth * 0.5), 0, Main.maxTilesY); + int islandBottomY = Math.Clamp((int)(islandOrigin.Y + islandWidth * 0.5), 0, Main.maxTilesY); + + double num11 = islandWidth * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = islandOrigin.Y + 1f; + for (int k = islandLeftX; k < islandRightX; k++) { if (WorldGen.genRand.NextBool(2)) { num12 += (float)WorldGen.genRand.Next(-1, 2); } - if (num12 < vector.Y) + if (num12 < islandOrigin.Y) { - num12 = vector.Y; + num12 = islandOrigin.Y; } - if (num12 > vector.Y + 2f) + if (num12 > islandOrigin.Y + 2f) { - num12 = vector.Y + 2f; + num12 = islandOrigin.Y + 2f; } - for (int l = num9; l < num10; l++) + for (int l = islandTopY; l < islandBottomY; l++) { if ((float)l > num12) { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; + float arg_218_0 = Math.Abs((float)k - islandOrigin.X); + float num13 = Math.Abs((float)l - islandOrigin.Y) * 3f; if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) { - if (k < num3) + if (k < islandPositionX) { - num3 = k; + islandPositionX = k; } - if (k > num4) + if (k > islandPositionXAgain) { - num4 = k; + islandPositionXAgain = k; } - if (l < num5) + if (l < islandPositionYAgain) { - num5 = l; + islandPositionYAgain = l; } - if (l > num6) + if (l > islandPositionY) { - num6 = l; + islandPositionY = l; } Main.tile[k, l].Get().HasTile = true; Main.tile[k, l].TileType = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); @@ -464,7 +449,7 @@ namespace CalamityMod.World } } } - vector += vector2; + islandOrigin += vector2; vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; if (vector2.X > 1f) { @@ -483,11 +468,11 @@ namespace CalamityMod.World vector2.Y = -0.2f; } } - int m = num3; + int m = islandPositionX; int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + for (m += WorldGen.genRand.Next(5); m < islandPositionXAgain; m += WorldGen.genRand.Next(num15, (int)(num15 * 1.5))) { - int num14 = num6; + int num14 = islandPositionY; while (!Main.tile[m, num14].HasTile) { num14--; @@ -503,7 +488,7 @@ namespace CalamityMod.World { for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) { - if (num17 > num5) + if (num17 > islandPositionYAgain) { float arg_409_0 = (float)Math.Abs(n - m); float num18 = (float)(Math.Abs(num17 - num14) * 2); @@ -519,11 +504,11 @@ namespace CalamityMod.World } if (hasTenebris) { - int p = num3; + int p = islandPositionX; int num150; - for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) + for (p += WorldGen.genRand.Next(5); p < islandPositionXAgain; p += WorldGen.genRand.Next(num150, (int)(num150 * 1.5))) { - int num14 = num6; + int num14 = islandPositionY; while (!Main.tile[p, num14].HasTile) { num14--; @@ -535,11 +520,11 @@ namespace CalamityMod.World { for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) { - if (num17 > num5) + if (num17 > islandPositionYAgain) { - float arg_409_0 = (float)Math.Abs(n - p); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) + float arg_409_0 = Math.Abs(n - p); + float num18 = (Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (num150 + WorldGen.genRand.Next(2))) { Main.tile[n, num17].Get().HasTile = true; Main.tile[n, num17].TileType = (ushort)num16; @@ -552,22 +537,22 @@ namespace CalamityMod.World } int sizeMinSmall2 = sizeMin2 / 8; int sizeMaxSmall2 = sizeMax2 / 8; - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + islandWidth = WorldGen.genRand.Next(sizeMin2, sizeMax2); + smallIslandWidth = WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); + islandOrigin.X = i; + islandOrigin.Y = islandPositionYAgain; + vector2.X = WorldGen.genRand.Next(-20, 21) * 0.2f; while (vector2.X > -2f && vector2.X < 2f) { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + vector2.X = WorldGen.genRand.Next(-20, 21) * 0.2f; } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) + vector2.Y = WorldGen.genRand.Next(-20, -10) * 0.02f; + while (islandWidth > 0.0 && smallIslandWidth > 0f) { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + islandWidth -= WorldGen.genRand.Next(4); + smallIslandWidth -= 1f; + islandOrigin += vector2; + vector2.X += WorldGen.genRand.Next(-20, 21) * 0.05f; if (vector2.X > 1f) { vector2.X = 1f; @@ -576,30 +561,30 @@ namespace CalamityMod.World { vector2.X = -1f; } - if ((double)vector2.Y > 0.2) + if (vector2.Y > 0.2) { vector2.Y = -0.2f; } - if ((double)vector2.Y < -0.2) + if (vector2.Y < -0.2) { vector2.Y = -0.2f; } } - int num23 = num3; + int num23 = islandPositionX; num23 += WorldGen.genRand.Next(5); - while (num23 < num4) + while (num23 < islandPositionXAgain) { - int num24 = num6; - while ((!Main.tile[num23, num24].HasTile || Main.tile[num23, num24].TileType != 0) && num23 < num4) + int num24 = islandPositionY; + while ((!Main.tile[num23, num24].HasTile || Main.tile[num23, num24].TileType != 0) && num23 < islandPositionXAgain) { num24--; - if (num24 < num5) + if (num24 < islandPositionYAgain) { - num24 = num6; + num24 = islandPositionY; num23 += WorldGen.genRand.Next(1, 4); } } - if (num23 < num4) + if (num23 < islandPositionXAgain) { num24 += WorldGen.genRand.Next(0, 4); int num25 = WorldGen.genRand.Next(2, 5); @@ -608,11 +593,11 @@ namespace CalamityMod.World { for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) { - if (num28 > num5) + if (num28 > islandPositionYAgain) { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + float arg_890_0 = Math.Abs(num27 - num23); + float num29 = (Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < num25) { Main.tile[num27, num28].TileType = (ushort)num26; CalamityUtils.SafeSquareTileFrame(num27, num28, true); @@ -620,39 +605,42 @@ namespace CalamityMod.World } } } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + num23 += WorldGen.genRand.Next(num25, (int)(num25 * 1.5)); } } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + + //Place backwall + for (int backwallX = islandPositionX - 20; backwallX <= islandPositionXAgain + 20; backwallX++) { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + for (int backwallJ = islandPositionYAgain - 20; backwallJ <= islandPositionY + 20; backwallJ++) { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + //Check to see if the tile is surrounded by other tiles to place a wall + bool AmISurroundedByTiles = true; + for (int i2 = backwallX - 1; i2 <= backwallX + 1; i2++) { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + for (int j2 = backwallJ - 1; j2 <= backwallJ + 1; j2++) { - if (!Main.tile[num32, num33].HasTile) + if (!Main.tile[i2, j2].HasTile) { - flag = false; + AmISurroundedByTiles = false; } } } - if (flag) + if (AmISurroundedByTiles) { - Main.tile[num30, num31].WallType = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); - WorldGen.SquareWallFrame(num30, num31, true); + Main.tile[backwallX, backwallJ].WallType = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); + WorldGen.SquareWallFrame(backwallX, backwallJ, true); } } } - for (int num34 = num3; num34 <= num4; num34++) + for (int num34 = islandPositionX; num34 <= islandPositionXAgain; num34++) { - int num35 = num5 - 10; + int num35 = islandPositionYAgain - 10; while (!Main.tile[num34, num35 + 1].HasTile) { num35++; } - if (num35 < num6 && Main.tile[num34, num35 + 1].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) + if (num35 < islandPositionY && Main.tile[num34, num35 + 1].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) { if (WorldGen.genRand.NextBool(10)) { diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index a8f1f99a75..b2774e32f9 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; using System.Linq; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; @@ -19,6 +20,7 @@ namespace CalamityMod.World { public class AstralBiome { + public static readonly SoundStyle MeteorSound = new("CalamityMod/Sounds/Custom/AstralStarFall"); public static bool CanAstralMeteorSpawn() { int astralOreCount = 0; @@ -215,7 +217,7 @@ namespace CalamityMod.World } int num = 35; Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); - for (int k = 0; k < 255; k++) + for (int k = 0; k < Main.maxPlayers; k++) { if (Main.player[k].active) { @@ -226,7 +228,7 @@ namespace CalamityMod.World } } } - for (int l = 0; l < 200; l++) + for (int l = 0; l < Main.maxNPCs; l++) { if (Main.npc[l].active) { @@ -382,6 +384,9 @@ namespace CalamityMod.World NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); if (CanAstralBiomeSpawn()) { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + SoundEngine.PlaySound(MeteorSound, Main.player[Main.myPlayer].position); + DoAstralConversion(new Point(i, j)); // Upward checks go up 180 tiles. If for whatever reason the placement Y position @@ -491,30 +496,30 @@ namespace CalamityMod.World float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent); if (rand.NextFloat(1f) > outerEdgePercent) { - ConvertToAstral(x, y); + ConvertToAstral(x, y, true); } } else { - ConvertToAstral(x, y); + ConvertToAstral(x, y, true); } } } } } - public static void ConvertToAstral(int startX, int endX, int startY, int endY) + public static void ConvertToAstral(int startX, int endX, int startY, int endY, bool convertOre = false) { for (int x = startX; x <= endX; x++) { for (int y = startY; y <= endY; y++) { - ConvertToAstral(x, y); + ConvertToAstral(x, y, convertOre); } } } - public static void ConvertToAstral(int x, int y) + public static void ConvertToAstral(int x, int y, bool convertOre = false) { if (WorldGen.InWorld(x, y, 1)) { @@ -661,6 +666,21 @@ namespace CalamityMod.World WorldGen.SquareTileFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; + case TileID.Copper: + case TileID.Iron: + case TileID.Silver: + case TileID.Gold: + case TileID.Tin: + case TileID.Lead: + case TileID.Tungsten: + case TileID.Platinum: + if (convertOre) + { + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + WorldGen.SquareTileFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + } + break; case TileID.LeafBlock: case TileID.Sunflower: WorldGen.KillTile(x, y); diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 261bc6acc3..73a303db62 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -14,7 +14,6 @@ namespace CalamityMod.World public static class CalamityWorld { #region Vars - private const int saveVersion = 0; public static int ArmoredDiggerSpawnCooldown = 0; public static int MoneyStolenByBandit = 0; public static int Reforges; @@ -43,32 +42,10 @@ namespace CalamityMod.World public static bool spawnedCirrus = false; public static bool foundHomePermafrost = false; - // Town NPC name chosen bools - public static bool anglerName = false; - public static bool armsDealerName = false; - public static bool clothierName = false; - public static bool cyborgName = false; - public static bool demolitionistName = false; - public static bool dryadName = false; - public static bool dyeTraderName = false; - public static bool goblinTinkererName = false; - public static bool guideName = false; - public static bool mechanicName = false; - public static bool merchantName = false; - public static bool nurseName = false; - public static bool painterName = false; - public static bool partyGirlName = false; - public static bool pirateName = false; - public static bool princessName = false; - public static bool skeletonMerchantName = false; - public static bool steampunkerName = false; - public static bool stylistName = false; - public static bool tavernkeepName = false; - public static bool taxCollectorName = false; - public static bool travelingMerchantName = false; - public static bool truffleName = false; - public static bool witchDoctorName = false; - public static bool wizardName = false; + // Town Pet name chosen bools + public static bool catName = false; + public static bool dogName = false; + public static bool bunnyName = false; // Draedon Summoning stuff. public static int DraedonSummonCountdown = 0; diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 5e41427fc2..db4bb75a29 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.LabFinders; using CalamityMod.Schematics; using Microsoft.Xna.Framework; using System; @@ -95,6 +96,21 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; + float rng = WorldGen.genRand.NextFloat(); + + //Adds a Lab Seeking Mechanism at a 50% chance, or any of the 5 Bio Lab Seeking Mechanisms at a 10% chance each + if(rng < 0.5f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if(rng < 0.6f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if(rng < 0.7f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if (rng < 0.8f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if (rng < 0.9f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); //Add suspicious scrap into the chest rarely. Chance depends on the world size int probability = Main.maxTilesX <= 4200f ? 0 : Main.maxTilesX >= 8400f ? 2 : 1; @@ -167,6 +183,21 @@ namespace CalamityMod.World new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(4, 6 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(4, 7 + 1)), }; + float rng = WorldGen.genRand.NextFloat(); + + //Adds a Lab Seeking Mechanism at a 50% chance, or any of the 5 Bio Lab Seeking Mechanisms at a 10% chance each + if (rng < 0.5f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if (rng < 0.6f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if (rng < 0.7f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if (rng < 0.8f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else if (rng < 0.9f) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + else + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); for (int i = 0; i < contents.Count; i++) { @@ -233,6 +264,10 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; + + //Adds the Ice Seeking Mechanism + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + if (!hasPlacedMurasama) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); @@ -306,6 +341,10 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; + + //Adds the Planetoid Seeking Mechanism + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); @@ -385,17 +424,18 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; + + //Adds the Base Seeking Mechanism + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); } - // If it's a frozen chest. + // If it's a frozen chest, add Arctic Diving Gear to it. if (type == TileID.Containers) - { - int specialItem = Utils.SelectRandom(WorldGen.genRand, ItemID.ArcticDivingGear, ItemID.BlizzardinaBalloon, ItemID.FrozenTurtleShell); - contents.Insert(0, new ChestItem(specialItem, 1)); - } + contents.Insert(0, new ChestItem(ItemID.ArcticDivingGear, 1)); for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -469,6 +509,10 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; + + //Adds the Hell Seeking Mechanism + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + if (!hasPlacedLogAndSchematic) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); @@ -564,7 +608,19 @@ namespace CalamityMod.World Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) - contents.Add(new ChestItem(thorium.Find("MarineKelpPlanterBox").Type, WorldGen.genRand.Next(5, 9 + 1))); + { + try + { + contents.Add(new ChestItem(thorium.Find("MarineKelpPlanterBox").Type, WorldGen.genRand.Next(5, 9 + 1))); + } + catch + { + CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); + } + } + + //Adds the Jungle Seeking Mechanism + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); if (!hasPlacedLogAndSchematic) { diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 6ebd5642fe..130ec4a78b 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -26,10 +26,10 @@ namespace CalamityMod.World { progress.Message = "Adding a new Biome Chest"; - // Get dungeon size field infos. These fields are private for some reason - int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; - int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + // Get dungeon size field infos. + int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.Public).GetValue(null) + 25; + int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.Public).GetValue(null) - 25; + int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.Public).GetValue(null) - 25; int[] ChestTypes = { ModContent.TileType() }; int[] ItemTypes = { ModContent.ItemType() }; diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index 5d59e3e6dd..a48c3fd394 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -84,13 +84,12 @@ namespace CalamityMod.World.Planets { bool convertToRegularSpikes = (j % 2 == 0 && k % 2 == 0) || (j % 2 != 0 && k % 2 != 0); if (Main.tile[j, k].TileType == TileID.WoodenSpikes && convertToRegularSpikes) + Main.tile[j, k].TileType = TileID.Spikes; + + if (Main.tile[j, k].TileType == TileID.WoodenSpikes || Main.tile[j, k].TileType == TileID.Spikes) { // Random lava too :^) - if (WorldGen.genRand.NextBool()) - { - Main.tile[j, k].TileType = TileID.Spikes; - } - else + if (WorldGen.genRand.NextBool(3)) { Main.tile[j, k].Get().HasTile = false; Main.tile[j, k].LiquidAmount = 255; diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index bfc27b0afe..e2a6f0fa48 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -737,11 +737,11 @@ namespace CalamityMod.World if (YStartWhitelist.Contains(type) || OtherTilesForSulphSeaToDestroy.Contains(type)) { - Main.tile[trueX, y].Get().HasTile = false; + CalamityUtils.ParanoidTileRetrieval(trueX, y).Get().HasTile = false; } - if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].WallType)) + if (WallsForSulphSeaToDestroy.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).WallType)) { - Main.tile[trueX, y].WallType = 0; + CalamityUtils.ParanoidTileRetrieval(trueX, y).WallType = 0; } } } diff --git a/build.txt b/build.txt index 307237585f..c9dca54e40 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.0.003 +version = 2.0.1.002 displayName = Calamity Mod homepage = https://discord.gg/calamity buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes