diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index 11b86c7d67..b3399fee89 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Backgrounds if (Main.dedServ) return; - SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG0"); - SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG1"); - SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG2"); - SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG3"); + SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); } public override void FillTextureArray(int[] textureSlots) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 9cc73f84a1..5a31c53ed0 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -92,13 +92,8 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges = new List(); - #region Desert Scourge - // 25% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(DesertScourgeIDList.List, Do(ResistTrueMelee(0.8f)))); - #endregion - #region Crabulon - // 25% resist to true melee. + // 20% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.8f))); #endregion @@ -185,9 +180,6 @@ namespace CalamityMod.Balancing #region Astrum Aureus // 30% resist to The Ballista's greatarrows. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - - // 30% resist to Whitewater. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); #endregion #region Duke Fishron @@ -216,9 +208,6 @@ namespace CalamityMod.Balancing // 50% resist to Icicle Arrows. NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Whitewater. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType())))); - // 35% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); @@ -259,15 +248,15 @@ namespace CalamityMod.Balancing // 70% resist to Stardust Dragon Staff. NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); - // 65% resist to Atlantis (Atlantis gaming!). - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); - // 55% resist to Flak Kraken. NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(ResistTrueMelee(0.5f)))); + // 50% resist to Atlantis (Atlantis gaming!). + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Aurora Blazer. NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); @@ -306,6 +295,9 @@ namespace CalamityMod.Balancing // 50% resist to Galactus Blade. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType()))); + // 40% resist to Pristine Fury's alt fire. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); + // 40% resist to Stellar Torus Staff. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); #endregion @@ -370,6 +362,9 @@ namespace CalamityMod.Balancing #endregion #region Exo Mechs: Ares + // 35% resist to Devil's Devastation's slash. + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 30% resist to Dynamic Pursuer. NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); @@ -487,9 +482,6 @@ namespace CalamityMod.Balancing // 15% resist to The Final Dawn's AoE sweep flames. NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - // 15% resist to Dragon's Breath's beam of fire. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - // 15% resist to God Slayer Slugs. NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 590cc74fcd..430de64677 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -21,7 +21,8 @@ internal const float VanillaFrogLegJumpSpeedBoost = 1.6f; // Altered jump speed boost provided by Amphibian Boots via global item UpdateAccessory - internal static readonly float AmphibianBootsJumpSpeedBoost = 1f; + //doze 23apr2025 - Undid nerf, it's now the same as frog leg. If it's a problem, maybe retier it? + internal static readonly float AmphibianBootsJumpSpeedBoost = 1.6f; // Altered movement stats provided by Shadow Armor via IL edit // This item is modified to not stack with Magiluminescence if on the ground. If in the air, it still functions. @@ -50,6 +51,7 @@ #region Dashes and Dodges // Dash cooldowns (in frames) internal const int UniversalDashCooldown = 30; + internal const int UniversalSashDashCooldown = 30; internal const int UniversalShieldSlamCooldown = 30; internal const int UniversalShieldBonkCooldown = 30; internal const int OnShieldBonkCooldown = 30; @@ -241,6 +243,16 @@ internal static readonly float TrueMeleeRipperReductionFactor = 0.5f; // True melee benefits less from rippers to prevent excessive melting. #endregion + #region Pierce Resistance + // Both of the below variables only apply when an NPC has universal pierce resistance enabled via attribute. + // Projectiles may be marked as exempt from this pierce resistance by using an attribute. + + /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. + public const float PierceResistHarshness = 0.12f; + /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. + public const float PierceResistCap = 0.8f; + #endregion + // TODO -- NPC classification is not done consistently with predictable thresholds. // These variables should be used in general to classify "enemies" vs "non-enemies" as well. // See NPCUtils.IsAnEnemy @@ -252,6 +264,13 @@ internal const int UnreasonableHealthThreshold = 25000000; // 25 million #endregion + #region Multiplayer Boss Health Scaling Overrides + // These values are used to replace the vanilla 1.35f and 1.9166666666666666f for the 2-player and 3-player cases, respectively. + // Editing them via reflection or otherwise will apply to newly spawned bosses during gameplay. + public static float ExpertHealthScalingOverride_2Players = 1.75f; + public static float ExpertHealthScalingOverride_3Players = 2.25f; + #endregion + // TODO -- Add all balance related constants here that don't belong in other files. // Review all constants and static readonlys in the entire mod to find things to add. } diff --git a/BiomeManagers/AbyssLayer1Biome.cs b/BiomeManagers/AbyssLayer1Biome.cs index 8d852ea389..90b8a31632 100644 --- a/BiomeManagers/AbyssLayer1Biome.cs +++ b/BiomeManagers/AbyssLayer1Biome.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; using CalamityMod.Waters; using CalamityMod.World; @@ -48,7 +48,7 @@ namespace CalamityMod.BiomeManagers // Temporarily use sulphur for now public override ModWaterStyle WaterStyle => SulphuricDepthsWater.Instance; - public override int BiomeTorchItemType => ModContent.ItemType(); + public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer1Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; diff --git a/BiomeManagers/AbyssLayer2Biome.cs b/BiomeManagers/AbyssLayer2Biome.cs index 7f520a6835..6afa10e76b 100644 --- a/BiomeManagers/AbyssLayer2Biome.cs +++ b/BiomeManagers/AbyssLayer2Biome.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; using CalamityMod.Waters; using CalamityMod.World; @@ -22,7 +22,7 @@ namespace CalamityMod.BiomeManagers } public override ModWaterStyle WaterStyle => UpperAbyssWater.Instance; - public override int BiomeTorchItemType => ModContent.ItemType(); + public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer2Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index f9ad0fc426..8b62bf1917 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; using CalamityMod.Waters; using CalamityMod.World; @@ -22,7 +22,7 @@ namespace CalamityMod.BiomeManagers } public override ModWaterStyle WaterStyle => MiddleAbyssWater.Instance; - public override int BiomeTorchItemType => ModContent.ItemType(); + public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer3Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; diff --git a/BiomeManagers/AbyssLayer4Biome.cs b/BiomeManagers/AbyssLayer4Biome.cs index 8a2de62e0e..8ade64a46e 100644 --- a/BiomeManagers/AbyssLayer4Biome.cs +++ b/BiomeManagers/AbyssLayer4Biome.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Systems; using CalamityMod.Waters; using CalamityMod.World; @@ -22,7 +22,7 @@ namespace CalamityMod.BiomeManagers } public override ModWaterStyle WaterStyle => VoidWater.Instance; - public override int BiomeTorchItemType => ModContent.ItemType(); + public override int BiomeTorchItemType => ModContent.ItemType(); public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer4Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer4"; diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index 92cab6a912..e1757ba91c 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -21,12 +21,15 @@ namespace CalamityMod.Buffs.StatBuffs if (modPlayer.abyssalDivingSuitPrevious) { if (player.IsUnderwater()) + { + if (player.maxFallSpeed < 9f) + player.maxFallSpeed = 9f; player.gills = true; + } modPlayer.abyssalDivingSuitPower = true; modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; modPlayer.anechoicPlating = true; - modPlayer.ironBoots = true; player.arcticDivingGear = true; player.accFlipper = true; player.accDivingHelm = true; diff --git a/Buffs/StatBuffs/AbyssalMadness.cs b/Buffs/StatBuffs/AbyssalMadness.cs index 1851277c44..60f92a0141 100644 --- a/Buffs/StatBuffs/AbyssalMadness.cs +++ b/Buffs/StatBuffs/AbyssalMadness.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().omegaBlueHentai = true; + player.Calamity().omegaBlueAbyssalMadness = true; } } } diff --git a/Buffs/Summon/SeashineSwordBuff.cs b/Buffs/Summon/SeashineSwordBuff.cs new file mode 100644 index 0000000000..c45048954a --- /dev/null +++ b/Buffs/Summon/SeashineSwordBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.Summon; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SeashineSwordBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.seashineSwordBuff; + } +} diff --git a/Buffs/Summon/SeashineSwordBuff.png b/Buffs/Summon/SeashineSwordBuff.png new file mode 100644 index 0000000000..a7b9a06f29 Binary files /dev/null and b/Buffs/Summon/SeashineSwordBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e97bb0adc3..815d2c316d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -61,9 +61,11 @@ using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -143,6 +145,7 @@ namespace CalamityMod.CalPlayer public bool disableHiveCystSpawns = false; public bool disableNaturalScourgeSpawns = false; public bool disableAnahitaSpawns = false; + public int whitewaterHeal = 0; /// Used for toggling Calamity's blazing cursor effect. public bool blazingCursorDamage = false; /// @@ -297,7 +300,12 @@ namespace CalamityMod.CalPlayer public int GalaxyHammer = 0; /// Variable used to apply Ontological Despoiler's nerfs when continuously using a single firing mode. public bool despoilerNerf = false; + /// Variable used to trigger Molten Amputator's stealth effect on right-click. public int amputatorBuff = 0; + /// Variable used to track the fuel of Pristine Fury right click + public int furyFuelMax = 1800; + public int furyFuel = 1800; + public float furyRefuelTimer = 0; public int rOfResilienceCooldown = 0; public int rOfResilienceEffect = 0; public int rOfResilienceOrbitOffset = 0; @@ -309,7 +317,7 @@ namespace CalamityMod.CalPlayer public int hideOfDeusMeleeBoostTimer = 0; /// /// The player's alcohol level. Increased by 1 for each alcohol the player has drank, 2 for Everclear.
- /// Is this value is greater than 3, the player is inflicted with Alcohol Poisoning. + /// If this value is greater than 3, the player is inflicted with Alcohol Poisoning. ///
public int alcoholPoisonLevel = 0; public int dashTimeMod; @@ -358,7 +366,7 @@ namespace CalamityMod.CalPlayer public int giantShellPostHit = 0; public int tortShellPostHit = 0; public int RustyMedallionCooldown = 0; - public int MiniSwamerCooldown = 0; + public int MiniSwarmerCooldown = 0; public float SulphWaterPoisoningLevel; public float holyInfernoFadeIntensity; public NPC unstableSelectedTarget; @@ -710,9 +718,11 @@ namespace CalamityMod.CalPlayer public bool shieldOfTheHighRulerDashVelocityBoosted = false; public bool luxorsGift = false; public bool luxorHit = false; + public bool luxorsGiftVanity = false; public bool fungalSymbiote = false; public bool trinketOfChi = false; public bool gladiatorSword = false; + public int gladiatorTimer = 0; public bool unstableGraniteCore = false; public bool regenator = false; public float regenatorDamage = 0; @@ -731,6 +741,10 @@ namespace CalamityMod.CalPlayer /// Used to prevent dodges from triggering The Bee's full health damage reduction cooldown. public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; + public bool aFossil = false; + public bool aPowder = false; + public bool fallingBlockProtection = false; + public bool trapProtection = false; public bool alluringBait = false; public bool enchantedPearl = false; public bool fishingStation = false; @@ -773,8 +787,13 @@ namespace CalamityMod.CalPlayer public int gloveLevel = 0; public bool alreadyHasFrogLeg = false; // Unused, intended to prevent Frog Leg tinker stacking public bool eTalisman = false; - /// Counter variable used for spawning Statis' Void Sash's scythes when dashing. - public int statisTimer = 0; + public bool statisNinjaBelt = false; + /// Used to keep track of how many dashes in the same direction you make to prevent dashing away from bosses forever at max efficency. + public int statisPenaltyTimer = 0; + public int statisAnticheese = 0; + public int statisTimerMax => (int)(Utils.Remap(statisAnticheese, 1, 6, 120, 50, true)); + public bool voidSashVisuals = true; + public bool statisVoidSash = false; public bool nucleogenesis = false; public bool nuclearFuelRod = false; public bool nebulousCore = false; @@ -794,9 +813,11 @@ namespace CalamityMod.CalPlayer public bool rampartOfDeities = false; public bool gShell = false; public bool lAmbergris = false; + public bool lAmbergrisVisual = false; public bool tortShell = false; public bool absorber = false; public bool alwaysHoneyRegen = false; + public float alwaysHoneyRegenAmount = 0; public bool honeyTurboRegen = false; public bool honeyDewHalveDebuffs = false; public bool livingDewHalveDebuffs = false; @@ -813,11 +834,14 @@ namespace CalamityMod.CalPlayer public float pulseRate = 1; public bool aAmpoule = false; public bool rOoze = false; + public float radiantOozeRegen = 0; + public float ambrosialAmpouleRegen = 0; + public float purityRegen = 0; public bool fBarrier = false; public bool aBrain = false; public bool amalgam = false; public bool raiderTalisman = false; - public float raiderCritLifespan = 0f; + public int raiderCritLifespan = 0; public int raiderSoundCooldown = 0; public bool gSabaton = false; public int gSabatonHotkeyHoldTime = 0; @@ -873,8 +897,6 @@ namespace CalamityMod.CalPlayer public int PurityHealSlowdownFrames = 0; public bool harpyRing = false; public bool angelTreads = false; - /// Synergy effect while wearing Harpy Wings with Harpy Ring or Angel Treads, allowing attacks to be accompanied by feathers. - public bool harpyWingBoost = false; /// Counter variable used for automatically re-engaging Vortex armor's stealth with Vortex Booster. public int vortexBoosterStealthDelay = 0; /// Makes Flesh Knuckles and its upgrades increase the player's max health by 45. @@ -884,7 +906,7 @@ namespace CalamityMod.CalPlayer public bool anechoicPlating = false; /// Used for increasing light level in the Abyss. public bool jellyfishNecklace = false; - /// Calamity's Fairy Boots effect; makes fairies spawn around you which give stats. + /// Calamity's Fairy Boots effect; makes fairies spawn around the player which give stats. public bool fairyBoots = false; /// Calamity's Flame Waker Boots effect; multiplies heat debuff damage and makes attacks inflict On Fire. public bool flameWakerBoots = false; @@ -909,6 +931,7 @@ namespace CalamityMod.CalPlayer public bool baroclaw = false; public bool HasIncreasedDashFirstFrame = false; public bool IsFirstDashFrame = true; + public int fallingBootVelCheckTimer = 0; public bool voidOfCalamity = false; public bool voidOfExtinction = false; public bool eArtifact = false; @@ -916,11 +939,15 @@ namespace CalamityMod.CalPlayer public bool auricSArtifact = false; public bool pSoulArtifact = false; public bool giantPearl = false; + public bool shieldOfTheOcean = false; + public int shieldOfTheOceanParry = 0; + public bool shieldOfTheOceanEmpoweredParry = false; public bool normalityRelocator = false; public bool flameLickedShell = false; public int flameLickedShellParry = 0; public bool flameLickedShellEmpoweredParry = false; - public bool Pauldron = false; + public bool sPauldron = false; + public bool sPauldronVisual = false; public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; public bool manaOverloader = false; @@ -1002,7 +1029,7 @@ namespace CalamityMod.CalPlayer public int phantomicHeartRegen = 0; public bool silvaWings = false; public int silvaWingsLifeRegenTimer = 0; - /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Harpy Wings, Tattered Fairy Wings, and Festive Wings. + /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Tattered Fairy Wings, and Festive Wings. public int wingProjectileCooldown = 0; public bool RustyMedallionDroplets = false; public bool noStupidNaturalARSpawns = false; @@ -1024,7 +1051,7 @@ namespace CalamityMod.CalPlayer #region Armor Set public int ArmorSetBonusKeyHeldTimer; - /// Calamity's Silver armor set bonus; taking over 20 damage heals 10 health if you avoid damage for 2 seconds. + /// Calamity's Silver armor set bonus; taking over 20 damage heals 10 health if the player avoids damage for 2 seconds. public bool silverMedkit = false; public int silverMedkitTimer = 0; /// Calamity's Gold armor set bonus; makes enemies drop Gold Coins. @@ -1039,7 +1066,7 @@ namespace CalamityMod.CalPlayer public int tornadoCooldown = 0; /// Calamity's Snow armor set bonus; reduces cold enemy damage and increases cold debuff damage. public bool eskimoSet = false; - /// Calamity's Rain armor set bonus; gives jump speed and makes jumps create a splash + /// Calamity's Rain armor set bonus; increases jump speed and makes jumps create a damaging splash. public bool rainSet = false; /// Calamity's Meteor armor set bonus; makes all magic guns cost 33% mana instead of Space Gun costing 0 mana. public bool meteorSet = false; @@ -1151,12 +1178,14 @@ namespace CalamityMod.CalPlayer public bool auricSet = false; public bool omegaBlueChestplate = false; public bool omegaBlueSet = false; - public bool omegaBlueHentai = false; + public bool omegaBlueAbyssalMadness = false; /// Aerospec armor's summoner set bonus minion. public bool valkyrie = false; /// Statigel armor's summoner set bonus minion. public bool slimeGod = false; - public bool molluskSet = false; + public bool molluskHelmet = false; + public bool molluskChest = false; + public bool molluskLegs = false; public bool fearmongerSet = false; public int fearmongerRegenFrames = 0; public bool daedalusCrystal = false; @@ -1388,7 +1417,6 @@ namespace CalamityMod.CalPlayer /// Sun Spirit Staff. public bool SP = false; public bool dCreeper = false; - public bool bClot = false; public bool eAxe = false; public bool endoCooper = false; /// Vengeful Sun Staff. @@ -1451,6 +1479,7 @@ namespace CalamityMod.CalPlayer /// Dragonblood Disgorger. public bool dragonFamily = false; public bool providenceStabber = false; + public bool seashineSwordBuff = false; public bool saros = false; /// Fuel Cell Bundle. public bool plaguebringerMK2 = false; @@ -2097,9 +2126,11 @@ namespace CalamityMod.CalPlayer omegaBlueChestplate = false; omegaBlueSet = false; - omegaBlueHentai = false; + omegaBlueAbyssalMadness = false; - molluskSet = false; + molluskHelmet = false; + molluskChest = false; + molluskLegs = false; fearmongerSet = false; ataxiaBolt = false; @@ -2121,6 +2152,7 @@ namespace CalamityMod.CalPlayer blazingCursorVisuals = false; luxorsGift = false; + luxorsGiftVanity = false; fungalSymbiote = false; trinketOfChi = false; gladiatorSword = false; @@ -2132,6 +2164,10 @@ namespace CalamityMod.CalPlayer arcFlashRingVisual = false; bGlassBand = false; bGlassBandVisual = false; + aFossil = false; + aPowder = false; + fallingBlockProtection = false; + trapProtection = false; alluringBait = false; enchantedPearl = false; fishingStation = false; @@ -2152,11 +2188,15 @@ namespace CalamityMod.CalPlayer tortShell = false; absorber = false; alwaysHoneyRegen = false; + alwaysHoneyRegenAmount = 0; honeyTurboRegen = false; honeyDewHalveDebuffs = false; livingDewHalveDebuffs = false; aAmpoule = false; rOoze = false; + radiantOozeRegen = 0; + ambrosialAmpouleRegen = 0; + purityRegen = 0; fBarrier = false; aBrain = false; amalgam = false; @@ -2175,6 +2215,8 @@ namespace CalamityMod.CalPlayer eGauntlet = false; eGauntletVisuals = true; gloveLevel = 0; + statisNinjaBelt = false; + statisVoidSash = false; alreadyHasFrogLeg = false; eTalisman = false; nucleogenesis = false; @@ -2206,14 +2248,10 @@ namespace CalamityMod.CalPlayer purity = false; harpyRing = false; angelTreads = false; - harpyWingBoost = false; //harpy wings + harpy ring fleshKnuckles = false; darkSunRing = false; crawCarapace = false; baroclaw = false; - gShell = false; - lAmbergris = false; - tortShell = false; voidOfCalamity = false; voidOfExtinction = false; eArtifact = false; @@ -2221,9 +2259,10 @@ namespace CalamityMod.CalPlayer auricSArtifact = false; pSoulArtifact = false; giantPearl = false; + shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; - Pauldron = false; + sPauldron = false; XykVisualsBlue = false; XykVisualsOrange = false; manaOverloader = false; @@ -2538,7 +2577,6 @@ namespace CalamityMod.CalPlayer aquaticStar = false; SP = false; dCreeper = false; - bClot = false; eAxe = false; endoCooper = false; apexShark = false; @@ -2597,6 +2635,7 @@ namespace CalamityMod.CalPlayer powerfulRaven = false; dragonFamily = false; providenceStabber = false; + seashineSwordBuff = false; plaguebringerMK2 = false; igneousExaltation = false; GlacialEmbrace = false; @@ -2783,6 +2822,7 @@ namespace CalamityMod.CalPlayer #region Buffs, Debuffs, Counters, and Nonsense heldGaelsLastFrame = false; gaelSwipes = 0; + whitewaterHeal = 0; luxorHit = false; arsenalCooldown = 0; andromedaState = AndromedaPlayerState.Inactive; @@ -2803,7 +2843,7 @@ namespace CalamityMod.CalPlayer spiritOriginCritBoost = 0; rage = 0f; adrenaline = 0f; - raiderCritLifespan = 0f; + raiderCritLifespan = 0; raiderSoundCooldown = 0; gSabatonHotkeyHoldTime = 0; gSabatonFall = 0; @@ -2844,7 +2884,7 @@ namespace CalamityMod.CalPlayer scuttlerCooldown = 0; rogueCrownCooldown = 0; wingProjectileCooldown = 0; - statisTimer = 0; + statisPenaltyTimer = -1; hallowedRuneCooldown = 0; sulphurBubbleCooldown = 0; ladHearts = 0; @@ -3055,7 +3095,9 @@ namespace CalamityMod.CalPlayer ChlorophyteHealDelay = 0; omegaBlueChestplate = false; omegaBlueSet = false; - molluskSet = false; + molluskHelmet = false; + molluskChest = false; + molluskLegs = false; fearmongerSet = false; daedalusReflect = false; daedalusSplit = false; @@ -3136,6 +3178,8 @@ namespace CalamityMod.CalPlayer tracersDust = false; elysianWingsDust = false; GemTechState.OnDeathEffects(); + shieldOfTheOceanParry = 0; + shieldOfTheOceanEmpoweredParry = false; blazingCoreParry = 0; blazingCoreEmpoweredParry = false; blazingCoreSuccessfulParry = 0; @@ -3265,7 +3309,7 @@ namespace CalamityMod.CalPlayer } //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero - if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) + if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { gSabatonHotkeyHoldTime++; if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime % 3f == 0) @@ -3394,20 +3438,97 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item34, Player.Center); } + if (CalamityKeybinds.AmmoCycleHotkey.JustPressed && deadshotBrooch) + { + SoundEngine.PlaySound(SoundID.Item149, Player.Center); + + // I could've made this so simple on myself, but no, I felt the need to make things convenient for the users... + // First we need to determine the bounds for what we're swapping. + int ammoType = Player.HeldItem.useAmmo; + int lastSlot, firstSlot; + for (lastSlot = 57; lastSlot >= 54; lastSlot--) + { + if (!Player.inventory[lastSlot].IsAir && Player.inventory[lastSlot].ammo == ammoType) + break; + } + for (firstSlot = 54; firstSlot <= 57; firstSlot++) + { + if (!Player.inventory[firstSlot].IsAir && Player.inventory[firstSlot].ammo == ammoType) + break; + } + // If firstSlot = lastSlot, then there is only one ammo in ammo slots, so don't do anything. + if (firstSlot != lastSlot) + { + int tempType = Player.inventory[lastSlot].type; + int tempStack = Player.inventory[lastSlot].stack; + // This list tracks the favorited status of the ammo slots. Since swapping the slots around fucks with the favorite status it must be manually set. + List favorited = []; + for (int z = 54; z <= 57; z++) + favorited.Add(!Player.inventory[z].IsAir && Player.inventory[z].favorited); + + // It is impossible for lastSlot to equal 54 and firstSlot to not equal 54. + for (int i = lastSlot; i >= 55; i--) + { + if (Player.inventory[i].IsAir || Player.inventory[i].ammo != ammoType) + continue; + + // If the slot we're interested in is the lower bound of our ammos, set it to the temp values and don't run anything else. + if (i == firstSlot) + { + Player.inventory[i].SetDefaults(tempType); + Player.inventory[i].stack = tempStack; + Player.inventory[i].favorited = favorited[lastSlot - 54]; + continue; + } + + // Find the next slot that has ammo in it. + int nextSlot; + for (nextSlot = i - 1; nextSlot >= 54; nextSlot--) + { + if (!Player.inventory[nextSlot].IsAir && Player.inventory[nextSlot].ammo == ammoType) + break; + } + + // Set this slot to what is in that slot. + Player.inventory[i].SetDefaults(Player.inventory[nextSlot].type); + Player.inventory[i].stack = Player.inventory[nextSlot].stack; + Player.inventory[i].favorited = favorited[nextSlot - 54]; + } + + // Handles swapping the ammo that is in the first slot. + if (firstSlot == 54) + { + Player.inventory[54].SetDefaults(tempType); + Player.inventory[54].stack = tempStack; + Player.inventory[54].favorited = favorited[lastSlot - 54]; + } + + // Produce a visual effect showing the top ammo that you swapped to. + int visualType = Player.inventory[firstSlot].type; + Texture2D ammoTex = TextureAssets.Item[visualType].Value; + int frameAmt = Main.itemAnimations[visualType] == null ? 1 : ammoTex.Height / Main.itemAnimations[visualType].GetFrame(ammoTex).Height; + CustomSprite ammoVisual = new(Player.Center - Vector2.UnitY * 20f, -Vector2.UnitY * 7f, 30, ammoTex, 1f, Color.White, 0f, false, false, frameAmt); + GeneralParticleHandler.SpawnParticle(ammoVisual); + } + } + if (CalamityKeybinds.ArmorSetBonusHotKey.JustPressed) { PlayerLoader.ArmorSetBonusActivated(Player); - // Activate vanilla set bonuses - if (Player.setVortex && !Player.mount.Active) - Player.vortexStealthActive = !Player.vortexStealthActive; - - if (Player.setForbidden) + if (CalamityClientConfig.Instance.CalamityArmorSetBonusDoubleTap) { - Player.MinionRestTargetAim(); + // Activate vanilla set bonuses + if (Player.setVortex && !Player.mount.Active) + Player.vortexStealthActive = !Player.vortexStealthActive; - if (!Player.setForbiddenCooldownLocked) - Player.CommandForbiddenStorm(); + if (Player.setForbidden) + { + Player.MinionRestTargetAim(); + + if (!Player.setForbiddenCooldownLocked) + Player.CommandForbiddenStorm(); + } } } @@ -3447,6 +3568,12 @@ namespace CalamityMod.CalPlayer flameLickedShellParry = FlameLickedShell.flameLickedParry; } } + else if (shieldOfTheOcean && shieldOfTheOceanParry == 0) + { + GeneralScreenShakePower = 2f; + SoundEngine.PlaySound(ShieldoftheOcean.TriggerSound, Player.Center); + shieldOfTheOceanParry = ShieldoftheOcean.ParryTime; + } } // Trigger for pressing the God Slayer dash key @@ -3614,6 +3741,10 @@ namespace CalamityMod.CalPlayer public override void ArmorSetBonusActivated() { + // Don't trigger set bonuses if the config is disabled and the double-tap hotkey was triggered + if (!(CalamityKeybinds.ArmorSetBonusHotKey.JustPressed || CalamityClientConfig.Instance.CalamityArmorSetBonusDoubleTap)) + return; + // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) { @@ -3990,7 +4121,7 @@ namespace CalamityMod.CalPlayer } // Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued // Also cancel fall if the player has upwards Y velocity (Goodbye Inner Tube cheese) - if (Player.velocity.Y < 0f || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) + if ((Player.gravDir == 1 && Player.velocity.Y < 0f) || (Player.gravDir == -1 && Player.velocity.Y > 1f) || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) { gSabatonFall = 0; gSabatonFalling = false; @@ -4009,7 +4140,7 @@ namespace CalamityMod.CalPlayer Player.controlJump = false; // Check if player hit some form of solid resistance (the ground) - if (Player.oldVelocity.Y == Player.velocity.Y) + if (0 == Player.velocity.Y) { var source = Player.GetSource_Accessory(FindAccessory(ItemType())); //Spawn explosion. ai[0] is used for transferring the recorded falling time @@ -4303,6 +4434,8 @@ namespace CalamityMod.CalPlayer (getSandCloakAccelBoost ? 0.75f : 0f) + (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + (ascendantInsignia ? 0.25f : 0f ) + // Added to Soaring Insignia's 1.25x multiplier to get 1.5x + (statisNinjaBelt ? 0.6f : 0f) + + (statisVoidSash ? 0.85f : 0f) + (blueCandle ? WeightlessCandle.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + //(exaltedKillMode ? 7f : devilsDevastationKillMode ? 11f : 0) + @@ -4364,6 +4497,8 @@ namespace CalamityMod.CalPlayer ModDashMovement(); } #endregion + + Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it } #endregion @@ -5524,6 +5659,9 @@ namespace CalamityMod.CalPlayer // It also starts the speedrun timer if applicable. public override void OnEnterWorld() { + if (CalamityClientConfig.Instance.StutterFix) + WorldGen.SectionTileFrameWithCheck(0, 0, Main.maxTilesX, Main.maxTilesY); + if (Main.netMode == NetmodeID.MultiplayerClient) EnterWorldSync(); @@ -5538,9 +5676,7 @@ namespace CalamityMod.CalPlayer // Set a random delay between 12 and 20 seconds. When this delay hits zero, startup messages display if (showStartupMessages) - { startMessageDisplayDelay = Main.rand.Next(CalamityUtils.SecondsToFrames(12), CalamityUtils.SecondsToFrames(20) + 1); - } } /// @@ -5587,7 +5723,7 @@ namespace CalamityMod.CalPlayer Player.HealEffect(-5); Player.statLife -= 5; if (Player.statLife <= 0) - Player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaConversionEnchant").Format(Player.name)), 1000, -1); + Player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaConversionEnchant").ToNetworkText(Player.name)), 1000, -1); } for (int i = 0; i < 8; i++) diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index a2e591296b..426cf2c311 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -120,6 +120,8 @@ namespace CalamityMod.CalPlayer dashDelayToApply = BalancingConstants.UniversalShieldBonkCooldown; if (DashID == DeepDiverDash.ID) dashDelayToApply = 23; + if (DashID == StatisNinjaBeltDash.ID || DashID == StatisVoidSashDash.ID || Player.dashType == 1) + dashDelayToApply = BalancingConstants.UniversalSashDashCooldown; float dashSpeed = 12f; float dashSpeedDecelerationFactor = 0.985f; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index eaaeda1189..11c960eb68 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -442,7 +442,7 @@ namespace CalamityMod.CalPlayer } #endregion Profaned Moonlight Dye Colors - #region Tanks/Backpacks + #region Vanity Accessories and Tanks/Backpacks public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) { if (drawInfo.shadow != 0f) @@ -451,6 +451,52 @@ namespace CalamityMod.CalPlayer Player drawPlayer = drawInfo.drawPlayer; Item item = drawPlayer.ActiveItem(); + // Vanity accessory effects, allows them to draw while the game is paused + if (drawPlayer.Calamity().ghostBracelet) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); + } + else if ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); + drawPlayer.face = -1; + } + else if (drawPlayer.Calamity().punchCard) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head); + } + else if ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Head); + drawPlayer.face = -1; + } + else if ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide) + { + drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Legs); + drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Body); + drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Head); + drawPlayer.face = -1; + } + // Need to set all of these so that certain vanity pieces like Capricorn Tail don't screw it up + if (drawPlayer.Calamity().ghostBracelet || ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) || + drawPlayer.Calamity().punchCard || ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) || + ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide)) + { + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.bodyGlowMask = -1; + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + if (!drawPlayer.frozen && (item.IsAir || item.type > ItemID.None) && !drawPlayer.dead && diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 15fd719931..636585b6d9 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -352,7 +352,7 @@ namespace CalamityMod.CalPlayer { if (alcoholPoisoning) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholBig" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholBig" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } if (vHex) { @@ -372,123 +372,123 @@ namespace CalamityMod.CalPlayer // if none of SCal's phases are detected somehow then it just uses the normal messages all the time } - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText(vHexKeyToUse).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText(vHexKeyToUse).ToNetworkText(Player.name)); } if (ZoneCalamity && Player.lavaWet) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SearingLava" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SearingLava" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } if (gsInferno) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.GodSlayerInferno" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.GodSlayerInferno" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (sulphurPoison) { if (!Main.rand.NextBool(4)) // 75% custom - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SulphuricPoisoning" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SulphuricPoisoning" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); else damageSource = PlayerDeathReason.ByOther(9); // 25% generic Poisoned death text } if (dragonFire) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Dragonfire" + Main.rand.Next(1, 4 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Dragonfire" + Main.rand.Next(1, 4 + 1)).ToNetworkText(Player.name)); } if (vermillionFlux) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.VermillionFlux" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.VermillionFlux" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (auricRebuke) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRebuke" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRebuke" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (staticDischarge) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.StaticDischarge" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.StaticDischarge" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (miracleBlight) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.MiracleBlight" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.MiracleBlight" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (hInferno) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyInferno").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyInferno").ToNetworkText(Player.name)); } if (hFlames || banishingFire) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyFlames" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyFlames" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (shadowflame) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Shadowflame").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Shadowflame").ToNetworkText(Player.name)); } if (daybroken) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Daybroken").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Daybroken").ToNetworkText(Player.name)); } if (bBlood) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BurningBlood" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BurningBlood" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } if (brainRot) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (heavybleeding) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HeavyBleeding" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HeavyBleeding" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (laceration) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Laceration" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Laceration" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (elementalMix) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ElementalMix" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ElementalMix" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } if (cDepth) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CrushDepth" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CrushDepth" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (rTide) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Riptide" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Riptide" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } if (hPressure) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HadopelagicPressure" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HadopelagicPressure" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (bFlames || weakBrimstoneFlames || demonicFlames) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrimstoneFlames" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrimstoneFlames" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (pFlames) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Plague" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Plague" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (astralInfection) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInfection" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInfection" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } if (nightwither) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Nightwither").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Nightwither").ToNetworkText(Player.name)); } if (vaporfied) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Vaporfied").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Vaporfied").ToNetworkText(Player.name)); } if (manaOverloader || ManaBurn) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaBurn").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaBurn").ToNetworkText(Player.name)); } if (witheredDebuff) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").ToNetworkText(Player.name)); } } if (profanedCrystalBuffs && !profanedCrystalHide) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProfanedSoulCrystal").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProfanedSoulCrystal").ToNetworkText(Player.name)); } // Leon Death Noise RE4 @@ -496,7 +496,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); if (NorfleetCounter > 3 && NorfleetCounter < 1000) - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Norfleet").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Norfleet").ToNetworkText(Player.name)); NorfleetCounter = 0; if (NPC.AnyNPCs(ModContent.NPCType())) @@ -812,7 +812,7 @@ namespace CalamityMod.CalPlayer } if (trinketOfChiBuff) - contactDamageReduction += 0.04; + contactDamageReduction += 0.08; // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. // To prevent abuse, this effect does not work if there are any bosses alive. @@ -938,7 +938,7 @@ namespace CalamityMod.CalPlayer Player.GiveUniversalIFrames(evolutionIFrames, true); modifiers.Cancel(); - evolutionLifeRegenCounter = 300; + evolutionLifeRegenCounter = 600; projTypeJustHitBy = proj.type; int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.EvolutionReflectCooldownMin, BalancingConstants.EvolutionReflectCooldownMax, cooldownDurationScalar); @@ -993,7 +993,7 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= 0.65f; // 80 in normal, 100 in expert, 150 in master - else if (proj.type == ProjectileID.SpikyBallTrap || proj.type == ProjectileID.FlamethrowerTrap || proj.type == ProjectileID.PoisonDartTrap) + else if (proj.type == ProjectileID.SpikyBallTrap || proj.type == ProjectileID.FlamethrowerTrap || proj.type == ProjectileID.FlamesTrap || proj.type == ProjectileID.PoisonDartTrap) modifiers.SourceDamage *= 0.625f; // 120 in normal, 144 in expert, 216 in master @@ -1001,6 +1001,20 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= 0.6f; } + bool isFallingBlock = (proj.type == ProjectileID.SandBallFalling) || (proj.type == ProjectileID.SiltBall) || (proj.type == ProjectileID.AshBallFalling) || + (proj.type == ProjectileID.CrimsandBallFalling) || (proj.type == ProjectileID.EbonsandBallFalling) || (proj.type == ProjectileID.PearlSandBallFalling) || + (proj.type == ProjectileID.ShellPileFalling) || (proj.type == ProjectileID.SlushBall) || (proj.type == ModContent.ProjectileType()); + if (Player.Calamity().fallingBlockProtection && isFallingBlock) + modifiers.Cancel(); + + bool isIgnoredTrap = (proj.type == ProjectileID.PoisonDartTrap) || (proj.type == ProjectileID.VenomDartTrap) || (proj.type == ProjectileID.PoisonDart); + if (Player.Calamity().trapProtection && isIgnoredTrap) + modifiers.Cancel(); + + bool isReducedTrap = (proj.trap || proj.type == ProjectileID.RollingCactusSpike || proj.type == ProjectileID.Landmine) && !isIgnoredTrap; + if (Player.Calamity().trapProtection && isReducedTrap) + modifiers.SourceDamage *= 0.35f; + // Reduce damage dealt by rainbow trails depending on how faded they are. if (proj.type == ProjectileID.HallowBossLastingRainbow) { @@ -1036,7 +1050,7 @@ namespace CalamityMod.CalPlayer if (evolution) { if (proj.type == projTypeJustHitBy) - projectileDamageReduction += 0.2; + projectileDamageReduction += 0.25; } if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) @@ -1047,7 +1061,7 @@ namespace CalamityMod.CalPlayer } if (trinketOfChiBuff) - projectileDamageReduction += 0.04; + projectileDamageReduction += 0.08; // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. // To prevent abuse, this effect does not work if there are any bosses alive. @@ -1361,6 +1375,10 @@ namespace CalamityMod.CalPlayer // Guaranteed Cursed Inferno for 1 second (vanilla also has a 68.75% chance of Cursed Inferno for 2 to 3 seconds) Player.AddBuff(BuffID.CursedInferno, 60); } + else if (proj.type == ProjectileID.DesertDjinnCurse) + { + Player.AddBuff(BuffID.Cursed, 180); + } else if (proj.type == ProjectileID.Stinger || proj.type == ProjectileID.QueenBeeStinger) { // 66.6% chance of Poison for 3 seconds, 1 guaranteed second of Poison otherwise (vanilla also has a 33.3% chance of Poison for 10 seconds) @@ -1875,6 +1893,23 @@ namespace CalamityMod.CalPlayer FlameLickedShell.handleParry(Player); } } + else if (shieldOfTheOceanParry >= 12) + { + if (!Player.HasCooldown(ParryCooldown.ID)) + { + // Shield of the Ocean is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + int shieldParryIFrames = Player.ComputeParryIFrames(); + Player.GiveUniversalIFrames(shieldParryIFrames, true); + + shieldOfTheOceanEmpoweredParry = true; + modifiers.FinalDamage *= 0.4f; // 60% DR + modifiers.DisableSound(); + } + + SoundEngine.PlaySound(Main.zenithWorld ? ShieldoftheOcean.ParrySoundGFB : ShieldoftheOcean.ParrySound, Player.Center); + Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean"); + ShieldoftheOcean.ActivateParry(Player); + } } private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info) @@ -2874,11 +2909,11 @@ namespace CalamityMod.CalPlayer if (abyssDeath) { SoundEngine.PlaySound(DrownSound, Player.Center); - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AbyssDrown" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AbyssDrown" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } else if (CalamityWorld.armageddon && areThereAnyDamnBosses) { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Armageddon").Format(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Armageddon").ToNetworkText(Player.name)); } NetworkText deathText = damageSource.GetDeathText(Player.name); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 5a65730151..0b0a4a5b17 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -178,7 +178,7 @@ namespace CalamityMod.CalPlayer if (SulphWaterPoisoningLevel >= 1f) { SulphWaterPoisoningLevel = 0f; - Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SulphurMeter").Format(Player.name)), Math.Min(Player.statLifeMax2 / 4, 150), 0); + Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SulphurMeter").ToNetworkText(Player.name)), Math.Min(Player.statLifeMax2 / 4, 150), 0); } } else @@ -310,6 +310,7 @@ namespace CalamityMod.CalPlayer // Exact copy of vanilla Honey behavior, but does not stack with actually standing in Honey if (!Player.honey) { + alwaysHoneyRegenAmount += 1; Player.lifeRegen += 2; Player.lifeRegenTime += 1; @@ -317,6 +318,7 @@ namespace CalamityMod.CalPlayer // However, this can't bring regen into the positives. if (Player.lifeRegen < 0) { + alwaysHoneyRegenAmount += Math.Min(1f, 0 - Player.lifeRegen/2f); Player.lifeRegen += 2; if (Player.lifeRegen > 0) Player.lifeRegen = 0; @@ -392,10 +394,13 @@ namespace CalamityMod.CalPlayer // Grant life regen based on missing health for Radiant Ooze, Ambrosial Ampule, and purity if (rOoze || aAmpoule || purity) { - float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / Player.statLifeMax2; + float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / (float)Player.statLifeMax2; //Ambrosial Ampule and ooze give between 2 and 6 hp/s - float lifeRegenToGive = MathHelper.Lerp(4f, 12f, missingLifeRatio); - Player.lifeRegen += (int)lifeRegenToGive; + int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp((purity || aAmpoule? 2f : 4f), (purity || aAmpoule ? 8f : 12f), missingLifeRatio));//Rounding is needed for it to ever actually give +6 hp/s, as the integer conversion would otherwise floor it. + Player.lifeRegen += lifeRegenToGive; + radiantOozeRegen += lifeRegenToGive / 2f; + ambrosialAmpouleRegen += lifeRegenToGive / 2f; + purityRegen += lifeRegenToGive / 2f; } if (purity) @@ -409,10 +414,10 @@ namespace CalamityMod.CalPlayer int healFrameCadence = 12; // Healing slows down after 5 seconds (300 frames) debuffed. For every 15 frames thereafter the cadence slows - // There is no upper limit to how slow it can get and it can take a very long time to reset to normal + // The upper limit to how slow it can get is after 15 seconds (900 frames) int punishmentFrames = PurityHealSlowdownFrames - 300; - //lowest punishment is three full seconds between the one health heal - if (healFrameCadence < 180) + //lowest punishment is a little under a second between the one health heal + if (healFrameCadence < 52) healFrameCadence += (punishmentFrames < 0) ? 0 : punishmentFrames / 15; if (Player.miscCounter % healFrameCadence == healFrameCadence - 1) @@ -426,7 +431,9 @@ namespace CalamityMod.CalPlayer jewelBonusDefense = intendedPurityDefense; // Count up total frames spent healing for slowdown. - ++PurityHealSlowdownFrames; + if (PurityHealSlowdownFrames < 900) + ++PurityHealSlowdownFrames; + purityRegen += (60 / (float)healFrameCadence); } // If the defense should be ticking down to some lower value, do that. @@ -610,10 +617,8 @@ namespace CalamityMod.CalPlayer if (trinketOfChi || chiRegen) Player.lifeRegen += 2; - // Remember this is for 5 seconds after triggering a reflect with a long cooldown if (evolutionLifeRegenCounter > 0) { - Player.lifeRegen += 12; if (Player.lifeRegenTime < 3600f) Player.lifeRegenTime = 3600f; } @@ -770,6 +775,8 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += turboRegenPower; Player.lifeRegenTime += turboRegenPower; + purityRegen += turboRegenPower/2f; + if (!shadeRegen || cFreeze || purity) ambrosialAmpouleRegen += turboRegenPower/2f; } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 75015c9458..5ac2219239 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -203,6 +203,16 @@ namespace CalamityMod.CalPlayer rage = 0f; } + if (furyFuel < furyFuelMax && furyRefuelTimer >= 0) + { + furyFuel += (int)furyRefuelTimer; + furyRefuelTimer = MathHelper.Lerp(furyRefuelTimer, 25, 0.01f); + if (furyFuel > furyFuelMax) + furyFuel = furyFuelMax; + } + else if (furyRefuelTimer < 0) + furyRefuelTimer++; + // De-equipping Draedon's Heart deletes all Adrenaline. if (!draedonsHeart && hadNanomachinesLastFrame) { @@ -227,6 +237,17 @@ namespace CalamityMod.CalPlayer Player.velocity.X *= 0.9f; } + // Tabi/Master Ninja Gear dash change + if (Player.dashType == 1) + { + if (dashStart) + Player.velocity.X *= 3.5f; + if (Player.dashDelay == -1) + { + Player.velocity.X *= 0.9f; + } + } + if ((devilsDevastationKillMode || exaltedKillMode) && !Player.mount.Active) { float fxScale = 1; @@ -296,49 +317,19 @@ namespace CalamityMod.CalPlayer { if (dashStart) { - Player.velocity.X *= 1.2f; + Player.velocity.X *= 2.2f; // +120% dash speed int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); - - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33% Player.dashDelay--; - if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal) - { - float numberOfDusts = 10f; - float rotFactor = 180f / numberOfDusts; - for (int i = 0; i < numberOfDusts; i++) - { - float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(Player.velocity.X * dir * 0.7f + 6f, 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); - Vector2 velOffset = Vector2.Zero; - Dust dust = Dust.NewDustPerfect(Player.Center + offset + Player.velocity, Main.rand.NextBool() ? 160 : 307, new Vector2(velOffset.X, velOffset.Y)); - dust.noGravity = true; - dust.velocity = velOffset; - dust.alpha = 100; - dust.scale = (Player.velocity.X * dir * 0.08f); - } - if (Player.miscCounter % 4 == 0) - { - float sparkscale = (Player.velocity.X * dir * 0.07f); - Vector2 SparkVelocity1 = Player.velocity.RotatedBy(dir * 2, default) * 0.1f - Player.velocity / 2f; - LineParticle spark = new LineParticle(Player.Center + Player.velocity.RotatedBy(2f * dir) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue); - GeneralParticleHandler.SpawnParticle(spark); - Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * -2, default) * 0.1f - Player.velocity / 2f; - LineParticle spark2 = new LineParticle(Player.Center + Player.velocity.RotatedBy(-2f * dir) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue); - GeneralParticleHandler.SpawnParticle(spark2); - } - if (Player.miscCounter % 4 == 0 && Player.velocity != Vector2.Zero) //every other frame spawn the hitbox - { - int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); - } - } + if (Player.dashDelay == -1) + Player.velocity.X *= 0.9f; } - if (Pauldron) + if (sPauldron) { if (dashStart) { @@ -346,37 +337,9 @@ namespace CalamityMod.CalPlayer int damage = (int)Player.GetBestClassDamage().ApplyTo(SlagsplitterPauldron.PauldronSlamDamage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); } - if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal) - { - int damage = (int)Player.GetBestClassDamage().ApplyTo(SlagsplitterPauldron.PauldronSlamDamage); + if (Player.dashDelay == -1) Player.endurance += 0.1f; - - float numberOfDusts = 10f; - float rotFactor = 180f / numberOfDusts; - for (int i = 0; i < numberOfDusts; i++) - { - float rot = MathHelper.ToRadians(i * rotFactor); - Vector2 offset = new Vector2(MathF.Min(Player.velocity.X * dir * 0.7f + 8f, 20f), 0).RotatedBy(rot * Main.rand.NextFloat(4f, 5f)); - Vector2 velOffset = Vector2.Zero; - Dust dust = Dust.NewDustPerfect(Player.Center + offset + Player.velocity, Main.rand.NextBool() ? 35 : 127, new Vector2(velOffset.X, velOffset.Y)); - dust.noGravity = true; - dust.velocity = velOffset; - dust.alpha = 100; - dust.scale = MathF.Min(Player.velocity.X * dir * 0.08f, 1.2f); - } - float sparkscale = MathF.Min(Player.velocity.X * dir * 0.08f, 1.2f); - Vector2 SparkVelocity1 = Player.velocity.RotatedBy(dir * -3, default) * 0.1f - Player.velocity / 2f; - SparkParticle spark = new SparkParticle(Player.Center + Player.velocity.RotatedBy(2f * dir) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); - GeneralParticleHandler.SpawnParticle(spark); - Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * 3, default) * 0.1f - Player.velocity / 2f; - SparkParticle spark2 = new SparkParticle(Player.Center + Player.velocity.RotatedBy(-2f * dir) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); - GeneralParticleHandler.SpawnParticle(spark2); - - if (Player.miscCounter % 6 == 0 && Player.velocity != Vector2.Zero) - { - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), SlagsplitterPauldron.PauldronSlamDamage, 0, Player.whoAmI); - } - } + } if (XykVisualsBlue || XykVisualsOrange) @@ -467,12 +430,6 @@ namespace CalamityMod.CalPlayer } } - // Solar Wings increase dash velocity of Solar Flare armor dash - if (Player.wingsLogic == (int)VanillaWingID.WingsSolar && Player.dash == 3 && dashStart) - { - Player.velocity.X *= 1.25f; - } - if (Player.dashDelay == -1) IsFirstDashFrame = false; else @@ -538,13 +495,17 @@ namespace CalamityMod.CalPlayer { float rageGen = 0f; - // Shattered Community provides constant rage generation (stronger than Heart of Darkness). + // Shattered Community provides constant rage generation and overrides the value from Heart of Darkness. if (shatteredCommunity) { float scRageGen = rageMax * ShatteredCommunity.RagePerSecond / 60f; if (rageGen < scRageGen) rageGen = scRageGen; } + + // 26MAR2025: Ozzatron: Shattered Community and Heart of Darkness have equal rage generation now. + // It's easier to not change the code here to unify the cases, because there is no reason to. + // // Heart of Darkness grants constant rage generation. else if (heartOfDarkness) { @@ -820,7 +781,7 @@ namespace CalamityMod.CalPlayer Player.velocity += yeetVec * auricRejectionKB; if (tile.TileType == auricOreID) { - Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").Format(Player.name)), auricRejectionDamage, 0); + Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").ToNetworkText(Player.name)), auricRejectionDamage, 0); Player.AddBuff(ModContent.BuffType(), 120); } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center); @@ -1276,9 +1237,6 @@ namespace CalamityMod.CalPlayer // Increase fall speed if (!Player.mount.Active) { - if (Player.IsUnderwater() && ironBoots) - Player.maxFallSpeed = 9f; - if (!Player.wet) { if (cirrusDress) @@ -1289,6 +1247,15 @@ namespace CalamityMod.CalPlayer Player.maxFallSpeed = 20f; } + if (Player.controlDown && ironBoots) + { + Player.maxFallSpeed = 23f; // This is slightly faster than slimy saddle (so it can be viable) + if (Player.gravDir == 1 ? Player.velocity.Y <= 0 : Player.velocity.Y >= 0) + Player.velocity.Y *= 0.7f; + else if (Player.gravDir == 1 ? Player.velocity.Y < Player.maxFallSpeed : Player.velocity.Y > Player.maxFallSpeed) + Player.velocity.Y = MathHelper.Lerp(Player.velocity.Y, Player.maxFallSpeed, 0.1f); + } + if (LungingDown) { Player.maxFallSpeed = 80f; @@ -1307,7 +1274,7 @@ namespace CalamityMod.CalPlayer if (holdingDown && Player.ControlsEnabled() && notInLiquid && notOnRope && notGrappling && airborne && !Player.Calamity().gSabatonFalling) //Player cannot further increase their ridiculous gravity during a Gravistar Slam { Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); - if (Player.Calamity().gSabaton) + if (Player.Calamity().gSabaton && !Player.gravControl2) { Player.maxFallSpeed *= 1.5f; } @@ -1409,7 +1376,7 @@ namespace CalamityMod.CalPlayer { if (!tentaclesPresent[i]) { - int damage = (int)Player.GetBestClassDamage().ApplyTo(390); + int damage = (int)Player.GetBestClassDamage().ApplyTo(350); var source = Player.GetSource_FromThis(OmegaBlueHelmet.TentacleEntitySourceContext); Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; @@ -1420,10 +1387,10 @@ namespace CalamityMod.CalPlayer float damageUp = 0.1f; int critUp = 10; - if (omegaBlueHentai) + if (omegaBlueAbyssalMadness) { - damageUp *= 2f; - critUp *= 2; + damageUp += 0.1f; + critUp += 10; } Player.GetDamage() += damageUp; Player.GetCritChance() += critUp; @@ -1732,6 +1699,49 @@ namespace CalamityMod.CalPlayer } } + if (ironBoots) + { + if (Player.controlDown) + { + if (Player.gravDir == 1 ? Player.velocity.Y > 0 : Player.velocity.Y < 0) + fallingBootVelCheckTimer++; + + if (Player.velocity.Y == 0 && fallingBootVelCheckTimer > 10) + { + float power = Utils.Remap(fallingBootVelCheckTimer, 10, 40, 0.1f, 1); + float scaledPower = (float)Math.Pow(power, 3); + int damage = (int)Player.GetBestClassDamage().ApplyTo(1500 * scaledPower); // Damage scales down thrice + Vector2 playerFeet = Player.Center + Vector2.UnitY * 26 * Player.gravDir; + + float blastSize = 120 * power; + float minMultiplier = 0.1f; + int hitsToMinMult = 6; + int debuff = ModContent.BuffType(); + int debuffTime = (int)(300 * power); + Projectile blast = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), playerFeet, Vector2.Zero, ModContent.ProjectileType(), (int)(damage), -25 * power, Player.whoAmI, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 5; + + int particleNumber = (int)Math.Max(15 * power, 2); + for (int i = -particleNumber; i <= particleNumber; i++) + { + Particle sparks = new AltSparkParticle(playerFeet, (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, false, Main.rand.Next(17, 30 + 1), Main.rand.NextFloat(0.2f, 0.8f), Main.rand.NextBool() ? Color.Lerp(Color.Gold, Color.Silver, 0.3f) : Color.Silver); + GeneralParticleHandler.SpawnParticle(sparks); + } + + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound with { Volume = 0.6f * power, Pitch = Main.rand.NextFloat(0.6f, 0.8f) }, playerFeet); + + Player.Calamity().GeneralScreenShakePower = 4 * scaledPower; + fallingBootVelCheckTimer = 0; + } + } + + if (Player.gravDir == 1 ? Player.velocity.Y <= 0 : Player.velocity.Y >= 0) + fallingBootVelCheckTimer = 0; + } + if (unstableGraniteCore) { zapActivity += 1; @@ -1794,6 +1804,25 @@ namespace CalamityMod.CalPlayer } } + if (whitewaterHeal > 0) + { + if (whitewaterHeal % 15 == 0) + Player.HealPlayer(1); + whitewaterHeal--; + + Vector2 vel = (MathHelper.TwoPi * whitewaterHeal * Player.direction / 25).ToRotationVector2() * 3f; + for (int i = -1; i <= 1; i += 2) + { + Dust c = Dust.NewDustPerfect(Player.Center + vel * 4 * i, ModContent.DustType()); + c.velocity = vel * i; + c.scale = Main.rand.NextFloat(0.9f, 1f); + c.noGravity = true; + c.alpha = 150; + c.color = Color.SkyBlue; + c.noLightEmittence = true; + } + } + // Tick all cooldowns. // Depending on the code for each individual cooldown, this isn't guaranteed to do anything. // It may not tick down the timer or not do anything at all. @@ -1848,6 +1877,8 @@ namespace CalamityMod.CalPlayer if (arsenalCooldown > 0) arsenalCooldown--; + if (Main.zenithWorld) + arsenalCooldown = 0; if (killModeCooldown > 0) killModeCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) @@ -1876,6 +1907,8 @@ namespace CalamityMod.CalPlayer KameiBladeUseDelay--; if (galileoCooldown > 0) galileoCooldown--; + if (gladiatorTimer > 0) + gladiatorTimer--; if (dragonRageCooldown > 0) dragonRageCooldown--; if (soundCooldown > 0) @@ -1937,11 +1970,16 @@ namespace CalamityMod.CalPlayer if (vortexBoosterStealthDelay > 0) { vortexBoosterStealthDelay--; - if (vortexBoosterStealthDelay == 1) + if (vortexBoosterStealthDelay == 1 && Player.setVortex) Player.vortexStealthActive = true; } - if (statisTimer > 0 && Player.dashDelay >= 0) - statisTimer = 0; + if (statisPenaltyTimer > 0) + statisPenaltyTimer--; + if (statisPenaltyTimer == 0 && statisAnticheese > 0) + { + statisAnticheese--; + statisPenaltyTimer = statisTimerMax; + } if (hallowedRuneCooldown > 0) hallowedRuneCooldown--; if (sulphurBubbleCooldown > 0) @@ -2022,9 +2060,21 @@ namespace CalamityMod.CalPlayer else if (blazingCoreParry > 0) BlazingCore.HandleParryCountdown(Player); } - else if (flameLickedShell && flameLickedShellParry > 0) + else if (blazingCoreParry > 0) + blazingCoreParry--; + else if (flameLickedShellParry > 0) { - FlameLickedShell.HandleParryCountdown(Player); + if (flameLickedShell) + FlameLickedShell.HandleParryCountdown(Player); + else + flameLickedShellParry--; + } + if (shieldOfTheOceanParry > 0) + { + if (shieldOfTheOcean) + ShieldoftheOcean.HandleParryCountdown(Player); + else + shieldOfTheOceanParry--; } if (!flameLickedShell && flameLickedShellParry > 0) @@ -2082,8 +2132,8 @@ namespace CalamityMod.CalPlayer miningSetCooldown--; if (RustyMedallionCooldown > 0) RustyMedallionCooldown--; - if (MiniSwamerCooldown > 0) - MiniSwamerCooldown--; + if (MiniSwarmerCooldown > 0) + MiniSwarmerCooldown--; // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) @@ -2149,7 +2199,7 @@ namespace CalamityMod.CalPlayer if (necroReviveCounter >= NecroArmorSetChange.PostMortemDuration * 60) { - Player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.NecroRevive").Format(Player.name)), 1000, -1); + Player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.NecroRevive").ToNetworkText(Player.name)), 1000, -1); necroReviveCounter = -1; } else if (necroReviveCounter % 60 == 59) @@ -2291,8 +2341,10 @@ namespace CalamityMod.CalPlayer } // Raider Talisman bonus - if (raiderTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + if (raiderTalisman && !vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) Player.GetCritChance() += RaidersTalisman.RaiderBonus; + if (vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + Player.GetCritChance() += VampiricTalisman.RaiderBonus; if (kamiBoost) Player.GetDamage() += YanmeisKnife.DamageBoost; @@ -3552,8 +3604,12 @@ namespace CalamityMod.CalPlayer if ((vaporfied && !purity) || galvanicCorrosion) Player.velocity *= 0.98f; - if (molluskSet) - Player.velocity.X *= 0.985f; + if (molluskHelmet) + Player.velocity.X *= 0.995f; + if (molluskChest) + Player.velocity.X *= 0.995f; + if (molluskLegs) + Player.velocity.X *= 0.995f; if ((warped || caribbeanRum) && !Player.slowFall && !Player.mount.Active) { @@ -3621,8 +3677,7 @@ namespace CalamityMod.CalPlayer if (vexation) { - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.GetDamage() += 0.2f; + Player.GetDamage() += 0.3f* (1 - Player.statLife / (float)Player.statLifeMax2); } if (ataxiaBlaze) @@ -4169,6 +4224,10 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += 10; } + + if (Player.portableStoolInfo.IsInUse) + Player.GetCritChance(DamageClass.Generic) += 5; + // Amalgam boosts if (Main.myPlayer == Player.whoAmI) { diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index aaa7dc5820..5ee8e4dcba 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -755,7 +755,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < 2; l++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int leafDamage = (int)(0.25f * proj.damage); + int leafDamage = CalamityUtils.DamageSoftCap((int)(0.25f * proj.damage), 150); int leaf = Projectile.NewProjectile(source, position, velocity, ProjectileID.Leaf, leafDamage, 0f, Player.whoAmI); if (leaf.WithinBounds(Main.maxProjectiles)) { @@ -768,15 +768,15 @@ namespace CalamityMod.CalPlayer for (int projCount = 0; projCount < 2; projCount++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int energyDamage = (int)(0.33f * proj.damage); + int energyDamage = CalamityUtils.DamageSoftCap((int)(0.33f * proj.damage), 200); Projectile.NewProjectile(source, proj.Center, velocity, ProjectileType(), energyDamage, 0f, proj.owner); } } } } - if (dynamoStemCells && MiniSwamerCooldown <= 0 && proj.CountsAsClass()) + if (dynamoStemCells && MiniSwarmerCooldown <= 0 && proj.CountsAsClass()) { - MiniSwamerCooldown = DynamoStemCells.MiniSwamerCooldown; + MiniSwarmerCooldown = DynamoStemCells.MiniSwarmerCooldown; Vector2 velocity = proj.velocity.SafeNormalize(Vector2.UnitY) * 19; int MiniSwamerDamage = (int)Player.GetTotalDamage().ApplyTo(DynamoStemCells.MiniSwamerDamage); @@ -1099,6 +1099,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); + Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, vampiricTalisman ? "Bloodfeast" : "default"); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1256,12 +1257,7 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType() || - Player.armor[0].type == ItemType()) && Player.armor[1].type == ItemType() && - Player.armor[2].type == ItemType()) - { target.AddBuff(BuffID.Venom, 120, false); - } } } #endregion @@ -1282,8 +1278,13 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { + float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ProjectileType(), 0, 0f); + if (healPower >= 1) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + gladiatorTimer = 300; + } } if (Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) @@ -1303,11 +1304,19 @@ namespace CalamityMod.CalPlayer if (vampiricTalisman && proj.CountsAsClass() && crit) { - int heal = (int)Math.Round(damage * 0.015); + int heal = (int)Math.Round(damage * (Main.zenithWorld ? 0.01 : 0.008)); + if (proj.Calamity().stealthStrike) + { + heal /= 2; //stealth strikes heal half due to generally dealing far more dmg + + if (Main.zenithWorld) + heal *= -2; // IT YEARNS FOR MORE BLOOD + } if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(1f, heal)) + // Heals more if the ability is active + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile((raiderCritLifespan > 0) ? 1.5f : 1f, heal)) CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } @@ -1448,8 +1457,13 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { + float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0f); + if (healPower >= 1) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + gladiatorTimer = 300; + } } if (reaverDefense) diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 5452bc59ae..108819e310 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -32,7 +32,7 @@ namespace CalamityMod.CalPlayer.Dashes public float Size = 2.2f; public bool SoundOnce = true; - public override float CalculateDashSpeed(Player player) => 40f; + public override float CalculateDashSpeed(Player player) => 32f; public override void OnDashEffects(Player player) { @@ -110,7 +110,7 @@ namespace CalamityMod.CalPlayer.Dashes } // Dash at a much, much faster speed than the default value. - dashSpeed = 40f; + dashSpeed = 32f; runSpeedDecelerationFactor = 0.8f; // Cooldown for God Slayer Armor dash. diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs index a0253e7f77..9c0196c584 100644 --- a/CalPlayer/Dashes/StatisNinjaBeltDash.cs +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -1,8 +1,11 @@ -using CalamityMod.Enums; +using System; +using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes { @@ -12,46 +15,60 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.NoCollision; public override bool IsOmnidirectional => false; public int Time = 0; + public int lastDashDir = 0; - public override float CalculateDashSpeed(Player player) => 20f; + public override float CalculateDashSpeed(Player player) => (50f * player.moveSpeed); public override void OnDashEffects(Player player) { - Time = 0; - for (int i = 0; i < 12; i++) + if (Math.Sign(player.velocity.X) == lastDashDir && lastDashDir != 0) { - Vector2 smokePos = player.Center + new Vector2(Main.rand.Next(-player.width, player.width), Main.rand.Next(-player.height, player.height)) * 0.8f; - Vector2 smokeVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.25f, 1.75f); - HeavySmokeParticle onDashSmoke = new(smokePos, smokeVel, Color.Gray, 30, 0.5f, 0.75f, 0.2f * Main.rand.NextFloatDirection()); - GeneralParticleHandler.SpawnParticle(onDashSmoke); + player.Calamity().statisPenaltyTimer = player.Calamity().statisTimerMax; + if (player.Calamity().statisAnticheese < 6) + player.Calamity().statisAnticheese++; + } + else + player.Calamity().statisAnticheese = 0; + if (player.Calamity().statisAnticheese > 1) + player.velocity.X *= Utils.Remap(player.Calamity().statisAnticheese, 1, 6, 0.9f, 0.3f, true); + lastDashDir = Math.Sign(player.velocity.X); + lastDashDir = Math.Sign(player.velocity.X); + + Time = 0; + for (int i = 0; i < 15; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 1.5f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(player.velocity.ToRotation()); + Vector2 fxPlace = player.Center + fxVel.RotatedBy(player.velocity.ToRotation()) + player.velocity.SafeNormalize(Vector2.UnitX) * 60; + + Color dustColor = Main.rand.NextBool() ? Color.Purple : Color.DarkSlateBlue; + + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(fxPlace, dustStyle, (fxVel - player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(4, 5)) * Main.rand.NextFloat(1.2f, 1.5f)); + dust2.scale = Main.rand.NextFloat(1.6f, 2.3f) * 1.8f; + dust2.color = dustColor; + dust2.noGravity = true; + dust2.fadeIn = 1.5f; } } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { Time++; - if (Time % 3 == 0) + for (int i = 0; i < 2; i++) { - int colorType = Main.rand.Next(3); - Color smokeColor = Color.White; - switch (colorType) - { - case 0: - smokeColor = Color.Gray; - break; - case 1: - smokeColor = new Color(28, 75, 163); - break; - case 2: - smokeColor = new Color(195, 0, 255); - break; - } - - Vector2 smokePos = player.Center - (player.velocity * 1.25f) + Main.rand.NextVector2Circular(10, 20); - float smokeScale = player.velocity.X * 0.045f; - HeavySmokeParticle midDashSmoke = new(smokePos, player.velocity * 0.2f, smokeColor, 20, smokeScale, 0.75f, 0.2f * Main.rand.NextFloatDirection(), true); + HeavySmokeParticle midDashSmoke = new(player.Center + Main.rand.NextVector2Circular(15, 15), -player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5, 9), Main.rand.NextBool() ? Color.Purple : Color.DarkSlateBlue, 16, Main.rand.NextFloat(0.7f, 0.9f), 0.55f, 0.2f * Main.rand.NextFloatDirection(), true); GeneralParticleHandler.SpawnParticle(midDashSmoke); } + + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Circular(15, 15), dustStyle, player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5, 9)); + dust2.scale = Main.rand.NextFloat(0.9f, 1.7f); + dust2.color = Main.rand.NextBool() ? Color.Purple : Color.DarkSlateBlue; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + + player.velocity.X *= 0.93f; } } } diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index e1931be364..fa4d3f04a2 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -1,8 +1,14 @@ -using CalamityMod.Enums; +using System; +using System.Security.Policy; +using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using rail; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -15,47 +21,94 @@ namespace CalamityMod.CalPlayer.Dashes public override bool IsOmnidirectional => false; public int Time = 0; - public bool AngleSwap = true; + public Vector2 aimVel; + public bool strongVisuals = true; + public int lastDashDir = 0; - public override float CalculateDashSpeed(Player player) => 25.4f; + public override float CalculateDashSpeed(Player player) => (70f * player.moveSpeed); public override void OnDashEffects(Player player) { + if (Math.Sign(player.velocity.X) == lastDashDir && lastDashDir != 0) + { + player.Calamity().statisPenaltyTimer = player.Calamity().statisTimerMax; + if (player.Calamity().statisAnticheese < 6) + player.Calamity().statisAnticheese++; + } + else + player.Calamity().statisAnticheese = 0; + if (player.Calamity().statisAnticheese > 1) + player.velocity.X *= Utils.Remap(player.Calamity().statisAnticheese, 1, 6, 0.9f, 0.3f, true); + lastDashDir = Math.Sign(player.velocity.X); + + strongVisuals = player.Calamity().voidSashVisuals; Time = 0; + aimVel = player.velocity; + + if (strongVisuals) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/VoidDash"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, player.Center); + for (int i = 0; i < 40; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / 40f).ToRotationVector2() * 5.5f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(player.velocity.ToRotation()); + Vector2 fxPlace = player.Center + fxVel.RotatedBy(player.velocity.ToRotation()) + player.velocity.SafeNormalize(Vector2.UnitX) * 60; + + SignusMetaball.SpawnParticle(fxPlace, fxVel - player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(6, 9), 60f * Main.rand.NextFloat(0.7f, 1), 60, new Vector2(1.8f, 0.9f), 0.06f, 0); + } + } + for (int i = 0; i < 30; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / 30f).ToRotationVector2() * 5.5f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(player.velocity.ToRotation()); + Vector2 fxPlace = player.Center + fxVel.RotatedBy(player.velocity.ToRotation()) + player.velocity.SafeNormalize(Vector2.UnitX) * 60; + + Color dustColor = Main.rand.NextBool(3) ? Color.Indigo : Color.DarkOrchid; + + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(fxPlace, dustStyle, (fxVel - player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(6, 9)) * Main.rand.NextFloat(1.2f, 1.5f)); + dust2.scale = Main.rand.NextFloat(1.6f, 2.3f) * 2.3f; + dust2.color = dustColor; + dust2.noGravity = true; + dust2.fadeIn = 1.5f; + } } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { Time++; - if (Time % 3 == 0) - { - Vector2 trailPos = player.Center - (player.velocity * 2) + Main.rand.NextVector2Circular(10, 20); - float trailScale = player.velocity.X * player.direction * 0.08f; - Color trailColor = Main.rand.NextBool(3) ? Color.Indigo : Color.DarkOrchid; - Particle Trail = new SparkParticle(trailPos, player.velocity * 0.2f, false, 35, trailScale, trailColor); - GeneralParticleHandler.SpawnParticle(Trail); - } + aimVel = Vector2.Lerp(aimVel, player.velocity, 0.2f); - // Periodically release scythes. - player.Calamity().statisTimer++; - if (Main.myPlayer == player.whoAmI && player.Calamity().statisTimer % 5 == 0) - { - int scytheDamage = (int)player.GetBestClassDamage().ApplyTo(250); + float fxFade = Utils.GetLerpValue(5, 15, Math.Abs(aimVel.X), true); - int scythe = Projectile.NewProjectile(player.GetSource_FromAI(), player.Center, player.velocity.RotatedBy(player.direction * (AngleSwap ? 30 : -30), default) * 0.1f - player.velocity / 2f, ModContent.ProjectileType(), scytheDamage, 5f, player.whoAmI); ; - if (scythe.WithinBounds(Main.maxProjectiles)) + Vector2 trailPos = player.Center - (aimVel * 2) + Main.rand.NextVector2Circular(10, 20); + float trailScale = 1 * fxFade; + Color trailColor = Main.rand.NextBool(3) ? Color.Indigo : Color.DarkOrchid; + + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(trailPos, dustStyle, aimVel.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(9, 15)); + dust2.scale = Main.rand.NextFloat(0.9f, 1.7f); + dust2.color = trailColor; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + + if (strongVisuals) + { + SignusMetaball.SpawnParticle(player.Center + Main.rand.NextVector2Circular(20, 20), -aimVel.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5, 15), 120f * Main.rand.NextFloat(0.7f, 1f), 60, new Vector2(0.8f, 1.2f), 0.08f, 0); + + int dir = MathF.Sign(aimVel.X); + Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX); + float sparkscale2 = 0.35f * Math.Max(fxFade, 0.5f); + for (int i = -1; i <= 1; i += 2) { - Main.projectile[scythe].DamageType = DamageClass.Generic; - Main.projectile[scythe].usesIDStaticNPCImmunity = true; - Main.projectile[scythe].idStaticNPCHitCooldown = 10; + Vector2 fxVelocity = safeVel.RotatedBy(dir * MathHelper.ToRadians(75) * -i) - safeVel * 3; + Vector2 fxPlace = player.Center + (safeVel * 35).RotatedBy(-0.2f * dir * i) * 1.5f; + + SignusMetaball.SpawnParticle(fxPlace, fxVelocity * Main.rand.NextFloat(5, 8), 50f * Main.rand.NextFloat(0.7f, 1f), 8, new Vector2(0.8f, 1.2f), 0.18f, 0); } - - AngleSwap = !AngleSwap; - } - - // Dash at a faster speed than the default value. - dashSpeed = 14f; + player.velocity.X *= 0.912f; } } } diff --git a/CalPlayer/DrawLayers/EncasementParryLayer.cs b/CalPlayer/DrawLayers/EncasementParryLayer.cs index 28e75b3674..c0ffbb8c29 100644 --- a/CalPlayer/DrawLayers/EncasementParryLayer.cs +++ b/CalPlayer/DrawLayers/EncasementParryLayer.cs @@ -12,11 +12,12 @@ namespace CalamityMod.CalPlayer.DrawLayers public enum EncasementType { BlazingCore, - FlameLickedShell + FlameLickedShell, + ShieldoftheOcean } public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.FrontAccFront); //me when the player layer is called front acc front :skull: - public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : EncasementType.FlameLickedShell; + public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : modPlayer.flameLickedShell ? EncasementType.FlameLickedShell : EncasementType.ShieldoftheOcean; public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { @@ -28,6 +29,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { EncasementType.BlazingCore => visible && modPlayer.blazingCoreParry > 0, EncasementType.FlameLickedShell => visible && modPlayer.flameLickedShellParry > 0, + EncasementType.ShieldoftheOcean => visible && modPlayer.shieldOfTheOceanParry > 0, _ => false }; return visible; @@ -56,6 +58,12 @@ namespace CalamityMod.CalPlayer.DrawLayers defaultOpacity = 0.875f; scale = 1.2f; break; + case EncasementType.ShieldoftheOcean: + tex += "OceanShieldBubble"; + currentParry = calPlayer.shieldOfTheOceanParry; + defaultOpacity = 0.7f; + scale = 1.3f; + break; default: //should never be this option tex += "BlazingCoreCrystal"; currentParry = 0; @@ -70,8 +78,8 @@ namespace CalamityMod.CalPlayer.DrawLayers drawPos.X += 15f; - int maxParry = 30; //all parries use thirty seconds as a max at this point in time, if this changes, this too should change - float colorIntensity = currentParry >= 18 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true); + int maxParry = 30; // All parries currently last 30 frames. If this changes, this too should change. + float colorIntensity = currentParry >= 12 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true); SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; drawInfo.DrawDataCache.Add(new DrawData(texture, drawPos, null, Color.White * colorIntensity, 0f, texture.Size() * 0.75f, scale, spriteEffects, 0)); } diff --git a/CalPlayer/DrawLayers/OceanShieldBubble.png b/CalPlayer/DrawLayers/OceanShieldBubble.png new file mode 100644 index 0000000000..e98f8c6037 Binary files /dev/null and b/CalPlayer/DrawLayers/OceanShieldBubble.png differ diff --git a/CalamityConfig.cs b/CalamityConfig.cs index ffe552857b..e98b6a34cd 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -281,6 +281,14 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool FasterFallHotkey { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool CalamityArmorSetBonusDoubleTap { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool StutterFix { get; set; } #endregion } diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index cba78a4d7b..c09e181762 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -6,6 +6,7 @@ namespace CalamityMod { public static ModKeybind AccessoryParryHotKey { get; private set; } public static ModKeybind AdrenalineHotKey { get; private set; } + public static ModKeybind AmmoCycleHotkey { get; private set; } public static ModKeybind AngelicAllianceHotKey { get; private set; } public static ModKeybind ArmorSetBonusHotKey { get; private set; } public static ModKeybind AscendantInsigniaHotKey { get; private set; } @@ -24,6 +25,7 @@ namespace CalamityMod // Register keybinds AccessoryParryHotKey = KeybindLoader.RegisterKeybind(Mod, "ActivateAccessoryParry", "N"); AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "AdrenalineMode", "B"); + AmmoCycleHotkey = KeybindLoader.RegisterKeybind(Mod, "AmmoCycle", "Mouse3"); AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "AngelicAllianceBlessing", "G"); ArmorSetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "ArmorSetBonus", "Y"); AscendantInsigniaHotKey = KeybindLoader.RegisterKeybind(Mod, "AscendantInsigniaHotKey", "K"); @@ -42,6 +44,7 @@ namespace CalamityMod { AccessoryParryHotKey = null; AdrenalineHotKey = null; + AmmoCycleHotkey = null; AngelicAllianceHotKey = null; ArmorSetBonusHotKey = null; AscendantInsigniaHotKey = null; diff --git a/CalamityMod.csproj b/CalamityMod.csproj index 5aadf21dce..06a7b9a67d 100644 --- a/CalamityMod.csproj +++ b/CalamityMod.csproj @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/Cooldowns/ArsenalPower.cs b/Cooldowns/ArsenalPower.cs index d61c4bce55..488565d0bb 100644 --- a/Cooldowns/ArsenalPower.cs +++ b/Cooldowns/ArsenalPower.cs @@ -2,7 +2,6 @@ using Terraria; using Terraria.Audio; using Terraria.Localization; -using static CalamityMod.CalamityUtils; namespace CalamityMod.Cooldowns { @@ -15,7 +14,13 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => Color.White; public override Color CooldownStartColor => Color.Sienna; public override Color CooldownEndColor => Color.LightSlateGray; + public override void Tick() + { + if (Main.zenithWorld) + instance.timeLeft = -1; + + } - public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/ArsenalOffCooldown"); + public override SoundStyle? EndSound => (Main.zenithWorld ? null : new("CalamityMod/Sounds/Item/ArsenalOffCooldown")); } } diff --git a/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs b/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs index 84f3cfd089..b751a90295 100644 --- a/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs +++ b/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.Cooldowns // If the player doesn't have DSO, this cooldown should not appear. public override bool ShouldDisplay => instance.player.GetModPlayer().spiritOrigin; - private float ExtraCritChance => instance.player.GetModPlayer().spiritOriginCritBoost; + private float ExtraCritChance => Math.Min(instance.player.GetModPlayer().spiritOriginCritBoost, CritHardCap); private float TextXOffset => (ExtraCritChance > 99 ? -24 : ExtraCritChance > 9 ? -20 : -16) * TextScale; private Vector2 TextPosition => new(TextXOffset , 25); diff --git a/Cooldowns/FuryFuel.cs b/Cooldowns/FuryFuel.cs new file mode 100644 index 0000000000..0df9315cc6 --- /dev/null +++ b/Cooldowns/FuryFuel.cs @@ -0,0 +1,45 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class FuryFuel : CooldownHandler + { + public float CompletionPercentage => MathF.Round(instance.Completion * 100); + private bool IsEmpty => CompletionPercentage == 100; + private float TextXOffset => -5.4f; + private Vector2 TextPosition => new(TextXOffset, 15); + private Color TextColor => Color.White; + private Color TextBorderColor = Color.Violet; + + public static new string ID => "FuryFuel"; + public override bool CanTickDown => false; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Orchid, Color.SlateGray, instance.Completion); + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + } + } +} diff --git a/Cooldowns/FuryFuel.png b/Cooldowns/FuryFuel.png new file mode 100644 index 0000000000..6820cf90a0 Binary files /dev/null and b/Cooldowns/FuryFuel.png differ diff --git a/Items/Tools/MonolithPickaxe.png b/Cooldowns/FuryFuelOutline.png similarity index 84% rename from Items/Tools/MonolithPickaxe.png rename to Cooldowns/FuryFuelOutline.png index d4e945293c..9f65a9db98 100644 Binary files a/Items/Tools/MonolithPickaxe.png and b/Cooldowns/FuryFuelOutline.png differ diff --git a/Items/Tools/AcidwoodPickaxe.png b/Cooldowns/FuryFuelOverlay.png similarity index 84% rename from Items/Tools/AcidwoodPickaxe.png rename to Cooldowns/FuryFuelOverlay.png index 800c0698de..834115ddfb 100644 Binary files a/Items/Tools/AcidwoodPickaxe.png and b/Cooldowns/FuryFuelOverlay.png differ diff --git a/Cooldowns/ParryCooldown.cs b/Cooldowns/ParryCooldown.cs index e7cdbb218b..c226732eb7 100644 --- a/Cooldowns/ParryCooldown.cs +++ b/Cooldowns/ParryCooldown.cs @@ -38,6 +38,13 @@ namespace CalamityMod.Cooldowns cooldownColorStart = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0)); cooldownColorEnd = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0)); break;*/ + case "shieldoftheocean": + // skinTexture = "ShieldOfTheOceanParry"; + skinTexture = "ParryCooldown"; + outlineColor = Color.White; + cooldownColorStart = new Color(233, 111, 165); + cooldownColorEnd = new Color(105, 139, 148); + break; default: skinTexture = "ParryCooldown"; outlineColor = Color.White; diff --git a/Cooldowns/RaiderBoost.cs b/Cooldowns/RaiderBoost.cs new file mode 100644 index 0000000000..79bb9ae02d --- /dev/null +++ b/Cooldowns/RaiderBoost.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class RaiderBoost : CooldownHandler + { + public static new string ID => "RaidersBoost"; + + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + + public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; + public override Color OutlineColor => outlineColor; + public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + + //It's the same cooldown with different skins each time, basically. + public string skinTexture; + public Color outlineColor; + public Color cooldownColorStart; + public Color cooldownColorEnd; + + public RaiderBoost() : this("") { } + public RaiderBoost(string skin) + { + switch (skin) + { + case "Bloodfeast": + skinTexture = "VampiricTalismanBoost"; + outlineColor = new Color(143, 27, 27); + cooldownColorStart = new Color(133, 5, 5); + cooldownColorEnd = new Color(255, 0, 0); + break; + + default: + skinTexture = "RaiderBoost"; + outlineColor = new Color(122, 97, 77); + cooldownColorStart = new Color(168, 122, 86); + cooldownColorEnd = new Color(74, 60, 49); + break; + } + } + } +} diff --git a/Cooldowns/RaiderBoost.png b/Cooldowns/RaiderBoost.png new file mode 100644 index 0000000000..9e34eeb520 Binary files /dev/null and b/Cooldowns/RaiderBoost.png differ diff --git a/Cooldowns/RaiderBoostOutline.png b/Cooldowns/RaiderBoostOutline.png new file mode 100644 index 0000000000..f2964069b8 Binary files /dev/null and b/Cooldowns/RaiderBoostOutline.png differ diff --git a/Cooldowns/RaiderBoostOverlay.png b/Cooldowns/RaiderBoostOverlay.png new file mode 100644 index 0000000000..630cad2d91 Binary files /dev/null and b/Cooldowns/RaiderBoostOverlay.png differ diff --git a/Cooldowns/VampiricTalismanBoost.png b/Cooldowns/VampiricTalismanBoost.png new file mode 100644 index 0000000000..fa87b4b68c Binary files /dev/null and b/Cooldowns/VampiricTalismanBoost.png differ diff --git a/Cooldowns/VampiricTalismanBoostOutline.png b/Cooldowns/VampiricTalismanBoostOutline.png new file mode 100644 index 0000000000..7cf25cffc7 Binary files /dev/null and b/Cooldowns/VampiricTalismanBoostOutline.png differ diff --git a/Cooldowns/VampiricTalismanBoostOverlay.png b/Cooldowns/VampiricTalismanBoostOverlay.png new file mode 100644 index 0000000000..85ed189dba Binary files /dev/null and b/Cooldowns/VampiricTalismanBoostOverlay.png differ diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 26ccaea36d..b9bca0a0aa 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -575,6 +575,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 26, 44, 60, 76, 114 } }, { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, @@ -595,9 +596,13 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 52, 84 } }, { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 84, 126 } }, + { new Tuple(NPCID.QueenBee, ModContent.ProjectileType()), new int[] { 46, 72, 84, 96, 144 } }, // Beenade Bees: 122 (death mode-exclusive) { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 72, 84, 96, 144 } }, { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 36, 72, 88, 104, 156 } }, @@ -707,13 +712,13 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 366 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 72, 132, 160, 188, 282 } }, + { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, - { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { 60, 120, 160, 200, 300 } }, + { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, { new Tuple(NPCID.GolemFistLeft, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, { new Tuple(NPCID.GolemFistRight, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { 60, 120, 160, 200, 300 } }, + { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, @@ -813,7 +818,6 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 412, 600 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 576, 900 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, diff --git a/Dusts/DiamondDust.cs b/Dusts/DiamondDust.cs new file mode 100644 index 0000000000..501f5b7643 --- /dev/null +++ b/Dusts/DiamondDust.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class DiamondDust : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + + dust.velocity *= 0.96f; + if (dust.noGravity) + dust.scale -= 0.045f; + else + { + dust.scale -= 0.03f; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f); + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + dust.fadeIn++; // Fade in is used for the time strech instead + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + + // dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash + float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true); + Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp)); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquareDust.cs b/Dusts/SquareDust.cs new file mode 100644 index 0000000000..054b05ad37 --- /dev/null +++ b/Dusts/SquareDust.cs @@ -0,0 +1,63 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquareDust : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + dust.rotation = Main.rand.NextFloat(-5, 5); + } + + public override bool Update(Dust dust) + { + float fadeSpeed = (dust.fadeIn + 1); + float rotDir = Math.Sign(dust.rotation); + dust.rotation += 0.04f * dust.scale * rotDir; + dust.velocity *= 0.96f * fadeSpeed; + if (dust.noGravity) + dust.scale -= 0.045f * fadeSpeed; + else + { + dust.scale -= 0.03f * fadeSpeed; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 squash = Vector2.One; + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquashDust.cs b/Dusts/SquashDust.cs new file mode 100644 index 0000000000..5894cedb1b --- /dev/null +++ b/Dusts/SquashDust.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquashDust : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + float fadeSpeed = (dust.fadeIn + 1); + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + dust.velocity *= 0.96f; + if (dust.noGravity) + dust.scale -= 0.045f * fadeSpeed; + else + { + dust.scale -= 0.03f * fadeSpeed; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquashDustHollow.cs b/Dusts/SquashDustHollow.cs new file mode 100644 index 0000000000..9378128784 --- /dev/null +++ b/Dusts/SquashDustHollow.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquashDustHollow : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + dust.velocity *= 0.96f; + if (dust.noGravity) + dust.scale -= 0.045f; + else + { + dust.scale -= 0.03f; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f); + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + // dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash + Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquashDustTileTouch.cs b/Dusts/SquashDustTileTouch.cs new file mode 100644 index 0000000000..0884d87cb4 --- /dev/null +++ b/Dusts/SquashDustTileTouch.cs @@ -0,0 +1,68 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquashDustTileTouch : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + bool touchedTiles = false; + int size = (int)(2); + if (Collision.SolidCollision(dust.position, size, size)) + { + touchedTiles = true; + dust.velocity = Vector2.Zero; + } + float fadeSpeed = (dust.fadeIn + 1); // For this dust, fadeIn is used to increase the power of gravity if it's active, otherwise it makes it's lifetime change + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + dust.velocity *= 0.96f; + if (dust.noGravity) + dust.scale -= 0.045f * (touchedTiles ? 0.4f : 1) * fadeSpeed; + else + { + dust.scale -= 0.03f * (touchedTiles ? 0.4f : 1); + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + if (!touchedTiles) + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/UnstableDust.cs b/Dusts/UnstableDust.cs new file mode 100644 index 0000000000..ee9cbf0fce --- /dev/null +++ b/Dusts/UnstableDust.cs @@ -0,0 +1,63 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class UnstableDust : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + dust.rotation = Main.rand.NextFloat(-5, 5); + } + + public override bool Update(Dust dust) + { + float rotDir = Math.Sign(dust.rotation); + dust.rotation += 0.5f * dust.scale * rotDir; + dust.velocity *= 0.96f; + if (dust.noGravity) + dust.scale -= 0.045f; + else + { + dust.scale -= 0.03f; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f); + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + // dust.fadeIn is used to change the shake intensity, -2 will negate it + dust.position += Main.rand.NextVector2Circular(dust.fadeIn + 2, dust.fadeIn + 2); + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/FullStar").Value; + + Vector2 squash = new Vector2(0.4f, 1); + float texScaling = 6; + + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Effects/ArsenalEffects.cs b/Effects/ArsenalEffects.cs new file mode 100644 index 0000000000..41ecff817f --- /dev/null +++ b/Effects/ArsenalEffects.cs @@ -0,0 +1,27 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Effects +{ + public class ArsenalEffects + { + public static int ArsenalDust = 278; // Colorable firework dust, simple and effective. Most visuals use a mix of the energy respective dust and this + + // Plasma + public static int ArsenalPlasmaDust = ModContent.DustType(); + public static Color ArsenalPlasmaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.45f); + // Laser + public static int ArsenalLaserDust = ModContent.DustType(); + public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f); + // Pulse + public static int ArsenalPulseDust = ModContent.DustType(); + public static Color ArsenalPulseColor = Color.Lerp(Color.DarkOrchid, Color.Magenta, 0.35f); + // Electric + public static int ArsenalElectricDust = ModContent.DustType(); + public static Color ArsenalElectricColor = Color.Lerp(Color.Aqua, Color.Aquamarine, 0.35f); + // Gauss + public static int ArsenalGaussDust = ModContent.DustType(); + public static Color ArsenalGaussColor = Color.Lerp(Color.Yellow, Color.Goldenrod, 0.25f); + } +} diff --git a/Items/Tools/DriftwoodPickaxe.png b/ExtraTextures/BasicMess.png similarity index 83% rename from Items/Tools/DriftwoodPickaxe.png rename to ExtraTextures/BasicMess.png index 8e7156c574..1e752bf91a 100644 Binary files a/Items/Tools/DriftwoodPickaxe.png and b/ExtraTextures/BasicMess.png differ diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs index dd5c2d46a8..bc86cb89a7 100644 --- a/ExtraTextures/ExtraTextureRefs.cs +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -13,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.ExtraTextures { [Autoload(Side = ModSide.Client)] - internal sealed class ExtraTextureRefs : ModSystem + public class ExtraTextureRefs : ModSystem { // Destroyer glowmasks public static Asset DestroyerHeadGlowmask; diff --git a/ExtraTextures/Jesus.png b/ExtraTextures/Jesus.png new file mode 100644 index 0000000000..8750d55c55 Binary files /dev/null and b/ExtraTextures/Jesus.png differ diff --git a/Fonts/CodebreakerDialog.xnb b/Fonts/CodebreakerDialog.xnb index eef588aef5..45515ed30f 100644 Binary files a/Fonts/CodebreakerDialog.xnb and b/Fonts/CodebreakerDialog.xnb differ diff --git a/Gores/Abyss/AbyssPot1.png b/Gores/Abyss/AbyssPot1.png new file mode 100644 index 0000000000..f61b152031 Binary files /dev/null and b/Gores/Abyss/AbyssPot1.png differ diff --git a/Gores/Abyss/AbyssPot2.png b/Gores/Abyss/AbyssPot2.png new file mode 100644 index 0000000000..3161ceab31 Binary files /dev/null and b/Gores/Abyss/AbyssPot2.png differ diff --git a/Gores/Abyss/AbyssPot3.png b/Gores/Abyss/AbyssPot3.png new file mode 100644 index 0000000000..e2b2a0bc35 Binary files /dev/null and b/Gores/Abyss/AbyssPot3.png differ diff --git a/Gores/Abyss/AbyssPot4.png b/Gores/Abyss/AbyssPot4.png new file mode 100644 index 0000000000..9a79f015e8 Binary files /dev/null and b/Gores/Abyss/AbyssPot4.png differ diff --git a/Gores/Abyss/AbyssPot5.png b/Gores/Abyss/AbyssPot5.png new file mode 100644 index 0000000000..e6f7d58bde Binary files /dev/null and b/Gores/Abyss/AbyssPot5.png differ diff --git a/Gores/Abyss/AbyssPot6.png b/Gores/Abyss/AbyssPot6.png new file mode 100644 index 0000000000..2a01b0ddfb Binary files /dev/null and b/Gores/Abyss/AbyssPot6.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateL1.png b/Gores/Abyss/PirateCrate/PirateCrateL1.png new file mode 100644 index 0000000000..3939d42a5c Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateL1.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateL2.png b/Gores/Abyss/PirateCrate/PirateCrateL2.png new file mode 100644 index 0000000000..69800697bb Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateL2.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateL3.png b/Gores/Abyss/PirateCrate/PirateCrateL3.png new file mode 100644 index 0000000000..62349bb13b Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateL3.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateM1.png b/Gores/Abyss/PirateCrate/PirateCrateM1.png new file mode 100644 index 0000000000..7b8fcc7dbb Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateM1.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateM2.png b/Gores/Abyss/PirateCrate/PirateCrateM2.png new file mode 100644 index 0000000000..76be32af00 Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateM2.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateM3.png b/Gores/Abyss/PirateCrate/PirateCrateM3.png new file mode 100644 index 0000000000..00bfd9bb1b Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateM3.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateR1.png b/Gores/Abyss/PirateCrate/PirateCrateR1.png new file mode 100644 index 0000000000..cd6a3b5653 Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateR1.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateR2.png b/Gores/Abyss/PirateCrate/PirateCrateR2.png new file mode 100644 index 0000000000..db5c8ad99c Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateR2.png differ diff --git a/Gores/Abyss/PirateCrate/PirateCrateR3.png b/Gores/Abyss/PirateCrate/PirateCrateR3.png new file mode 100644 index 0000000000..da3b6b0e50 Binary files /dev/null and b/Gores/Abyss/PirateCrate/PirateCrateR3.png differ diff --git a/Gores/SulphSeaGen/AbyssPotGore1.png b/Gores/SulphSeaGen/AbyssPotGore1.png deleted file mode 100644 index cd19852002..0000000000 Binary files a/Gores/SulphSeaGen/AbyssPotGore1.png and /dev/null differ diff --git a/Gores/SulphSeaGen/AbyssPotGore2.png b/Gores/SulphSeaGen/AbyssPotGore2.png deleted file mode 100644 index 9554ae7280..0000000000 Binary files a/Gores/SulphSeaGen/AbyssPotGore2.png and /dev/null differ diff --git a/Graphics/Metaballs/SignusLayer.png b/Graphics/Metaballs/SignusLayer.png new file mode 100644 index 0000000000..d28069a497 Binary files /dev/null and b/Graphics/Metaballs/SignusLayer.png differ diff --git a/Graphics/Metaballs/SignusMetaball.cs b/Graphics/Metaballs/SignusMetaball.cs new file mode 100644 index 0000000000..7c90c5fda0 --- /dev/null +++ b/Graphics/Metaballs/SignusMetaball.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Graphics.Metaballs +{ + public class SignusMetaball : Metaball + { + public Color borderColor = Color.Purple; + public Vector2 goalDir = Vector2.Zero; + public Vector2 scrollDir = Vector2.Zero; + public class CosmicParticle + { + public float Size; + + public Vector2 Velocity; + + public Vector2 Center; + public Vector2 BaseSquash = Vector2.One; + public float Rotation; + public float ShrinkSpeed = 0; + public int Lifetime; + public float SquashPower = 0; + public int time = 0; + + public CosmicParticle(Vector2 center, Vector2 velocity, float size, int lifetime, Vector2 squash, float shrinkSpeed = 0, float velocitySquash = 0) + { + Center = center; + Velocity = velocity; + Size = size; + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + BaseSquash = squash; + Lifetime = lifetime; + ShrinkSpeed = shrinkSpeed; + SquashPower = velocitySquash; + } + + public void Update() + { + Center += Velocity; + Velocity *= 0.95f; + if ((float)time / (float)Lifetime > 0.5f) + { + Size *= 0.94f; + } + BaseSquash.X *= (1 - 0.2f * ShrinkSpeed); + BaseSquash.Y *= (1 + 0.2f * ShrinkSpeed); + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + } + public static Asset LayerAsset + { + get; + private set; + } + + public static List Particles + { + get; + private set; + } = new(); + + public override bool AnythingToDraw => Particles.Any(); + + public override IEnumerable Layers + { + get + { + yield return LayerAsset.Value; + } + } + + public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + public override void Load() + { + if (Main.dedServ) + return; + + // Load the layer asset wrapper. + LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/SignusLayer", AssetRequestMode.ImmediateLoad); + } + + public override void Update() + { + if (goalDir == Vector2.Zero) + goalDir = Vector2.One.RotatedByRandom(Math.PI); + if ((int)(Main.GlobalTimeWrappedHourly * 50) % 5 == 0) + { + goalDir = goalDir.RotatedByRandom(0.13f); + } + scrollDir = Vector2.Lerp(scrollDir, goalDir, 0.01f); + + float rate = Main.GlobalTimeWrappedHourly * 19; + List colors = new List() + { + Color.Purple, + Color.BlueViolet, + Color.DarkViolet + }; + + int colorIndex = (int)(rate / 2 % colors.Count); + Color currentColor = colors[colorIndex]; + Color nextColor = colors[(colorIndex + 1) % colors.Count]; + borderColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // Update all particle instances. + // Once sufficiently small, they vanish. + for (int i = 0; i < Particles.Count; i++) + Particles[i].Update(); + Particles.RemoveAll(p => p.Size <= 2f); + } + public override Color EdgeColor => borderColor with { A = 0 }; + + public static void SpawnParticle(Vector2 position, Vector2 velocity, float size, int lifetime, Vector2 squash, float shrinkSpeed = 0, float velocitySquash = 0) => + Particles.Add(new(position, velocity, size, lifetime, squash, shrinkSpeed, velocitySquash)); + + // Make the texture scroll. + public override Vector2 CalculateManualOffsetForLayer(int layerIndex) + { + return scrollDir * 0.5f; + } + + public override void DrawInstances() + { + Texture2D tex = ModContent.Request("CalamityMod/ExtraTextures/BasicMess").Value; + + foreach (CosmicParticle particle in Particles) + { + Vector2 squash = Vector2.Lerp(particle.BaseSquash, new Vector2(Utils.Remap(particle.Velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(particle.Velocity.Length(), 2, 7, 1, 2.5f)), particle.SquashPower); + Vector2 drawPosition = particle.Center - Main.screenPosition; + Vector2 origin = tex.Size() * 0.5f; + Vector2 scale = Vector2.One * particle.Size / tex.Size(); + Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, particle.Rotation, origin, squash * scale, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index 800ad701fe..409ff05a3e 100644 --- a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers } var shader = GameShaders.Misc["CalamityMod:HolyInfernoShader"].Shader; - shader.Parameters["colorMult"].SetValue(Main.IsItDay() ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour. + shader.Parameters["colorMult"].SetValue(prov.hasBeenGivenFullPower ? 7.65f : 7.35f); //I want you to know it took considerable restraint to deliberately misspell colour. shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); shader.Parameters["radius"].SetValue(borderDistance); shader.Parameters["anchorPoint"].SetValue(npc.Center); @@ -74,7 +74,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity); shader.Parameters["playerPosition"].SetValue(target.Center); shader.Parameters["maxOpacity"].SetValue(maxOpacity); - shader.Parameters["day"].SetValue(Main.IsItDay()); + shader.Parameters["day"].SetValue(!prov.hasBeenGivenFullPower); spriteBatch.GraphicsDevice.Textures[1] = diagonalNoise.Value; spriteBatch.GraphicsDevice.Textures[2] = upwardNoise.Value; diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 18468c030a..5018cee4bb 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -719,6 +719,29 @@ namespace CalamityMod.ILEditing } #endregion + #region Solar Wings Change to Solar Flare Armor Dash + private static void SolarWingsDashChange(ILContext il) + { + // Make Solar Wings always allow using Solar Flare armor's dash. + var cursor = new ILCursor(il); + + // Genuinely how the fuck is this the only OR opcode in the entire method + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchOr())) + { + LogFailure("Solar Dash Change", "Could not locate the OR opcode."); + return; + } + + // Add an additional check for if the player is wearing Solar Wings. + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldfld, typeof(Player).GetField("wingsLogic")); + cursor.Emit(OpCodes.Ldc_I4, (int)VanillaWingID.WingsSolar); + cursor.EmitCeq(); + // Then OR it. + cursor.EmitOr(); + } + #endregion + #region Remove Melee Armor (Beetle Shell + Solar Flare) Multiplicative DR private static void RemoveBeetleAndSolarFlareMultiplicativeDR(ILContext il) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 866fd43eac..ad2714f756 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -92,6 +92,7 @@ namespace CalamityMod.ILEditing On_TileDrawing.DrawSingleTile += GlowMaskTileRender; On_Main.DoUpdate_HandleChat += SpawnPunchCard; On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; + On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck; // Mana Burn (Chaos Stone) and Chalice of the Blood God IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; @@ -147,6 +148,7 @@ namespace CalamityMod.ILEditing IL_Projectile.Damage += VanillaBossResistChanges; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; IL_Projectile.AI_120_StardustGuardian += StardustGuardianAttackBuffs; + IL_Player.UpdateArmorSets += SolarWingsDashChange; IL_Player.UpdateBuffs += UpdateBuffsBalancingChanges; IL_Player.ApplyVanillaHurtEffectModifiers += RemoveBeetleAndSolarFlareMultiplicativeDR; @@ -176,7 +178,6 @@ namespace CalamityMod.ILEditing IL_WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits; IL_UIWorldCreation.SetDefaultOptions += ChangeDefaultWorldSize; IL_UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey; - IL_UIWorldCreation.AddWorldDifficultyOptions += SwapMasterModeDescriptionKey; Terraria.IO.On_WorldFile.ClearTempTiles += ClearModdedTempTiles; On_WorldGen.MakeDungeon += LimitDungeonEntranceXPosition; IL_WorldGen.DungeonHalls += LimitDungeonHallsXPosition; @@ -188,6 +189,7 @@ namespace CalamityMod.ILEditing IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable; IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable; IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; + IL_Player.ItemCheck_Shoot += RemoveForcedInaccuracyFromChainGunAndGatligator; IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; @@ -205,6 +207,7 @@ namespace CalamityMod.ILEditing On_Player.ItemCheck_CheckCanUse += RemoveUseLocks; On_Player.ItemCheck_UseEventItems += ApplyCelestialSigilChanges; IL_Main.DrawInfoAccs += RemoveDamageConditionFromRadar; + On_ShopHelper.ApplyNpcRelationshipEffect += AllowMultipleLikedNPCs; // Fix vanilla bugs exposed by Calamity mechanics IL_NPC.NPCLoot += FixSplittingWormBannerDrops; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 982f343ba2..680d860670 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1868,7 +1868,7 @@ namespace CalamityMod.ILEditing #region Revengeance Master Mode Twins Shenanigans public static void TripletsSpawnTextOverride(Terraria.On_NPC.orig_SpawnBoss orig, int x, int y, int type, int targetPlayerIndex) { - if (Main.masterMode && CalamityWorld.revenge && type == NPCID.Retinazer) + if (CalamityWorld.death && type == NPCID.Retinazer) { int retinazerIndex = NPC.NewNPC(NPC.GetBossSpawnSource(targetPlayerIndex), x, y, type, 1); if (retinazerIndex == 200) @@ -1896,7 +1896,7 @@ namespace CalamityMod.ILEditing public static void PreventFoveanatorDefeatMessageIfNotKilledLast(On_NPC.orig_DoDeathEvents_BeforeLoot orig, NPC self, Player closestPlayer) { - if (Main.masterMode && CalamityWorld.revenge && self.type == ModContent.NPCType() && (NPC.AnyNPCs(NPCID.Spazmatism) || NPC.AnyNPCs(NPCID.Retinazer))) + if (CalamityWorld.death && self.type == ModContent.NPCType() && (NPC.AnyNPCs(NPCID.Spazmatism) || NPC.AnyNPCs(NPCID.Retinazer))) { self.value = 0f; self.boss = false; @@ -1911,7 +1911,7 @@ namespace CalamityMod.ILEditing public static void TripletsDefeatTextOverride(On_NPC.orig_DoDeathEvents_CelebrateBossDeath orig, NPC self, string typeName) { bool correctNPCType = self.type == NPCID.Retinazer || self.type == NPCID.Spazmatism || self.type == ModContent.NPCType(); - if (Main.masterMode && CalamityWorld.revenge && correctNPCType) + if (CalamityWorld.death && correctNPCType) { if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", CalamityUtils.GetTextValue("Status.Boss.TripletsDefeatName")), 175, 75, 255); @@ -2485,5 +2485,16 @@ namespace CalamityMod.ILEditing #endregion #endregion + + #region Make Celestial Onion give the Master Mode slot + public static bool MasterModeCelestialOnionCheck(Terraria.On_Player.orig_IsItemSlotUnlockedAndUsable orig, Player self, int slot) + { + if ((slot == 9 || slot == 19) && self.Calamity().extraAccessoryML && !Main.gameMenu) + { + return true; + } + return orig(self, slot); + } + #endregion } } diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 4971102da3..0cf37992d2 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; @@ -14,7 +15,9 @@ using MonoMod.Cil; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.Drawing; +using Terraria.GameContent.Personalities; using Terraria.ID; using Terraria.ModLoader; @@ -120,6 +123,33 @@ namespace CalamityMod.ILEditing } #endregion Reforge Requirement Relaxation + #region Remove Forced Inaccuracy from Chain Gun and Gatligator + private static void RemoveForcedInaccuracyFromChainGunAndGatligator(ILContext il) + { + var cursor = new ILCursor(il); + + // Go to the load of the Chain Gun's item ID (1929). + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcI4(1929))) + { + LogFailure("Remove Chain Gun and Gatligator Inaccuracy", "Could not locate the ID of the Chain Gun."); + return; + } + + // Change this item ID check to check for -1048576. This will never occur. + cursor.Next.Operand = -1048576; + + // Go to the load of the Gatligator's item ID (2270). + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcI4(2270))) + { + LogFailure("Remove Chain Gun and Gatligator Inaccuracy", "Could not locate the ID of the Gatligator."); + return; + } + + // Change this item ID check to check for -1048576. This will never occur. + cursor.Next.Operand = -1048576; + } + #endregion + #region Prevention of Slime Rain Spawns When Near Bosses private static void PreventBossSlimeRainSpawns(Terraria.On_NPC.orig_SlimeRainSpawns orig, int plr) { @@ -1121,6 +1151,38 @@ namespace CalamityMod.ILEditing } #endregion + #region Multiple NPC Happiness support for Cirrus + private static void AllowMultipleLikedNPCs(On_ShopHelper.orig_ApplyNpcRelationshipEffect orig, ShopHelper self, int npcType, AffectionLevel affectionLevel) + { + FieldInfo npcTalkField = typeof(ShopHelper).GetField("_currentNPCBeingTalkedTo", BindingFlags.Instance | BindingFlags.NonPublic); + NPC talkedNPC = (NPC)npcTalkField.GetValue(self); + + // Allow Cirrus to have things to say about multiple NPCs with the same happiness level + if (talkedNPC.type == ModContent.NPCType()) + { + MethodInfo addReportField = typeof(ShopHelper).GetMethod("AddHappinessReportText", BindingFlags.Instance | BindingFlags.NonPublic); + + FieldInfo happinessField = typeof(ShopHelper).GetField("_currentPriceAdjustment", BindingFlags.Instance | BindingFlags.NonPublic); + float currentPriceAdjustment = (float)happinessField.GetValue(self); + + if (affectionLevel != 0 && Enum.IsDefined(affectionLevel)) + { + // Add a suffix to the localization key which specifies the NPC's name + addReportField.Invoke(self, [ $"{affectionLevel}NPC_" + NPCID.Search.GetName(npcType), new + { + NPCName = NPC.GetFullnameByID(npcType) + }, 0]); + currentPriceAdjustment *= NPCHappiness.AffectionLevelToPriceMultiplier[affectionLevel]; + happinessField.SetValue(self, currentPriceAdjustment); + } + } + else + { + orig(self, npcType, affectionLevel); + } + } + #endregion + // 02JUN2024: Ozzatron: The below code is being kept in its initial state for historic value. #region Store The Stupid Fucking Private Wind Map In Public Property [/*TotallyNot*/Obsolete("This function serves no purpose and is included in the Calamity source code for historic value.", error: true)] diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index b6ca1da325..419d4c19f9 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -161,7 +161,7 @@ namespace CalamityMod.ILEditing } #endregion - #region Change World Generation Descriptions + #region Change Small World Description /// /// Changes the description of Small worlds to serve as a warning. /// @@ -184,26 +184,6 @@ namespace CalamityMod.ILEditing } - - /// - /// Changes the description of Master Mode to mention boss changes. - /// - private static void SwapMasterModeDescriptionKey(ILContext il) - { - // Swap vanilla's Master Mode description string (UI.WorldDescriptionMaster) with Calamity's edited version (Mods.CalamityMod.UI.WorldMaster). - var cursor = new ILCursor(il); - - // Move to after the string. - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdstr("UI.WorldDescriptionMaster"))) - { - LogFailure("Change Master Mode Description", "Could not match string \"UI.WorldDescriptionMaster\"."); - return; - } - - // Pop this value off, then replace it with Calamity's new string. - cursor.EmitPop(); - cursor.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.WorldMaster"); - } #endregion #region Clear temporary modded tiles diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 51803181a3..8fa999b765 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(15). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 90779b1ac3..a201961732 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -37,6 +38,15 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight(player.Center, new Vector3(1.2f, 1.2f, 0.72f)); } + public override void ModifyTooltips(List list) + { + var player = Main.LocalPlayer; + if (player != null) + { + list.FindAndReplace("[REGEN]", (player.Calamity().ambrosialAmpouleRegen + player.Calamity().alwaysHoneyRegenAmount).ToString("0.##")); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 09447e3273..6293e34145 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.pickSpeed -= 0.1f; + player.Calamity().aFossil = true; + player.Calamity().fallingBlockProtection = true; } public override void AddRecipes() diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 05610d1dc1..56939d04f4 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 56; + Item.height = 34; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; @@ -20,20 +20,25 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.pickSpeed -= 0.15f; - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) - { - player.statDefense += 10; - player.endurance += 0.05f; - } + player.pickSpeed -= 0.3f; + player.Calamity().aPowder = true; + player.Calamity().fallingBlockProtection = true; + player.Calamity().trapProtection = true; + + // Doesn't stack with downgrades + if (player.chiselSpeed) + player.pickSpeed += 0.15f; + if (player.Calamity().aFossil) + player.pickSpeed += 0.1f; } public override void AddRecipes() { CreateRecipe(). AddIngredient(). + AddIngredient(ItemID.AncientChisel). AddIngredient(3). - AddIngredient(15). + AddIngredient(10). AddIngredient(ItemID.Bone, 15). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/ArchaicPowder.png b/Items/Accessories/ArchaicPowder.png index aacf76a64a..d67144dcb2 100644 Binary files a/Items/Accessories/ArchaicPowder.png and b/Items/Accessories/ArchaicPowder.png differ diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index e13bb27c68..307cc2620b 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.ascendantInsignia = true; player.empressBrooch = true; + player.moveSpeed += 0.05f; + player.jumpSpeedBoost += 0.25f; } public override void AddRecipes() diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 064400cf16..6ada54ffe2 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Accessories public Color? TooltipExtensionColor => new(195, 223, 255); - public const int ShieldSlamDamage = 900; + public const int ShieldSlamDamage = 1000; public const float ShieldSlamKnockback = 15f; public const int ShieldSlamIFrames = 12; - public const int RamExplosionDamage = 450; + public const int RamExplosionDamage = 300; public const float RamExplosionKnockback = 20f; public override void SetDefaults() diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index 622a89f0a2..9a72bf77c4 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Items.Accessories // If this reduces the player's health to zero, make sure they actually die. if (player.statLife <= 0) { - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ChaliceOfTheBloodGod" + Main.rand.Next(1, 18 + 1)).Format(player.name)), modPlayer.chaliceBleedoutBuffer, 0, false); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ChaliceOfTheBloodGod" + Main.rand.Next(1, 18 + 1)).ToNetworkText(player.name)), modPlayer.chaliceBleedoutBuffer, 0, false); } } @@ -137,7 +137,7 @@ namespace CalamityMod.Items.Accessories { // Death message changes depending on whether it was the last few drips of an "honored" bleed, or attempting to cheat by removing the accessory. string deathMessageKey = modPlayer.chaliceOfTheBloodGod ? "Status.Death.ChaliceOfTheBloodGodClose" : "Status.Death.ChaliceOfTheBloodGodUnequip"; - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText(deathMessageKey).Format(player.name)), modPlayer.chaliceBleedoutBuffer, 0, false); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText(deathMessageKey).ToNetworkText(player.name)), modPlayer.chaliceBleedoutBuffer, 0, false); } } diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index e5a655113b..41291522ae 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -58,6 +58,11 @@ namespace CalamityMod.Items.Accessories // Special search radius for coin ricoshots that only applies to DSO targets. public static readonly float RicoshotSearchDistance = 2800f; + /// + /// The maximum amount of extra critical strike chance you can get from this accessory. + /// + public static readonly int CritHardCap = 100; + #endregion public override void SetDefaults() @@ -115,7 +120,7 @@ namespace CalamityMod.Items.Accessories modPlayer.spiritOriginCritBoost = currentCritBoost; // Actually give the crit boost as a direct increase to ranged critical strike chance. - player.GetCritChance() += modPlayer.spiritOriginCritBoost; + player.GetCritChance() += Math.Min(modPlayer.spiritOriginCritBoost, CritHardCap); // Display the current crit boost on a cooldown. if (modPlayer.cooldowns.TryGetValue(DaawnlightSpiritOriginExtraCrit.ID, out var cooldown)) diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index 1e1ec3c3ad..d017624cdf 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,10 +23,12 @@ namespace CalamityMod.Items.Accessories { player.Calamity().deadshotBrooch = true; player.Calamity().rangedAmmoCost *= 0.8f; - player.GetDamage() += 0.1f; - player.GetCritChance() += 5; + player.GetDamage() += 0.12f; + player.GetCritChance() += 7; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index dfd9f7fe01..4885c220ef 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories public class DynamoStemCells : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const int MiniSwamerCooldown = 180; + public const int MiniSwarmerCooldown = 180; public static int MiniSwamerDamage = 1000; public override void SetStaticDefaults() { diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 192f3565f2..05e3ce7943 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Items.Accessories public bool HasFlavorTooltip => true; public Color? TooltipExtensionColor => new(195, 223, 255); - public const int ShieldSlamDamage = 400; + public const int ShieldSlamDamage = 500; public const float ShieldSlamKnockback = 12f; public const int ShieldSlamIFrames = 12; - public const int RamExplosionDamage = 200; + public const int RamExplosionDamage = 100; public const float RamExplosionKnockback = 15f; public override void SetDefaults() diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index c422418d78..01132959e8 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories AddRecipeGroup("AnyGoldCrown"). AddIngredient(6). AddIngredient(ItemID.Feather, 8). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 4e1d606e02..c7b583cea5 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -17,17 +18,15 @@ namespace CalamityMod.Items.Accessories Item.height = 36; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.defense = 5; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - float damageIncrease = 0.2f; - float moveSpeedIncrease = 0.2f; + float statPower = (float)Math.Round(0.2f * Utils.GetLerpValue(1, 0.5f, ((float)player.statLife / (float)player.statLifeMax2), true), 2); player.Calamity().gladiatorSword = true; - player.GetDamage() += damageIncrease - (damageIncrease * player.statLife / player.statLifeMax2); - player.moveSpeed += moveSpeedIncrease - (moveSpeedIncrease * player.statLife / player.statLifeMax2); + player.GetDamage() += statPower; + player.moveSpeed += statPower; } } } diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 927a30b43a..e6af6589cf 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(2). AddIngredient(ItemID.SunplateBlock, 2). AddIngredient(ItemID.Feather, 5). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 41c8bcedcd..ad0586e27c 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -1,9 +1,6 @@ using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +10,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; // The percentage of a full Rage bar that is gained every second with Heart of Darkness equipped. - public const float RagePerSecond = 0.01f; + public const float RagePerSecond = 0.02f; public override void SetStaticDefaults() { diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index a87ec69437..5e50b0a3b2 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.ironBoots = true; + player.noFallDmg = true; } } } diff --git a/Items/Accessories/JellyChargedBattery.png b/Items/Accessories/JellyChargedBattery.png index e389aad9f4..8edc8c65a6 100644 Binary files a/Items/Accessories/JellyChargedBattery.png and b/Items/Accessories/JellyChargedBattery.png differ diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index a50bfc0663..29b3f78836 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories public class LeviathanAmbergris : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int ambergrisDashDamage = 90; + public static int ambergrisDashDamage = 650; public override void SetDefaults() { Item.width = 20; @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.lAmbergris = true; + modPlayer.lAmbergrisVisual = !hideVisual; } } } diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index d2d0a1d680..aeeda7a03d 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -50,7 +50,18 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ProjectileType()] < 1 && !player.dead) { - Projectile lux = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.luxorsGiftVanity = true; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !player.dead) + { + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); } } } diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index 8f20c5926b..ca173561dc 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -92,6 +92,8 @@ namespace CalamityMod.Items.Accessories Projectile.tileCollide = false; Projectile.ArmorPenetration = 20; Projectile.netImportant = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 7d73cda868..f37b4fbf5f 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nanotech = true; - modPlayer.raiderTalisman = true; modPlayer.electricianGlove = true; modPlayer.filthyGlove = true; modPlayer.bloodyGlove = true; @@ -36,7 +35,6 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(4). diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 8b0b948c8a..39d4b09ccd 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -32,5 +33,12 @@ namespace CalamityMod.Items.Accessories AddTile(TileID.MythrilAnvil). Register(); } + + public override void ModifyTooltips(List list) + { + var player = Main.LocalPlayer; + if (player != null) + list.FindAndReplace("[DAMAGE]", (0.3f * (1 - player.statLife / (float)player.statLifeMax2)).ToPercent()); + } } } diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 61da35b09b..20902eceda 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -31,6 +32,8 @@ namespace CalamityMod.Items.Accessories modPlayer.rangedAmmoCost *= 0.8f; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Radiance.cs b/Items/Accessories/Radiance.cs index 68b3b5836c..355fd413a3 100644 --- a/Items/Accessories/Radiance.cs +++ b/Items/Accessories/Radiance.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -11,7 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [LegacyName("AstralArcanum", "Purity")] - public class Radiance : ModItem, ILocalizedModType + public class Radiance : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() @@ -48,6 +49,17 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight(player.Center, new Vector3(1.32f, 1.32f, 1.82f)); } + + public override void ModifyTooltips(List list) + { + var player = Main.LocalPlayer; + if (player != null) + { + list.FindAndReplace("[REGEN]", (player.Calamity().purityRegen + player.Calamity().alwaysHoneyRegenAmount).ToString("0.##")); + list.FindAndReplace("[DEFENSE]", player.Calamity().jewelBonusDefense.ToString()); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 42f5a8a1de..42a64e5120 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -31,6 +32,15 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight(player.Center, new Vector3(1f, 1f, 0.6f)); } + public override void ModifyTooltips(List list) + { + var player = Main.LocalPlayer; + if (player != null) + { + list.FindAndReplace("[REGEN]", (player.Calamity().radiantOozeRegen).ToString("0.##")); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 7ded8661aa..775a842fa1 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 10f; - public const int RaiderCooldown = 10; + public const float RaiderBonus = 15f; + public const int RaiderCooldown = 10; //seconds public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); public override void SetDefaults() diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 387cfa5b86..1289b42d86 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -64,8 +64,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 38; - Item.height = 26; + Item.width = 34; + Item.height = 30; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Accessories/RoverDrive.png b/Items/Accessories/RoverDrive.png index dc5b42b8ba..6ee7811338 100644 Binary files a/Items/Accessories/RoverDrive.png and b/Items/Accessories/RoverDrive.png differ diff --git a/Items/Accessories/SandSharkToothNecklace.cs b/Items/Accessories/SandSharkToothNecklace.cs index c18875f349..48c7b5d494 100644 --- a/Items/Accessories/SandSharkToothNecklace.cs +++ b/Items/Accessories/SandSharkToothNecklace.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetDamage() += 0.06f; + player.GetDamage() += 0.1f; player.GetArmorPenetration() += 10; } diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 9db1a74924..cacb484ead 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,6 +1,10 @@ -using CalamityMod.Items.Armor.Victide; -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,40 +13,115 @@ namespace CalamityMod.Items.Accessories public class ShieldoftheOcean : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static readonly SoundStyle TriggerSound = new("CalamityMod/Sounds/Custom/MossMine"); + public static readonly SoundStyle ParrySound = new("CalamityMod/Sounds/Custom/BubbleCracklePop"); + public static readonly SoundStyle ParrySoundGFB = new("CalamityMod/Sounds/Custom/GFB/OceanShieldParryGFB"); + public const int ParryTime = 30; + // These damage values scale in Expert and Master. + public const int ShoveFallBaseDamage = 80; + public const int ImmuneToShoveBaseDamage = 200; + public override void SetDefaults() { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 2; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + player.Calamity().shieldOfTheOcean = true; + } + + public static void HandleParryCountdown(Player player) + { + player.Calamity().shieldOfTheOceanParry--; + + if (player.Calamity().shieldOfTheOceanParry > 0) { - player.statDefense += 5; - } - // Accessory update comes before set bonus for some reason, so this has to be done - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.moveSpeed += 0.1f; - player.lifeRegen += 2; + player.controlJump = false; + player.controlDown = false; + player.controlLeft = false; + player.controlRight = false; + player.controlUp = false; + player.controlUseItem = false; + player.controlUseTile = false; + player.controlThrow = false; + player.gravDir = 1f; + player.velocity = Vector2.Zero; + player.velocity.Y = -0.1f; // Ensure Y velocity is not 0, otherwise the flight meter gets reset. + player.RemoveAllGrapplingHooks(); } } - public override void AddRecipes() + // GFB changes: + // Different sound when parrying. + // Larger radius for pushing away enemies. + // Enemies are pushed much faster. + // Damage is multiplied by 10. + public static void ActivateParry(Player player) { - CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.Starfish, 5). - AddTile(TileID.Anvils). - Register(); + bool empowered = player.Calamity().shieldOfTheOceanEmpoweredParry; + + // Search for every NPC within a certain radius of the player. + foreach (NPC npc in Main.ActiveNPCs) + { + if (Vector2.Distance(player.Center, npc.Center) > (Main.zenithWorld ? 720f : 240f)) + continue; + + // Inflict Riptide on empowered parries. + if (empowered) + npc.AddBuff(ModContent.BuffType(), 300); + + // If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries. + // Otherwise, simply deal a large amount of damage to them if empowered. + if (npc.CanBeMoved(true)) + { + // The NPC has to actually have its velocity changed, because TileCollisionHarmNPC only changes its position. Not confusing at all! + Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f; + npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true); + + int scaledFallDamage = ShoveFallBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + if (empowered) + npc.FlungNPC().ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); + else + npc.FlungNPC().ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true); + + for (int i = -1; i <= 1; i++) + { + Vector2 particleVel = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.Pi / 6f * i) * 7.5f; + WaterFlavoredParticle pushHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(pushHit); + } + } + else + { + if (empowered) + { + int scaledImmuneDamage = ImmuneToShoveBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + Projectile.NewProjectile(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), scaledImmuneDamage, 0f, player.whoAmI, npc.whoAmI); + } + + float randOffset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 6; i++) + { + Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.Pi / 3f * i + randOffset) * 7.5f; + WaterFlavoredParticle bigHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(bigHit); + } + } + } + player.Calamity().shieldOfTheOceanEmpoweredParry = false; + + for (int b = 0; b < 20; b++) + { + Vector2 waterVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi / 15f * b) * Main.rand.NextFloat(12f, 24f); + WaterFoamParticle sorryToBurstYourBubble = new(player.Center, waterVel, 15, 0.6f, Color.Blue); + GeneralParticleHandler.SpawnParticle(sorryToBurstYourBubble); + } } } } diff --git a/Items/Accessories/SlagsplitterPauldron.cs b/Items/Accessories/SlagsplitterPauldron.cs index 57f9ef5984..0bce37c59f 100644 --- a/Items/Accessories/SlagsplitterPauldron.cs +++ b/Items/Accessories/SlagsplitterPauldron.cs @@ -1,12 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Crags; -using CalamityMod.Projectiles.Typeless; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +11,7 @@ namespace CalamityMod.Items.Accessories public class SlagsplitterPauldron : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int PauldronSlamDamage = 170; + public static int PauldronSlamDamage = 330; public override void SetDefaults() { Item.width = 54; @@ -29,7 +24,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.Pauldron = true; + modPlayer.sPauldron = true; + modPlayer.sPauldronVisual = !hideVisual; } public override void AddRecipes() diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 3b5dca0d99..9ac868fe4a 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -30,18 +30,16 @@ namespace CalamityMod.Items.Accessories { player.autoJump = true; player.jumpSpeedBoost += 1.6f; + player.moveSpeed += 0.1f; player.noFallDmg = true; player.blackBelt = true; player.dashType = 0; player.Calamity().DashID = StatisNinjaBeltDash.ID; player.spikedBoots = 2; player.accFlipper = true; - player.hasMagiluminescence = true; + player.Calamity().statisNinjaBelt = true; player.MountedCenter.ToTileCoordinates(); - DelegateMethods.v3_1 = new Vector3(0.8f, 0.5f, 1f); - Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); - Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); } public override void AddRecipes() @@ -51,8 +49,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.MasterNinjaGear). AddIngredient(ItemID.FrogFlipper). - AddIngredient(ItemID.Magiluminescence). - AddIngredient(50). + AddIngredient(25). AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); @@ -61,8 +58,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.Tabi). AddIngredient(ItemID.BlackBelt). AddIngredient(ItemID.FrogGear). - AddIngredient(ItemID.Magiluminescence). - AddIngredient(50). + AddIngredient(25). AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index f68a1bc362..8fc1788724 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -35,20 +35,21 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + + modPlayer.voidSashVisuals = !hideVisual; + player.autoJump = true; player.jumpSpeedBoost += 1.6f; + player.moveSpeed += 0.2f; player.noFallDmg = true; player.blackBelt = true; modPlayer.DashID = StatisVoidSashDash.ID; player.dashType = 0; player.spikedBoots = 2; player.accFlipper = true; - player.hasMagiluminescence = true; + player.Calamity().statisVoidSash = true; player.MountedCenter.ToTileCoordinates(); - DelegateMethods.v3_1 = new Vector3(0.8f, 0.5f, 1f); - Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); - Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); } public override void AddRecipes() diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index e6e56b2c1d..b37ec798aa 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Items.Accessories public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f }; public static int ShieldDurabilityMax = 180; - public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(9); // was 6 - public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(6); + public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(8); // Was 6, then was 9 + public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(10); // Was 6 - // While active, The Sponge gives 30 defense and 10% DR - public static int ShieldActiveDefense = 30; + // While active, The Sponge gives 20 defense and 10% DR + public static int ShieldActiveDefense = 20; public static float ShieldActiveDamageReduction = 0.1f; public int OwnerPlayer { get; set; } diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index eb41891dc2..4c5043b3ba 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -57,10 +57,10 @@ namespace CalamityMod.Items.Accessories AddIngredient(10). AddRecipeGroup("AnyMythrilBar", 5). AddIngredient(2). - AddIngredient(2). AddIngredient(2). - AddIngredient(ItemID.SoulofNight, 3). + AddIngredient(2). AddIngredient(ItemID.SoulofLight, 3). + AddIngredient(ItemID.SoulofNight, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index aaba2c7446..0730b3c78a 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories public class TrinketofChi : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - internal const int ChiBuffTimerMax = 300; + internal const int ChiBuffTimerMax = 600; public override void SetDefaults() { diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index 4f6d09983b..d5d2f6e118 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -3,11 +3,23 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Accessories { - public class VampiricTalisman : ModItem, ILocalizedModType + public class VampiricTalisman : ModItem, ILocalizedModType, IHoldShiftTooltipItem { + internal const int ArmorCrunchDebuffTime = 150; + internal const int HeavyBleedingDebuffTime = 300; + internal const float StealthStrikeDamageMultiplier = 0.08f; + public const float RaiderBonus = 15f; + + public bool ShowExtensionIndicator => false; + + // Easter egg has a special tooltip key and color. + public string TooltipExtensionKey => "YearningForBlood"; + public Color? TooltipExtensionColor => Color.Red; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -22,14 +34,22 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.vampiricTalisman = true; - player.GetDamage() += 0.12f; + modPlayer.raiderTalisman = true; + modPlayer.rottenDogTooth = true; + player.Calamity().bonusStealthDamage += StealthStrikeDamageMultiplier; + + //get fixed boi funny + if (Main.zenithWorld) + player.lifeRegen -= 10; //Never ending thirst } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(10). + AddIngredient(ItemID.BrokenBatWing). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index 32ca98b5e7..ae04d03443 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -104,5 +105,27 @@ namespace CalamityMod.Items.Accessories.Vanity Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (forceHelmetOn || transformationActive) + { + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + drawInfo.drawPlayer.face = -1; + } + + if (transformationActive) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body); + drawInfo.bodyGlowMask = -1; + + drawInfo.drawPlayer.HideAccessories(); + } + } } } diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs index ada7c260f7..4067719941 100644 --- a/Items/Accessories/Vanity/CrystalHeartVodka.cs +++ b/Items/Accessories/Vanity/CrystalHeartVodka.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -82,5 +84,21 @@ namespace CalamityMod.Items.Accessories.Vanity //Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/GoldenBomb.cs b/Items/Accessories/Vanity/GoldenBomb.cs index cef27a6ceb..dca2e3d2a2 100644 --- a/Items/Accessories/Vanity/GoldenBomb.cs +++ b/Items/Accessories/Vanity/GoldenBomb.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -76,5 +78,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/HapuFruit.cs b/Items/Accessories/Vanity/HapuFruit.cs index 65b1948303..0461d330f8 100644 --- a/Items/Accessories/Vanity/HapuFruit.cs +++ b/Items/Accessories/Vanity/HapuFruit.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -84,5 +85,20 @@ namespace CalamityMod.Items.Accessories.Vanity //Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Back); + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Body); + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/OracleHeadphones.cs b/Items/Accessories/Vanity/OracleHeadphones.cs index 47645f8084..eb87fecceb 100644 --- a/Items/Accessories/Vanity/OracleHeadphones.cs +++ b/Items/Accessories/Vanity/OracleHeadphones.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -81,5 +83,21 @@ namespace CalamityMod.Items.Accessories.Vanity //Player.HideAccessories(); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Back); + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/SharkyPlush.cs b/Items/Accessories/Vanity/SharkyPlush.cs index 77efd68e44..521c319e7a 100644 --- a/Items/Accessories/Vanity/SharkyPlush.cs +++ b/Items/Accessories/Vanity/SharkyPlush.cs @@ -1,5 +1,8 @@ -using System; +using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; @@ -78,5 +81,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 520a9f3202..9a949d9667 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -89,5 +91,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index b2908d3a7b..98ef8e6afa 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -89,5 +91,20 @@ namespace CalamityMod.Items.Accessories.Vanity Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); } } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (vanityEquipped) + { + drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs); + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body); + drawInfo.bodyGlowMask = -1; + drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + } } } diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index cfc15ce1ec..a67ed6ac4c 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public class WarbanneroftheRighteous : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - internal const float MaxBonus = 0.8f; + internal const float MaxBonus = 0.6f; internal const float MaxDistance = 350f; public override void SetStaticDefaults() @@ -57,8 +57,8 @@ namespace CalamityMod.Items.Accessories } int maxValue = (int)(MaxBonus * 100); - float bonus = CalculateBonus(player) - 0.6f; - float displayBonus = (int)((bonus + 0.6f) * 100); // Should range from 0 to the maxValue + float bonus = CalculateBonus(player) - 0.4f; + float displayBonus = (int)((bonus + 0.4f) * 100); // Should range from 0 to the maxValue if (player.Calamity().cooldowns.TryGetValue(WarbanneroftheRighteousBuff.ID, out var cooldown)) { diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index 9bd60529f1..b1339b3a06 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Accessories player.moveSpeed += 0.08f; player.GetModPlayer().WulfrumPackEquipped = true; player.GetModPlayer().PackItem = Item; - + player.maxFallSpeed *= 1.25f; Lighting.AddLight(player.Center, Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f).ToVector3()); } @@ -108,7 +108,7 @@ namespace CalamityMod.Items.Accessories /// /// The index of the grapple projectile currently grappled. /// - public int Grapple = 0; + public int Grapple = -1; /// /// The length of the current rope. Determined when the grapple lands. /// @@ -124,7 +124,7 @@ namespace CalamityMod.Items.Accessories /// /// 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 Grappled => WulfrumPackEquipped && Grapple > -1 && Main.projectile[Grapple].active && Main.projectile[Grapple].ModProjectile is WulfrumHook hook && hook.State == WulfrumHook.HookState.Grappling; public bool GrappleMovementDisabled { get @@ -146,14 +146,82 @@ namespace CalamityMod.Items.Accessories 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; + //Hook stats + /// + /// This is the length when using Grappling Hook. Faster hooks get more length, and slower ones get less. + /// + public const float BaseMaxLength = 600; + /// + /// This is the launch velocity when using Grappling Hook. Faster hooks get more speed, and slower ones get less. + /// + public const float BaseLaunchVelocity = 17f; + /// + /// This is the return velocity when using Grappling Hook. + /// The ratio between this and BaseLaunchVelocity will be the same regardless of hook + /// + public const float BaseReturnVelocity = 5f; + /// + /// This is how much of the equipped hook's launch speed is factored into the Acro Pack hook speed + /// All other stat changes are based off the ratio of the base launch velocity and actual launch velocity + /// Increase this to make the difference between hooks more obvious, and lower it to make the difference less obvious + /// Note: The base stats balance around having Grappling Hook equipped + /// + public const float HookSpeedFactor = 0.5f; + /// + /// How quickly you reel in/out with UP and DOWN + /// + public const float ReelSpeed = 4f; + /// + /// How quickly you reel in with Static Hook equipped + /// + public const float StaticHookReelSpeed = 6f; + /// + /// How much stronger the player manually swinging should be with antigrav hook equipped + /// + public const float AntiGravSwingModifier = 2f; + + public const int SimulationResolution = 5; + public const int HookUpdates = 3; + public const float MaxHopVelocity = 3f; //The maximum velocity at which the player gets any amount of vertical boost from hopping out of the hook + public const int SafetySteps = 3; + public const float SafetyHookAngle = MathHelper.PiOver2 * 1.2f; + public const float SafetyHookAngleResolution = 50f; + + + public float ActualLaunchVelocity + { + get + { + float hookSpeed = 0; + Item hook = Player.miscEquips[4]; + if (!hook.IsAir) + { + hookSpeed = hook.shootSpeed; + } + return BaseLaunchVelocity + (-11.5f + hookSpeed) * HookSpeedFactor; + } + } + public float HookSpeedRatio + { + get + { + return ActualLaunchVelocity / BaseLaunchVelocity; + } + } + public float ActualMaxLength + { + get + { + return BaseMaxLength * HookSpeedRatio; + } + } + public float ActualReturnVelocity + { + get + { + return BaseReturnVelocity * HookSpeedRatio; + } + } public bool PlayerOnGround => Collision.SolidCollision(Player.position + Vector2.UnitY * 2f * Player.gravDir, Player.width, Player.height, false); @@ -161,6 +229,8 @@ namespace CalamityMod.Items.Accessories { WulfrumPackEquipped = false; PackItem = null; + if (Grapple >= 0) + Player.GoingDownWithGrapple = true; //This causes the player to fall through platforms when grappled. Used to fix a weird bug when grappling and standing on a platform. if (hookCooldown > 0) hookCooldown--; @@ -221,6 +291,10 @@ namespace CalamityMod.Items.Accessories else SimulateMovement(Main.projectile[Grapple]); } + else + { + Grapple = -1; + } } public void SimulateMovement(Projectile grapple) @@ -237,8 +311,6 @@ namespace CalamityMod.Items.Accessories //Dust doost = Dust.NewDustPerfect(CurrentPosition, 1, Vector2.Zero); //doost.noGravity = true; } - - if (!GrappleMovementDisabled) { CurrentPosition = Segments[SimulationResolution].position; @@ -267,7 +339,7 @@ namespace CalamityMod.Items.Accessories swing -= 0.1f; } - Player.velocity.X += swing; + Player.velocity.X += swing * (Player.miscEquips[4].type == ItemID.AntiGravityHook ? 1.75f : 1); } else if (Math.Abs(Player.Center.X - Segments[0].position.X) < 30f && Math.Abs(Player.velocity.X) < 1) @@ -341,7 +413,7 @@ namespace CalamityMod.Items.Accessories for (float angle = -halfSpread; angle < halfSpread; angle += SafetyHookAngle / SafetyHookAngleResolution) { - for (int i = 0; i < (int)(WulfrumHook.MaxReach / 16f); i++) + for (int i = 0; i < (int)(ActualMaxLength / 16f); i++) { Vector2 checkSpot = Player.Center + (-Vector2.UnitY * Player.gravDir * i * 16f).RotatedBy(angle); Point tilePos = checkSpot.ToSafeTileCoordinates(); @@ -391,11 +463,11 @@ namespace CalamityMod.Items.Accessories { float score = 0.0001f; - if (distance < 2 * WulfrumHook.MaxReach / 3f) - score += distance / (2 * WulfrumHook.MaxReach / 3f); + if (distance < 2 * ActualMaxLength / 3f) + score += distance / (2 * ActualMaxLength / 3f); else - score += 1 - (distance - (2 * WulfrumHook.MaxReach / 3f)) / (WulfrumHook.MaxReach / 3f); + score += 1 - (distance - (2 * ActualMaxLength / 3f)) / (ActualMaxLength / 3f); score += (1 - Math.Abs(angle) / (SafetyHookAngle / 2f)) * 0.5f; @@ -426,7 +498,7 @@ namespace CalamityMod.Items.Accessories if (Player.whoAmI == Main.myPlayer) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 velocity = (Main.MouseWorld - Player.Center).SafeNormalize(Vector2.One) * GrappleVelocity; + Vector2 velocity = (Main.MouseWorld - Player.Center).SafeNormalize(Vector2.One) * ActualLaunchVelocity; Projectile.NewProjectile(Player.GetSource_ItemUse(PackItem), Player.Center, velocity, ProjectileType(), 0, 0, Player.whoAmI); float angleToRightBelow = velocity.AngleBetween(Vector2.UnitY); @@ -438,7 +510,21 @@ namespace CalamityMod.Items.Accessories } } } - + if (Grappled && triggersSet.Up) + { + SwingLength -= (Player.miscEquips[4].type == ItemID.StaticHook ? StaticHookReelSpeed : ReelSpeed); + Player.controlUp = false; //This is required to stop the player from bouncing off platforms when falling down and reeling in. Also prevents gravity swapping while hooked. + } + if (triggersSet.Down) //Static Hook doesn't effect this speed because it would be faster than your fall speed and feel janky. + { + float length = ActualMaxLength; + if (SwingLength < length) + { + SwingLength += (ReelSpeed); + if (SwingLength > length) + SwingLength = length; + } + } //Jumping out of the hook if (triggersSet.Jump && Player.releaseJump) { @@ -462,6 +548,8 @@ namespace CalamityMod.Items.Accessories if ((Math.Sign(Player.velocity.X) < 0 && Player.controlLeft) || (Math.Sign(Player.velocity.X) > 0 && Player.controlRight)) { velocityBoost += Player.velocity * 0.15f; + if (velocityBoost.Y < 0) //This causes upward velocity to be increased by more. Not needed, but just feels good. + velocityBoost.Y *= 2; } //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. @@ -469,10 +557,15 @@ namespace CalamityMod.Items.Accessories { velocityBoost -= Vector2.UnitY * Player.jumpSpeed * (1 - (float)Math.Pow(Player.velocity.Length() / MaxHopVelocity, 5f)); } + //If the player is moving fast enough, don't jump out of the hook. This is to maintain vertical momentum when releasing grapple while swinging. + if (Player.velocity.Length() < 8f) + { + Player.jump = Player.jumpHeight / 2; + } Player.velocity += velocityBoost; - Player.jump = Player.jumpHeight / 2; + Player.releaseJump = false; } else diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index efa3e9f2ac..6fa9f06057 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Accessories { public override void AI(Projectile projectile) { - if (!projectile.npcProj && !projectile.trap && projectile.minion && !ProjectileID.Sets.MinionShot[projectile.type] && Main.player[projectile.owner].GetModPlayer().battery) + if (!projectile.npcProj && !projectile.trap && (projectile.minion||projectile.sentry) && !ProjectileID.Sets.MinionShot[projectile.type] && !ProjectileID.Sets.SentryShot[projectile.type] && Main.player[projectile.owner].GetModPlayer().battery) { float lightMult = 1f; if (Lighting.UpdateEveryFrame) //The light loks wayyy too bright in retro/trippy diff --git a/Items/Accessories/WulfrumBattery.png b/Items/Accessories/WulfrumBattery.png index ada5ddef24..f2559fc5f6 100644 Binary files a/Items/Accessories/WulfrumBattery.png and b/Items/Accessories/WulfrumBattery.png differ diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 6c44ff4334..93de0fc981 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 14; Item.height = 36; - Item.damage = 30; + Item.damage = 19; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index 490e39bf4b..915a56bf28 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 14; Item.height = 30; - Item.damage = 27; + Item.damage = 17; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index 72545034d4..7f60191950 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 36; - Item.damage = 17; + Item.damage = 15; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/FlashRound.cs b/Items/Ammo/FlashRound.cs index fbd7778605..488ad4ead5 100644 --- a/Items/Ammo/FlashRound.cs +++ b/Items/Ammo/FlashRound.cs @@ -18,23 +18,23 @@ namespace CalamityMod.Items.Ammo { Item.width = 12; Item.height = 18; - Item.damage = 5; + Item.damage = 6; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; - Item.knockBack = 1.15f; - Item.value = Item.sellPrice(copper: 2); + Item.knockBack = 6f; + Item.value = Item.sellPrice(copper: 1); Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 10f; Item.ammo = AmmoID.Bullet; } public override void AddRecipes() { - CreateRecipe(10). - AddIngredient(ItemID.Grenade). - AddIngredient(ItemID.Glass, 3). + CreateRecipe(70). + AddRecipeGroup("AnyCopperBar", 1). + AddIngredient(ItemID.Glass, 1). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index da4a0261d5..8b25b3ab3b 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 22; - Item.damage = 28; + Item.damage = 18; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { CreateRecipe(999). - AddIngredient(ItemID.EmptyBullet, 999). + AddIngredient(ItemID.MoonlordBullet, 999). AddIngredient(). AddTile(). Register(); diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index 068b149d82..794853a48b 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -10,18 +10,16 @@ namespace CalamityMod.Items.Ammo public class HolyFireBullet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; - internal const float ExplosionMultiplier = 0.275f; public static readonly SoundStyle Explosion = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion") { PitchVariance = 0.2f, Volume = 0.6f }; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; } - public override void SetDefaults() { Item.width = 22; Item.height = 22; - Item.damage = 20; + Item.damage = 19; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; @@ -35,8 +33,8 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.ExplodingBullet, 100). + CreateRecipe(333). + AddIngredient(ItemID.ExplodingBullet, 333). AddIngredient(). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index 135be89269..7d7083766f 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,20 +9,18 @@ namespace CalamityMod.Items.Ammo { public class HyperiusBullet : ModItem, ILocalizedModType { + public static float overflowEfficency = 1.2f; // Multiplier applied to overflow damage done by other damage sources + public static readonly SoundStyle hit = new("CalamityMod/Sounds/Item/HyperiusOverflow"); public new string LocalizationCategory => "Items.Ammo"; - - public static int SplitBulletBonusDamage = 16; - public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; } - public override void SetDefaults() { Item.width = 24; Item.height = 30; - Item.damage = 13; + Item.damage = 12; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; @@ -35,8 +34,8 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.MusketBall, 150). + CreateRecipe(333). + AddIngredient(ItemID.MusketBall, 333). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index 51aff1f16b..2510619ad2 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 20; Item.height = 14; - Item.damage = 20; + Item.damage = 8; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 1b751ed01c..1d09a5521e 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 20; Item.height = 14; - Item.damage = 20; + Item.damage = 8; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index efc4a9ff33..ea06605ea6 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 46; - Item.damage = 30; + Item.damage = 16; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index 0379cb9b0f..c4601b3ca1 100644 --- a/Items/Armor/Aerospec/AerospecBreastplate.cs +++ b/Items/Armor/Aerospec/AerospecBreastplate.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(11). AddIngredient(ItemID.SunplateBlock, 8). AddIngredient(ItemID.Feather, 2). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHat.cs index b423f48d9b..5b81c6206c 100644 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ b/Items/Armor/Aerospec/AerospecHat.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(5). AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index 2caf137da0..e4e6d096d3 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(5). AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHelm.cs index d8303c5fee..0a8e39c35d 100644 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ b/Items/Armor/Aerospec/AerospecHelm.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(5). AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHelmet.cs index 4147feed8f..2ab7b3fd09 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHelmet.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(5). AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHood.cs index e452f6a125..6b41319026 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHood.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(5). AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Aerospec/AerospecLeggings.cs b/Items/Armor/Aerospec/AerospecLeggings.cs index 2cb02ee477..e28d5c8641 100644 --- a/Items/Armor/Aerospec/AerospecLeggings.cs +++ b/Items/Armor/Aerospec/AerospecLeggings.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(7). AddIngredient(ItemID.SunplateBlock, 4). AddIngredient(ItemID.Feather, 2). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 9785855ba4..0efb6e01dc 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Astral { player.statLifeMax2 += 20; player.statManaMax2 += 80; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.07f; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index df802b0cea..35c40f89a9 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { player.GetDamage() += 0.05f; - player.GetCritChance() += 15; + player.GetCritChance() += 10; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index 093563cbfc..3a717b7f0c 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { player.moveSpeed += 0.15f; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index caa5cbe2cc..f3b1a5205e 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Silva; @@ -6,6 +7,7 @@ using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +17,13 @@ namespace CalamityMod.Items.Armor.Auric [AutoloadEquip(EquipType.Body)] public class AuricTeslaBodyArmor : ModItem, ILocalizedModType { + + public static int setBonusTooltipNumber = 0; //Set this to zero so the first Shift pressed will increment it to 1. + public static bool holdingShift = false; + public static Color tooltipTarragonColor = new(194, 255, 194); + public static Color tooltipBloodflareColor = new(255, 195, 194); + public static Color tooltipSilvaColor = new(246, 255, 194); + public static Color tooltipGodslayerColor = new(204, 194, 255); public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void Load() { @@ -42,6 +51,18 @@ namespace CalamityMod.Items.Armor.Auric player.GetDamage() += 0.08f; player.GetCritChance() += 5; } + public override void ModifyTooltips(List tooltips) + { + //This just runs the ModifyTooltips for whatever helmet is equipped if a full auric set is equipped; but runs it on this item's tooltips. + //This is a simple way to copy the tooltip edits for the set bonuses and have it adapt to helmet type. + //If we ever add a way for auricSet to be TRUE without a helmet on, this will need to be changed. + //If the helmet's ModifyTooltips is changed to do more than just the Set Bonus, their Set Bonus modification should be moved into it's own method, and have that called both here and in the helmet's ModifyTooltips. + //Alternatively, their ModifyTooltips could simply return early if the item ID doesn't match the helmet type. + if (Main.LocalPlayer.Calamity().auricSet) + { + Main.LocalPlayer.armor[0].ModItem.ModifyTooltips(tooltips); + } + } public override void AddRecipes() { diff --git a/Items/Armor/Auric/AuricTeslaCuisses.cs b/Items/Armor/Auric/AuricTeslaCuisses.cs index 1cb579a498..267e888e12 100644 --- a/Items/Armor/Auric/AuricTeslaCuisses.cs +++ b/Items/Armor/Auric/AuricTeslaCuisses.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Armor.Bloodflare; +using System.Collections.Generic; +using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; @@ -31,6 +32,18 @@ namespace CalamityMod.Items.Armor.Auric player.GetDamage() += 0.12f; player.GetCritChance() += 5; } + public override void ModifyTooltips(List tooltips) + { + //This just runs the ModifyTooltips for whatever helmet is equipped if a full auric set is equipped; but runs it on this item's tooltips. + //This is a simple way to copy the tooltip edits for the set bonuses and have it adapt to helmet type. + //If we ever add a way for auricSet to be TRUE without a helmet on, this will need to be changed. + //If the helmet's ModifyTooltips is changed to do more than just the Set Bonus, their Set Bonus modification should be moved into it's own method, and have that called both here and in the helmet's ModifyTooltips. + //Alternatively, their ModifyTooltips could simply return early if the item ID doesn't match the helmet type. + if (Main.LocalPlayer.Calamity().auricSet) + { + Main.LocalPlayer.armor[0].ModItem.ModifyTooltips(tooltips); + } + } public override void AddRecipes() { diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs index db0aaa3a4e..70979a5a03 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs @@ -1,12 +1,12 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -61,6 +61,34 @@ namespace CalamityMod.Items.Armor.Auric player.GetDamage() += 0.3f; player.GetCritChance() += 30; } + public override void ModifyTooltips(List tooltips) + { + ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; + ref var setBonusTooltipNumber = ref AuricTeslaBodyArmor.setBonusTooltipNumber; + if (Main.keyState.PressingShift()) + { + if (!holdingShift) + { + holdingShift = true; + setBonusTooltipNumber++; + if (setBonusTooltipNumber > 3) setBonusTooltipNumber = 1; + } + foreach (TooltipLine line in tooltips) + { + if (line.Name == "SetBonus") + { + Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; + var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodslayerArmorDash.GodslayerCooldown) : setBonusTooltipNumber == 2 ? LocalizedText.Format(CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString()) : LocalizedText.Format()); + line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; + } + } + } + else + { + holdingShift = false; + } + } public override void AddRecipes() { diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs index 69eaa3d741..9be81d8673 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs @@ -1,11 +1,12 @@ -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Accessories; +using System.Collections.Generic; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -63,6 +64,34 @@ namespace CalamityMod.Items.Armor.Auric player.GetCritChance() += 20; player.moveSpeed += 0.05f; } + public override void ModifyTooltips(List tooltips) + { + ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; + ref var setBonusTooltipNumber = ref AuricTeslaBodyArmor.setBonusTooltipNumber; + if (Main.keyState.PressingShift()) + { + if (!holdingShift) + { + holdingShift = true; + setBonusTooltipNumber++; + if (setBonusTooltipNumber > 3) setBonusTooltipNumber = 1; + } + foreach (TooltipLine line in tooltips) + { + if (line.Name == "SetBonus") + { + Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; + var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodslayerArmorDash.GodslayerCooldown) : setBonusTooltipNumber == 2 ? LocalizedText.Format() : LocalizedText.Format(CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString())); + line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; + } + } + } + else + { + holdingShift = false; + } + } public override void AddRecipes() { diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs index 078a350ff0..9a66c641ab 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs @@ -1,13 +1,14 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric @@ -65,6 +66,34 @@ namespace CalamityMod.Items.Armor.Auric player.GetDamage() += 0.2f; player.GetCritChance() += 10; } + public override void ModifyTooltips(List tooltips) + { + ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; + ref var setBonusTooltipNumber = ref AuricTeslaBodyArmor.setBonusTooltipNumber; + if (Main.keyState.PressingShift()) + { + if (!holdingShift) + { + holdingShift = true; + setBonusTooltipNumber++; + if (setBonusTooltipNumber > 3) setBonusTooltipNumber = 1; + } + foreach (TooltipLine line in tooltips) + { + if (line.Name == "SetBonus") + { + Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; + var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodslayerArmorDash.GodslayerCooldown) : setBonusTooltipNumber == 2 ? LocalizedText.Format() : LocalizedText.Format(CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString())); + line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; + } + } + } + else + { + holdingShift = false; + } + } public override void AddRecipes() { diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index fdc49f0a7a..cc8ea6a873 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -1,13 +1,11 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Accessories; +using System.Collections.Generic; using CalamityMod.Items.Armor.Bloodflare; 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 Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -61,6 +59,33 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.auricBoost = true; player.GetDamage() += 0.15f; } + public override void ModifyTooltips(List tooltips) + { + ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; + ref var setBonusTooltipNumber = ref AuricTeslaBodyArmor.setBonusTooltipNumber; + if (Main.keyState.PressingShift()) + { + if (!holdingShift) + { + holdingShift = true; + setBonusTooltipNumber++; + if (setBonusTooltipNumber > 3) setBonusTooltipNumber = 1; + } + foreach (TooltipLine line in tooltips) + { + if (line.Name == "SetBonus") + { + Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipSilvaColor }; + line.Text = this.GetLocalizedValue($"SetBonus{setBonusTooltipNumber}"); + line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; + } + } + } + else + { + holdingShift = false; + } + } public override void AddRecipes() { diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs index 18993c56ec..0f8e4acdbb 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs @@ -1,11 +1,11 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Accessories; +using System.Collections.Generic; 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 Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -50,6 +50,33 @@ namespace CalamityMod.Items.Armor.Auric player.crimsonRegen = true; } + public override void ModifyTooltips(List tooltips) + { + ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; + ref var setBonusTooltipNumber = ref AuricTeslaBodyArmor.setBonusTooltipNumber; + if (Main.keyState.PressingShift()) + { + if (!holdingShift) + { + holdingShift = true; + setBonusTooltipNumber++; + if (setBonusTooltipNumber > 3) setBonusTooltipNumber = 1; + } + foreach (TooltipLine line in tooltips) + { + if (line.Name == "SetBonus") + { + Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipSilvaColor }; + line.Text = this.GetLocalizedValue($"SetBonus{setBonusTooltipNumber}"); + line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; + } + } + } + else + { + holdingShift = false; + } + } public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index fae0a56ad4..cbf664f6a8 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor.GodSlayer player.thorns += 0.5f; player.statLifeMax2 += 60; player.GetDamage() += 0.11f; - player.GetCritChance() += 6; + player.GetCritChance() += 8; } public override void AddRecipes() diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index 2e74e4c676..8e6b92d140 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void UpdateEquip(Player player) { - player.moveSpeed += 0.05f; - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; + player.moveSpeed += 0.1f; + player.GetDamage() += 0.11f; + player.GetCritChance() += 11; } public override void AddRecipes() diff --git a/Items/Armor/Mollusk/MolluskShelleggings.cs b/Items/Armor/Mollusk/MolluskShelleggings.cs index 5b2afdc3c7..607fdb87d5 100644 --- a/Items/Armor/Mollusk/MolluskShelleggings.cs +++ b/Items/Armor/Mollusk/MolluskShelleggings.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 15; + Item.defense = 12; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; + player.GetDamage() += 0.06f; player.GetCritChance() += 4; - player.moveSpeed -= 0.07f; + player.Calamity().molluskLegs = true; } public override void AddRecipes() diff --git a/Items/Armor/Mollusk/MolluskShellmet.cs b/Items/Armor/Mollusk/MolluskShellmet.cs index 8b5db6f70e..180be5c2c6 100644 --- a/Items/Armor/Mollusk/MolluskShellmet.cs +++ b/Items/Armor/Mollusk/MolluskShellmet.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 22; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 18; + Item.defense = 15; } public override void UpdateEquip(Player player) @@ -31,6 +31,7 @@ namespace CalamityMod.Items.Armor.Mollusk player.ignoreWater = true; player.GetDamage() += 0.05f; player.GetCritChance() += 4; + player.Calamity().molluskHelmet = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,10 +42,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateArmorSet(Player player) { player.setBonus = this.GetLocalizedValue("SetBonus"); - var modPlayer = player.Calamity(); - player.GetDamage() += 0.1f; - modPlayer.molluskSet = true; - player.maxMinions += 4; + player.endurance += 0.1f; + player.maxMinions += 4; // These are allocated for the Shellfish minions; there is no net change in minion slots. if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Armor/Mollusk/MolluskShellplate.cs b/Items/Armor/Mollusk/MolluskShellplate.cs index 33d3dea500..881bed8097 100644 --- a/Items/Armor/Mollusk/MolluskShellplate.cs +++ b/Items/Armor/Mollusk/MolluskShellplate.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 22; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 22; + Item.defense = 18; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 6; - player.moveSpeed -= 0.15f; + player.GetDamage() += 0.06f; + player.GetCritChance() += 5; + player.Calamity().molluskChest = true; } public override void AddRecipes() diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index f431d2621b..b40932ff94 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -70,7 +70,6 @@ namespace CalamityMod.Items.Armor.OmegaBlue player.setBonus = this.GetLocalization("SetBonus").Format(hotkey); var mp = player.Calamity(); - player.GetArmorPenetration() += 15; player.maxMinions += 2; mp.wearingRogueArmor = true; mp.omegaBlueSet = true; diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index 0aa94e0c19..c9ae9d2ca9 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.Silva public override void UpdateEquip(Player player) { player.statLifeMax2 += 80; - player.GetDamage() += 0.12f; + player.GetDamage() += 0.11f; player.GetCritChance() += 8; } diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 9a7be46dde..2ee193c596 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Armor.Silva public override void UpdateEquip(Player player) { player.moveSpeed += 0.1f; - player.GetDamage() += 0.12f; - player.GetCritChance() += 12; + player.GetDamage() += 0.11f; + player.GetCritChance() += 11; } public override void AddRecipes() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 4df5b0fc6f..724b013cae 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -7,9 +7,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; @@ -478,25 +480,77 @@ namespace CalamityMod.Items } } } - if (modPlayer.harpyWingBoost && (modPlayer.harpyRing || modPlayer.angelTreads)) + + // 23APR2025: Ozzatron: make late game vanilla guns significantly more accurate + // Currently applies to Gatligator, Tactical Shotgun and Chain Gun + #region Vanilla Item Shoot Overrides + if (item.type == ItemID.Gatligator) { - if (Main.rand.NextBool(5) && modPlayer.wingProjectileCooldown == 0 && !item.channel) + // Vanilla Gatligator: X/Y velocity += -2 to 2 in steps of 0.05 (-40 to 40 x 0.05) + // Calamity Gatligator: Velocity gets randomly rotated by up to 0.05 radians and multiplied by 0.87 to 1.13 + // This logic is lifted from Onyxia + // + // Gatligator has an additional inaccuracy effect where bullets have a 1 in 3 chance to have their velocity totally fucked + // When this happens, the X and Y components of the velocity are multiplied by 0.4 to 1.6, with separate random calls for each + // This has been replicated by giving bullets a 1 in 3 chance to go much faster, but be more inaccurate + // + // Vanilla Gatligator gets additional hardcoded inaccuracy to produce the gun jittering visual + // Extra inaccuracy: X/Y velocity += -1.5 to 1.5 in steps of 0.03 (-50 to 50 x 0.03) + // This is IL edited out + + Vector2 spreadVel; + if (Main.rand.NextBool(3)) // Xtra Inaccurate { - modPlayer.wingProjectileCooldown = 20; - if (player.whoAmI == Main.myPlayer) - { - float spreadX = velocity.X + Main.rand.NextFloat(-0.75f, 0.75f); - float spreadY = velocity.Y + Main.rand.NextFloat(-0.75f, 0.75f); - int feather = Projectile.NewProjectile(playerSource, position, new Vector2(spreadX, spreadY) * 1.25f, ModContent.ProjectileType(), (int)(damage * 0.3), 2f, player.whoAmI); - if (feather.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[feather].usesLocalNPCImmunity = true; - Main.projectile[feather].localNPCHitCooldown = 10; - Main.projectile[feather].DamageType = DamageClass.Generic; - } - } + float radianInaccuracy = 0.09f; + float randAngle = Main.rand.NextFloat(-radianInaccuracy, radianInaccuracy); + float randVelMultiplier = Main.rand.NextFloat(1.3f, 1.63f); + spreadVel = velocity.RotatedBy(randAngle) * randVelMultiplier; } + else + { + float radianInaccuracy = 0.05f; + float randAngle = Main.rand.NextFloat(-radianInaccuracy, radianInaccuracy); + float randVelMultiplier = Main.rand.NextFloat(0.87f, 1.13f); + spreadVel = velocity.RotatedBy(randAngle) * randVelMultiplier; + } + + Projectile.NewProjectile(source, position, spreadVel, type, damage, knockBack, player.whoAmI); + return false; } + + if (item.type == ItemID.TacticalShotgun) + { + // Vanilla Tactical Shotgun: X/Y velocity += -2 to 2 in steps of 0.05 (-40 to 40 x 0.05) + // Calamity Tactical Shotgun: Velocity gets a random vector of magnitude 0-1 added to it, anywhere on the unit circle + + int tacticalShotgunNumBullets = 6; + for (int i = 0; i < tacticalShotgunNumBullets; i++) + { + Vector2 spreadVel = velocity + Main.rand.NextVector2Circular(0.5f, 0.5f); + Projectile.NewProjectile(source, position, spreadVel, type, damage, knockBack, player.whoAmI); + } + return false; + } + + if (item.type == ItemID.ChainGun) + { + // Vanilla Chain Gun: X/Y velocity += -1.2 to 1.2 in steps of 0.03 (-40 to 40 x 0.03) + // Calamity Chain Gun: Velocity gets randomly rotated by up to 0.035 radians and multiplied by 0.92 to 1.08 + // This logic is lifted from Onyxia + // + // Vanilla Chain Gun gets additional hardcoded accuracy to produce the gun jittering visual + // Extra inaccuracy: X/Y velocity += -1.5 to 1.5 in steps of 0.03 (-50 to 50 x 0.03) + // This is IL edited out + + float radianInaccuracy = 0.035f; + float randAngle = Main.rand.NextFloat(-radianInaccuracy, radianInaccuracy); + float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); + Vector2 spreadVel = velocity.RotatedBy(randAngle) * randVelMultiplier; + Projectile.NewProjectile(source, position, spreadVel, type, damage, knockBack, player.whoAmI); + return false; + } + #endregion + return true; } #endregion @@ -562,15 +616,23 @@ namespace CalamityMod.Items #endregion #region Pickup Item Changes + public override bool CanPickup(Item item, Player player) + { + // Prevent Mana Stars from being picked up while wielding Ion Blaster or Apoctosis Array + if (item.type == ItemID.Star || item.type == ItemID.SoulCake || item.type == ItemID.SugarPlum) + { + if (player.ActiveItem().type == ModContent.ItemType() || player.ActiveItem().type == ModContent.ItemType()) + return false; + } + return base.CanPickup(item, player); + } + public override bool OnPickup(Item item, Player player) { - if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) + if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) // On heart pickup { - bool boostedHeart = player.Calamity().photosynthesis; - if (boostedHeart) - { + if (player.Calamity().photosynthesis) player.HealPlayer(PhotosynthesisPotion.IncreasedHeartHeal); - } } return true; } @@ -916,6 +978,31 @@ namespace CalamityMod.Items } #endregion + public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + // Hyperius Overflow + if (target.Calamity().hyperiusMarked) + { + int damage = 0; + if (target.Calamity().hyperiusDamage < damageDone) + damage = damageDone - target.Calamity().hyperiusDamage; + else + damage = damageDone; + target.Calamity().hyperiusDamage -= damage; + + // Spawn overflow hit + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, player.whoAmI, target.whoAmI); + overflow.DamageType = item.DamageType; + overflow.ArmorPenetration = item.ArmorPenetration; // Takes the armor pen from what did the hit + + if (target.Calamity().hyperiusDamage <= 0) + { + target.Calamity().hyperiusDamage = 0; + target.Calamity().hyperiusMarked = false; + } + } + } + #region Armor Set Changes public override string IsArmorSet(Item head, Item body, Item legs) { @@ -1290,7 +1377,7 @@ namespace CalamityMod.Items if (item.type == ItemID.MoonStone) { - if (!Main.dayTime) + if (!Main.dayTime || Main.eclipse) player.GetAttackSpeed() -= 0.1f; } @@ -1302,7 +1389,16 @@ namespace CalamityMod.Items if (item.type == ItemID.TerrasparkBoots) player.buffImmune[BuffID.OnFire] = true; - else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water + if (item.type == ItemID.GravityGlobe) + { + player.jumpSpeedBoost += 1.6f; + if (player.controlDown) + player.maxFallSpeed *= 1.5f; + else + player.maxFallSpeed *= 1.2f; + } + + if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water { if (player.IsUnderwater()) player.gills = true; @@ -1331,7 +1427,6 @@ namespace CalamityMod.Items } else if (item.type == ItemID.HarpyWings) { - modPlayer.harpyWingBoost = true; player.moveSpeed += 0.1f; player.noFallDmg = true; } @@ -1573,7 +1668,7 @@ namespace CalamityMod.Items // Draw all particles. float currentPower = 0f; - int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); + int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); if (calamitasNPCIndex != -1) currentPower = Utils.GetLerpValue(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); @@ -1637,7 +1732,7 @@ namespace CalamityMod.Items { storedPrefix = -1; // Bandit steals 20% of the total price of the reforge if she's around. - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(ModContent.NPCType())) { // Calculate the item's reforge cost. int value = item.value; diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index ae6727df34..bdf23947ce 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -174,7 +174,7 @@ namespace CalamityMod.Items 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.Add(ModContent.ItemType(), 1, 40, 50); loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 298f055625..bfb8475015 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -569,6 +569,13 @@ namespace CalamityMod.Items if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotionMultiplier != 1f) EditTooltipByName("HealLife", (line) => line.Text = Language.GetOrRegister("CommonItemTooltip.RestoresLife").Format((int)(item.healLife * Main.LocalPlayer.Calamity().healingPotionMultiplier))); + + if (item.type == ItemID.GravityGlobe) + EditTooltipByName("Tooltip1", (line) => line.Text = EditedTooltip("GravityGlobe")); + + + if (item.type == ItemID.PortableStool) + EditTooltipByName("Tooltip0", (line) => line.Text += AddedTooltip("Stepstool")); #endregion // For boss summon item clarity diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 9a134872a1..cb454cbecc 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -171,7 +171,7 @@ namespace CalamityMod.Items { ItemID.MonkStaffT1, Do(TrueMeleeNoSpeed, DamageExact(83)) }, // Sleepy Octopod { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury - { ItemID.MoonlordBullet, Do(DamageExact(19)) }, // Luminite Bullet + { ItemID.MoonlordBullet, Do(DamageExact(17)) }, // Luminite Bullet { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, // Lunar Portal Staff { ItemID.Muramasa, Do(CritDelta(+10)) }, { ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) }, @@ -278,6 +278,7 @@ namespace CalamityMod.Items { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, { ItemID.UnholyTrident, Do(ManaRatio(0.78f), DamageRatio(0.91f)) }, // Uses ratios due to remix seed + { ItemID.Uzi, Do(PointBlank, UseExact(8)) }, { ItemID.VampireKnives, Do(DamageExact(38)) }, { ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats { ItemID.VenomStaff, Do(DamageExact(55)) }, @@ -482,7 +483,6 @@ namespace CalamityMod.Items { ItemID.StakeLauncher, pointBlank }, { ItemID.TinBow, pointBlank }, { ItemID.TungstenBow, pointBlank }, - { ItemID.Uzi, pointBlank }, { ItemID.VortexBeater, pointBlank }, { ItemID.WoodenBow, pointBlank }, #endregion diff --git a/Items/DraedonMisc/EncryptedSchematicHell.cs b/Items/DraedonMisc/EncryptedSchematicHell.cs index 73fc317a35..0f7f4e1250 100644 --- a/Items/DraedonMisc/EncryptedSchematicHell.cs +++ b/Items/DraedonMisc/EncryptedSchematicHell.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.DraedonMisc meleeDisplay.OverrideColor = new Color(201, 41, 255); list.Insert(insertIndex + 1, meleeDisplay); - int rangedItem = ModContent.ItemType(); + int rangedItem = ModContent.ItemType(); TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{rangedItem}] {CalamityUtils.GetItemName(rangedItem)}"); rangedDisplay.OverrideColor = new Color(255, 64, 31); list.Insert(insertIndex + 2, rangedDisplay); diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs index a4eec184c9..21ea505af7 100644 --- a/Items/DraedonMisc/EncryptedSchematicJungle.cs +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.DraedonMisc meleeDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 1, meleeDisplay); - int rangedItem = ModContent.ItemType(); + int rangedItem = ModContent.ItemType(); TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{rangedItem}] {CalamityUtils.GetItemName(rangedItem)}"); rangedDisplay.OverrideColor = new Color(236, 255, 31); list.Insert(insertIndex + 2, rangedDisplay); diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index d0389e89e5..fb7e5cccf1 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.DraedonMisc meleeDisplay.OverrideColor = new Color(31, 242, 245); list.Insert(insertIndex + 1, meleeDisplay); - int rangedItem = ModContent.ItemType(); + int rangedItem = ModContent.ItemType(); TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{rangedItem}] {CalamityUtils.GetItemName(rangedItem)}"); rangedDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 2, rangedDisplay); @@ -74,7 +74,7 @@ namespace CalamityMod.Items.DraedonMisc summonDisplay.OverrideColor = new Color(255, 64, 31); list.Insert(insertIndex + 4, summonDisplay); - int rogueItem = ModContent.ItemType(); + int rogueItem = ModContent.ItemType(); TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{rogueItem}] {CalamityUtils.GetItemName(rogueItem)}"); rogueDisplay.OverrideColor = new Color(201, 41, 255); list.Insert(insertIndex + 5, rogueDisplay); diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index 01e8c386a2..59ffdfced2 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.DraedonMisc meleeDisplay.OverrideColor = new Color(236, 255, 31); list.Insert(insertIndex + 1, meleeDisplay); - int rangedItem = ModContent.ItemType(); + int rangedItem = ModContent.ItemType(); TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{rangedItem}] {CalamityUtils.GetItemName(rangedItem)}"); rangedDisplay.OverrideColor = new Color(31, 242, 245); list.Insert(insertIndex + 2, rangedDisplay); @@ -81,7 +81,7 @@ namespace CalamityMod.Items.DraedonMisc summonDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 4, summonDisplay); - int rogueItem = ModContent.ItemType(); + int rogueItem = ModContent.ItemType(); TooltipLine rogueDisplay = new TooltipLine(this.Mod, "CalamityMod:RogueDisplay", $"[i:{rogueItem}] {CalamityUtils.GetItemName(rogueItem)}"); rogueDisplay.OverrideColor = new Color(255, 64, 31); list.Insert(insertIndex + 5, rogueDisplay); diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index d7be7cc7ba..2e15e436bf 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Fishing.FishingRods CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.SunplateBlock, 3). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index d14e2f292c..8aa67f0bd6 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -58,8 +58,8 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType() )); - // Pre-HM Abyss Weapons - itemLoot.Add(new OneFromOptionsDropRule(10, 1, + // Ancient Treasure Chest Loot @ 100%; Individually 10% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Materials/AnodizedWulfrumMetal.cs b/Items/Materials/AnodizedWulfrumMetal.cs new file mode 100644 index 0000000000..f15a1658a3 --- /dev/null +++ b/Items/Materials/AnodizedWulfrumMetal.cs @@ -0,0 +1,44 @@ +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Wulfrum; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Materials +{ + public class AnodizedWulfrumMetal : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Materials"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 25; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(copper: 10); + Item.rare = ItemRarityID.Blue; + Item.ammo = Item.type; + } + public override void AddRecipes() + { + CreateRecipe(1). + AddIngredient(). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + //Added to avoid making the recipes really repeditive and nonsensical. It also makes the new metal color make sense. Adds a bit of flavor to the Wulfrum Recipes + //Fun fact the reason used Stormlion Manible is because in order to anodize a metal you must use a current, the other option was a powercell but I feel StormlionMandible needed more uses + //More uses are planned for other blocks and furniture for wulfrum that use this new metal color and gives a bit more depth to the set + } +} diff --git a/Items/Materials/AnodizedWulfrumMetal.png b/Items/Materials/AnodizedWulfrumMetal.png new file mode 100644 index 0000000000..0e901b9399 Binary files /dev/null and b/Items/Materials/AnodizedWulfrumMetal.png differ diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index c16a1a60e2..494cdca070 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -94,7 +94,8 @@ namespace CalamityMod.Items.Materials CreateRecipe(5). AddIngredient(50). AddIngredient(). - AddTile(). + //Not Cosmic Anvil because making a bar at an anvil is a little odd? also allows pre-moon lord scal for those who really want to do it. win-win. + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index d15ca6a99a..68cbb03212 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials AddIngredient(5). AddIngredient(). AddIngredient(). - AddTile(TileID.AdamantiteForge). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 7b0199c8d5..195d4ab52a 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Mounts { foreach (NPC npc in Main.ActiveNPCs) { - if (npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) { npc.active = false; npc.netUpdate = true; @@ -100,10 +100,10 @@ namespace CalamityMod.Items.Mounts // Spawn Cirrus if no other players are on the Alicorn mount. if (!anyPlayerOnFabMount) { - if (!NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(ModContent.NPCType())) { if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_TownSpawn(), (int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_TownSpawn(), (int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); } } } diff --git a/Items/PermanentBoosters/CelestialOnion.cs b/Items/PermanentBoosters/CelestialOnion.cs index 255737a155..8b0d74a480 100644 --- a/Items/PermanentBoosters/CelestialOnion.cs +++ b/Items/PermanentBoosters/CelestialOnion.cs @@ -46,19 +46,4 @@ namespace CalamityMod.Items.PermanentBoosters return true; } } - - public class CelestialOnionAccessorySlot : ModAccessorySlot - { - // Celestial Onion does not work in Master Mode. - public override bool IsEnabled() - { - // GetModPlayer will throw an index error in this step of the loading process for whatever reason - // We prematurely stop it from getting to that point - if (!Player.active || Main.masterMode) - return false; - - return Player.Calamity().extraAccessoryML; - } - public override bool IsHidden() => IsEmpty && !IsEnabled(); - } } diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 974b0cbc05..ad1b42d30f 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -73,7 +73,8 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.LifeFruit, 5). AddIngredient(5). AddIngredient(12). - AddTile(TileID.MythrilAnvil). + //Not an anvil because making fruit at an anvil is a little weird, so here's something more magical. + AddTile(TileID.DemonAltar). Register(); } } diff --git a/Items/PermanentBoosters/SacredStrawberry.cs b/Items/PermanentBoosters/SacredStrawberry.cs index d6e040021e..623ccd1731 100644 --- a/Items/PermanentBoosters/SacredStrawberry.cs +++ b/Items/PermanentBoosters/SacredStrawberry.cs @@ -76,7 +76,8 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.LifeFruit, 5). AddIngredient(5). AddIngredient(). - AddTile(). + //Not an anvil because making fruit at an anvil is a little weird, so here's something more magical. + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/PermanentBoosters/SanguineTangerine.cs b/Items/PermanentBoosters/SanguineTangerine.cs index 1348fda9fe..49ab59f968 100644 --- a/Items/PermanentBoosters/SanguineTangerine.cs +++ b/Items/PermanentBoosters/SanguineTangerine.cs @@ -76,7 +76,8 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.SoulofFright, 5). AddIngredient(ItemID.SoulofMight, 5). AddIngredient(ItemID.SoulofSight, 5). - AddTile(TileID.MythrilAnvil). + //Not an anvil because making fruit at an anvil is a little weird, so here's something more magical. + AddTile(TileID.DemonAltar). Register(); } } diff --git a/Items/Placeables/Furniture/CausticTorch.cs b/Items/Placeables/Furniture/CausticTorch.cs new file mode 100644 index 0000000000..f1be4f0c02 --- /dev/null +++ b/Items/Placeables/Furniture/CausticTorch.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class CausticTorch : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.Torches[Type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; + } + + public override void SetDefaults() + { + Item.DefaultToTorch(ModContent.TileType(), 0, true); + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.t_LivingWood); + } + 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, 1.35f, 0.3f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 1.35f, 0.3f); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/CausticTorch.png b/Items/Placeables/Furniture/CausticTorch.png new file mode 100644 index 0000000000..55354c16ad Binary files /dev/null and b/Items/Placeables/Furniture/CausticTorch.png differ diff --git a/Items/Placeables/Furniture/CausticTorch_Flame.png b/Items/Placeables/Furniture/CausticTorch_Flame.png new file mode 100644 index 0000000000..0f5b254659 Binary files /dev/null and b/Items/Placeables/Furniture/CausticTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index 2c39b76899..f1afd84641 100644 --- a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -30,7 +30,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddIngredient(30). AddIngredient(5). AddIngredient(). - AddTile(). + //Not Cosmic Anvil so if people *really* want do do Scal pre-moon lord it is possible. + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs index 016e210fb8..8fb585473e 100644 --- a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("IronBar", 10). AddIngredient(20). + AddIngredient(6). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index b955370119..6def9ed011 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -65,14 +65,16 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "CrabBar", "Dandy", "Dia", + "dozezoze", + "Eddie Spaghetti", "enamoured", "ENNWAY", "Flowaria", "Fluffy", + "fryzahh", "HaguriHat", "Heart Plus Up!", "Hugekraken", - "Lilac Olligoci", "LordMetarex", "Memes", "Mercutio 'Merkalto' Takle", @@ -84,6 +86,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "PokerFace", "Poroboros", "Raesh", + "Sagittariod", "Shade", "SharZz", "Shayy", @@ -145,6 +148,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "L0st", "Leon", "Leviathan", + "Lilac Olligoci", "Lompl Allimath", "Lucille Karma", "MarieArk", diff --git a/Items/Placeables/Furniture/GloomTorch.cs b/Items/Placeables/Furniture/GloomTorch.cs index 04c3af2328..7d1e2624c3 100644 --- a/Items/Placeables/Furniture/GloomTorch.cs +++ b/Items/Placeables/Furniture/GloomTorch.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Furniture Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); if (!killTorch) - Lighting.AddLight(position, 0.9f, 1.2f, 0.3f); + Lighting.AddLight(position, 0.5f, 0.75f, 1.2f); } public override void PostUpdate() diff --git a/Items/Placeables/Furniture/KelpTorch.cs b/Items/Placeables/Furniture/KelpTorch.cs new file mode 100644 index 0000000000..fbe56c0291 --- /dev/null +++ b/Items/Placeables/Furniture/KelpTorch.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class KelpTorch : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.Torches[Type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; + } + + public override void SetDefaults() + { + Item.DefaultToTorch(ModContent.TileType(), 0, true); + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.Sunflower); + } + 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, 1.5f, 1.35f, 0.3f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1.5f, 1.35f, 0.3f); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/KelpTorch.png b/Items/Placeables/Furniture/KelpTorch.png new file mode 100644 index 0000000000..46deffc2ca Binary files /dev/null and b/Items/Placeables/Furniture/KelpTorch.png differ diff --git a/Items/Placeables/Furniture/KelpTorch_Flame.png b/Items/Placeables/Furniture/KelpTorch_Flame.png new file mode 100644 index 0000000000..7c58581149 Binary files /dev/null and b/Items/Placeables/Furniture/KelpTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs index ece5bf1f44..3fd80fc669 100644 --- a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs +++ b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { CreateRecipe(). AddIngredient(15). - AddTile(). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Placeables/Furniture/ThermalTorch.cs b/Items/Placeables/Furniture/ThermalTorch.cs new file mode 100644 index 0000000000..ea492f656c --- /dev/null +++ b/Items/Placeables/Furniture/ThermalTorch.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ThermalTorch : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.Torches[Type] = true; + ItemID.Sets.SingleUseInGamepad[Type] = true; + ItemID.Sets.WaterTorches[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.ShimmerTorch; + } + + public override void SetDefaults() + { + Item.DefaultToTorch(ModContent.TileType(), 0, true); + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, DustID.DynastyShingle_Red); + } + 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, 1.8f, 0f, 0f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1.8f, 0f, 0f); + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/ThermalTorch.png b/Items/Placeables/Furniture/ThermalTorch.png new file mode 100644 index 0000000000..96ee455c8f Binary files /dev/null and b/Items/Placeables/Furniture/ThermalTorch.png differ diff --git a/Items/Placeables/Furniture/ThermalTorch_Flame.png b/Items/Placeables/Furniture/ThermalTorch_Flame.png new file mode 100644 index 0000000000..48f4aec2c9 Binary files /dev/null and b/Items/Placeables/Furniture/ThermalTorch_Flame.png differ diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/Furniture/VoidTorch.cs similarity index 86% rename from Items/Placeables/FurnitureAbyss/AbyssTorch.cs rename to Items/Placeables/Furniture/VoidTorch.cs index b30c3a0747..8f1d5467ba 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/Furniture/VoidTorch.cs @@ -5,9 +5,9 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureAbyss +namespace CalamityMod.Items.Placeables.Furniture { - public class AbyssTorch : ModItem, ILocalizedModType + public class VoidTorch : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - Item.DefaultToTorch(ModContent.TileType(), 0, true); + Item.DefaultToTorch(ModContent.TileType(), 0, true); } public override void HoldItem(Player player) @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss { CreateRecipe(3). AddIngredient(ItemID.Torch, 3). - AddIngredient(). + AddIngredient(). Register(); } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.png b/Items/Placeables/Furniture/VoidTorch.png similarity index 100% rename from Items/Placeables/FurnitureAbyss/AbyssTorch.png rename to Items/Placeables/Furniture/VoidTorch.png diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch_Flame.png b/Items/Placeables/Furniture/VoidTorch_Flame.png similarity index 100% rename from Items/Placeables/FurnitureAbyss/AbyssTorch_Flame.png rename to Items/Placeables/Furniture/VoidTorch_Flame.png diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs new file mode 100644 index 0000000000..e9661426a4 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class AnodizedWulfrumPanels : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.png b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.png new file mode 100644 index 0000000000..e30cada799 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPanels.png differ diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform.cs b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform.cs new file mode 100644 index 0000000000..4e1e0c7de6 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.FurnitureWulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class AnodizedWulfrumPlatform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow").Value); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform.png b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform.png new file mode 100644 index 0000000000..25fbcddcd6 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform.png differ diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow.png b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow.png new file mode 100644 index 0000000000..80c89d798a Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow.png differ diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs new file mode 100644 index 0000000000..8fa1356cc2 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class AnodizedWulfrumTrim : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.png b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.png new file mode 100644 index 0000000000..196d3e8e6b Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.png differ diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs new file mode 100644 index 0000000000..9fabe8b5ef --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class ChargedWulfrumEnergyBarrier : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ItemID.Glass, 25). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.png b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.png new file mode 100644 index 0000000000..0201cfa0e6 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.png differ diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..cfa4f34b81 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class ChargedWulfrumWallMountedBulb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType ()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png new file mode 100644 index 0000000000..e948233679 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png differ diff --git a/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs b/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs new file mode 100644 index 0000000000..db8a56db59 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs @@ -0,0 +1,33 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class RoundedAnodizedWulfrumPanels : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.png b/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.png new file mode 100644 index 0000000000..597351bb01 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs b/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs new file mode 100644 index 0000000000..bb35ba6159 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumEnergyBarrier : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ItemID.Glass, 25). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.png b/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.png new file mode 100644 index 0000000000..22b1dacbc8 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumEnergyBarrier.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs new file mode 100644 index 0000000000..7495dca459 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPanels.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumPanels : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPanels.png b/Items/Placeables/FurnitureWulfrum/WulfrumPanels.png new file mode 100644 index 0000000000..b7ba3e50a9 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumPanels.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlatform.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlatform.cs new file mode 100644 index 0000000000..ee3cf4904e --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlatform.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.FurnitureWulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumPlatform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Placeables/FurnitureWulfrum/WulfrumPlatform_Glow").Value); + } + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlatform.png b/Items/Placeables/FurnitureWulfrum/WulfrumPlatform.png new file mode 100644 index 0000000000..d91c28ed3f Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumPlatform.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlatform_Glow.png b/Items/Placeables/FurnitureWulfrum/WulfrumPlatform_Glow.png new file mode 100644 index 0000000000..9cc33827ee Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumPlatform_Glow.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs new file mode 100644 index 0000000000..c07dcca835 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSheets.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumSheets : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSheets.png b/Items/Placeables/FurnitureWulfrum/WulfrumSheets.png new file mode 100644 index 0000000000..2d29605930 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumSheets.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs new file mode 100644 index 0000000000..1569c2ba93 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSiding.cs @@ -0,0 +1,33 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumSiding : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddIngredient(). + AddTile(TileID.HeavyWorkBench). + Register(); + //CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSiding.png b/Items/Placeables/FurnitureWulfrum/WulfrumSiding.png new file mode 100644 index 0000000000..462a2ce24d Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumSiding.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..50db216abe --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumWallMountedBulb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType ()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.png b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.png new file mode 100644 index 0000000000..fa3672d7d4 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.png differ diff --git a/Items/Placeables/Ores/ExodiumCluster.png b/Items/Placeables/Ores/ExodiumCluster.png index 7baedbf6af..2375afce0a 100644 Binary files a/Items/Placeables/Ores/ExodiumCluster.png and b/Items/Placeables/Ores/ExodiumCluster.png differ diff --git a/Items/Placeables/SunkenSea/Driftwood.png b/Items/Placeables/SunkenSea/Driftwood.png index 25ff08f299..b32a47fe74 100644 Binary files a/Items/Placeables/SunkenSea/Driftwood.png and b/Items/Placeables/SunkenSea/Driftwood.png differ diff --git a/Items/Placeables/SunkenSea/RuneSand.cs b/Items/Placeables/SunkenSea/Dunesand.cs similarity index 75% rename from Items/Placeables/SunkenSea/RuneSand.cs rename to Items/Placeables/SunkenSea/Dunesand.cs index b5c6ead314..af03dbc96c 100644 --- a/Items/Placeables/SunkenSea/RuneSand.cs +++ b/Items/Placeables/SunkenSea/Dunesand.cs @@ -3,7 +3,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea { - public class RuneSand : ModItem, ILocalizedModType + [LegacyName("RuneSand")] + public class Dunesand : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() @@ -12,6 +13,6 @@ namespace CalamityMod.Items.Placeables.SunkenSea ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); } } diff --git a/Items/Placeables/SunkenSea/RuneSand.png b/Items/Placeables/SunkenSea/Dunesand.png similarity index 100% rename from Items/Placeables/SunkenSea/RuneSand.png rename to Items/Placeables/SunkenSea/Dunesand.png diff --git a/Items/Placeables/SunkenSea/Shellstone.cs b/Items/Placeables/SunkenSea/Shellstone.cs index 321018307f..ad69d66322 100644 --- a/Items/Placeables/SunkenSea/Shellstone.cs +++ b/Items/Placeables/SunkenSea/Shellstone.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs b/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs new file mode 100644 index 0000000000..83494b9878 --- /dev/null +++ b/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class AnodizedWulfrumTrimWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(8). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/AnodizedWulfrumTrimWall.png b/Items/Placeables/Walls/AnodizedWulfrumTrimWall.png new file mode 100644 index 0000000000..8ffe2432ec Binary files /dev/null and b/Items/Placeables/Walls/AnodizedWulfrumTrimWall.png differ diff --git a/Items/Placeables/Walls/ChargedWulfrumEnergyBarrierWall.cs b/Items/Placeables/Walls/ChargedWulfrumEnergyBarrierWall.cs new file mode 100644 index 0000000000..e54857d01b --- /dev/null +++ b/Items/Placeables/Walls/ChargedWulfrumEnergyBarrierWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ChargedWulfrumEnergyBarrierWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/ChargedWulfrumEnergyBarrierWall.png b/Items/Placeables/Walls/ChargedWulfrumEnergyBarrierWall.png new file mode 100644 index 0000000000..f179d2db1e Binary files /dev/null and b/Items/Placeables/Walls/ChargedWulfrumEnergyBarrierWall.png differ diff --git a/Items/Placeables/Walls/EutrophicGlassWall.cs b/Items/Placeables/Walls/EutrophicGlassWall.cs new file mode 100644 index 0000000000..64ab1c799f --- /dev/null +++ b/Items/Placeables/Walls/EutrophicGlassWall.cs @@ -0,0 +1,25 @@ +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class EutrophicGlassWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/EutrophicGlassWall.png b/Items/Placeables/Walls/EutrophicGlassWall.png new file mode 100644 index 0000000000..9f7cfe4799 Binary files /dev/null and b/Items/Placeables/Walls/EutrophicGlassWall.png differ diff --git a/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs new file mode 100644 index 0000000000..539bda7c35 --- /dev/null +++ b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class RoundedAnodizedWulfrumPanelWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(8). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.png b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.png new file mode 100644 index 0000000000..f95eb6ede4 Binary files /dev/null and b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.png differ diff --git a/Items/Placeables/Walls/WulfrumComplexPanelWall.cs b/Items/Placeables/Walls/WulfrumComplexPanelWall.cs new file mode 100644 index 0000000000..4b24747fe2 --- /dev/null +++ b/Items/Placeables/Walls/WulfrumComplexPanelWall.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumComplexPanelWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(8). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumComplexPanelWall.png b/Items/Placeables/Walls/WulfrumComplexPanelWall.png new file mode 100644 index 0000000000..bbf5dd0895 Binary files /dev/null and b/Items/Placeables/Walls/WulfrumComplexPanelWall.png differ diff --git a/Items/Placeables/Walls/WulfrumEnergyBarrierWall.cs b/Items/Placeables/Walls/WulfrumEnergyBarrierWall.cs new file mode 100644 index 0000000000..7ce9e493b5 --- /dev/null +++ b/Items/Placeables/Walls/WulfrumEnergyBarrierWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumEnergyBarrierWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumEnergyBarrierWall.png b/Items/Placeables/Walls/WulfrumEnergyBarrierWall.png new file mode 100644 index 0000000000..212f4a7a8c Binary files /dev/null and b/Items/Placeables/Walls/WulfrumEnergyBarrierWall.png differ diff --git a/Items/Placeables/Walls/WulfrumPanelWall.cs b/Items/Placeables/Walls/WulfrumPanelWall.cs new file mode 100644 index 0000000000..c459d56ba5 --- /dev/null +++ b/Items/Placeables/Walls/WulfrumPanelWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumPanelWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumPanelWall.png b/Items/Placeables/Walls/WulfrumPanelWall.png new file mode 100644 index 0000000000..2333e1721f Binary files /dev/null and b/Items/Placeables/Walls/WulfrumPanelWall.png differ diff --git a/Items/Placeables/Walls/WulfrumPillar.cs b/Items/Placeables/Walls/WulfrumPillar.cs new file mode 100644 index 0000000000..ecca3e570f --- /dev/null +++ b/Items/Placeables/Walls/WulfrumPillar.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumPillar : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(8). + AddIngredient(). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumPillar.png b/Items/Placeables/Walls/WulfrumPillar.png new file mode 100644 index 0000000000..e4c3444ab3 Binary files /dev/null and b/Items/Placeables/Walls/WulfrumPillar.png differ diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.png b/Items/Placeables/Walls/WulfrumPlatingWall.png index 22d0216af5..8d32b5e211 100644 Binary files a/Items/Placeables/Walls/WulfrumPlatingWall.png and b/Items/Placeables/Walls/WulfrumPlatingWall.png differ diff --git a/Items/Placeables/Walls/WulfrumSheetWall.cs b/Items/Placeables/Walls/WulfrumSheetWall.cs new file mode 100644 index 0000000000..91c9471ddc --- /dev/null +++ b/Items/Placeables/Walls/WulfrumSheetWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumSheetWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumSheetWall.png b/Items/Placeables/Walls/WulfrumSheetWall.png new file mode 100644 index 0000000000..c9a8e72a7a Binary files /dev/null and b/Items/Placeables/Walls/WulfrumSheetWall.png differ diff --git a/Items/Placeables/Walls/WulfrumSidingWall.cs b/Items/Placeables/Walls/WulfrumSidingWall.cs new file mode 100644 index 0000000000..f444611ee7 --- /dev/null +++ b/Items/Placeables/Walls/WulfrumSidingWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumSidingWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumSidingWall.png b/Items/Placeables/Walls/WulfrumSidingWall.png new file mode 100644 index 0000000000..6657ef206b Binary files /dev/null and b/Items/Placeables/Walls/WulfrumSidingWall.png differ diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index e2bbfbc188..11496ee727 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Potions } if (player.statLife <= 0) { - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInjection" + Main.rand.Next(1, 2 + 1)).Format(player.name)), 1000.0, 0, false); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInjection" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), 1000.0, 0, false); } } @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Potions AddIngredient(4). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). Register(); CreateRecipe(15). diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index 625751c603..b2ba7604a1 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.BottledWater, 4). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). Register(); CreateRecipe(8). diff --git a/Items/Potions/Food/ShroomBowl.cs b/Items/Potions/Food/ShroomBowl.cs new file mode 100644 index 0000000000..7287b2cb4f --- /dev/null +++ b/Items/Potions/Food/ShroomBowl.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class ShroomBowl : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.FoodParticleColors[Type] = [ + new Color(248, 195, 96), + new Color(115, 57, 15), + new Color(230, 124, 45) + ]; + } + + public override void SetDefaults() + { + Item.DefaultToFood(30, 24, BuffID.WellFed2, CalamityUtils.MinutesToFrames(10)); + Item.value = Item.sellPrice(silver: 10); + Item.rare = ItemRarityID.Blue; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Bowl). + AddIngredient(). + AddTile(TileID.CookingPots). + DisableDecraft(). + Register(); + } + } +} diff --git a/Items/Potions/Food/ShroomBowl.png b/Items/Potions/Food/ShroomBowl.png new file mode 100644 index 0000000000..df866a2f05 Binary files /dev/null and b/Items/Potions/Food/ShroomBowl.png differ diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index e95b3e3898..b7de4cc666 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index f1dbcd15c1..ef2b4b4340 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Potions AddIngredient(ItemID.Daybloom, 3). AddIngredient(). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). AddDecraftCondition(Condition.Hardmode). Register(); diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index c89f575924..91606786c4 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Potions AddIngredient(). AddIngredient(ItemID.SoulofFlight). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index 905b6f831d..ca8656fc27 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Potions AddIngredient(2). AddIngredient(ItemID.Daybloom, 3). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index 0d118409f3..18a531edbe 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Potions AddIngredient(2). AddIngredient(ItemID.Fireblossom, 2). AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). + AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). Register(); CreateRecipe(). diff --git a/Items/SummonItems/Abombination.cs b/Items/SummonItems/Abombination.cs index 5897c5788b..c842ac181a 100644 --- a/Items/SummonItems/Abombination.cs +++ b/Items/SummonItems/Abombination.cs @@ -54,8 +54,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddIngredient(20). - AddRecipeGroup("IronBar", 8). - AddIngredient(8). + AddIngredient(12). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index efbc3cdfc3..ab9d6b9b34 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Items.SummonItems { switch (npc.type) { - case NPCID.CultistTablet: case NPCID.CultistBoss: case NPCID.LunarTowerSolar: case NPCID.LunarTowerVortex: diff --git a/Items/Tools/AcidwoodAxe.cs b/Items/Tools/AcidwoodAxe.cs deleted file mode 100644 index 681916df76..0000000000 --- a/Items/Tools/AcidwoodAxe.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Placeables.Abyss; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class AcidwoodAxe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Tools"; - public override void SetDefaults() - { - Item.damage = 8; - Item.knockBack = 3f; - Item.useTime = 15; - Item.useAnimation = 23; - Item.axe = 60 / 5; - - Item.DamageType = DamageClass.Melee; - Item.width = 40; - Item.height = 32; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(10). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Tools/AcidwoodPickaxe.cs b/Items/Tools/AcidwoodPickaxe.cs deleted file mode 100644 index 95630050c4..0000000000 --- a/Items/Tools/AcidwoodPickaxe.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Placeables.Abyss; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class AcidwoodPickaxe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Tools"; - public override void SetDefaults() - { - Item.damage = 5; - Item.knockBack = 1f; - Item.useTime = 8; - Item.useAnimation = 18; - Item.pick = 40; - - Item.DamageType = DamageClass.Melee; - Item.width = 36; - Item.height = 36; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(15). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index 7f257532ef..d07fd537db 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Tools CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.SunplateBlock, 5). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/DriftwoodAxe.cs b/Items/Tools/DriftwoodAxe.cs deleted file mode 100644 index 2d06c0f68f..0000000000 --- a/Items/Tools/DriftwoodAxe.cs +++ /dev/null @@ -1,61 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class DriftwoodAxe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Tools"; - - public static int NormalUseTime = 15; - public static int FasterUseTime = 11; - - public override void SetDefaults() - { - Item.damage = 9; - Item.knockBack = 3.5f; - Item.useTime = NormalUseTime; - Item.useAnimation = 30; - Item.axe = 60 / 5; - - Item.DamageType = DamageClass.Melee; - Item.width = 40; - Item.height = 34; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - - // The tool is mechanically faster when wet. - public override float UseTimeMultiplier(Player player) - { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) - return (float)FasterUseTime / NormalUseTime; - return base.UseTimeMultiplier(player); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(10). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Tools/DriftwoodPickaxe.cs b/Items/Tools/DriftwoodPickaxe.cs deleted file mode 100644 index dbec552f83..0000000000 --- a/Items/Tools/DriftwoodPickaxe.cs +++ /dev/null @@ -1,61 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class DriftwoodPickaxe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Tools"; - - public static int NormalUseTime = 8; - public static int FasterUseTime = 6; - - public override void SetDefaults() - { - Item.damage = 7; - Item.knockBack = 1.5f; - Item.useTime = NormalUseTime; - Item.useAnimation = 18; - Item.pick = 45; - - Item.DamageType = DamageClass.Melee; - Item.width = 38; - Item.height = 38; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - - // The tool is mechanically faster when wet. - public override float UseTimeMultiplier(Player player) - { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) - return (float)FasterUseTime / NormalUseTime; - return base.UseTimeMultiplier(player); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - bool surface = player.Center.Y < Main.worldSurface * 16.0; - bool GetEffects = ((Main.raining && surface) || player.dripping || (player.wet && !player.lavaWet && !player.honeyWet)); - if (GetEffects) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 160); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(15). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index 8dddba14cd..6b7fe5b12e 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.Tools Item.height = 48; Item.damage = 19; Item.knockBack = 2.5f; - Item.useTime = 9; - Item.useAnimation = 20; - Item.pick = 105; + Item.useTime = 6; + Item.useAnimation = 12; + Item.pick = 90; Item.tileBoost += 1; Item.DamageType = DamageClass.Melee; diff --git a/Items/Tools/MonolithAxe.cs b/Items/Tools/MonolithAxe.cs deleted file mode 100644 index a34af5e678..0000000000 --- a/Items/Tools/MonolithAxe.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Astral; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class MonolithAxe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Tools"; - public override void SetDefaults() - { - Item.damage = 25; - Item.knockBack = 2f; - Item.useTime = 8; - Item.useAnimation = 8; - Item.axe = 90 / 5; - Item.tileBoost = 1; - - Item.DamageType = DamageClass.Melee; - Item.width = 38; - Item.height = 36; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()); - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(10). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Tools/MonolithPickaxe.cs b/Items/Tools/MonolithPickaxe.cs deleted file mode 100644 index 5281c45aae..0000000000 --- a/Items/Tools/MonolithPickaxe.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Astral; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools -{ - public class MonolithPickaxe : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Tools"; - public override void SetDefaults() - { - Item.damage = 19; - Item.knockBack = 0.8f; - Item.useTime = 6; - Item.useAnimation = 6; - Item.pick = 90; - Item.tileBoost = 1; - - Item.DamageType = DamageClass.Melee; - Item.width = 38; - Item.height = 40; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()); - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(15). - AddTile(TileID.WorkBenches). - Register(); - } - } -} diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 5bf89577f3..9a969c5485 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Tools CreateRecipe(). AddIngredient(7). AddIngredient(ItemID.SunplateBlock, 3). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } diff --git a/Items/TreasureBags/CeaselessVoidBag.cs b/Items/TreasureBags/CeaselessVoidBag.cs index 3e82674595..cabe86cc17 100644 --- a/Items/TreasureBags/CeaselessVoidBag.cs +++ b/Items/TreasureBags/CeaselessVoidBag.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 6, 9); + itemLoot.Add(ModContent.ItemType(), 1, 12, 16); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index e5bd7e7854..3a2e4aefee 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 55, 65); + itemLoot.Add(ModContent.ItemType(), 1, 75, 90); itemLoot.Add(ModContent.ItemType(), 1, 200, 320); // Weapons diff --git a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs index bbbe86179b..10b84e3d82 100644 --- a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureAbyss; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using Terraria; using Terraria.GameContent.ItemDropRules; @@ -61,7 +61,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags // Pots can normally contain hearts here... but we turned it into a grab bag (so... coins!) // 4-12/5-18 Biome Torches @ 12.43% (87/700) - var torches = DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 4, 12, 5, 18); + var torches = DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 4, 12, 5, 18); // 10-20 Hellfire Arrows @ 12.43% var ammo = ItemDropRule.NotScalingWithLuck(ItemID.HellfireArrow, 1, 10, 20); diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 90f1610de5..45f42511a1 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.TreasureBags // Materials itemLoot.Add(ModContent.ItemType(), 1, 25, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 35); + itemLoot.Add(ModContent.ItemType(), 1, 40, 50); itemLoot.Add(ItemID.Stinger, 1, 4, 8); // Weapons diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index 6b10c1e1a0..e52a0d01c2 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 20); + itemLoot.Add(ModContent.ItemType(), 1, 25, 30); itemLoot.Add(ModContent.ItemType(), 1, 40, 50); // Weapons diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index d192e2f733..807ca04a4b 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -58,8 +58,8 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 25, 35); - itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ModContent.ItemType(), 1, 40, 50); + itemLoot.Add(ModContent.ItemType(), 1, 60, 70); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/SignusBag.cs b/Items/TreasureBags/SignusBag.cs index fff0ce985d..90fc769aec 100644 --- a/Items/TreasureBags/SignusBag.cs +++ b/Items/TreasureBags/SignusBag.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 6, 9); + itemLoot.Add(ModContent.ItemType(), 1, 12, 16); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index 48c7eb7a9d..2e114ab6e0 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 6, 9); + itemLoot.Add(ModContent.ItemType(), 1, 12, 16); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 82a29bcd1c..5af40c3c7c 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 30, 35); + itemLoot.Add(ModContent.ItemType(), 1, 40, 50); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/AerialTracker.cs similarity index 67% rename from Items/Weapons/DraedonsArsenal/TrackingDisk.cs rename to Items/Weapons/DraedonsArsenal/AerialTracker.cs index 8853f072ea..8bb357e8d8 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/AerialTracker.cs @@ -13,15 +13,16 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class TrackingDisk : RogueWeapon, ILocalizedModType + [LegacyName("TrackingDisk")] + public class AerialTracker : RogueWeapon, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 30; - Item.height = 34; + Item.width = 52; + Item.height = 40; Item.damage = 16; Item.DamageType = RogueDamageClass.Instance; Item.useTime = 40; @@ -39,19 +40,26 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.07f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (player.Calamity().StealthStrikeAvailable()) + { + for (int i = -1; i <= 1; i += 2) + { + Vector2 vel = (velocity * 1.2f).RotatedBy(0.6f * i); + int proj = Projectile.NewProjectile(source, position, vel, type, (int)(damage * 0.8f), knockback, player.whoAmI); + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].ai[2] = i; + Main.projectile[proj].extraUpdates = 3; + Main.projectile[proj].tileCollide = false; + } + } + else + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/DraedonsArsenal/AerialTracker.png b/Items/Weapons/DraedonsArsenal/AerialTracker.png new file mode 100644 index 0000000000..989a70fb14 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AerialTracker.png differ diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.png b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.png deleted file mode 100644 index e99257dcc2..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs deleted file mode 100644 index ea4fe97f92..0000000000 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.DraedonsArsenal -{ - public class GaussRifle : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/LargeMechGaussRifle"); - - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 112; - Item.height = 36; - Item.DamageType = DamageClass.Ranged; - Item.damage = 150; - Item.knockBack = 30f; - Item.useAnimation = Item.useTime = 32; - Item.autoReuse = true; - - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = CommonCalamitySounds.GaussWeaponFire; - Item.noMelee = true; - - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 27f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 135f; - modItem.ChargePerUse = 0.1125f; - } - - 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, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - return false; - } - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(18). - AddIngredient(12). - AddIngredient(5). - AddIngredient(10). - AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.png b/Items/Weapons/DraedonsArsenal/GaussRifle.png deleted file mode 100644 index f1e885da7d..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/GaussRifle.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs deleted file mode 100644 index 01d8c9d04e..0000000000 --- a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.DraedonsArsenal; -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.DraedonsArsenal -{ - [LegacyName("LaserRifle")] - public class HeavyLaserRifle : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/LaserRifleFire"); - - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 84; - Item.height = 28; - Item.DamageType = DamageClass.Ranged; - Item.damage = 210; - Item.knockBack = 4f; - Item.useTime = 25; - Item.useAnimation = 25; - Item.autoReuse = true; - - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = FireSound; - Item.noMelee = true; - - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 190f; - modItem.ChargePerUse = 0.125f; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (velocity.Length() > 5f) - { - velocity.Normalize(); - velocity *= 5f; - } - for (int i = 0; i < 2; i++) - { - float SpeedX = velocity.X + Main.rand.Next(-1, 2) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-1, 2) * 0.05f; - Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType(), damage, knockback, player.whoAmI, i, 0f); - } - return false; - } - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); - - public override Vector2? HoldoutOffset() - { - return new Vector2(-20, 0); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(15). - AddIngredient(15). - AddIngredient(8). - AddIngredient(ItemID.LunarBar, 4). - AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.png b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.png deleted file mode 100644 index 9f3f3750da..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs similarity index 52% rename from Items/Weapons/DraedonsArsenal/MatterModulator.cs rename to Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs index 004fcf0338..a260077562 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs @@ -3,51 +3,57 @@ using System.Collections.Generic; using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class MatterModulator : ModItem, ILocalizedModType + [LegacyName("MatterModulator")] + public class HolofiberImmolator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public static readonly SoundStyle PlasmaSound = new("CalamityMod/Sounds/Item/PlasmaSmall"); public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 40; - Item.height = 22; + Item.width = 26; + Item.height = 78; Item.DamageType = DamageClass.Ranged; - Item.damage = 100; - Item.knockBack = 11f; - Item.useAnimation = Item.useTime = 33; + Item.damage = 50; + Item.knockBack = 0.8f; + Item.useTime = Item.useAnimation = 14; Item.autoReuse = true; + Item.noUseGraphic = true; + Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; + Item.UseSound = null; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 85f; - modItem.ChargePerUse = 0.075f; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool CanConsumeAmmo(Item ammo, Player player) => false; + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + 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/DraedonsArsenal/HolofiberImmolatorGlow").Value); + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i < Main.rand.Next(3, 5 + 1); i++) - { - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.3f), type, damage, knockback, player.whoAmI); - } + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } diff --git a/Items/Tools/AcidwoodAxe.png b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.png similarity index 77% rename from Items/Tools/AcidwoodAxe.png rename to Items/Weapons/DraedonsArsenal/HolofiberImmolator.png index 55652b2c68..6a8c4ccaae 100644 Binary files a/Items/Tools/AcidwoodAxe.png and b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.png differ diff --git a/Items/Tools/DriftwoodAxe.png b/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png similarity index 83% rename from Items/Tools/DriftwoodAxe.png rename to Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png index 9fb519983f..847fa4b5c8 100644 Binary files a/Items/Tools/DriftwoodAxe.png and b/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.png b/Items/Weapons/DraedonsArsenal/MatterModulator.png deleted file mode 100644 index 7bdc4d548a..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/MatterModulator.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/Nidhogg.cs b/Items/Weapons/DraedonsArsenal/Nidhogg.cs new file mode 100644 index 0000000000..b709c79b66 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/Nidhogg.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + [LegacyName("GaussRifle", "CompactRailgun")] + public class Nidhogg : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + + Item.width = 70; + Item.height = 30; + Item.DamageType = DamageClass.Ranged; + Item.damage = 69; + Item.knockBack = 7f; + Item.useTime = Item.useAnimation = 8; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 7f; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + 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/DraedonsArsenal/NidhoggGlow").Value); + } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(18). + AddIngredient(12). + AddIngredient(5). + AddIngredient(10). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Tools/MonolithAxe.png b/Items/Weapons/DraedonsArsenal/Nidhogg.png similarity index 76% rename from Items/Tools/MonolithAxe.png rename to Items/Weapons/DraedonsArsenal/Nidhogg.png index b87a887ee3..9e37dee348 100644 Binary files a/Items/Tools/MonolithAxe.png and b/Items/Weapons/DraedonsArsenal/Nidhogg.png differ diff --git a/Items/Weapons/DraedonsArsenal/NidhoggGlow.png b/Items/Weapons/DraedonsArsenal/NidhoggGlow.png new file mode 100644 index 0000000000..6df5cebd78 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/NidhoggGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs b/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs new file mode 100644 index 0000000000..e7cf6bd724 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +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.DraedonsArsenal +{ + [LegacyName("HeavyLaserRifle")] + [LegacyName("ScattershotSkewer")] + public class PhalanxSurge : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } + public override void SetDefaults() + { + Item.width = 64; + Item.height = 36; + Item.DamageType = DamageClass.Ranged; + Item.damage = 150; + Item.knockBack = 4f; + Item.useTime = 30; + Item.useAnimation = 30; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PhalanxSurgeGlow").Value); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(15). + AddIngredient(8). + AddIngredient(ItemID.LunarBar, 4). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/PhalanxSurge.png b/Items/Weapons/DraedonsArsenal/PhalanxSurge.png new file mode 100644 index 0000000000..bd3c28d67f Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PhalanxSurge.png differ diff --git a/Items/Weapons/DraedonsArsenal/PhalanxSurgeGlow.png b/Items/Weapons/DraedonsArsenal/PhalanxSurgeGlow.png new file mode 100644 index 0000000000..dc1111d379 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PhalanxSurgeGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/PulseGrenade.cs similarity index 53% rename from Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs rename to Items/Weapons/DraedonsArsenal/PulseGrenade.cs index 12f8741267..480f8fbc4a 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/PulseGrenade.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -12,51 +13,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class FrequencyManipulator : RogueWeapon, ILocalizedModType + [LegacyName("FrequencyManipulator")] + public class PulseGrenade : RogueWeapon, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 26; - Item.height = 44; - Item.damage = 80; + Item.width = 30; + Item.height = 40; + Item.damage = 59; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 56; - Item.useAnimation = 56; + Item.useTime = 75; + Item.useAnimation = 75; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 5f; + Item.knockBack = 8f; + Item.channel = true; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item1; Item.shootSpeed = 16f; - Item.shoot = ModContent.ProjectileType(); - - modItem.UsesCharge = true; - modItem.MaxCharge = 85f; - modItem.ChargePerUse = 0.04f; + Item.shoot = ModContent.ProjectileType(); } + public override bool CanUseItem(Player player) + { + return (player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0); + } + public override void HoldItem(Player player) + { + bool notUsingItem = (player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0); + if (!notUsingItem) + { + player.Calamity().rogueStealth = 0; + } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - + player.Calamity().mouseWorldListener = true; + } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) - damage = (int)(damage * 0.9f); - - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Projectile grenade = Projectile.NewProjectileDirect(source, position, velocity, type, damage, 0, player.whoAmI, 0, 0); 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/DraedonsArsenal/PulseGrenadeGlow").Value); + } public override void AddRecipes() { diff --git a/Items/Weapons/DraedonsArsenal/PulseGrenade.png b/Items/Weapons/DraedonsArsenal/PulseGrenade.png new file mode 100644 index 0000000000..a30040e813 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PulseGrenade.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow.png b/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow.png new file mode 100644 index 0000000000..9d305134cc Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 53f707848b..afd9ba1dd8 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,31 +19,62 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 62; - Item.height = 22; - Item.damage = 22; + Item.width = 54; + Item.height = 38; Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.useAnimation = Item.useTime = 23; - Item.knockBack = 0.25f; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. - - Item.UseSound = PulseRifle.FireSound; - Item.useStyle = ItemUseStyleID.Shoot; + Item.damage = 49; + Item.knockBack = 3f; + Item.useTime = 64; + Item.useAnimation = 64; Item.autoReuse = true; + Item.mana = 15; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = PulseRifle.FireSound with { Pitch = 0.3f, Volume = 0.7f }; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.05f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8.2f; } - public override Vector2? HoldoutOffset() => new Vector2(10f, 0f); + 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 * 4, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + float pullback = 7f; + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(54, 38); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); public override void AddRecipes() diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.png b/Items/Weapons/DraedonsArsenal/PulsePistol.png index f5ae99fd92..20ff87d7f8 100644 Binary files a/Items/Weapons/DraedonsArsenal/PulsePistol.png and b/Items/Weapons/DraedonsArsenal/PulsePistol.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 3d58c31b72..0f0ad89be9 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire") { Volume = 0.8f }; - private int BaseDamage = 990; public int FiringTimer = 30; public override void SetDefaults() @@ -29,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 100; Item.height = 32; Item.DamageType = DamageClass.Ranged; - Item.damage = BaseDamage; + Item.damage = 720; Item.useAnimation = Item.useTime = 55; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); @@ -42,16 +41,43 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - - modItem.UsesCharge = true; - modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.24f; } 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/DraedonsArsenal/PulseRifleGlow").Value); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + float pullback = 13f; + + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.8f) + pullback -= (5.75f) * (float)Math.Pow((0.85f - animProgress) / 0.85f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(100, 32); + Vector2 itemOrigin = new Vector2(-44, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override Vector2? HoldoutOffset() => new Vector2(-15, 0); diff --git a/Items/Weapons/DraedonsArsenal/ShortCircuit.cs b/Items/Weapons/DraedonsArsenal/ShortCircuit.cs new file mode 100644 index 0000000000..65de7b18c9 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/ShortCircuit.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + [LegacyName("Taser")] + public class ShortCircuit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(10); + public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/TaserLaunch") { Volume = 0.6f }; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + + Item.width = 42; + Item.height = 24; + Item.DamageType = DamageClass.Ranged; + Item.damage = 9; + Item.knockBack = 7f; + Item.useTime = Item.useAnimation = 8; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; + } + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 0.3f; + + return 1f; + } + public override bool CanUseItem(Player player) => (player.altFunctionUse == 2 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) || player.altFunctionUse == 0; + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2 && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + { + SoundEngine.PlaySound(Fire with { Pitch = -0.1f }, position); + Projectile hook = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.2f), 0, player.whoAmI); + return false; + } + + if (player.altFunctionUse == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall"); + SoundEngine.PlaySound(fire with { Pitch = Main.rand.NextFloat(0.5f, 0.65f), Volume = 0.2f, MaxInstances = -1 }, position); + Projectile shot = Projectile.NewProjectileDirect(source, position + velocity - Vector2.UnitY * 5, (velocity * 1.5f).RotatedByRandom(0.15f), type, damage, 0, player.whoAmI); + return false; + } + + return false; + } + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.altFunctionUse == 0) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + float pullback = 7f; + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(42, 24); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + } + + public override void UseItemFrame(Player player) + { + if (player.altFunctionUse == 0) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + } + public override Vector2? HoldoutOffset() => new Vector2(0f, 0f); + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(7). + AddIngredient(5). + AddIngredient(4). + AddIngredient(7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Func condition), condition). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/ShortCircuit.png b/Items/Weapons/DraedonsArsenal/ShortCircuit.png new file mode 100644 index 0000000000..d493b95d2e Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/ShortCircuit.png differ diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs deleted file mode 100644 index af84e0175b..0000000000 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Sounds; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.DraedonsArsenal -{ - public class Taser : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 50; - Item.height = 26; - Item.damage = 16; - Item.DamageType = DamageClass.Ranged; - Item.useAnimation = Item.useTime = 28; - Item.knockBack = 0.25f; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; - - Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; - Item.useStyle = ItemUseStyleID.Shoot; - Item.autoReuse = true; - Item.noMelee = true; - - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.05f; - } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(7). - AddIngredient(5). - AddIngredient(4). - AddIngredient(7). - AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Func condition), condition). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/Taser.png b/Items/Weapons/DraedonsArsenal/Taser.png deleted file mode 100644 index 16aeb51518..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/Taser.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.png b/Items/Weapons/DraedonsArsenal/TrackingDisk.png deleted file mode 100644 index 4ddea6ac7d..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/TrackingDisk.png and /dev/null differ diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index f240be95f0..ebb944edd7 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index 49ef7576af..154e914af3 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 56; Item.height = 50; - Item.damage = 77; + Item.damage = 127; Item.DamageType = DamageClass.Magic; Item.mana = 7; Item.useTime = 22; diff --git a/Items/Weapons/Magic/Apathanull.cs b/Items/Weapons/Magic/Apathanull.cs index da4a586ebb..38ea4e46b0 100644 --- a/Items/Weapons/Magic/Apathanull.cs +++ b/Items/Weapons/Magic/Apathanull.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 54; + Item.damage = 67; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useTime = 8; diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index b641a22307..32c603bd92 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -14,53 +15,49 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 130; Item.height = 58; - Item.damage = 99; + Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useAnimation = 7; - Item.useTime = 7; + Item.mana = 7; + Item.useAnimation = 5; + Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 6.75f; - Item.UseSound = SoundID.Item91; + Item.knockBack = 6f; Item.autoReuse = true; Item.noMelee = true; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; + + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override Vector2? HoldoutOffset() => new Vector2(-25, 0); - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool AltFunctionUse(Player player) => true; + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - float manaRatio = (float)player.statMana / player.statManaMax2; - bool injectionNerf = player.Calamity().astralInjection; - if (injectionNerf) - manaRatio = MathHelper.Min(manaRatio, 0.65f); - - // 20% to 160% damage. Astral Injection caps it at 111% damage. - float damageRatio = 0.2f + 1.4f * manaRatio; - damage = (int)(damage * damageRatio); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/ApoctosisArrayGlow").Value); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float manaRatio = (float)player.statMana / player.statManaMax2; - bool injectionNerf = player.Calamity().astralInjection; - if (injectionNerf) - manaRatio = MathHelper.Min(manaRatio, 0.65f); - - Projectile proj = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); - proj.scale = 0.75f + 0.75f * manaRatio; + Projectile holdout; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + { + holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5); + } + else + holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 0); + holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.LunarBar, 5). + AddIngredient(ItemID.FragmentSolar, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/ApoctosisArrayGlow.png b/Items/Weapons/Magic/ApoctosisArrayGlow.png new file mode 100644 index 0000000000..99d6a2db8a Binary files /dev/null and b/Items/Weapons/Magic/ApoctosisArrayGlow.png differ diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index f78e124280..1067e27f81 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 40; - Item.damage = 143; + Item.damage = 159; Item.DamageType = DamageClass.Magic; Item.mana = 38; Item.useTime = 50; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 0875c6bebd..cde4852367 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 84; Item.height = 84; - Item.damage = 135; + Item.damage = 140; Item.DamageType = DamageClass.Magic; - Item.mana = 40; + Item.mana = 35; Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 5320497da6..7aaf4eb0c4 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 38; Item.height = 42; - Item.damage = 72; + Item.damage = 79; Item.DamageType = DamageClass.Magic; Item.mana = 13; Item.useTime = 20; diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index 61de44955a..fcf8c4aeb8 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -8,13 +8,13 @@ namespace CalamityMod.Items.Weapons.Magic public class GloriousEnd : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public static int PlayerExplosionDmgMin = 50; - public static int PlayerExplosionDmgMax = 60; + public static int PlayerExplosionDmgMin = 60; + public static int PlayerExplosionDmgMax = 80; public override void SetDefaults() { Item.width = 30; Item.height = 58; - Item.damage = 120; + Item.damage = 100; Item.knockBack = 10f; Item.useAnimation = Item.useTime = 30; Item.mana = 20; diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index 68f3fa069c..96b6aa113a 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,50 +11,50 @@ namespace CalamityMod.Items.Weapons.Magic public class IonBlaster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { Item.width = 68; Item.height = 38; - Item.damage = 29; + Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useAnimation = 10; - Item.useTime = 10; + Item.mana = 12; + Item.useAnimation = 7; + Item.useTime = 7; Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 5.5f; - Item.UseSound = SoundID.Item91; + Item.knockBack = 6f; Item.autoReuse = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool AltFunctionUse(Player player) => true; + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - float manaRatio = (float)player.statMana / player.statManaMax2; - bool injectionNerf = player.Calamity().astralInjection; - if (injectionNerf) - manaRatio = MathHelper.Min(manaRatio, 0.65f); - - // 20% to 160% damage. Astral Injection caps it at 111% damage. - float damageRatio = 0.2f + 1.4f * manaRatio; - damage = (int)(damage * damageRatio); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/IonBlasterGlow").Value); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float manaRatio = (float)player.statMana / player.statManaMax2; - bool injectionNerf = player.Calamity().astralInjection; - if (injectionNerf) - manaRatio = MathHelper.Min(manaRatio, 0.65f); - - Projectile proj = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); - proj.scale = 0.75f + 0.75f * manaRatio; + Projectile holdout; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + { + holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5); + } + else + holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 0); + holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Magic/IonBlasterGlow.png b/Items/Weapons/Magic/IonBlasterGlow.png new file mode 100644 index 0000000000..80a35987da Binary files /dev/null and b/Items/Weapons/Magic/IonBlasterGlow.png differ diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs deleted file mode 100644 index 152ffbb9a2..0000000000 --- a/Items/Weapons/Magic/Lazhar.cs +++ /dev/null @@ -1,50 +0,0 @@ -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class Lazhar : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetDefaults() - { - Item.width = 42; - Item.height = 20; - Item.damage = 76; - Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.useTime = 7; - Item.useAnimation = 7; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5f; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item12; - Item.autoReuse = true; - Item.shootSpeed = 15f; - Item.shoot = ModContent.ProjectileType(); - } - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - velocity.X += (float)Main.rand.Next(-15, 16) * 0.05f; - velocity.Y += (float)Main.rand.Next(-15, 16) * 0.05f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.SpaceGun). - AddIngredient(ItemID.HeatRay). - AddIngredient(ItemID.FragmentSolar, 6). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/Lazhar.png b/Items/Weapons/Magic/Lazhar.png deleted file mode 100644 index d250d2920e..0000000000 Binary files a/Items/Weapons/Magic/Lazhar.png and /dev/null differ diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index a3d4564a54..067916b491 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 60; - Item.damage = 188; + Item.damage = 197; Item.DamageType = DamageClass.Magic; Item.mana = 60; Item.useTime = 3; diff --git a/Items/Weapons/Magic/PhotosynthesisGlow.png b/Items/Weapons/Magic/PhotosynthesisGlow.png index dc3a8eeab5..ca021b33a5 100644 Binary files a/Items/Weapons/Magic/PhotosynthesisGlow.png and b/Items/Weapons/Magic/PhotosynthesisGlow.png differ diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index b587e34686..adcc961a6c 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 56; - Item.damage = 2800; + Item.damage = 3900; Item.DamageType = DamageClass.Magic; Item.mana = 85; Item.useTime = 78; diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index bfda7be735..bfe7b3b5d2 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 42; - Item.damage = 210; + Item.damage = 300; Item.DamageType = DamageClass.Magic; Item.mana = 48; Item.useTime = 68; diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index e496dd6214..49abe53755 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 30; - Item.damage = 175; + Item.damage = 170; Item.DamageType = DamageClass.Magic; Item.mana = 25; Item.crit += 4; diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 379715917a..086d1ef099 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBShot"); - public const int ShotsPerSoul = 40; + public const int ShotsPerSoul = 50; public int storedSoulpower = 0; public int storedSoulType = ItemID.SoulofLight; // Determines bar color and soul effects for projectile public int recoilProgress = 0; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Magic } #region Weapon-Specific Functions - public int FindSoulForAmmo(Player player) + public static int FindSoulForAmmo(Player player) { int soul = -1; bool foundItem = false; diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index d438f5e097..c5073452b4 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 56; - Item.damage = 190; + Item.damage = 260; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.useTime = 12; diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 005e22edf6..e727186d01 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic player.statLife -= 3; if (player.statLife <= 0) { - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ThornBlossom").Format(player.name)), 1000.0, 0, false); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ThornBlossom").ToNetworkText(player.name)), 1000.0, 0, false); } for (int index = 0; index < 3; ++index) { diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index f3a317b299..b4edeef570 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.SunplateBlock, 3). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 31455c4fe4..8289d33ecb 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 92; Item.height = 94; - Item.damage = 35; + Item.damage = 48; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 38; diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 8e6627d650..6d1c3063e9 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 118; Item.height = 118; - Item.damage = 235; + Item.damage = 400; Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee } if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) { - Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 30, Item.knockBack, player.whoAmI, 0, throwCount); + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 15, Item.knockBack, player.whoAmI, 0, throwCount); //This used to be 30x damage. } } 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/Earth.cs b/Items/Weapons/Melee/Earth.cs index ad209469b3..2c01111690 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 186; Item.height = 186; - Item.damage = 5684; + Item.damage = 4200; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 42; Item.useTime = 42; diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 285c560887..a1b1ac172f 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index 6dd42db33a..1e59199936 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 88; Item.height = 88; - Item.damage = 95; + Item.damage = 90; Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Melee } if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) { - Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 23, Item.knockBack, player.whoAmI, 0, throwCount); + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 15, Item.knockBack, player.whoAmI, 0, throwCount); //This used to be 23x damage. } } 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/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 91545b0bfb..6a60b3e4d3 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 74; Item.height = 74; - Item.damage = 44; + Item.damage = 58; Item.useAnimation = Item.useTime = 50; Item.useStyle = ItemUseStyleID.Shoot; @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee } if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) { - Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter,Vector2.Zero, ModContent.ProjectileType(), Item.damage * 12, Item.knockBack, player.whoAmI, 0, throwCount); + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter,Vector2.Zero, ModContent.ProjectileType(), Item.damage * 10, Item.knockBack, player.whoAmI, 0, throwCount); // This used to be 12x damage. } } 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/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index b870ed806a..cd2cf73cb4 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(10). AddIngredient(ItemID.SunplateBlock, 4). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index ac5bfb214c..05109ea63c 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -1,11 +1,14 @@ -using CalamityMod.Items.BaseItems; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; -using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -18,6 +21,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static readonly SoundStyle GrandDadEasterEggSound = new("CalamityMod/Sounds/Custom/GFB/GrandDad"); + public Vector2 oldVel = Vector2.Zero; + public int time = 0; + public float highestSpeed = 0; + public bool hitFloor = false; public override void SetDefaults() { Item.width = 124; @@ -57,7 +64,70 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(TileID.LunarCraftingStation). Register(); } + public override void OnSpawn(IEntitySource source) + { + time = 0; + hitFloor = false; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + Vector2 place = Item.Center + Vector2.UnitY * 48; + if (time == 0 && Item.velocity.Y != 0) + { + oldVel = Item.velocity; + Item.velocity = new Vector2(Math.Sign(Item.velocity.X) * 20, -10); + } + if (oldVel.Y != 0 && Item.velocity.Y == 0) + { + time = 0; + float power = Utils.GetLerpValue(35, 75, highestSpeed, true) * 2; + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3.5f * power) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3.5f * power; + if (power > 0.25f) + { + float blastSize = 150 * power; + float minMultiplier = 0.3f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), place, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 2 * power), -35 * power, -1, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 5; + int particleNumber = (int)Math.Max(15 * power, 2); + for (int i = -particleNumber; i <= particleNumber; i++) + { + Particle sparks = new AltSparkParticle(place, (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, false, Main.rand.Next(17, 30 + 1), Main.rand.NextFloat(0.2f, 0.8f), Main.rand.NextBool() ? Color.Lerp(Color.Blue, Color.DodgerBlue, 0.3f) : Color.Gold); + GeneralParticleHandler.SpawnParticle(sparks); + Dust dust = Dust.NewDustPerfect(place, ModContent.DustType(), (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, 0, default, Main.rand.NextFloat(0.85f, 1.2f) * power); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Blue : Color.DodgerBlue; + } + + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound with { Volume = 0.6f * power, Pitch = Main.rand.NextFloat(0.4f, 0.6f) }, Item.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(sound2 with { Volume = 0.45f * power, Pitch = -0.2f }, Item.Center); + } + + highestSpeed = 0; + } + if (Item.velocity.Y != 0) + { + if (Item.velocity.Y > 0 && Item.velocity.Y < 75) + { + Item.velocity.X *= 0.98f; + Item.velocity.Y += 0.35f; + Item.velocity.Y *= 1.15f; + } + else + Item.velocity.Y += 0.55f; + time++; + if (highestSpeed < Item.velocity.Y) + highestSpeed = Item.velocity.Y; + } + + gravity = 0; + maxFallSpeed = 75; + oldVel = Item.velocity; + } public override void OnCreated(ItemCreationContext context) { if (Main.zenithWorld) diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 5691d09fe2..6b8dc1e723 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 130; Item.height = 130; - Item.damage = 325; + Item.damage = 515; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 35; Item.useTime = 35; diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 2c7fe3aabe..ce68ea8fc9 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 62; Item.height = 62; - Item.damage = 87; // IS THAT THE BITE OF '87 + Item.damage = 97; Item.DamageType = DamageClass.Melee; Item.useTime = 27; Item.useAnimation = 27; diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 840223abe1..61e02ad1f3 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 70; - Item.damage = 295; + Item.damage = 351; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index f61f948bca..4b09dcf3a6 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.damage = 325; + Item.damage = 365; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 50; Item.useTime = 50; diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index 2b512bb0b4..4dff8f0547 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.ThrowingKnife, 200). + AddIngredient(ItemID.ThrowingKnife, 50). AddIngredient(ItemID.LifeCrystal). AddIngredient(ItemID.LesserHealingPotion, 5). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index 8151d67e9f..6a835e742a 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 70; Item.height = 70; - Item.damage = 202; + Item.damage = 195; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index d4192e2eda..4672492beb 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 108; - Item.damage = 415; + Item.damage = 445; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = useTime; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 20941fbed8..cf8f7e9eba 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 50; Item.height = 50; - Item.damage = 300; + Item.damage = 490; Item.useStyle = ItemUseStyleID.Shoot; Item.useAnimation = Item.useTime = 13; Item.reuseDelay = 30; diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs deleted file mode 100644 index c28720bdff..0000000000 --- a/Items/Weapons/Melee/SeashineSword.cs +++ /dev/null @@ -1,49 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class SeashineSword : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - - public override void SetDefaults() - { - Item.CloneDefaults(ItemID.EnchantedSword); - Item.width = 40; - Item.height = 40; - Item.useTime = 30; - Item.damage = 25; - Item.DamageType = DamageClass.Melee; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.knockBack = 4f; - Item.shootSpeed = 12f; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item1; - Item.shoot = ModContent.ProjectileType(); - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddIngredient(7). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/SeashineSword.png b/Items/Weapons/Melee/SeashineSword.png deleted file mode 100644 index ec74860678..0000000000 Binary files a/Items/Weapons/Melee/SeashineSword.png and /dev/null differ diff --git a/Items/Weapons/Melee/SkytideDragoon.cs b/Items/Weapons/Melee/SkytideDragoon.cs index ec33a45b04..eb4c791c2c 100644 --- a/Items/Weapons/Melee/SkytideDragoon.cs +++ b/Items/Weapons/Melee/SkytideDragoon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 94; - Item.damage = 345; + Item.damage = 365; Item.DamageType = DamageClass.Melee; Item.useAnimation = 35; Item.useTime = 35; diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 7179fb521f..f8c25997b1 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 118; - Item.damage = 56; + Item.damage = 98; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 33; diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index dfda5d3c3f..1be0c3f0b6 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(9). AddIngredient(ItemID.SunplateBlock, 3). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index 31cedfa79f..b3a233e150 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -50,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.Valor). AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). - AddIngredient(ItemID.SoulofNight, 7). AddIngredient(ItemID.SoulofLight, 7). + AddIngredient(ItemID.SoulofNight, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 7f7c60844b..f6152e10a7 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public class AcesHigh : ModItem, ILocalizedModType { + public int shots = 0; public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { @@ -42,7 +43,12 @@ namespace CalamityMod.Items.Weapons.Ranged { return new Vector2(-5, 0); } - + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } public override void AddRecipes() { CreateRecipe(). @@ -56,13 +62,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - type = Utils.SelectRandom(Main.rand, new int[] + shots++; + switch (shots) { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); + case 4: + type = ModContent.ProjectileType(); + shots = 0; + break; + case 3: + type = ModContent.ProjectileType(); + break; + case 2: + type = ModContent.ProjectileType(); + break; + default: + type = ModContent.ProjectileType(); + break; + } } } } diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index f90dedf730..43927c6267 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 90; - Item.damage = 83; + Item.damage = 91; Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 80e6aabbf1..52ae3be18f 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -61,5 +61,12 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } } } diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 3231490127..4bef0633a7 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 40; Item.height = 78; - Item.damage = 153; + Item.damage = 159; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 20; diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 5e3073cde9..ffb8e030fb 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 68; Item.height = 36; - Item.damage = 74; + Item.damage = 89; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index 323cf7ae91..5b3983dd1b 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -70,6 +71,8 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), // Not ranged ModContent.ProjectileType(), diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 93f7bfbfff..4f76ab7311 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 88; Item.height = 48; - Item.damage = 592; + Item.damage = 530; Item.DamageType = DamageClass.Ranged; Item.useTime = 39; Item.useAnimation = 39; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 4a0f30013d..2a6a2f5255 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged player.statLife -= 1; if (player.statLife <= 0) { - PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodBoiler" + Main.rand.Next(1, 2 + 1)).Format(player.name)); + PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodBoiler" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)); player.KillMe(pdr, 1000.0, 0, false); return false; } diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index 0e19d9b1a0..2fa1f265cf 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 48; Item.height = 30; - Item.damage = 140; + Item.damage = 148; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 9; diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 0574340fcb..6a3667da12 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 128; - Item.damage = 150; + Item.damage = 162; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 5b485b9487..3bdb517214 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 40; Item.height = 82; - Item.damage = 148; + Item.damage = 154; Item.DamageType = DamageClass.Ranged; Item.useTime = 14; Item.useAnimation = 14; diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 36ca91f8d5..45496b42b1 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 64; Item.height = 84; - Item.damage = 129; + Item.damage = 136; Item.knockBack = 1f; Item.shootSpeed = 18f; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 65e5339690..6027e5535d 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 76; Item.height = 46; - Item.damage = 250; + Item.damage = 315; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index 8fbc80de2b..0f943388fb 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(8). AddIngredient(ItemID.SunplateBlock, 3). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index 87466ac4f7..87e94b5a7c 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -15,11 +15,11 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 46; Item.height = 30; - Item.damage = 85; + Item.damage = 88; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; - Item.useTime = 19; - Item.useAnimation = 19; + Item.useTime = 18; + Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index 45ca6ba331..aec808cfbe 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.damage = 740; Item.knockBack = 16f; - Item.useTime = 84; - Item.useAnimation = 84; + Item.useTime = Item.useAnimation = 74; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; @@ -52,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(ItemID.RocketLauncher). AddRecipeGroup("IronBar", 50). AddIngredient(5). AddIngredient(ItemID.TigerSkin). diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 0dedc0af37..c259c226ab 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 34; - Item.damage = 320; + Item.damage = 385; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; @@ -51,11 +51,11 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().cooldowns.TryGetValue(HellbornShots.ID, out var cooldown)) { - cooldown.timeLeft = 8 - player.Calamity().hellbornShots; + cooldown.timeLeft = 12 - player.Calamity().hellbornShots; } else { - player.AddCooldown(HellbornShots.ID, 8); + player.AddCooldown(HellbornShots.ID, 12); } } 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/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 6f702331f1..a636a0b041 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 85; + Item.damage = 95; Item.DamageType = DamageClass.Ranged; Item.useTime = 1; Item.useAnimation = 4; diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index 1fd0f82a85..fec63a99b4 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 92; Item.height = 44; - Item.damage = 245; + Item.damage = 249; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 3; diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 1b018e6854..0efe846d37 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 46; Item.height = 78; - Item.damage = 152; + Item.damage = 156; Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; diff --git a/Items/Weapons/Ranged/NullificationPistol.cs b/Items/Weapons/Ranged/NullificationPistol.cs index c5bd838ea6..f196a583e4 100644 --- a/Items/Weapons/Ranged/NullificationPistol.cs +++ b/Items/Weapons/Ranged/NullificationPistol.cs @@ -26,10 +26,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 52; Item.height = 28; - Item.damage = 180; + Item.damage = 190; Item.DamageType = DamageClass.Ranged; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useTime = 18; + Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.1f; diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index 89fb5c4a7a..935f42b12a 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 88; Item.height = 34; - Item.damage = 387; + Item.damage = 445; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 8; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 4dddf0b7fd..659e5b422e 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 64; Item.height = 32; - Item.damage = 51; + Item.damage = 58; Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 15; diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 175f3a44a0..9acf97013b 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 84; Item.height = 34; - Item.damage = 90; + Item.damage = 100; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index dd50793b44..d5b25e3154 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 80; Item.height = 46; - Item.damage = 150; + Item.damage = 160; Item.scale = 0.75f; Item.DamageType = DamageClass.Ranged; Item.useTime = 9; diff --git a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs index 604367a05d..fd0a634b5e 100644 --- a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 68; Item.height = 32; - Item.damage = 74; + Item.damage = 79; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 5; diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index e1aa81d309..73019a111a 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; @@ -8,6 +9,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Ranged { @@ -32,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 100; Item.height = 46; - Item.damage = 80; + Item.damage = 77; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 15; @@ -56,20 +58,40 @@ namespace CalamityMod.Items.Weapons.Ranged // Right click consumes ammo at the same rate but faster at spewing public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.5f : 1f; - + public override void HoldItem(Player player) + { + int max = player.Calamity().furyFuelMax; + if (player.Calamity().cooldowns.TryGetValue(FuryFuel.ID, out var cooldown)) + { + cooldown.timeLeft = max - player.Calamity().furyFuel; + } + else + { + player.AddCooldown(FuryFuel.ID, max); + } + } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + return (player.altFunctionUse != 2); // Right click doesn't use ammo, it's crystal powder not gel + } 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 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + player.Calamity().furyRefuelTimer = -50; + if (player.Calamity().furyFuel > 0) + { + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int)(damage * 0.25f), knockback, player.whoAmI); //.25x base damage - Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); - dust.noGravity = true; - dust.color = Color.Orchid; + Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); + dust.noGravity = true; + dust.color = Color.Orchid; - CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Color.White, Color.Orchid, 0.9f, 18, 2f, 2.2f); - GeneralParticleHandler.SpawnParticle(spark); + CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Color.White, Color.Orchid, 0.9f, 18, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark); + player.Calamity().furyFuel -= 15; + } } else { diff --git a/Items/Weapons/Ranged/Riftburst.cs b/Items/Weapons/Ranged/Riftburst.cs index 61f46860e6..bb67b81471 100644 --- a/Items/Weapons/Ranged/Riftburst.cs +++ b/Items/Weapons/Ranged/Riftburst.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 48; Item.height = 82; - Item.damage = 117; + Item.damage = 122; Item.useTime = 12; Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 93660b0972..797b938ae8 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 74; Item.height = 34; - Item.damage = 100; + Item.damage = 115; Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 2; diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index 5137773712..25edac78bc 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 45; + Item.damage = 48; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 32; diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index 39271ef02f..9f5f5c080d 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 84; Item.height = 46; - Item.damage = 88; + Item.damage = 127; Item.DamageType = DamageClass.Ranged; Item.useTime = 30; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index da30c36b85..2261b93f72 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 60; Item.height = 26; - Item.damage = 222; + Item.damage = 232; Item.DamageType = DamageClass.Ranged; Item.useTime = 1; Item.useAnimation = 3; diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 2c5775d3a2..08adaa405d 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 74; Item.height = 126; - Item.damage = 79; + Item.damage = 83; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 25; diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index a6d0fc3f6f..3ada4994ca 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 96; - Item.height = 40; + Item.width = 134; + Item.height = 46; Item.damage = 1000; Item.DamageType = DamageClass.Ranged; Item.useTime = 52; diff --git a/Items/Weapons/Ranged/ThePack.png b/Items/Weapons/Ranged/ThePack.png index e865101e10..5867be9ba8 100644 Binary files a/Items/Weapons/Ranged/ThePack.png and b/Items/Weapons/Ranged/ThePack.png differ diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index 83e6dd9282..62013d29ee 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 54; Item.height = 90; - Item.damage = 23; + Item.damage = 40; Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 20; diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 2dec620a10..d88653ec1f 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 150; Item.height = 48; - Item.damage = 2000; + Item.damage = 2150; Item.knockBack = 9.5f; Item.DamageType = DamageClass.Ranged; Item.useTime = 60; diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 4a2e5cf67a..4d64603325 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.UseSound = SoundID.Item33; + Item.UseSound = SoundID.Item158; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index bfad290128..5647aea1ae 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (Main.myPlayer == player.whoAmI) player.HealEffect(-6); if (player.statLife <= 0) - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").ToNetworkText(player.name)), 1000.0, 0, false); return false; } return true; diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index f7b115b4da..3a54076ed3 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[stealth].Calamity().stealthStrike = true; Main.projectile[stealth].aiStyle = -1; Main.projectile[stealth].tileCollide = false; + Main.projectile[stealth].usesIDStaticNPCImmunity = false; Main.projectile[stealth].usesLocalNPCImmunity = true; + Main.projectile[stealth].localNPCHitCooldown = 10; } return false; } diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index 926ce17a5a..7bce69a725 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 3133d376dc..a3b6427bf1 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). - AddIngredient(ItemID.SoulofNight, 7). AddIngredient(ItemID.SoulofLight, 7). + AddIngredient(ItemID.SoulofNight, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 2399ea3992..1692e04126 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow").Value); } - public override float StealthDamageMultiplier => 0.6f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 756ef3c40a..e67b1ec4cc 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.SunplateBlock, 4). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index a83905ca76..a2e668dace 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -51,7 +51,6 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(ItemID.GoldBar, 12). - AddIngredient(ItemID.ThrowingKnife, 250). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 6e8efee10d..e609f2bb77 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -51,7 +51,6 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(ItemID.PlatinumBar, 12). - AddIngredient(ItemID.ThrowingKnife, 250). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 2042fcee4d..175a7f3c36 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -46,14 +46,5 @@ namespace CalamityMod.Items.Weapons.Rogue } return true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.Hive, 10). - AddIngredient(ItemID.BeeWax, 8). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index d07c9ea8e1..a981e139b2 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 36; - Item.damage = 10; + Item.damage = 9; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 20; diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 89cf7dcd29..374b63d451 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; } return false; } diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index 1b49987a1c..8afe0a8142 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 48; Item.height = 48; - Item.damage = 111; + Item.damage = 144; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 17; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.5f; + public override float StealthDamageMultiplier => 0.65f; 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/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index 21446160b0..c3158a2b17 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.SunplateBlock, 8). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 31295b43ed..470fb109e5 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 94; - Item.damage = 420; + Item.damage = 438; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 90; diff --git a/Items/Weapons/Rogue/TheOldReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs index 841f548173..82ab767e6c 100644 --- a/Items/Weapons/Rogue/TheOldReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 106; Item.height = 104; - Item.damage = 1450; + Item.damage = 1750; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 50; diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 2799f984b0..686a7719a8 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; } return false; } diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 8a9a9c21f4..df12311f53 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 46; - Item.damage = 230; + Item.damage = 272; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 40; diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index f74c72f6fb..7dcbb8d404 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(7). AddIngredient(ItemID.SunplateBlock, 3). - AddTile(TileID.SkyMill). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Rogue/Whitewater.cs b/Items/Weapons/Rogue/Whitewater.cs index fe1e7f836b..b8831ffa01 100644 --- a/Items/Weapons/Rogue/Whitewater.cs +++ b/Items/Weapons/Rogue/Whitewater.cs @@ -15,12 +15,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 36; Item.height = 40; - Item.damage = 88; + Item.damage = 120; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 42; + Item.useTime = Item.useAnimation = 42; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 42; Item.knockBack = 6.5f; Item.UseSound = SoundID.Item106 with { Volume = 0.7f }; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index 764c1af28f..038c64ae12 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -97,6 +97,13 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(10). AddCondition(Condition.NearShimmer). Register(); + + CreateRecipe(). + AddIngredient(ItemID.IceMirror). + AddIngredient(10). + AddIngredient(10). + AddCondition(Condition.NearShimmer). + Register(); } } } diff --git a/Items/Weapons/Summon/SeashineHilt.cs b/Items/Weapons/Summon/SeashineHilt.cs new file mode 100644 index 0000000000..8168f5fff6 --- /dev/null +++ b/Items/Weapons/Summon/SeashineHilt.cs @@ -0,0 +1,145 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + [LegacyName("SeashineSword")] + public class SeashineHilt : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + public override void SetDefaults() + { + Item.width = 32; + Item.height = 34; + Item.useTime = 10; + Item.useAnimation = 10; + Item.damage = 55; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = DamageClass.Summon; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.knockBack = 5f; + Item.shootSpeed = 12f; + Item.mana = 10; + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + } + public override bool AltFunctionUse(Player player) => true; + public override float UseSpeedMultiplier(Player player) + { + // There's a long cooldown on commanding blades + // This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready + if (player.altFunctionUse == 2) + return 0.1f; + else + return 1f; + } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + // Call all active blades to attack if they are charged + // The check to see if a blade is charged is done in the blade itself + if (player.altFunctionUse == 2) + { + int blades = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Item.shoot && projectile.ai[0] < 5 && projectile.timeLeft < 90000 - 180) + { + projectile.ai[0] = 5; + blades++; + } + } + if (blades > 0) // If theres no blades, then don't do anything + { + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center, ModContent.DustType(), (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 10f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.95f, 1.7f); + dust.color = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; + dust.noLightEmittence = true; + + Particle fx = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 20f), "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(16, 26 + 1)), Main.rand.NextFloat(1.1f, 1.7f), Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + Particle e = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.15f, 0.25f) * 3, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(e); + SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center); + } + } + else // Toss out the summon + { + SoundEngine.PlaySound(SoundID.Item1, player.Center); + + int pr = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(pr)) + Main.projectile[pr].originalDamage = Item.damage; + + float angleMax = MathHelper.ToRadians(360f); + if (CalamityUtils.CountProjectiles(type) == 1) + angleMax = 0f; + float index = 1f; + if (player.ownedProjectileCounts[Item.shoot] > 30) + { + angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); + } + angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == type && p.owner == player.whoAmI) + { + p.ai[2] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f; + p.ai[1] = index; + p.netUpdate = true; + index++; + } + } + } + return false; + } + public override void UseItemFrame(Player player) // Player hand animation when you command the blades + { + if (player.altFunctionUse == 2) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += (-0.15f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddIngredient(7). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Summon/SeashineHilt.png b/Items/Weapons/Summon/SeashineHilt.png new file mode 100644 index 0000000000..7b2e0792bc Binary files /dev/null and b/Items/Weapons/Summon/SeashineHilt.png differ diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index 5ee42ced6e..096434f23d 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -48,23 +48,16 @@ namespace CalamityMod.Items.Weapons.Summon { // Find the base farthest position Vector2 initialSpawn = player.GetFarthestSpawnPositionOnLine(position, velocity.X, velocity.Y); + int dontLoopForever = 0; - // Push the squirrel away from collision in all directions if applicable - while (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0) || + // Move the squirrel towards the player if the position does not have line of sight on all edges + while ((!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0) || !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitX * 20f, 0, 0) || !Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0) || - !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0)) + !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0)) && dontLoopForever < 200) { - if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0)) - initialSpawn.X -= 1f; - // Be sure to not infinite loop - if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitX * 20f, 0, 0) && Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0)) - initialSpawn.X += 1f; - if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0)) - initialSpawn.Y -= 1f; - // Be sure to not infinite loop - if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0) && Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0)) - initialSpawn.Y += 1f; + initialSpawn = Vector2.Lerp(player.Center, initialSpawn, 0.99f); + dontLoopForever++; } Projectile.NewProjectile(source, initialSpawn, Vector2.Zero, type, damage, knockback, player.whoAmI); diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index b86411f793..06606aa88c 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -71,6 +71,7 @@ AuroraSpirit: Thought to be no more than an old wives' tale, sightings of aurora BloomSlime: Imbued with profaned energy, this slime wishes to see the world reduced to ashes to ensure the suffering it brings is no more. However, the simplicity of their form makes it difficult for the slain goddess to fully impose her will onto them. Bohldohr: Bohldohrs were made to serve the lihzahrds, being crafted from ancient stone and brought to life with magical power in the twilight of the great Lihzahrd Dynasty. But the sun sets on every civilization, and once their deity abandoned them, they were left to fend for themselves. CladCrab: Strong enough to carry an entire mound, these land crustaceans were hard pressed for survival during the Crusade. With no other option, they added rock and stone to their list of protections, allowing them to continue thriving. +CloudElemental: Part of a solitary elemental that rarely appears aside from when her domain is at its strongest. Many attempts were made by what remained of Yharim's forces to hunt down the elementals after Azafure fell. Only now that the war has passed do the weaker elementals dare return. GemCrawler: Relatives to the Ilmeran Sea's prismbacks. The aquatic lizards ended up in the wild after being taken in as pets, though without the proper nutrients to grow prisms on their back, many grew the next best thing– precious gems. BlightSlime: Slimes that have absorbed some of the blighted godly essence. Riddled with impurity, they are now more putrid flesh than gelatin and, having taken in such an amount that they seem ready to burst. Yet unlike most slimes which have relatively basic minds, these seem to be collecting mass with a purpose. Cryon: Archmage Permafrost went through great pains to not take part in combat himself, instead molding cryons to act as his personal guardians. Noticing the spread of godly essence just as many other creatures have, they have come out of stasis to combat any signs of it so that they may defend their master. @@ -93,7 +94,6 @@ ScornEater: For one to be weak of will does not inherently mean they are weak of ShockstormShuttle: Mining devices and scouts for a civilization from a long lost world. They now seek whatever resources are left on other nearby planets, and perhaps even this world as a potential replacement for their ruined home. Shroomble: Mushrooms offer surprisingly effective regenerative agents to human bodies. This is commonly attributed to their abundance of Life, and visibly, "abundance" is often an understatement. Sunskater: To the civilization that lived far above clouds, sunskaters were seen as a good omen. These creatures inspired hope in those who saw them, that their society might live on for as long as the sun's light bathes the world. -ThiccWaifu: Part of a solitary elemental that rarely appears aside from when her domain is at its strongest. Many attempts were made by what remained of Yharim's forces to hunt down the elementals after Azafure fell. Only now that the war has passed do the weaker elementals dare return. WildBumblefuck: Though but an adolescent dragonfolly, it poses a great threat to all around it regardless of its age. Their species survived the draconic purges by reproducing rapidly and becoming highly reclusive, alongside developing a hyper-aggressive nature. WulfrumAmplifier: These amplifiers empower fellow wulfrum machines through a surprisingly advanced tesla field. While the field is harmless to any organic beings that pass through it, wulfrum machines are designed to receive energy from it which allows them to run at peak efficiency. WulfrumDrone: The purpose the wulfrum machines once fulfilled can most clearly be seen through the drones: to harass the basic troopers of Yharim's forces. They were not threatening enough to be a priority target, though their laser attacks could be quite deadly if allowed to fully power up. @@ -137,11 +137,11 @@ Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. //Town NPCs AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to spread the Steampunker's solutions rather than clean dust and debris off of floors. They can be used to purify the world– or ruin it further, if one so desires. -DILF: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. -FAP: A princess from an unknown land. She drinks constantly in a vain attempt to escape the memories of her past, but is practically immune to alcohol. She makes a business of selling her mixtures, alcoholic and alchemic alike. -SEAHOE: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. -THIEF: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. -WITCH: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. +Archmage: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. +Bandit: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. +BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. +Cirrus: A princess from an unknown land. She drinks constantly in a vain attempt to escape the memories of her past, but is practically immune to alcohol. She makes a business of selling her mixtures, alcoholic and alchemic alike. +SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. SoulSeeker: The Clone's attempt at wielding the souls of the damned as weapons, these retain slightly more autonomy than their Azafurian brethren. And yet given the striking resemblance the bear to the Clone's shell, it's arguable that they might be further from Calamitas' current soul seekers than those found in Azafure's ruins. diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 35b35901e1..d9e582bda8 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1473,6 +1473,11 @@ SarosPossessionBuff: { Description: A radiant aura protects you } +SeashineSwordBuff: { + DisplayName: Seashine Sword + Description: A beautiful dance of crystalline blades... +} + SeaSnailBuff: { DisplayName: Sea Snail Description: Meow? @@ -1594,6 +1599,12 @@ YoungDukeBuff: { } // Misc + +HyperiusCollapse: { + DisplayName: Hyperius Collapse + Description: You should never see this... +} + PopoBuff: { DisplayName: Popo Description: You are a snowman now! diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 61bb06bf81..1e0a46ab2a 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -46,6 +46,15 @@ CalamityClientConfig: { ''' } + CalamityArmorSetBonusDoubleTap: { + Label: "[i:CalamityMod/DesertProwlerHat] Calamity Armor Set Bonuses Can Use Vanilla Hotkey" + Tooltip: + ''' + When enabled, allows Calamity armor set bonuses to be triggered by the vanilla double-tap DOWN hotkey (or UP depending on your settings). + Also allows vanilla armor set bonuses to be triggered by Calamity's armor set bonus hotkey. + ''' + } + ChargeMeter: { Label: "[i:CalamityMod/DraedonPowerCell] Display Charge Meter" Tooltip: @@ -300,6 +309,17 @@ CalamityClientConfig: { ''' } + StutterFix: { + Label: "[i:TrifoldMap] Enable Stutter Fix" + Tooltip: + ''' + When enabled, upon entering a world, the entire world will be loaded at once. + This config causes Terraria to stop responding while the world is being loaded, do NOT close the game while this is occurring. + Once the game starts responding again, you will enter the world and be able to play without random stutters. + This config option is only recommended for players who can't stand random stutters while playing. + ''' + } + SulphuricWaterMeterPosX: { Label: "[i:LaserRuler] Sulphuric Water Poison Meter X Position" Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 7bae0e6b06..f400f33a9f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -106,9 +106,9 @@ AmbrosialAmpoule: { Tooltip: ''' +50 max life - Grants +1 HP/s life regen - Grants +2 to +6 HP/s life regen based on missing health + Grants +2 to +5 HP/s life regen based on missing health Standing still grants +1.5 HP/s life regen and +1 HP/s life regen when inflicted with a damage debuff + Current boost: +[REGEN] HP/s Fire and sickness debuff durations are halved You emit yellow light if visibility is enabled ''' @@ -116,7 +116,11 @@ AmbrosialAmpoule: { AncientFossil: { DisplayName: Ancient Fossil - Tooltip: Increases mining speed by 10% + Tooltip: + ''' + Increases mining speed by 10% + Provides immunity to damage from falling blocks + ''' } AnechoicPlating: { @@ -202,8 +206,10 @@ ArchaicPowder: { DisplayName: Archaic Powder Tooltip: ''' - Increases mining speed by 15% - 5% increased damage reduction and +10 defense while underground or in the underworld + Increases mining speed by 30% + Provides immunity to damage from falling blocks and dart traps + 65% resistance to all damage from traps + Does not stack with downgrades ''' } @@ -211,7 +217,7 @@ AscendantInsignia: { DisplayName: Ascendant Insignia Tooltip: ''' - Increases wing flight time by 50%, movement and jump speed by 10%, and acceleration by 1.5x + Increases wing flight time by 50%, movement and jump speed by 15%, and acceleration by 1.5x Pressing [KEY] grants you the power of ascension, providing infinite flight time for 4 seconds Ascension has a 40 second cooldown ''' @@ -264,7 +270,7 @@ BadgeofBravery: { DisplayName: Badge of Bravery Tooltip: ''' - Increases melee damage and melee crit by 10% + Increases melee damage and critical strike chance by 10% Increases melee armor penetration by 5 ''' } @@ -542,7 +548,12 @@ DarkSunRing: { DeadshotBrooch: { DisplayName: Deadshot Brooch - Tooltip: 10% increased ranged damage, 5% increased ranged critical strike chance and 20% reduced ammo usage + Tooltip: + ''' + 12% increased ranged damage, 7% increased ranged critical strike chance and 20% reduced ammo usage + Pressing [KEY] will automatically swap the order of ammos in your ammo slots + The ammo type swapped depends on the ammo of the weapon you are holding + ''' } DeepDiver: { @@ -854,7 +865,7 @@ GladiatorsLocket: { Tooltip: ''' Enemies drop a healing orb on kill - Gain an increase to your damage and movement speed the lower your health is, up to 20% + Gain an increase to your damage and movement speed the lower your health is, up to 20% at 50% life or below ''' } @@ -999,7 +1010,13 @@ InterstellarStompers: { IronBoots: { DisplayName: Iron Boots - Tooltip: Allows you to sink faster through liquids + Tooltip: + ''' + Hold DOWN to increase your maximum fall speed, even in water + Upon hitting the ground, a shockwave is created at your feet + The shockwave scales in both damage and size the longer you fall for + Negates fall damage + ''' } JellyChargedBattery: { @@ -1029,8 +1046,9 @@ LeviathanAmbergris: { DisplayName: Leviathan Ambergris Tooltip: ''' - 20% increased dash velocity, and dash cooldown is 33% faster + 120% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration Your dashes are empowered by water, knocking back and damaging nearby enemies with viscous currents + Visual effects are reduced if visibility is disabled ''' } @@ -1142,8 +1160,9 @@ NecklaceofVexation: { DisplayName: Necklace of Vexation Tooltip: ''' - 20% increased damage when under 50% life - All attacks inflict acid venom while wearing Reaver armor + Up to 30% increased damage the lower your life is + Current boost: [DAMAGE]% + All attacks inflict acid venom Revenge ''' } @@ -1291,7 +1310,8 @@ PlanebreakersPouch: { ''' 15% increased ranged damage, 5% increased ranged critical strike chance and 20% reduced ammo usage Grants a 20% chance to not consume arrows - Greatly increases all ranged projectile velocity + Pressing [KEY] will automatically swap the ammos in your ammo slots + The ammo type swapped depends on the ammo of the weapon you are holding ''' } @@ -1356,16 +1376,22 @@ Radiance: { Tooltip: ''' +70 max life - Increases life regen based on missing health - Grants +1 HP/s life regen, and +1 HP/s life regen when inflicted with a damaging debuff - Each additional debuff grants 8 defense, which slowly decays while not debuffed - Standing still grants +2 HP/s life regen - Grants 20 defense and stronger regeneration while afflicted with any debuff - The healing eventually slows down if debuffed for an extended period of time - Weaker DoT debuffs are harmless and halves the duration of most other debuffs + Provides greatly improved life regen, increasing with lost health + Gain increased defense from debuffs inflicted on you, and greatly reduces their effectiveness + Current boosts: +[REGEN] HP/s and [DEFENSE] defense. You emit shining blue light if visibility is enabled 'A once putrid crystal, now glimmering with immaculate purity' ''' + HoldShiftTooltip: + ''' + [c/CDF69C:Grants +2 to +5 HP/s life regen based on missing health] + [c/CDF69C:Recover an additional 6 HP/s while inflicted with a debuff] + [c/CDF69C:This eventually slows to 1.33 HP/s when debuffed for an extended time period] + [c/CDF69C:Standing still provides +2 HP/s life regen and faster natural regen recovery] + [c/CDF69C:+20 defense and faster natural regen recovery while afflicted with any debuff] + [c/CDF69C:Each additional debuff grants 8 defense, which slowly decays while not debuffed] + [c/CDF69C:Weak damaging debuffs are harmless and halves the duration of most other debuffs] + ''' } RadiantOoze: { @@ -1373,13 +1399,14 @@ RadiantOoze: { Tooltip: ''' Grants +2 to +6 HP/s life regen based on missing health + Current boost: +[REGEN] HP/s You emit yellow light if visibility is enabled ''' } RaidersTalisman: { DisplayName: Raider's Talisman - Tooltip: Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds + Tooltip: Stealth strikes grant 15% critical strike chance to non-stealth strikes for 10 seconds } RampartofDeities: { @@ -1440,7 +1467,7 @@ RottenBrain: { RottenDogtooth: { DisplayName: Rotten Dogtooth - Tooltip: Stealth strikes inflict Crumbling and deal 8% more damage + Tooltip: Stealth strikes inflict Crumbling for 2.5 seconds and deal 8% more damage } RoverDrive: { @@ -1490,7 +1517,7 @@ SandSharkToothNecklace: { Tooltip: ''' Increases armor penetration by 10 - 6% increased damage + 10% increased damage ''' } @@ -1564,8 +1591,12 @@ ShieldoftheOcean: { DisplayName: Shield of the Ocean Tooltip: ''' - Increased defense by 5 when submerged in liquid - 10% increased movement speed and +1 HP/s life regen while wearing Victide armor + Pressing [KEY] will activate a parry, encasing you in a bubble + Being hit shortly after encasement will pop the bubble, granting 60% DR for that hit + Upon popping, nearby enemies are violently launched away from you, and will be damaged if they collide with tiles + Enemies which cannot be launched instead directly take large damage + After popping, the damage reducing effect goes on a 20 second cooldown + Damage parried whilst on cooldown will not be reduced, and will not deal collision damage to launched enemies ''' } @@ -1590,6 +1621,7 @@ SlagsplitterPauldron: { ''' You gain 10% damage reduction while dashing, and enemies are inflicted with Armor Crunch Your dashes are empowered by fire, shredding enemies near you with violent explosions + Visual effects are reduced if visibility is disabled ''' } @@ -1665,12 +1697,11 @@ StatisNinjaBelt: { DisplayName: Statis' Ninja Belt Tooltip: ''' - 32% increased jump speed, allows auto-jump, and negates fall damage - Increases movement acceleration and deceleration by 1.75x - Increases movement speed by 1.15x. This bonus applies to running boot accessories - Grants the ability to swim, climb walls, dash, and dodge attacks - Provides light when worn - {$Common.AbyssLightLevel1} + Provides a high-speed dash that scales with your movement speed + 10% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage + Increases movement acceleration and deceleration by 1.6x + Grants the ability to swim, climb walls, and dodge attacks + Consecutive dashes in the same direction reduce dash speed ''' HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1679,13 +1710,12 @@ StatisVoidSash: { DisplayName: Statis' Void Sash Tooltip: ''' - 32% increased jump speed, allows auto-jump, and negates fall damage - Increases movement acceleration and deceleration by 1.75x - Increases movement speed by 1.15x. This bonus applies to running boot accessories - Grants the ability to swim, climb walls, dash, and dodge attacks - Dashes leave homing scythes in your wake - Provides light when worn - {$Common.AbyssLightLevel1} + Provides a high-speed dash that scales with your movement speed + 20% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage + Increases movement acceleration and deceleration by 1.85x + Grants the ability to swim, climb walls, and dodge attacks + Visual effects are reduced if visibility is disabled + Consecutive dashes in the same direction reduce dash speed ''' HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1866,8 +1896,8 @@ TheEvolution: { ''' Reflects projectiles that hit you, negating their damage and dealing 10x damage to enemies {$Common.ReflectInformation} - Reflecting a projectile grants +6 HP/s life regen for 5 seconds and grants maximum natural life regen - Getting hit by the same enemy projectile type during cooldown will resist its damage by 20% + Reflecting a projectile grants maximum natural life regen for 10 seconds + Getting hit by the same enemy projectile type during cooldown will resist its damage by 25% ''' } @@ -1885,9 +1915,9 @@ TheSponge: { Tooltip: ''' Gain a barrier with 180 health - The barrier grants 30 defense and 10% damage reduction while active + The barrier grants 20 defense and 10% damage reduction while active [ADREN] - Once depleted, the barrier will regenerate 9 seconds after being hit + The barrier will regenerate 8 seconds after being hit, taking 10 seconds to completely regenerate Getting hit resets the timer ''' ShieldAdren: Halved Adrenaline loss if all damage is absorbed @@ -1929,7 +1959,7 @@ TrinketofChi: { DisplayName: Trinket of Chi Tooltip: ''' - Increases damage reduction by 4% if you avoid taking damage for 5 seconds + Increases damage reduction by 8% if you avoid taking damage for 10 seconds This buff expires on hit +1 HP/s life regen for teammates ''' @@ -1949,8 +1979,11 @@ VampiricTalisman: { Tooltip: ''' Rogue critical strikes steal enemy life - 12% increased rogue damage + Stealth strikes grant 15% critical strike chance and increased lifesteal to non-stealth strikes for 10 seconds + Stealth strikes inflict Heavy Bleeding and Armor Crunch, and deal 8% more damage + 'Possessing the talisman makes you yearn for blood' ''' + YearningForBlood: THIS ENDLESS HUNGER WON'T END } VeneratedLocket: { @@ -2001,7 +2034,7 @@ WarbanneroftheRighteous: { DisplayName: Warbanner of the Righteous Tooltip: ''' - Damage is increased by 20% when close to enemies, but decreased by 60% when none are nearby + Damage is increased by 20% when close to enemies, but decreased by 40% when none are nearby Emit a blazing aura that burns and repels nearby enemies Enemies take increasing damage the closer they are to you and the longer they are near you Effects are transparent and silent if visibility is disabled @@ -2026,8 +2059,10 @@ WulfrumAcrobaticsPack: { DisplayName: Wulfrum Acrobatics Pack Tooltip: ''' - Transforms equipped hooks into a wulfrum slingshot + Provides a wulfrum slingshot grappling hook + This slingshot's stats scale with your equipped hook The slingshot allows for advanced rope-swinging physics + Hold UP or DOWN to retract or extend the slingshot's rope Automatically grapples nearby walls if a lethal fall is detected This safety feature won't activate if DOWN is held 8% increased movement speed diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 31f7ee1828..c5a3e29830 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -12,7 +12,7 @@ BloodfireArrow: { Tooltip: ''' High-velocity arrows with a blood soaked tip - Firing these arrows will drain your health + Firing these arrows will drain your health and boost the arrow damage by 30% Accelerates your natural life regen and heals you on hit ''' } @@ -21,9 +21,9 @@ BloodfireBullet: { DisplayName: Bloodfire Bullet Tooltip: ''' - Passes through tiles and accelerates your natural life regen on hit - Deals bonus damage based on your current life regen and natural life regen - This damage caps at 35 + Passes through tiles and accelerates your natural life regen on hit based on how powerful the hit was + Deals bonus damage based on your current natural life regen + This damage caps at 1.1x ''' } @@ -58,7 +58,11 @@ ElysianArrow: { FlashRound: { DisplayName: Flash Round - Tooltip: Emits a wide-reaching concussive blast which briefly confuses enemies + Tooltip: + ''' + A ricocheting bullet that confuses enemies when it flashes and deals more damage with each bounce + The damage bonus is 1.13x or +2 flat damage per bounce, depending on which is stronger + ''' } GodSlayerSlug: { @@ -92,14 +96,22 @@ HolyFireBullet: { DisplayName: Holy Fire Bullet Tooltip: ''' - Profaned bullets that explode on impact, dealing extra damage - The explosion grows weaker the further the bullet travels + Profaned bullets that deal 1.15x damage and explode on impact + The explosion is larger and the bullet deals increased damage if impact occurs immediately after firing + The extra damage bonus caps at 1.15x ''' } HyperiusBullet: { DisplayName: Hyperius Bullet - Tooltip: Dazzling multicolor bullets that split into swirling lights on impact + Tooltip: + ''' + Dazzling multicolor bullets that split into swirling lights on impact + Damage that would be dealt from the bullets is instead stored on the target + As more damage is stored, it will begin to overflow, slowly releasing and damaging the enemy + Attacks from sources other than Hyperius Bullets will release some of the charge + Releasing charge in this way deals 20% more damage + ''' } IcicleArrow: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 5e1106ae0f..91905b3659 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -2,14 +2,14 @@ AstralBreastplate: { DisplayName: Astral Breastplate Tooltip: ''' - 10% increased damage + 7% increased damage +80 max mana and +20 max life ''' } AstralHelm: { DisplayName: Astral Helm - Tooltip: 5% increased damage and 15% increased critical strike chance + Tooltip: 5% increased damage and 10% increased critical strike chance SetBonus: ''' +3 max minions @@ -24,7 +24,7 @@ AstralLeggings: { DisplayName: Astral Leggings Tooltip: ''' - 10% increased damage + 5% increased damage 15% increased movement speed ''' } @@ -353,8 +353,8 @@ MolluskShelleggings: { DisplayName: Mollusk Shelleggings Tooltip: ''' - 12% increased damage and 4% increased critical strike chance - 7% decreased movement speed + 6% increased damage and 4% increased critical strike chance + Your horizontal movement is slowed ''' } @@ -364,12 +364,12 @@ MolluskShellmet: { ''' 5% increased damage and 4% increased critical strike chance You can move freely through liquids + Your horizontal movement is slowed ''' SetBonus: ''' Two shellfishes aid you in combat - 10% increased damage - Your horizontal movement is slowed + 10% increased damage reduction ''' } @@ -377,8 +377,8 @@ MolluskShellplate: { DisplayName: Mollusk Shellplate Tooltip: ''' - 10% increased damage and 6% increased critical strike chance - 15% decreased movement speed + 6% increased damage and 5% increased critical strike chance + Your horizontal movement is slowed ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index f94a0fd15a..acf38e0bb2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -20,7 +20,29 @@ AuricTeslaCuisses: { AuricTeslaHoodedFacemask: { DisplayName: Auric Tesla Hooded Facemask Tooltip: 30% increased ranged damage and critical strike chance - SetBonus: Ranged Tarragon, Bloodflare and God Slayer armor effects + SetBonus: + ''' + Ranged Tarragon, Bloodflare and God Slayer armor effects + Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + ''' + SetBonus1: + ''' + Inherited Tarragon Set Bonus: + {$TarragonHeadRanged.SetBonusEffect} + {$TarragonBreastplate.CommonSetBonus} + ''' + SetBonus2: + ''' + Inherited Bloodflare Set Bonus: + {$BloodflareHeadRanged.SetBonusEffect} + {$BloodflareBodyArmor.CommonSetBonus} + ''' + SetBonus3: + ''' + Inherited God Slayer Set Bonus: + {$GodSlayerHeadRanged.SetBonusEffect} + {$GodSlayerChestplate.CommonSetBonus} + ''' } AuricTeslaPlumedHelm: { @@ -32,8 +54,27 @@ AuricTeslaPlumedHelm: { ''' SetBonus: ''' - Rogue Tarragon, Bloodflare and God Slayer armor effects +130 maximum stealth + Rogue Tarragon, Bloodflare and God Slayer armor effects + Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + ''' + SetBonus1: + ''' + Inherited Tarragon Set Bonus: + {$TarragonHeadRogue.SetBonusEffect} + {$TarragonBreastplate.CommonSetBonus} + ''' + SetBonus2: + ''' + Inherited Bloodflare Set Bonus: + {$BloodflareHeadRogue.SetBonusEffect} + {$BloodflareBodyArmor.CommonSetBonus} + ''' + SetBonus3: + ''' + Inherited God Slayer Set Bonus: + {$GodSlayerHeadRogue.SetBonusEffect} + {$GodSlayerChestplate.CommonSetBonus} ''' } @@ -46,9 +87,28 @@ AuricTeslaRoyalHelm: { ''' SetBonus: ''' - Melee Tarragon, Bloodflare and God Slayer effects Enemies are more likely to target you 28% increased melee speed + Melee Tarragon, Bloodflare and God Slayer effects + Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + ''' + SetBonus1: + ''' + Inherited Tarragon Set Bonus: + {$TarragonHeadMelee.SetBonusEffect} + {$TarragonBreastplate.CommonSetBonus} + ''' + SetBonus2: + ''' + Inherited Bloodflare Set Bonus: + {$BloodflareHeadMelee.SetBonusEffect} + {$BloodflareBodyArmor.CommonSetBonus} + ''' + SetBonus3: + ''' + Inherited God Slayer Set Bonus: + {$GodSlayerHeadMelee.SetBonusEffect} + {$GodSlayerChestplate.CommonSetBonus} ''' } @@ -57,9 +117,28 @@ AuricTeslaSpaceHelmet: { Tooltip: 15% increased summon damage SetBonus: ''' - Summoner Tarragon, Bloodflare and Silva armor effects Max run speed and acceleration boosted by 5% +6 max minions and 75% increased summon damage + Summoner Tarragon, Bloodflare and Silva armor effects + Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + ''' + SetBonus1: + ''' + Inherited Tarragon Set Bonus: + {$TarragonHeadSummon.SetBonusEffect} + {$TarragonBreastplate.CommonSetBonus} + ''' + SetBonus2: + ''' + Inherited Bloodflare Set Bonus: + {$BloodflareHeadSummon.SetBonusEffect} + {$BloodflareBodyArmor.CommonSetBonus} + ''' + SetBonus3: + ''' + Inherited Silva Set Bonus: + {$SilvaHeadSummon.SetBonusEffect} + {$SilvaArmor.CommonSetBonus} ''' } @@ -68,8 +147,27 @@ AuricTeslaWireHemmedVisage: { Tooltip: 30% increased magic damage, 20% increased magic critical strike chance, +100 max mana and 20% reduced mana usage SetBonus: ''' - Magic Tarragon, Bloodflare and Silva armor effects Max run speed and acceleration boosted by 5% + Magic Tarragon, Bloodflare and Silva armor effects + Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + ''' + SetBonus1: + ''' + Inherited Tarragon Set Bonus: + {$TarragonHeadMagic.SetBonusEffect} + {$TarragonBreastplate.CommonSetBonus} + ''' + SetBonus2: + ''' + Inherited Bloodflare Set Bonus: + {$BloodflareHeadMagic.SetBonusEffect} + {$BloodflareBodyArmor.CommonSetBonus} + ''' + SetBonus3: + ''' + Inherited Silva Set Bonus: + {$SilvaHeadMagic.SetBonusEffect} + {$SilvaArmor.CommonSetBonus} ''' } @@ -96,7 +194,8 @@ BloodflareCuisses: { BloodflareHeadMagic: { DisplayName: Bloodflare Hydra Hood Tooltip: 20% increased magic damage, 10% increased magic critical strike chance, +100 max mana and 17% reduced mana usage - SetBonus: + SetBonus: "{$BloodflareHeadMagic.SetBonusEffect}" + SetBonusEffect: ''' Magic weapons fire ghostly bolts every 1.67 seconds Magic critical strikes cause blood explosions every 2 seconds @@ -110,6 +209,10 @@ BloodflareHeadMelee: { ''' 18% increased melee speed Enemies are more likely to target you + {$BloodflareHeadMelee.SetBonusEffect} + ''' + SetBonusEffect: + ''' True melee strikes will heal you After striking an enemy 15 times with true melee you will enter a blood frenzy for 5 seconds During this you will gain 25% increased melee damage, critical strike chance, and contact damage is halved @@ -120,7 +223,8 @@ BloodflareHeadMelee: { BloodflareHeadRanged: { DisplayName: Bloodflare Horned Helm Tooltip: 10% increased ranged damage and critical strike chance - SetBonus: + SetBonus: "{$BloodflareHeadRanged.SetBonusEffect}" + SetBonusEffect: ''' Press {0} to unleash the lost souls of polterghast to destroy your enemies This effect has a 30 second cooldown @@ -138,6 +242,10 @@ BloodflareHeadRogue: { SetBonus: ''' +120 maximum stealth + {$BloodflareHeadRogue.SetBonusEffect} + ''' + SetBonusEffect: + ''' Being over 80% life boosts your defense by 30 and rogue crit by 5% Being below 80% life boosts your rogue damage by 10% Rogue critical strikes heal you @@ -150,6 +258,10 @@ BloodflareHeadSummon: { SetBonus: ''' 50% increased summon damage and +3 max minions + {$BloodflareHeadSummon.SetBonusEffect} + ''' + SetBonusEffect: + ''' Summons polterghast mines to circle you At 90% life and above you gain 10% increased summon damage At 50% life and below you gain 20 defense and +1 HP/s life regen @@ -307,7 +419,7 @@ GodSlayerChestplate: { ''' +60 max life Enemies take damage when they hit you - 11% increased damage and 6% increased critical strike chance + 11% increased damage and 8% increased critical strike chance ''' CommonSetBonus: ''' @@ -329,6 +441,10 @@ GodSlayerHeadMelee: { ''' 20% increased melee speed Enemies are more likely to target you + {$GodSlayerHeadMelee.SetBonusEffect} + ''' + SetBonusEffect: + ''' Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts Enemies take a lot of damage when they hit you ''' @@ -337,7 +453,8 @@ GodSlayerHeadMelee: { GodSlayerHeadRanged: { DisplayName: God Slayer Helmet Tooltip: 14% increased ranged damage and critical strike chance - SetBonus: You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds + SetBonus: "{$GodSlayerHeadRanged.SetBonusEffect}" + SetBonusEffect: You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds } GodSlayerHeadRogue: { @@ -350,6 +467,10 @@ GodSlayerHeadRogue: { SetBonus: ''' +120 maximum stealth + {$GodSlayerHeadRogue.SetBonusEffect} + ''' + SetBonusEffect: + ''' While at full HP all of your rogue stats are boosted by 10% If you take over 80 damage in one hit you will be given extra immunity frames ''' @@ -359,8 +480,8 @@ GodSlayerLeggings: { DisplayName: God Slayer Leggings Tooltip: ''' - 5% increased movement speed - 10% increased damage and critical strike chance + 10% increased movement speed + 11% increased damage and critical strike chance ''' } @@ -383,11 +504,11 @@ OmegaBlueHelmet: { ''' SetBonus: ''' - Increases armor penetration by 15 10% increased damage and critical strike chance and +2 max minions Short-ranged tentacles heal you by sucking enemy life Press {0} to activate abyssal madness for 5 seconds - Abyssal madness increases damage, critical strike chance, and tentacle aggression/range + Abyssal madness increases damage and critical strike chance by 10% + It also increases tentacle aggression and range, and allows them to critically strike This effect has a 25 second cooldown ''' } @@ -445,7 +566,7 @@ SilvaArmor: { Tooltip: ''' +80 max life - 12% increased damage and 8% increased critical strike chance + 11% increased damage and 8% increased critical strike chance ''' CommonSetBonus: ''' @@ -463,7 +584,8 @@ SilvaHeadMagic: { 23% increased magic damage and 13% increased magic critical strike chance +100 max mana and 19% reduced mana usage ''' - SetBonus: Magic projectiles which cannot pierce will occasionally set off potent blasts of nature energy + SetBonus: "{$SilvaHeadMagic.SetBonusEffect}" + SetBonusEffect: Magic projectiles which cannot pierce will occasionally set off potent blasts of nature energy } SilvaHeadSummon: { @@ -472,8 +594,9 @@ SilvaHeadSummon: { SetBonus: ''' 65% increased summon damage and +5 max minions - Summons an ancient leaf prism to blast your enemies with life energy + {$SilvaHeadSummon.SetBonusEffect} ''' + SetBonusEffect: Summons an ancient leaf prism to blast your enemies with life energy } SilvaLeggings: { @@ -481,7 +604,7 @@ SilvaLeggings: { Tooltip: ''' 10% increased movement speed - 12% increased damage and critical strike chance + 11% increased damage and critical strike chance ''' } @@ -507,7 +630,8 @@ TarragonHeadMagic: { 15% increased magic damage and 10% increased magic critical strike chance 10% increased damage reduction, +100 max mana, and 15% reduced mana usage ''' - SetBonus: + SetBonus: "{$TarragonHeadMagic.SetBonusEffect}" + SetBonusEffect: ''' On every 5th critical strike you will fire a leaf storm Magic projectiles heal you on enemy hits @@ -526,6 +650,10 @@ TarragonHeadMelee: { ''' 15% increased melee speed Enemies are more likely to target you + {$TarragonHeadMelee.SetBonusEffect} + ''' + SetBonusEffect: + ''' Taking damage gives the Tarra Life buff, which grants +1.5 HP/s life regen Press {0} to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds This has a 30 second cooldown @@ -539,7 +667,8 @@ TarragonHeadRanged: { 10% increased ranged damage and critical strike chance 10% increased damage reduction ''' - SetBonus: Ranged projectiles split into homing life energy and leaves on death + SetBonus: "{$TarragonHeadRanged.SetBonusEffect}" + SetBonusEffect: Ranged projectiles split into homing life energy and leaves on death } TarragonHeadRogue: { @@ -552,6 +681,10 @@ TarragonHeadRogue: { SetBonus: ''' +115 maximum stealth + {$TarragonHeadRogue.SetBonusEffect} + ''' + SetBonusEffect: + ''' After every 50 rogue critical hits you will gain 2.5 seconds of damage immunity This effect has a cooldown of 25 seconds While under the effects of a debuff you gain 10% increased rogue damage @@ -564,8 +697,9 @@ TarragonHeadSummon: { SetBonus: ''' 50% increased summon damage and +3 max minions - Summons a life aura around you that damages nearby enemies + {$TarragonHeadSummon.SetBonusEffect} ''' + SetBonusEffect: Summons a life aura around you that damages nearby enemies } TarragonLeggings: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index e6c83d21fe..5856fdccf4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -331,3 +331,8 @@ YharonSoulFragment: { DisplayName: Yharon Soul Fragment Tooltip: A shard of a draconic Auric Soul } + +AnodizedWulfrumMetal: { + DisplayName: Anodized Wulfrum Metal + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 74cc606294..afef9d3c6a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -677,6 +677,11 @@ YharonRelic: { Tooltip: A glimpse into what will be... } +CausticTorch: { + DisplayName: Caustic Torch + Tooltip: Can be placed in water +} + ChaosCandle: { DisplayName: Chaos Candle Tooltip: The mere presence of this candle enrages surrounding enemies drastically @@ -699,6 +704,7 @@ AltarOfTheAccursedItem: { Offer [i:CalamityMod/AshesofCalamity] {$Items.Materials.AshesofCalamity.DisplayName} at this altar to summon the Witch Doing so will create a square arena of blocks, with the altar at its center The Witch enrages while you are outside of the arena + Hovering over the altar while using ruler measurements will display a temporary arena box {$CommonItemTooltip.SpecialCrafting} ''' } @@ -886,6 +892,11 @@ FrigidMonolith: { Tooltip: "'Enchant the sky with frosty auroras.'" } +KelpTorch: { + DisplayName: Kelp Torch + Tooltip: Can be placed in water +} + OtonilouStatue: { DisplayName: Otonilou Memorial Tooltip: "" @@ -968,11 +979,21 @@ ThaumaticChair: { Tooltip: One of Chloe's finest creations } +ThermalTorch: { + DisplayName: Thermal Torch + Tooltip: Can be placed in water +} + TranquilityCandle: { DisplayName: Tranquility Candle Tooltip: The mere presence of this candle calms surrounding enemies drastically } +VoidTorch: { + DisplayName: Void Torch + Tooltip: Can be placed in water +} + AnahitaTrophy: { DisplayName: Anahita Trophy Tooltip: "" @@ -1293,11 +1314,6 @@ AbyssTable: { Tooltip: "" } -AbyssTorch: { - DisplayName: Abyss Torch - Tooltip: Can be placed in water -} - AbyssWorkBench: { DisplayName: Abyss Work Bench Tooltip: "" @@ -4198,3 +4214,118 @@ RunestoneWall: { DisplayName: Runestone Wall Tooltip: "" } + +WulfrumEnergyBarrier: { + DisplayName: Wulfrum Energy Barrier + Tooltip: "" +} + +WulfrumPanels: { + DisplayName: Wulfrum Panels + Tooltip: "" +} + +ChargedWulfrumEnergyBarrier: { + DisplayName: Charged Wulfrum Energy Barrier + Tooltip: "" +} + +WulfrumEnergyBarrierWall: { + DisplayName: Wulfrum Energy Barrier Wall + Tooltip: "" +} + +ChargedWulfrumEnergyBarrierWall: { + DisplayName: Charged Wulfrum Energy Barrier Wall + Tooltip: "" +} + +WulfrumPlatform: { + DisplayName: Wulfrum Platform + Tooltip: "" +} + +WulfrumSheets: { + DisplayName: Wulfrum Sheets + Tooltip: "" +} + +WulfrumSiding: { + DisplayName: Wulfrum Siding + Tooltip: "" +} + +WulfrumPillar: { + DisplayName: Wulfrum Pillar + Tooltip: "" +} + +WulfrumComplexPanelWall: { + DisplayName: Wulfrum Complex Panel Wall + Tooltip: "" +} + +AnodizedWulfrumPlatform: { + DisplayName: Anodized Wulfrum Platform + Tooltip: "" +} + +AnodizedWulfrumTrim: { + DisplayName: Anodized Wulfrum Trim + Tooltip: "" +} + +RoundedAnodizedWulfrumPanels: { + DisplayName: Rounded Anodized Wulfrum Panels + Tooltip: "" +} + +AnodizedWulfrumTrimWall: { + DisplayName: Anodized Wulfrum Trim Wall + Tooltip: "" +} + +RoundedAnodizedWulfrumPanelWall: { + DisplayName: Rounded Anodized Wulfrum Panel Wall + Tooltip: "" +} + +AnodizedWulfrumPanels: { + DisplayName: Anodized Wulfrum Panels + Tooltip: "" +} + +WulfrumPanelWall: { + DisplayName: Wulfrum Panel Wall + Tooltip: "" +} + +ChargedWulfrumWallMountedBulb: { + DisplayName: Mods.CalamityMod.Items.Placeables.ChargedWulfrumWallMountedBulb.DisplayName + Tooltip: "" +} + +WulfrumWallMountedBulb: { + DisplayName: Mods.CalamityMod.Items.Placeables.WulfrumWallMountedBulb.DisplayName + Tooltip: "" +} + +WulfrumSheetWall: { + DisplayName: Wulfrum Sheet Wall + Tooltip: "" +} + +WulfrumSidingWall: { + DisplayName: Wulfrum Siding Wall + Tooltip: "" +} + +Dunesand: { + DisplayName: Dunesand + Tooltip: "" +} + +EutrophicGlassWall: { + DisplayName: Eutrophic Glass Wall + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index eda5f6d73f..051ecad1a8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -440,3 +440,12 @@ Salak: { DisplayName: Salak Tooltip: "{$CommonItemTooltip.MinorStats}" } + +ShroomBowl: { + DisplayName: Shroom Bowl + Tooltip: + ''' + {$CommonItemTooltip.MediumStats} + 'He has been grounded' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 248ea0cf93..9c176472a5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -1,11 +1,12 @@ -FrequencyManipulator: { - DisplayName: Frequency Manipulator +AerialTracker: { + DisplayName: P-LSR: Aerial Tracker Tooltip: ''' - Swings a spear around and then throws it - On collision, the spear releases a burst of homing energy - Stealth strikes release more energy and explode on collision - [c/1FFBFF:'A lengthy device originally used for mechanical tuning.'] + Releases a flying disk that fires lasers at nearby enemies + Lasers do not directly damage enemies, but instead apply a stacking laser burn effect + Once hit by enough lasers or sufficient time has passed, laser burn will deal direct damage + The disk gains acceleration as it returns to the player + Stealth strikes toss two disks that can fire at multiple different targets from farther range ''' } @@ -48,18 +49,16 @@ GaussPistol: { ''' } -GaussRifle: { - DisplayName: Gauss Rifle - Tooltip: Fires a devastating powerful high-velocity blast with absurd knockback -} - -HeavyLaserRifle: { - DisplayName: Heavy Laser Rifle +HolofiberImmolator: { + DisplayName: R-PMA: Holofiber Immolator Tooltip: ''' - Fires an incredibly accurate pair of destructive laser beams - [c/1FFBFF:'Though Godseeker Knights are often brutish, not all prefer close quarters melee combat.] - [c/1FFBFF:As such, Yharim personally requested that I create heavy weaponry for them despite being few in number.'] + Fires three gravity-affected plasma drops which dissolve through foes + Holding quickly charges the bow, firing a high-speed plasma arrow + Plasma arrows will detonate after impact, creating stronger explosions if stuck into tiles + Holding while firing will repeatedly fire uncharged shots + [c/1FFBFF:'The elegance of holofibre is unmatched.] + [c/1FFBFF:However, mechanical tension may have produced more consistent results.'] ''' } @@ -74,20 +73,24 @@ HydraulicVoltCrasher: { ''' } -MatterModulator: { - DisplayName: Matter Modulator - Tooltip: - ''' - Fires a burst of unstable matter that pierces infinitely but deals little damage - After striking a tile, the matter will gain enhanced damage and no longer pierce - ''' -} - MountedScanner: { DisplayName: Mounted Scanner Tooltip: Summons a powerful scanner module above your head that fires lasers at nearby enemies } +Nidhogg: { + DisplayName: B-GSS: Nidhogg + Tooltip: + ''' + A magnet powered energy railgun that fires rapidly, creating lingering magnetic implosions that pull in weak enemies on hit + Only one implosion can exist at a time + Press to begin charging a devastating energy beam that always crits and will fire once ready + This charge attack can not be interrupted once started and has a long cooldown + [c/1FFBFF:'Many soldiers underestimate the destructive capabilities of magnetism.] + [c/1FFBFF:This railgun has reliably pulled in skeptics of its crushing efficiency.'] + ''' +} + Phaseslayer: { DisplayName: Phaseslayer Tooltip: @@ -137,13 +140,28 @@ PulseDragon: { ''' } +PulseGrenade: { + DisplayName: R-PLS: Pulse Grenade + Tooltip: + ''' + A regenerating grenade that will track enemies and burst into 8 pulse orbs + Pulse orbs will return to you and reform the grenade, hitting anything in their path + Stealth strikes throw the grenade at high speeds and burst into twice as many orbs + ''' +} + PulsePistol: { - DisplayName: Pulse Pistol - Tooltip: Fires a pulse that arcs to a new target on enemy hits + DisplayName: P-PLS: Pulse Pistol + Tooltip: + ''' + Fires a pulse orb that tracks nearby targets + After hitting an enemy, the pulse orb will split in two + Pulse orb pierce will increase when killing enemies + ''' } PulseRifle: { - DisplayName: Pulse Rifle + DisplayName: A-PLS: Pulse Rifle Tooltip: ''' Fires an enhanced pulse beam that dissipates into 4 high-frequency pulse orbs on hit @@ -164,6 +182,31 @@ PulseTurretRemote: { ''' } +PhalanxSurge: { + DisplayName: W-LSR: Phalanx Surge + Tooltip: + ''' + Fires a spread of lasers + Holding charges the weapon, allowing it to thrust forward and impale enemies with an energy spear + Holding when firing the charge attack will launch you forward at high speeds and deal extra damage + Using the charged attack has a short cooldown + [c/1FFBFF:'There was much call from Yharim's forces for close range armaments.] + [c/1FFBFF:A laser lance with which to gore their foes was met with thunderous applause.'] + ''' +} + +ShortCircuit: { + DisplayName: P-TSL: Short Circuit + Tooltip: + ''' + Press to rapidly fire stunning bolts with high knockback + Press to shoot a hook that attaches to enemies and rapidly electrocutes them + After electrocuting an enemy enough, the hook will create a shock explosion before returning to you + Successful hook attacks have a short cooldown that is applied unless the hook kills an enemy + {$Common.ArmorPenetration} + ''' +} + SnakeEyes: { DisplayName: Snake Eyes Tooltip: @@ -195,15 +238,6 @@ SystemBane: { ''' } -Taser: { - DisplayName: Taser - Tooltip: - ''' - Shoots a hook that attaches to enemies and electrocutes them before returning - A slow, simple electric weapon, meant only for low ranking guards - ''' -} - TeslaCannon: { DisplayName: Tesla Cannon Tooltip: @@ -223,16 +257,6 @@ TheAnomalysNanogun: { ''' } -TrackingDisk: { - DisplayName: Tracking Disk - Tooltip: - ''' - Releases a flying disk that fires lasers at nearby enemies - This disk gains acceleration as it returns to the player - Stealth strikes fire lasers at a faster rate and distance, and can fire at multiple different targets - ''' -} - WavePounder: { DisplayName: Wave Pounder Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index fa5537a35f..b6a8a7aef9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -60,9 +60,11 @@ ApoctosisArray: { DisplayName: Apoctosis Array Tooltip: ''' - Fires ion blasts that speed up and then explode - Damage scales with how full your mana is - Using Astral Injection reduces the effectiveness of the mana boost + Rapidly fires an array of ion blasts with heavy armor penetration that accelerate and explode + Press to charge the blaster, restoring your mana until it reaches max + The more mana you restore, the stronger the arrow is when you release it + Charging for 90% of your max mana or more will reach max power + Holding this weapon disables the pickup of stars ''' } @@ -495,9 +497,11 @@ IonBlaster: { DisplayName: Ion Blaster Tooltip: ''' - Fires ion blasts that speed up and then explode - Damage scales with how full your mana is - Using Astral Injection reduces the effectiveness of the mana boost + Rapidly fires ion blasts with heavy armor penetration that accelerate and explode + Press to charge the blaster, restoring your mana until it reaches max + The more mana you restore, the stronger the burst is when you release it + Charging for 90% of your max mana or more will reach max power + Holding this weapon disables the pickup of stars ''' } @@ -519,11 +523,6 @@ LashesofChaos: { ''' } -Lazhar: { - DisplayName: Lazhar - Tooltip: Fires a highly volatile concentrated solar beam -} - LightGodsBrilliance: { DisplayName: Light God's Brilliance Tooltip: Casts small, homing light beads along with explosive light balls diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 1f831bc623..fbba76be1c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -749,7 +749,7 @@ Hellkite: { An ancient blade created during the Draconic Era by Azafure's finest forgemaster Swings a slow and heavy blade with powerful knockback Holding will begin charging a strengthened swing - Releasing while fully charged will unleash a devastating slash + Releasing while fully charged will unleash a devastating slash that always critically strikes [c/E1B65F:'Feel the strength of a blade forged through passion'] ''' TooltipGFB: @@ -757,7 +757,7 @@ Hellkite: { An ancient blade created during the Draconic Era by Azafure's finest forgemaster Swings a slow and heavy blade with powerful knockback Holding will begin charging a strengthened swing - Releasing while fully charged will unleash a devastating slash + Releasing while fully charged will unleash a devastating slash that always critically strikes [c/0C507F:'My beloved <3' -Xyk] ''' } @@ -1068,7 +1068,7 @@ Riptide: { Tooltip: ''' {$Common.YoyoStats} - Occasionally pulses a riptide wave with heavy knockback + Rapidly pulses riptide waves which get larger the more hits landed by the yoyo ''' } @@ -1106,11 +1106,6 @@ ScourgeoftheCosmos: { Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on enemy and tile hits } -SeashineSword: { - DisplayName: Seashine Sword - Tooltip: Shoots an aqua sword beam -} - SeekingScorcher: { DisplayName: Seeking Scorcher Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index e4025b826b..d4036cd346 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -7,6 +7,7 @@ AcesHigh: { Spades pierce enemies Diamonds violently explode Clubs split into three + 80% chance to save ammo ''' } @@ -82,7 +83,11 @@ Arbalest: { Archerfish: { DisplayName: Archerfish - Tooltip: Converts musket balls into streams of water + Tooltip: + ''' + Converts musket balls into streams of water + 33% chance to save ammo + ''' } ArcNovaDiffuser: { @@ -467,9 +472,8 @@ FetidEmesis: { ''' Fires an accelerating stream of bullets until the barrel overheats When the barrel overheats, a spread of fetid chunks is vomited out - Holding while firing will hold in the chunks - If held in for long enough, more chunks will be fired After firing, the gun must cool back down before it can be used again + Pressing while firing will instantly launch the chunks 75% chance to save ammo ''' } @@ -616,7 +620,7 @@ Hellborn: { ''' An ornate firearm created during the Draconic Era by Azafure's finest forgemaster Hold to twirl the gun in your hand, rapidly hitting nearby enemies - Hits with the gun itself add rounds to the gun, up to a max of 8 + Hits with the gun itself add rounds to the gun, up to a max of 12 At the cost of one round, hold to fire a giant energy sphere with potent recoil [c/E1B65F:'Know the grace of a gun forged through beauteous inspiration'] ''' @@ -985,7 +989,7 @@ PristineFury: { Tooltip: ''' Fires an intense helix of flames that burst into a column of smoke - to disperse flammable crystalline powder + to disperse a limited supply of flammable crystalline powder that restores over time Powder can be ignited, causuing it to explode for extra damage Both helix flames and other nearby explosions can ignite the powder Uses gel for ammo diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index ddacc2c83d..2d5549e4c7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1391,7 +1391,8 @@ Whitewater: { Throws a flask of magic white water at the cursor that glows after a short while Flasks that hit enemies while glowing release four water spears that converge back on the flask's position If the flask hits an enemy or gets too far, it will return to the owner - Stealth strikes create eight water spears and summon a swirling whitewater vortex that heals players and knocks back enemies + Stealth strikes create six water spears and summon a swirling whitewater vortex that heals players and knocks back enemies + Allies that enter the vortex will heal for twice as long ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 42d411ed19..dff9c92674 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -669,6 +669,17 @@ ScabRipper: { Tooltip: Summons a baby blood crawler to protect you } +SeashineHilt: { + DisplayName: Seashine Hilt + Tooltip: + ''' + Summons a brilliant sea prism blade to slice your enemies + Blades will charge up while you hold this item + Pressing will order all fully charged blades to swipe at your cursor + Each sword only consumes half a minion slot + ''' +} + ShellfishStaff: { DisplayName: Shellfish Staff Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson index 193563e512..8f12f250f0 100644 --- a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson +++ b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson @@ -1,5 +1,6 @@ ActivateAccessoryParry.DisplayName: Activate Accessory Parry AdrenalineMode.DisplayName: Adrenaline Mode +AmmoCycle.DisplayName: Ammo Cycle Hotkey AngelicAllianceBlessing.DisplayName: Angelic Alliance Blessing ArmorSetBonus.DisplayName: Armor Set Bonus AscendantInsigniaHotKey.DisplayName: Ascendant Insignia Flight @@ -7,9 +8,8 @@ BoosterDash.DisplayName: Booster Dash DashDoubleTapOverride.DisplayName: Dash Double Tap Override ExoChairSlowDown.DisplayName: Exo Chair Slow Down GodSlayerDash.DisplayName: God Slayer Dash -GravistarSabatonHotkey.DisplayName: Gravistar Sabaton Slam +GravistarSabatonHotkey.DisplayName: Interstellar Stompers Slam NormalityRelocator.DisplayName: Normality Relocator RageMode.DisplayName: Rage Mode -SandCloakEffect.DisplayName: Sand Cloak Effect SpectralVeilTeleport.DisplayName: Spectral Veil Teleport TransformerHotKey.DisplayName: Transformer Hot Key diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index c74a6fa126..b57065ae41 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -152,6 +152,7 @@ BloomSlime.DisplayName: Bloom Slime Bohldohr.DisplayName: Bohldohr BucketZombie.DisplayName: "{$NPCName.Zombie}" CladCrab.DisplayName: Clad Crab +CloudElemental.DisplayName: Cloud Elemental Cnidrion.DisplayName: Cnidrion CrawlerAmber.DisplayName: Amber Crawler CrawlerAmethyst.DisplayName: Amethyst Crawler @@ -188,11 +189,15 @@ Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater ShockstormShuttle.DisplayName: Shockstorm Shuttle Shroomble.DisplayName: Shroomble -SkeletronPrime2.DisplayName: Skeletron Prime +SkeletronOmega.DisplayName: Skeletron Omega +OmegaSaw.DisplayName: Omega Saw +OmegaLaser.DisplayName: Omega Laser +SkeletronPrime2.DisplayName: Skeletron Alpha +AlphaVice.DisplayName: Alpha Vice +AlphaCannon.DisplayName: Alpha Cannon Stormlion.DisplayName: Stormlion Sunskater.DisplayName: Sunskater SuperDummyNPC.DisplayName: Super Dummy -ThiccWaifu.DisplayName: Cloud Elemental WildBumblefuck.DisplayName: Draconic Swarmer WulfrumAmplifier.DisplayName: Wulfrum Amplifier WulfrumDrone.DisplayName: Wulfrum Drone @@ -302,7 +307,7 @@ YharonPhase2: Yharon, Resplendent Phoenix // Town NPCs, Pets, etc AndroombaFriendly.DisplayName: Androomba Pal -DILF: { +Archmage: { DisplayName: Archmage Census.SpawnCondition: Defeat Cryogen Name.Permafrost: Permafrost @@ -341,13 +346,137 @@ DILF: { } } -FAP: { +Bandit: { + DisplayName: Bandit + Census.SpawnCondition: Have a {$ItemName.PlatinumCoin} [i:PlatinumCoin] in your inventory after defeating Skeletron + + Name: { + Laura: Laura + Mie: Mie + Bonnie: Bonnie + Sarah: Sarah + Diane: Diane + Kate: Kate + Penelope: Penelope + Marisa: Marisa + Maribel: Maribel + Valerie: Valerie + Jessica: Jessica + Rowan: Rowan + Jessie: Jessie + Jade: Jade + Hearn: Hearn + Amber: Amber + Anne: Anne + Indiana: Indiana + } + + Chat: { + BloodMoon1: Oy, watch where you're going or I might just use you for dart practice. + BloodMoon2: Bet you'd look good as a pincushion, amiright? + BloodMoon3: Zombies don't dodge very well. Maybe you'll do a bit better. + BloodMoon4: Hey, careful over there. I've rigged the place. One wrong step and you're going to get a knife in your forehead. + Normal1: Anything is a weapon if you throw it hard enough. + Normal2: That's your chucking arm? You need to work out more. + Normal3: Listen here. It's all in the wrist, the wrist! Oh, forget it. + Normal4: Eh you know how it goes; steal from the rich, give to the poor, but I do take a cut of the profit. + Normal5: Snakes! Why does it always have to be snakes! + Normal6: It's super nice you know, to just have everything you want. Some people never got that luxury. + Normal7: It's not stealing! I'm just borrowing it until I die! + Night1: Hm, the stars are too bright tonight. Makes sneaking around a little more difficult. + Night2: You think those stars that fall occasionally would make good throwing weapons? + BrimstoneWitch: Hey, hey, has {0} seriously moved in here with us? Why??? + DrunkPrincess: I learned never to steal {0}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding. + Merchant: Don't tell {0}, but I took some of his stuff and replaced it with Angel Statues. + NurseArmsDealer: Don't tell {0} that I was responsible for {1}'s injuries. + NamedLaura: The nice thing about maps is I can track anything that has fallen. + NamedPenelope: Imagine how fast you could throw if you just had more hands. + NamedValerie: I also take food for currency. + NamedRowan: Usually I only think of animals as food or target practice, but dragons are an exception. + Jungle: I'd rather not be here. This place has bad vibes, y'know? It brings back some unpleasant memories. + Party: Where is my party hat? Well, I stole it of course. + Hardmode1: All sorts of new weapons to be found and looted. Get to that, and I'll share some of my collection too! + Hardmode2: There's so much scrap around this land with valuable parts to them. Makes you wonder who could afford to leave em all around. + Hardmode3: Crypts, tombs, dungeons, those're all just treasure troves to me. The dead are dead, they've got nothing to do with it. + MoonLordDefeated1: If you find anything cool, make sure to drop by and show it to me, I promise I'll keep my hands off it. + MoonLordDefeated2: So many new things to steal, I can't think of where to start! + MoonLordDefeated3: If I end up angering some deities or whatever, would you mind taking the blame for me? + HasBoneGlove: Wouldn't be the first time I used remains as weapons. + HasValediction: Oh man, did you rip that off a shark!? Now that's a weapon! + } + + RefundButton: Refund + Refund1: Want in on a little secret? Since {0} always gets so much cash from you, I've been stealing some of it as we go. I need you to keep quiet about it, so here. + Refund2: Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike? + NoRefund: Sorry, I got nothing. Perhaps you could reforge something and come back later... + + TownNPCMood: { + Content: It's been going well! + NoHome: You have a place to bunk? Sleeping on the ground makes me stiff and sore. + LoveSpace: Less people makes getting away with certain things easier. + FarFromHome: I need to get back to my secret cache! What if someone got their hands on it while I was away!? + DislikeCrowded: I don't like this, too many possible eyewitnesses. + HateCrowded: Being around this many people makes me think I'M going to be robbed. + LikeBiome: I know that a lot of wealthy traders come through the desert at times. Makes it a great spot to nick their goods. + DislikeBiome: Too stifling, too humid. I get sluggish in these conditions, no good. + HateBiome: No one lives here, and why would they?! This place is a dump! + LikeNPC: "{NPCName} doesn't only keep spiky balls in his pockets, he keeps a ton of cash! He's too absentminded to notice I'm stealing from him too! I like that a lot!" + DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. + LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! + Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" + } +} + +BrimstoneWitch: { + DisplayName: Brimstone Witch + Census.SpawnCondition: Defeat Supreme Witch, Calamitas + Name.Calamitas: Calamitas + + Chat: { + EasterEgg: Mrrp is cringe. + Homeless1: I'm considering moving back to that old cave of mine. + Homeless2: I certainly can't return to Yharim's old dwellings now, have you got any places to stay? + Normal1: I can't pay rent, but if you've got any dead relative you want me to try and... what? You don't? + Normal2: One of these days, I was thinking of starting a garden with the flowers from the old capitol of hell. I love the smell of brimstone in the morning. + Normal3: I think I've settled comfortably, thank you very much. + Normal4: Many seasons have gone by since I first met with the Tyrant, and only now did I break free. I wish I'd been stronger... + Normal5: If you've got any curses you want dispelled... well I'm not your person. + BloodMoon1: Such an unnatural shade of red. Nothing like my brimstone flames. + BloodMoon2: I can't work with nights like these. The stars seem to have shrunk away in fear. + Night1: These undead are horrific, I can't stand to look at them. How could anyone be satisfied with such amateur work? + Night2: I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby of mine once. + DrunkPrincess: I wonder if {0} ever feels cold given how revealing her dress is. Perhaps she should cover up a bit more. + SeaKing: I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion I just can't understand. + Party: If another person asks me if I can dance or not, I will light their hat on fire. + } + + EnchantButton: Enchant + + TownNPCMood: { + Content: I can't complain, really. + NoHome: Anywhere would be better than a cave with no bed or lighting. + LoveSpace: The quieter, the better. This is good. + FarFromHome: After being used to having people around for a bit, I miss it again. + DislikeCrowded: I really don't like how familiar some of these people are getting with me. + HateCrowded: I'm getting a headache from the pressure of having so many people around. + LikeBiome: I've never had the chance to live somewhere like this before. The trees and the songbirds… I quite like it. + DislikeBiome: Is this a sick joke? I can't bear to be here any longer, I've already tried to atone for my sins. + HateBiome: The spirits are unrestful here. It's really not a good feeling. + LikeNPC: "{NPCName} is someone who's had a terrible experience being cursed. He's put up with it quite well all that time, it's quite impressive honestly." + DislikeNPC: Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her! + LikeNPC_Princess: What a strangely pleasant kid {NPCName} is to be around. + Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" + } +} + +Cirrus: { DisplayName: Drunk Princess Census.SpawnCondition: Have {$Items.Potions.CirrusVodka.DisplayName} [i:CalamityMod/CirrusVodka] in your inventory in Hardmode or defeat Calamitas Clone/Plantera Name.Cirrus: Cirrus Chat: { - BossAlive: Why are you talking to me right now? Shouldn't you be bumbling around and dying for my amusement? + BossAlive: Why are you talking to me right now? Shouldn't you be bumbling about and dying for my amusement? + BossAliveAlt: You must be joking! Get back out there and FINISH THE FIGHT! Homeless1: I could smell my vodka from MILES away! Homeless2: Have any spare rooms available? Preferably candle-lit with a hefty supply of booze? BloodMoon1: I'm gonna make some Bloody Marys to relax, celery included. Want one? @@ -358,13 +487,13 @@ FAP: { Normal1: What do you want this time? I have an appointment to get my nails done in 5 minutes, make it quick. Normal1Alt: Whaddya need? I have candles and alcohols galore! Normal2: Maybe you should drink something that turns you into a magical flying unicorn, so you can be just like me. - Normal2Alt: Sometimes I think about returning to nature for a while to escape from all of this chaos. + Normal2Alt: Sometimes, I think about returning to nature for a while, to escape from all of this chaos. Normal3: Deals so good I'll [$$!$] myself! ...Sorry, I may have just had a minor stroke! Normal3Alt: I've been thinking more about the future lately. I can't say I'm not worried, but I'll be trying my best to make it better. Normal4: Did anyone ever tell you that large assets cause back pain? Well, they were right. - Normal4Alt: Do you have any idea how much extra money I make so {0} can afford her super fancy hair products? The back pain is worth it. + Normal4Alt: Do you have any idea how much extra money I make so {0} can afford her super-fancy hair products? Heh, the back pain is worth it. Archmage: "{0} can share a drink with me any time! ...Or maybe not, I'm not sure his old heart could take it." - BrimstoneWitch: The abuse {0} went through is something I can hardly comprehend. I'd offer her a drink, but I don't think she'd enjoy it. + BrimstoneWitch: The abuse {0} endured is something I can scarcely comprehend. I'd offer her a drink, but I don't think she'd enjoy it. Tavernkeep1: My booze will always be better than {0}'s, and nobody can convince me otherwise. Tavernkeep2: Tell {0} to stop calling me. He's not wanted. Tavernkeep3: I've had to tell baldie where my eyes are so many times that I've lost count. @@ -377,35 +506,39 @@ FAP: { Day1: I'm literally balls drunk off my sass right now, what do you want? Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? Day2: I'm either laughing because I'm drunk or because I've lost my mind, probably both. - Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them are appropriate. + Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them suit me. Day3: When I'm drunk I'm way happier... at least until the talking worms start to appear. Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. Day4: I should go fishing... while drunk, and jump into the ocean to spare myself {0}'s annoying naivety... Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. - DayStylist1: "{0} helped me learn to accept my past. It's been rough, but I think I'm on the right track now." + DayStylist1: "{0} helped me accept my past. It's been tough, but I think I'm on the right path now." DayStylist2: Might go out for a jog later with {0}. Nice day for it. - DayDrunk1: I drink to forget certain... things. What things, you might ask? Well, the point is to forget them, isn't it? + DayDrunk1: I drink to forget... What am I trying to forget, you might ask? Well, the point is to FORGET, not RECALL, isn't it? DayDrunk2: What a great day! Might just drink so much that I get poisoned again. - Night1: A perfect night to light some candles, drink some wine and relax. - Night2: Here's a challenge... take a shot for every time you've had to look at the wiki. Oh wait, you'd die. - Night3: Yes, everyone knows the mechworm is buggy. Well, not anymore, but still. - Night4: You lost or something? I don't mind company, but I'd rather be left alone at night. - Night5: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. - NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks for us. + Night1: A perfect night to light some candles, drink some wine, and relax. + Night2: Here's a challenge, take a shot for every time you've had to use the wiki. Oh wait, you'd die. + Night2Alt: There's more to life than challenge, y'know. Be sure to sit back and treat yourself once in a while. + Night3: You lost or something? I don't mind company, but I'd rather be left alone at night. + Night3Alt: I do love gazing at the stars. You could join me, if you like. + Night4: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. + NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks. Party: You'll always find me at parties where booze is involved... well, you'll always find BOOZE where I'M involved! - AcidRain: I'm melting! Put a stop to this inclement weather this instant before it ruins my hair! - Martians: You should probably deal with those ayy lmaos before anything else, but whatever. - CryogenDefeated: God I can't wait to smash some ice again! ...For drinks, of course. + PartyAlt: Y'know... this is fun and all, but I can't wait for the festivities to be over. + AcidRain: I'm melting! Put a stop to this inclement weather before it ruins my hair! + Martians: You should probably deal with those 'ayy lmaos' before doing anything else, but whatever. + CryogenDefeated: God, I can't wait to smash some ice again! ...For drinks, of course. LeviathanDefeated: How could you murder such a beautiful creature!? ...The blue one, not the obese cucumber. - MoonLordDefeated: Ever wondered why the Moon Lord needed so many tentacles? Uh... on second thought, I won't answer that. + MoonLordDefeated: Ever wondered why the Moon Lord needed so many tentacles? Uhm... on second thought, I won't answer that. PolterghastDefeated: I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads... frightening times those were. DoGDefeated: I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61! HasChibii: The hell is that? Looks like something I'd carry around if I was 5 years old. - HasAnahitaTrans: Nice scales... is it hot in here or is it just me? - HasVodka: Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat and other magical crap. + HasChibiiAlt: I won't judge you for having that creature in tow... but keep it the hell away from me. + HasAnahitaTrans: Nice scales... Is it hot in here, or is it just me? + HasVodka: Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat, and other magical crap. HasAlicorn1: So... you found my special bottle. Hope you enjoy it, I know I will. - HasAlicorn2: Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean offer you excellent deals you won't find anywhere else if you're riding me 24/7. + HasAlicorn2: Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean, offer you excellent deals you won't find anywhere else, if you're riding me 24/7. HasAlicorn3: Before you ask, no, I do NOT have a heart on my butt while in human form. Don't question my transformation preferences! + NewOutfit: It's so refreshing to finally wear something else. I still love my dress, of course, but it's not exactly ideal for exercising. } // Death Count stuffs @@ -422,25 +555,25 @@ FAP: { TownNPCMood: { Content: It's 5 o'clock somewhere. - NoHome: I need a place to crash! My drinks need to be properly cooled before they can be served! + NoHome: I need a place to crash! My drinks MUST be properly cooled before they can be served! LoveSpace: Finally, some peace and quiet. Large quantities of people tend to piss me off. - FarFromHome: I'm used to running away from home, but this is a little ridiculous. - DislikeCrowded: If one more person tells me 'it's happy hour somewhere' to try and get a discount, I'm going to snap! + FarFromHome: Don't get me wrong, I'm used to running away from home, but this is a little ridiculous. + DislikeCrowded: If one more person tells me 'it's happy hour somewhere', I'm going to snap! HateCrowded: No amount of alcohol can drown out the noise these people make! - LoveBiome: Other unicorns? Never thought I'd see the day! This place is incredible! - LikeBiome: A good breeze to cool some heads, that's the way to deal with customers who've had a few too many drinks! + LoveBiome: Other unicorns? I never thought I'd see the day... this place is incredible! + LikeBiome: Ah, a soothing breeze and a gorgeous view; a great way to calm some of my more 'unpleasant' patrons. DislikeBiome: This dry air and heat isn't good for my hair, or my drinks. - HateBiome: You think I can fix this mess with a magical friendship rainbow? That's not how it works, dumbass! Get me out of here already! + HateBiome: You think I can fix this place with a magical friendship rainbow? That's not how it works, so get me out of here already! LoveNPC_Stylist: "{NPCName} works wonders for my hair... among other things, hehe." LoveNPC_BestiaryGirl: "{NPCName} is so fluffy and squishy! She also says my alicorn form is 'mega rad'." - LikeNPC_Truffle: "{NPCName} makes me so hungry... I wonder how great of a trip he'd give..." + LikeNPC_DyeTrader: I tried inviting {NPCName} over for drinks a while back, but he didn't seem interested... oh well, his loss. LikeNPC_PartyGirl: "{NPCName} would make for a great bartender some day. She really knows how to liven the mood!" - DislikeNPC_DD2Bartender: "{NPCName} is so bald." + DislikeNPC_DD2Bartender: "{NPCName} is so bald. The sheen reflecting off his dome could legit blind someone, like, oh my god." DislikeNPC_TaxCollector: "{NPCName} had best keep his distance... he wouldn't want to wake up one morning with a pipe bomb in his mailbox." - HateNPC_GoblinTinkerer: "{NPCName} was so terrible that I had to FORCE him to have a better reforge system. Why would you house me next to him? Do you enjoy watching me relive the stress he gave me!?" - HateNPC_Angler: "{NPCName} never stops blabbering about his inane fishing quests. Get me away from him before I stomp him into the ground!" - LikeNPC_Princess: You think I'd dislike {NPCName} because we're too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks of course. - Princess_LovesNPC: "{NPCName} has really interesting stories to tell, I've learned a lot from her already!" + HateNPC_GoblinTinkerer: "{NPCName} was so terrible that I had to FORCE him to stop ripping off his customers... why would you house me next to him!?" + HateNPC_Angler: "{NPCName} never stops blabbering about his inane fishing quests. Get me away from him before I punt him into the sulphurous sea!" + LikeNPC_Princess: You think I'd dislike {NPCName} because we're too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks, of course. + Princess_LovesNPC: "{NPCName} has some fascinating stories to tell, I've learned quite a lot from her already." HateNPC: I hate {NPCName}. DislikeNPC: I dislike {NPCName}. LikeNPC: I like {NPCName}. @@ -448,7 +581,7 @@ FAP: { } } -SEAHOE: { +SeaKing: { DisplayName: Sea King Census.SpawnCondition: Defeat a Giant Clam after defeating the Desert Scourge Name.Amidias: Amidias @@ -532,126 +665,3 @@ SEAHOE: { Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" } } - -THIEF: { - DisplayName: Bandit - Census.SpawnCondition: Have a {$ItemName.PlatinumCoin} [i:PlatinumCoin] in your inventory after defeating Skeletron - - Name: { - Laura: Laura - Mie: Mie - Bonnie: Bonnie - Sarah: Sarah - Diane: Diane - Kate: Kate - Penelope: Penelope - Marisa: Marisa - Maribel: Maribel - Valerie: Valerie - Jessica: Jessica - Rowan: Rowan - Jessie: Jessie - Jade: Jade - Hearn: Hearn - Amber: Amber - Anne: Anne - Indiana: Indiana - } - - Chat: { - BloodMoon1: Oy, watch where you're going or I might just use you for dart practice. - BloodMoon2: Bet you'd look good as a pincushion, amiright? - BloodMoon3: Zombies don't dodge very well. Maybe you'll do a bit better. - BloodMoon4: Hey, careful over there. I've rigged the place. One wrong step and you're going to get a knife in your forehead. - Normal1: Anything is a weapon if you throw it hard enough. - Normal2: That's your chucking arm? You need to work out more. - Normal3: Listen here. It's all in the wrist, the wrist! Oh, forget it. - Normal4: Eh you know how it goes; steal from the rich, give to the poor, but I do take a cut of the profit. - Normal5: Snakes! Why does it always have to be snakes! - Normal6: It's super nice you know, to just have everything you want. Some people never got that luxury. - Normal7: It's not stealing! I'm just borrowing it until I die! - Night1: Hm, the stars are too bright tonight. Makes sneaking around a little more difficult. - Night2: You think those stars that fall occasionally would make good throwing weapons? - BrimstoneWitch: Hey, hey, has {0} seriously moved in here with us? Why??? - DrunkPrincess: I learned never to steal {0}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding. - Merchant: Don't tell {0}, but I took some of his stuff and replaced it with Angel Statues. - NurseArmsDealer: Don't tell {0} that I was responsible for {1}'s injuries. - NamedLaura: The nice thing about maps is I can track anything that has fallen. - NamedPenelope: Imagine how fast you could throw if you just had more hands. - NamedValerie: I also take food for currency. - NamedRowan: Usually I only think of animals as food or target practice, but dragons are an exception. - Jungle: I'd rather not be here. This place has bad vibes, y'know? It brings back some unpleasant memories. - Party: Where is my party hat? Well, I stole it of course. - Hardmode1: All sorts of new weapons to be found and looted. Get to that, and I'll share some of my collection too! - Hardmode2: There's so much scrap around this land with valuable parts to them. Makes you wonder who could afford to leave em all around. - Hardmode3: Crypts, tombs, dungeons, those're all just treasure troves to me. The dead are dead, they've got nothing to do with it. - MoonLordDefeated1: If you find anything cool, make sure to drop by and show it to me, I promise I'll keep my hands off it. - MoonLordDefeated2: So many new things to steal, I can't think of where to start! - MoonLordDefeated3: If I end up angering some deities or whatever, would you mind taking the blame for me? - HasBoneGlove: Wouldn't be the first time I used remains as weapons. - HasValediction: Oh man, did you rip that off a shark!? Now that's a weapon! - } - - RefundButton: Refund - Refund1: Want in on a little secret? Since {0} always gets so much cash from you, I've been stealing some of it as we go. I need you to keep quiet about it, so here. - Refund2: Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike? - NoRefund: Sorry, I got nothing. Perhaps you could reforge something and come back later... - - TownNPCMood: { - Content: It's been going well! - NoHome: You have a place to bunk? Sleeping on the ground makes me stiff and sore. - LoveSpace: Less people makes getting away with certain things easier. - FarFromHome: I need to get back to my secret cache! What if someone got their hands on it while I was away!? - DislikeCrowded: I don't like this, too many possible eyewitnesses. - HateCrowded: Being around this many people makes me think I'M going to be robbed. - LikeBiome: I know that a lot of wealthy traders come through the desert at times. Makes it a great spot to nick their goods. - DislikeBiome: Too stifling, too humid. I get sluggish in these conditions, no good. - HateBiome: No one lives here, and why would they?! This place is a dump! - LikeNPC: "{NPCName} doesn't only keep spiky balls in his pockets, he keeps a ton of cash! He's too absentminded to notice I'm stealing from him too! I like that a lot!" - DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. - LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! - Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" - } -} - -WITCH: { - DisplayName: Brimstone Witch - Census.SpawnCondition: Defeat Supreme Witch, Calamitas - Name.Calamitas: Calamitas - - Chat: { - EasterEgg: Mrrp is cringe. - Homeless1: I'm considering moving back to that old cave of mine. - Homeless2: I certainly can't return to Yharim's old dwellings now, have you got any places to stay? - Normal1: I can't pay rent, but if you've got any dead relative you want me to try and... what? You don't? - Normal2: One of these days, I was thinking of starting a garden with the flowers from the old capitol of hell. I love the smell of brimstone in the morning. - Normal3: I think I've settled comfortably, thank you very much. - Normal4: Many seasons have gone by since I first met with the Tyrant, and only now did I break free. I wish I'd been stronger... - Normal5: If you've got any curses you want dispelled... well I'm not your person. - BloodMoon1: Such an unnatural shade of red. Nothing like my brimstone flames. - BloodMoon2: I can't work with nights like these. The stars seem to have shrunk away in fear. - Night1: These undead are horrific, I can't stand to look at them. How could anyone be satisfied with such amateur work? - Night2: I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby of mine once. - DrunkPrincess: I wonder if {0} ever feels cold given how revealing her dress is. Perhaps she should cover up a bit more. - SeaKing: I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion I just can't understand. - Party: If another person asks me if I can dance or not, I will light their hat on fire. - } - - EnchantButton: Enchant - - TownNPCMood: { - Content: I can't complain, really. - NoHome: Anywhere would be better than a cave with no bed or lighting. - LoveSpace: The quieter, the better. This is good. - FarFromHome: After being used to having people around for a bit, I miss it again. - DislikeCrowded: I really don't like how familiar some of these people are getting with me. - HateCrowded: I'm getting a headache from the pressure of having so many people around. - LikeBiome: I've never had the chance to live somewhere like this before. The trees and the songbirds… I quite like it. - DislikeBiome: Is this a sick joke? I can't bear to be here any longer, I've already tried to atone for my sins. - HateBiome: The spirits are unrestful here. It's really not a good feeling. - LikeNPC: "{NPCName} is someone who's had a terrible experience being cursed. He's put up with it quite well all that time, it's quite impressive honestly." - DislikeNPC: Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her! - LikeNPC_Princess: What a strangely pleasant kid {NPCName} is to be around. - Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" - } -} diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 9c5863d7c5..f4629f8829 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -104,6 +104,7 @@ MoltenBlast.DisplayName: Molten Blast MoltenBlob.DisplayName: Molten Blob MushBomb.DisplayName: Mushroom Shot MushBombFall.DisplayName: Falling Mushroom +MushBombGround.DisplayName: Mushroom Shot OldDukeGore.DisplayName: Sulphurous Gore OldDukeSummonDrop.DisplayName: Acid OldDukeToothBallSpike.DisplayName: Spike @@ -124,6 +125,8 @@ ProfanedSpear.DisplayName: Profaned Spear ProvidenceCrystal.DisplayName: Holy Crystal ProvidenceCrystalShard.DisplayName: Holy Crystal Shard ProvidenceHolyRay.DisplayName: Holy Ray +QueenBeenade.DisplayName: Queen Beenade +QueenBeenadeBee.DisplayName: Queen Beenade Bee RavagerBlast.DisplayName: Ravaging Laser RavagerBlaster.DisplayName: Ravager Blaster RavagerFlame.DisplayName: Blue Flame diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 1d4c3faa63..4ed9ea7b49 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -6,6 +6,7 @@ AcidicSaxMist.DisplayName: Acid Mist AetherBeam.DisplayName: Aether Beam AnahitasArpeggioNote.DisplayName: Anahita's Song Ancient2.DisplayName: Ancient Dust +ApoctosisBlast.DisplayName: Apoctosis Blast ApotheosisEnergy.DisplayName: Apotheosis Energy ApotheosisWorm.DisplayName: The Devourer of Gods AquamarineBolt.DisplayName: Aqua Bolt @@ -110,7 +111,6 @@ IonBlast.DisplayName: Ion Blast KeelhaulBubble.DisplayName: Keelhaul Bubble KeelhaulGeyserBottom.DisplayName: Keelhaul Geyser KeelhaulGeyserTop.DisplayName: Keelhaul Geyser -LazharSolarBeam.DisplayName: Concentrated Solar Beam LightBall.DisplayName: Light Ball LightBallExplosion.DisplayName: Light Explosion LightBead.DisplayName: Light Bead diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 1643ae16d0..72ae489a01 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -225,7 +225,6 @@ SanguineFuryWheel.DisplayName: Sanguine Bladewheel ScorcherExplosion.DisplayName: Scorching Crystal Blast ScourgeoftheCosmosMini.DisplayName: Miniature Cosmic Scourge ScourgeoftheCosmosProj.DisplayName: Cosmic Scourge -SeashineSwordProj.DisplayName: Seashine Beam SeekingScorcherProj.DisplayName: Scorching Seeker SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 953ee69725..a72179f460 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -2,42 +2,48 @@ ArtifactOfResilienceBulwark.DisplayName: Artifact of Resilience MarniteRepulsionHitbox.DisplayName: Repulsion Matrix // Draedon's Arsenal +AerialTrackerLaser.DisplayName: Laser +AerialTrackerProjectile.DisplayName: Aerial Tracker AnomalysNanogunHoldout.DisplayName: The Anomaly's Nanogun AnomalysNanogunMPFBBoom.DisplayName: MPFB Explosion AnomalysNanogunMPFBDevastator.DisplayName: MPFB Devastator AnomalysNanogunPlasmaBeam.DisplayName: Plasma Beam -FrequencyManipulatorEnergy.DisplayName: Pulse Energy -FrequencyManipulatorProjectile.DisplayName: Frequency Manipulator GatlingLaserShot.DisplayName: Gatling Laser GaussEnergy.DisplayName: Gauss Energy GaussFlux.DisplayName: Gauss Flux GaussPistolShot.DisplayName: Gauss Shot -GaussRifleBlast.DisplayName: Gauss Blast -GaussRifleExplosion.DisplayName: Gauss Explosion +ImmolationArrow.DisplayName: Immolation Arrow +ImmolationBurst.DisplayName: Immolation Burst +ImmolationSpray.DisplayName: Immolation Spray LaserRifleShot.DisplayName: Laser Rifle MassivePlasmaExplosion.DisplayName: Plasma Explosion MountedScannerLaser.DisplayName: Deathray MountedScannerSummon.DisplayName: Mounted Scanner +NidhoggRailgunBigShot.DisplayName: Nidhogg Railgun +NidhoggRailgunBlast.DisplayName: Nidhogg Beam +NidhoggExplosion.DisplayName: Magnetic Implosion +PhalanxSurgeLance.DisplayName: Laser Lance +PhalanxSurgeLaser.DisplayName: Phalanx Laser PhaseslayerBeam.DisplayName: Light Blade PlasmaCasterShot.DisplayName: Plasma Bolt PlasmaGrenadeProjectile.DisplayName: Plasma Grenade PlasmaGrenadeSmallExplosion.DisplayName: Plasma Explosion PoleWarperSummon.DisplayName: Pole Warper PulseDragonProjectile.DisplayName: Pulse Dragon +PulseGrenadeProjectile.DisplayName: Pulse Grenade +PulseGrenadeOrb.DisplayName: Pulse Orb PulsePistolShot.DisplayName: Pulse Bolt PulseRifleShot.DisplayName: Pulse Bolt PulseTurret.DisplayName: Pulse Turret PulseTurretShot.DisplayName: Pulse Bolt +ShortCircuitHook.DisplayName: Short Circuit Hook SnakeEyesSummon.DisplayName: Snake Eyes SnakeEyesProjectile.DisplayName: Inescapable Bolt StarSwallowerAcid.DisplayName: Acid StarSwallowerSummon.DisplayName: Pet Froge SystemBaneLightning.DisplayName: Lightning SystemBaneProjectile.DisplayName: System Bane -TaserHook.DisplayName: Taser TeslaCannonShot.DisplayName: Tesla Beam -TrackingDiskLaser.DisplayName: Laser -TrackingDiskProjectile.DisplayName: Tracking Disk UnstableMatter.DisplayName: Unstable Matter VoltageStream.DisplayName: Voltage Stream WavePounderBoom.DisplayName: Explosion @@ -70,3 +76,4 @@ PlagueShot.DisplayName: Plague Shot PlagueShotBuffer.DisplayName: Plague Shot WaterShot.DisplayName: Water Shot WaterShotBuffer.DisplayName: Water Shot +FrequencyManipulatorEnergy.DisplayName: Frequency Manipulator Energy diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 403a7a04c0..07a9b5dd8a 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -87,6 +87,7 @@ FlakKrakenProjectile.DisplayName: Flak Kraken FlakToxicannonProjectile.DisplayName: Flak Toxicannon FlareBat.DisplayName: Flare Bat Flash.DisplayName: Flash +FlashRoundFlash.DisplayName: Flash FlashRoundProj.DisplayName: Flash Round FlurrystormIceChunk.DisplayName: Ice Chunk FlurrystormIceShard.DisplayName: Ice Shard @@ -107,7 +108,7 @@ HydraHead.DisplayName: Hydra Head HydraHeadLaunch.DisplayName: Hydra Head HydrasBlood.DisplayName: Hydra's Blood HyperiusBulletProj.DisplayName: Hyperius Bullet -HyperiusSplit.DisplayName: Hyperius Bad Time +HyperiusSplit.DisplayName: Hyperius Fragment IcicleArrowProj.DisplayName: Icicle Arrow HailstormBulletProj.DisplayName: Hailstorm Bullet HallowPointRoundProj.DisplayName: Hallow-Point Round @@ -198,6 +199,8 @@ ShadeFire.DisplayName: Shady Fire Shell.DisplayName: Shell Shockblast.DisplayName: Blast ShockblastRound.DisplayName: Round +ShortCircuitExplosion.DisplayName: Short Circuit +ShortCircuitShot.DisplayName: Short Circuit Shot Shroom.DisplayName: Shroom Sickness.DisplayName: Sickness SicknessRound.DisplayName: Round diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index ff757f55ba..3be6965766 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -244,6 +244,7 @@ SandTornado.DisplayName: Tornado SarosAura.DisplayName: Saros Aura SarosMicrosun.DisplayName: Saros Microsun SarosSunfire.DisplayName: Saros Sunfire +SeashineSwordProj.DisplayName: Seashine Sword SeekerSummonProj.DisplayName: Soul Seeker SepulcherMinion.DisplayName: Sepulcher Shellfish.DisplayName: Shellfish diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 2d7cf3ef7b..6277888d79 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -13,6 +13,7 @@ AstralStar.DisplayName: Star AuricLandMineExplosion.DisplayName: Auric Land Mine Explosion BabyCannonballProjectile.DisplayName: Baby Cannonball Projectile BasicBurst.DisplayName: Nondescript Damaging Explosion +BasicBurstExclusive.DisplayName: Nondescript Damaging Explosion BasicPlagueBee.DisplayName: Basic Plague Bee BlackGlassBandProjectile.DisplayName: Obsidian Strike BlazingStarHeal.DisplayName: Blazing Star Heal @@ -77,6 +78,8 @@ HydrothermalSmoke.DisplayName: Smoke HydrothermicFlare.DisplayName: Hydrothermic Flare HydrothermicFlareRogue.DisplayName: Hydrothermic Flare HydrothermicSphere.DisplayName: Hydrothermic Sphere +HyperiusDamage.DisplayName: Hyperius Overflow +HyperiusBleed.DisplayName: Hyperius Bleed JewelSpike.DisplayName: Spike KelvinCatalystStar.DisplayName: Kelvin Catalyst Star LeviAmberDash.DisplayName: Riptide Slam @@ -110,6 +113,7 @@ RetaliationProjectile.DisplayName: Retaliation Shard RiftReelerBobber.DisplayName: Chaotic Bobber SandCloakVeil.DisplayName: Dust Veil SandExplosion.DisplayName: Sand +SCalAltarArenaVisual.DisplayName: Supreme Calamitas Arena Visual Seashell.DisplayName: Seashell SepulcherSoul.DisplayName: Tormented Soul SerpentsBiteHook.DisplayName: Serpent's Bite diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index d396cb2598..93fe806e1f 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,6 +1,4 @@ -// Vanilla UI edits SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" -WorldMaster: Game over man, game over! (Brutally hard boss changes, for the truly brave) // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines @@ -22,7 +20,7 @@ StealthInfoText: ''' // Difficulty UI DifficultyStatusText: "{0} is {1}." -ModeAppend: " Mode" +ModeAppend: "{0} Mode" Active: Active NotActive: Not active DifficultyShiftText: "[c/737373:Hold the 'Shift' key for more information]" @@ -33,10 +31,8 @@ ChangingTheRules: "[c/919191:You cannot change the rules now!]" NoDifficulty: None NoDifficultyInfo: The classic Terraria experience, with no Calamity difficulty changes Revengeance: Revengeance -RevMaster: Rev+Master -RevLegend: Rev+Legend RevengeanceEnabled: Revengeance Mode is enabled -RevengeanceShortInfo: "[c/F54254:The intended Calamity experience!]" +RevengeanceShortInfo: "[c/F54254:The intended Calamity experience! Can only be enabled in Expert Mode!]" RevengeanceExpandedInfo: ''' [c/B55362:Enables the] [c/85FFE9:Adrenaline] [c/B55362:mechanic. You gain Adrenaline while fighting bosses. Getting hit drops Adrenaline back to 0] @@ -50,10 +46,9 @@ RevengeanceExpandedInfo: RevengeanceActivate: Revengeance is active. RevengeanceDeactivate: Revengeance is not active. Death: Death -DeathMaster: Death+Master DeathLegend: Death+Legend DeathEnabled: Death Mode is enabled -DeathShortInfo: "[c/C82DF7:A tougher challenge for the more experienced, or for those that want a step up from Revengeance Mode]" +DeathShortInfo: "[c/C82DF7:A far more difficult challenge than Revengeance Mode! Can only be enabled in Master Mode!]" DeathExpandedInfo: ''' [c/B834E0:All foes will pose a much larger threat with highly aggressive AIs and increased damage] @@ -94,6 +89,7 @@ Cooldowns: { DSOCritCooldown: Extra Critical Strike Chance ParryCooldown: Parry Ability Cooldown FleshTotem: Contact Damage Halving Cooldown + FuryFuel: Crystal Powder GaelsRage: Gael's Greatsword Rage Cooldown GlobalDodge: Dodge Cooldown GodSlayerDash: God Slayer Dash Cooldown @@ -116,6 +112,7 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge + RaiderBoost: Extra Critical Chance RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown @@ -589,6 +586,8 @@ Lecherous: { Disenchant: Disenchant // Worldgen Tasks +BetterUnderworld: Creating a smoother underworld +AshIslandLavaRemoval: Removing lava from ash island EvilIslandCorrupt: Adding a putrid floating island EvilIslandCrimson: Adding a grotesque floating island AstralChest: Placing an astral chest diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson index c736eca357..9edc92b12c 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson @@ -10,14 +10,10 @@ FinWings: ''' FlameWings: Multiplies all heat debuff damage by 1.25x FrozenWings: Multiplies all cold debuff damage by 1.25x -HarpyWings: - ''' - 10% increased movement speed - With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers - ''' +HarpyWings: 10% increased movement speed LeafWings: +10 defense and permanent Dryad's Blessing -WingsNebula: Increases the pickup range of Nebula armor's nebula boosters -WingsSolar: Increases Solar Flare armor's dash velocity by 25% -WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range TatteredFairyWings: You leave a trail of fairy dust as you fly +WingsNebula: Increases the pickup range of Nebula armor's nebula boosters +WingsSolar: Allows Solar Flare armor's dash to be used without any charges +WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range WingsVortex: Vortex armor's stealth ability is automatically reactivated 1 second after dashing diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 5a4c92113e..e5915809b6 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -29,6 +29,7 @@ AddedTooltip: { WarmthPotion: Greatly reduces the duration of Chilled, Frozen, and Glacial State HandWarmer: Provides a regeneration boost while wearing the Snow armor GoldenFishingRod: Its fishing line will never break + Stepstool: Standing on the stool grants 5% increased critical strike chance Tombstones: ''' 13 of any tombstone turns the surrounding area into a graveyard @@ -274,6 +275,12 @@ EditedTooltip: { ApprenticeAltHead: 10% increased summon & magic damage ApprenticeAltShirt: 15% increased summon damage and 10% increased magic damage ApprenticeAltPants: 10% increased summon damage + GravityGlobe: + ''' + Provides 32% increased jump speed and increased fall speed + Press UP to change gravity + Press DOWN to fall faster + ''' } // Buff Descriptions @@ -429,8 +436,9 @@ SteampunkerChat: { StylistChat: { Hardmode: Please don't catch space lice. Or {0} lice. Or just lice in general. - DrunkPrincess1: "{0} is always trying to brighten my mood... even if, deep down, I know she's sad..." + DrunkPrincess1: "{0} is always trying to brighten my mood... even though, deep down, I know she's sad..." DrunkPrincess2: Sometimes I catch {0} sneaking up from behind me. + DrunkPrincess3: "{0} has been smiling more often lately, even without alcohol. I think I can thank you for that, at least somewhat." ProfanedSoulCrystal1: They look so cute and yet, I can feel their immense power just by being near them. What are you? ProfanedSoulCrystal2: I hate to break it to you, but you don't have hair to cut or style, hun. ProfanedDonuts: Aww, they're so cute, do they have names? diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index b348b67afa..e5aaf5bc23 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1143,7 +1143,7 @@ namespace CalamityMod Mod dialogueMod = ExternalMods.dialogueTweak; if (dialogueMod != null) { - dialogueMod.Call("ReplaceShopButtonIcon", NPCType(), "Head"); + dialogueMod.Call("ReplaceShopButtonIcon", NPCType(), "Head"); } } #endregion diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 4658c23195..536cbf9a7e 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -11,6 +11,7 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -323,7 +324,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemID.Bomb, 1, 1, 1); + npcLoot.Add(ItemID.Bomb); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Bezoar, 100, 50)); npcLoot.Add(ItemID.JellyfishNecklace, 100); } } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 8e5716a636..fcdb2bf9cd 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -379,6 +379,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Blindfold, 100, 50)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 5)); } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 9651d90ae0..27b32a2a22 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -11,6 +11,7 @@ using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -256,6 +257,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Blindfold, 100, 50)); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index c1aa1563e4..3fbf5c0ef8 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -12,6 +12,7 @@ using Terraria; using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -187,6 +188,7 @@ namespace CalamityMod.NPCs.Abyss { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 4, 6)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Bezoar, 100, 50)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 7cfa43f431..376a638d63 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -289,7 +289,7 @@ namespace CalamityMod.NPCs.AcidRain // Register ground collision from the slam. // Once it has been hit a nuke explosion projectile is created on the ground, along with homing nuclear drops. - if ((NPC.Bottom.Y > Target.Bottom.Y && Collision.SolidCollision(NPC.BottomLeft, NPC.width, 1)) || AttackTimer > 180f) + if ((NPC.Bottom.Y > Target.Bottom.Y && Collision.SolidCollision(NPC.BottomLeft, NPC.width, 1) || Collision.WetCollision(NPC.BottomLeft, NPC.width, 1)) || AttackTimer > 180f) { NPC.velocity = Vector2.Zero; diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 08e6905be3..2aaa69c5f4 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -7,8 +7,10 @@ using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.AcidRain { public class Radiator : ModNPC @@ -116,6 +118,7 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Bezoar, 100, 50)); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index fa66f19776..b0db3298e4 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeBody : ModNPC { diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 9ef8a4450b..ae65703e57 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeBodyAlt : ModNPC { diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index d40200466a..211fbafc4d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -34,6 +34,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class AquaticScourgeHead : ModNPC { diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 0c7761be5b..989e090678 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeTail : ModNPC { diff --git a/NPCs/Astral/Glomerling.cs b/NPCs/Astral/Glomerling.cs index 4064e9380b..d4b64e4d1f 100644 --- a/NPCs/Astral/Glomerling.cs +++ b/NPCs/Astral/Glomerling.cs @@ -43,7 +43,6 @@ namespace CalamityMod.NPCs.Astral NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.5f; NPC.noGravity = true; - NPC.value = Item.buyPrice(0, 0, 1, 0); Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 67d8668cfb..6287515398 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -121,9 +121,12 @@ namespace CalamityMod.NPCs.Astral { NPC.ai[1] = 0f; - int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); - Main.npc[n].Center = spawnPoint; - Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : CalamityWorld.revenge ? 11f : 10f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); + Main.npc[n].Center = spawnPoint; + Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : CalamityWorld.revenge ? 11f : 10f); + } } else if (NPC.ai[1] >= 140f) //oozin dust at the "mouth" { diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 6929085234..6f7ae30efc 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -35,6 +35,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumAureus { [AutoloadBossHead] + [HasPierceResist(singleHitbox: true)] public class AstrumAureus : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AureusHit", 4); @@ -431,7 +432,7 @@ namespace CalamityMod.NPCs.AstrumAureus CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAstrumAureus); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAstrumAureus); // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops if (!DownedBossSystem.downedAstrumAureus) diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 48520d3f9e..7579665455 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AstrumDeusHead))] public class AstrumDeusBody : ModNPC { @@ -25,8 +26,11 @@ namespace CalamityMod.NPCs.AstrumDeus public static Asset TextureGlow2; public static Asset TextureGlow3; public static Asset TextureGlow4; + public static Asset TextureFlash; + public static Asset TextureFlash2; public static Asset TextureAltGlow1; public static Asset TextureAltGlow2; + public static Asset TextureAltFlash; public override void SetStaticDefaults() { @@ -39,8 +43,11 @@ namespace CalamityMod.NPCs.AstrumDeus TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + TextureFlash = ModContent.Request(Texture + "GlowFlash", AssetRequestMode.AsyncLoad); + TextureFlash2 = ModContent.Request(Texture + "GlowFlash2", AssetRequestMode.AsyncLoad); TextureAltGlow1 = ModContent.Request(Texture + "AltGlow", AssetRequestMode.AsyncLoad); TextureAltGlow2 = ModContent.Request(Texture + "AltGlow2", AssetRequestMode.AsyncLoad); + TextureAltFlash = ModContent.Request(Texture + "AltGlowFlash", AssetRequestMode.AsyncLoad); } } @@ -118,12 +125,21 @@ namespace CalamityMod.NPCs.AstrumDeus spriteEffects = SpriteEffects.FlipHorizontally; bool altBodyTextures = NPC.localAI[3] == 1f; - bool drawCyan = NPC.Calamity().newAI[3] >= (Main.getGoodWorld ? 300f : 600f); bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; + // Need segment amount to get a smooth transition down the worm based on length + int segmentAmt = Main.zenithWorld ? (CalamityWorld.death ? 8 : CalamityWorld.revenge ? 7 : Main.expertMode ? 6 : 5) : (CalamityWorld.death ? 40 : CalamityWorld.revenge ? 35 : Main.expertMode ? 30 : 25); + float cyanThreshold = Main.getGoodWorld ? 300f : 600f; + float transitionStart = MathHelper.Lerp(cyanThreshold * 0.75f, cyanThreshold * 0.95f, 1f - (NPC.ai[3] / (float)segmentAmt)); + float transitionEnd = MathHelper.Lerp(cyanThreshold * 0.8f, cyanThreshold, 1f - (NPC.ai[3] / (float)segmentAmt)); + bool drawCyan = NPC.Calamity().newAI[3] >= transitionEnd && NPC.Calamity().newAI[3] <= cyanThreshold + transitionEnd; + bool inColorTrans = doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold >= transitionStart && NPC.Calamity().newAI[3] % cyanThreshold <= transitionEnd; + Texture2D mainWormTex = altBodyTextures ? AltTexture.Value : TextureAssets.Npc[Type].Value; Texture2D secondWormTex = TextureGlow2.Value; + Texture2D mainFlashTex = altBodyTextures ? TextureAltFlash.Value : TextureFlash.Value; + Texture2D otherMainTex, otherSecondTex; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -132,26 +148,50 @@ namespace CalamityMod.NPCs.AstrumDeus spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); mainWormTex = altBodyTextures ? TextureAltGlow1.Value : TextureGlow1.Value; + float colorOpacity = Utils.GetLerpValue(transitionStart, transitionEnd, NPC.Calamity().newAI[3] % cyanThreshold, true); Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; - if (doubleWormPhase) + Color otherPhaseColor = drawCyan ? Color.Orange : Color.Cyan; + if (doubleWormPhase) // otherMainTex and otherSecondTex contain the opposite texture, and are faded in during the transition { mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? TextureAltGlow2.Value : TextureGlow3.Value); + otherMainTex = drawCyan ? (altBodyTextures ? TextureAltGlow2.Value : TextureGlow3.Value) : mainWormTex; secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; + otherSecondTex = drawCyan ? secondWormTex : TextureGlow4.Value; + } + else + { + otherMainTex = mainWormTex; + otherSecondTex = secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + { + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp * (inColorTrans ? 1f - colorOpacity : 1f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the new fading in glowmask for the upcoming behavior + if (inColorTrans) + spriteBatch.Draw(otherMainTex, drawLocation, NPC.frame, Color.Lerp(Color.White, otherPhaseColor, 0.5f) * colorOpacity, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the white flash immediately after swapping behaviors + if (doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold < 25f) + spriteBatch.Draw(mainFlashTex, drawLocation, NPC.frame, Color.White * MathHelper.Lerp(1f, 0f, NPC.Calamity().newAI[3] % cyanThreshold / 25f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + } if (!altBodyTextures) { timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + { + spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp * (inColorTrans ? 1f - colorOpacity : 1f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the new fading in glowmask for the upcoming behavior + if (inColorTrans) + spriteBatch.Draw(otherSecondTex, drawLocation, NPC.frame, Color.Lerp(Color.White, otherPhaseColor, 0.5f) * colorOpacity, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the white flash immediately after swapping behaviors + if (doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold < 25f) + spriteBatch.Draw(TextureFlash2.Value, drawLocation, NPC.frame, Color.White * MathHelper.Lerp(1f, 0f, NPC.Calamity().newAI[3] % cyanThreshold / 25f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + } } - return false; } diff --git a/NPCs/AstrumDeus/AstrumDeusBodyAltGlowFlash.png b/NPCs/AstrumDeus/AstrumDeusBodyAltGlowFlash.png new file mode 100644 index 0000000000..ca1a023d67 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyAltGlowFlash.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodyGlowFlash.png b/NPCs/AstrumDeus/AstrumDeusBodyGlowFlash.png new file mode 100644 index 0000000000..b6ca774c4d Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyGlowFlash.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodyGlowFlash2.png b/NPCs/AstrumDeus/AstrumDeusBodyGlowFlash2.png new file mode 100644 index 0000000000..1b450f2ec9 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyGlowFlash2.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index e1e14712ef..989ff9a9a1 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -35,6 +35,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class AstrumDeusHead : ModNPC { @@ -50,6 +51,7 @@ namespace CalamityMod.NPCs.AstrumDeus public static Asset TextureGlow2; public static Asset TextureGlow3; public static Asset TextureGlow4; + public static Asset TextureFlash2; // There is intentionally no flash texture for the eyes because I thought it looked weird public override void SetStaticDefaults() { @@ -69,6 +71,7 @@ namespace CalamityMod.NPCs.AstrumDeus TextureGlow2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); TextureGlow3 = ModContent.Request(Texture + "Glow3", AssetRequestMode.AsyncLoad); TextureGlow4 = ModContent.Request(Texture + "Glow4", AssetRequestMode.AsyncLoad); + TextureFlash2 = ModContent.Request(Texture + "GlowFlash2", AssetRequestMode.AsyncLoad); } } @@ -166,12 +169,18 @@ namespace CalamityMod.NPCs.AstrumDeus if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool drawCyan = NPC.Calamity().newAI[3] >= (Main.getGoodWorld ? 300f : 600f); bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; + float cyanThreshold = Main.getGoodWorld ? 300f : 600f; + // Head is always the last segment to visually transition + float transitionStart = cyanThreshold * 0.95f; + bool drawCyan = NPC.Calamity().newAI[3] >= cyanThreshold; + bool inColorTrans = doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold >= transitionStart; + Texture2D mainWormTex = TextureAssets.Npc[Type].Value; Texture2D secondWormTex = TextureGlow2.Value; + Texture2D otherMainTex, otherSecondTex; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -180,23 +189,45 @@ namespace CalamityMod.NPCs.AstrumDeus spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); mainWormTex = TextureGlow1.Value; + float colorOpacity = Utils.GetLerpValue(transitionStart, cyanThreshold, NPC.Calamity().newAI[3] % cyanThreshold, true); Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; - if (doubleWormPhase) + Color otherPhaseColor = drawCyan ? Color.Orange : Color.Cyan; + if (doubleWormPhase) // otherMainTex and otherSecondTex contain the opposite texture, and are faded in during the transition { mainWormTex = drawCyan ? mainWormTex : TextureGlow3.Value; + otherMainTex = drawCyan ? TextureGlow3.Value : mainWormTex; secondWormTex = drawCyan ? TextureGlow4.Value : secondWormTex; + otherSecondTex = drawCyan ? secondWormTex : TextureGlow4.Value; + } + else + { + otherMainTex = mainWormTex; + otherSecondTex = secondWormTex; } Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + { + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp * (inColorTrans ? 1f - colorOpacity : 1f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the new fading in glowmask for the upcoming behavior + if (inColorTrans) + spriteBatch.Draw(otherMainTex, drawLocation, NPC.frame, Color.Lerp(Color.White, otherPhaseColor, 0.5f) * colorOpacity, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Eyes intentionally do not flash + } timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - + { + spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp * (inColorTrans ? 1f - colorOpacity : 1f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the new fading in glowmask for the upcoming behavior + if (inColorTrans) + spriteBatch.Draw(otherSecondTex, drawLocation, NPC.frame, Color.Lerp(Color.White, otherPhaseColor, 0.5f) * colorOpacity, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the white flash immediately after swapping behaviors + if (doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold < 25f) + spriteBatch.Draw(TextureFlash2.Value, drawLocation, NPC.frame, Color.White * MathHelper.Lerp(1f, 0f, NPC.Calamity().newAI[3] % cyanThreshold / 25f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + } return false; } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadGlowFlash2.png b/NPCs/AstrumDeus/AstrumDeusHeadGlowFlash2.png new file mode 100644 index 0000000000..a974fd1138 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHeadGlowFlash2.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index df4cda8149..5c2009b644 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AstrumDeusHead))] public class AstrumDeusTail : ModNPC { @@ -22,6 +23,7 @@ namespace CalamityMod.NPCs.AstrumDeus public static Asset GlowTexture; public static Asset GlowTexture2; + public static Asset TextureFlash; public override void SetStaticDefaults() { @@ -31,6 +33,7 @@ namespace CalamityMod.NPCs.AstrumDeus { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); GlowTexture2 = ModContent.Request(Texture + "Glow2", AssetRequestMode.AsyncLoad); + TextureFlash = ModContent.Request(Texture + "GlowFlash", AssetRequestMode.AsyncLoad); } } @@ -105,11 +108,18 @@ namespace CalamityMod.NPCs.AstrumDeus if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool drawCyan = NPC.Calamity().newAI[3] >= (Main.getGoodWorld ? 300f : 600f); bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; + float cyanThreshold = Main.getGoodWorld ? 300f : 600f; + // Tail is always the first segment to visually transition + float transitionStart = cyanThreshold * 0.75f; + float transitionEnd = cyanThreshold * 0.8f; + bool drawCyan = NPC.Calamity().newAI[3] >= transitionEnd && NPC.Calamity().newAI[3] <= cyanThreshold + transitionEnd; + bool inColorTrans = doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold >= transitionStart && NPC.Calamity().newAI[3] % cyanThreshold <= transitionEnd; + Texture2D wormTexture = TextureAssets.Npc[Type].Value; + Texture2D otherTexture; Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; @@ -119,15 +129,29 @@ namespace CalamityMod.NPCs.AstrumDeus wormTexture = GlowTexture.Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; - if (doubleWormPhase) + Color otherPhaseColor = drawCyan ? Color.Orange : Color.Cyan; + if (doubleWormPhase) // otherTexture contains the opposite texture, and is faded in during the transition + { wormTexture = drawCyan ? GlowTexture2.Value : wormTexture; + otherTexture = drawCyan ? wormTexture : GlowTexture2.Value; + } + else + otherTexture = wormTexture; Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, wormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - + { + float opacity = Utils.GetLerpValue(transitionStart, transitionEnd, NPC.Calamity().newAI[3] % cyanThreshold, true); + spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, wormColorLerp * (inColorTrans ? 1f - opacity : 1f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the new fading in glowmask for the upcoming behavior + if (inColorTrans) + spriteBatch.Draw(otherTexture, drawLocation, NPC.frame, Color.Lerp(Color.White, otherPhaseColor, 0.5f) * opacity, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + // Controls drawing the white flash immediately after swapping behaviors + if (doubleWormPhase && NPC.Calamity().newAI[3] % cyanThreshold < 25f) + spriteBatch.Draw(TextureFlash.Value, drawLocation, NPC.frame, Color.White * MathHelper.Lerp(1f, 0f, NPC.Calamity().newAI[3] % cyanThreshold / 25f), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); + } return false; } diff --git a/NPCs/AstrumDeus/AstrumDeusTailGlowFlash.png b/NPCs/AstrumDeus/AstrumDeusTailGlowFlash.png new file mode 100644 index 0000000000..d8f48ba6b6 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusTailGlowFlash.png differ diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 95eeab7720..4a97327806 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.CalClone CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); // Mark the Calamitas Clone as dead DownedBossSystem.downedCalamitasClone = true; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index 4ae6fd1ae2..c7bc0300cc 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -102,6 +102,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); // Phase for flying at the player bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; @@ -365,6 +368,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); } + Main.npc[lol].ai[3] = segments + 1; Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; @@ -864,8 +868,15 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } } + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, npc.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < resistanceTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 0f)) + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) calamityGlobalNPC.newAI[1] += 1f; // Calculate contact damage based on velocity diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d21dfd4e62..1c3bdf8c60 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -72,7 +72,9 @@ using CalamityMod.UI; using CalamityMod.UI.DebuffSystem; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; +using Microsoft.Build.Evaluation; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Operations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoMod.Utils; @@ -338,6 +340,25 @@ namespace CalamityMod.NPCs public int veriumDoomTimer = 0; public int veriumDoomStacks = 0; public bool veriumDoomMarked = false; + + public bool laserBurnMarked = false; + /// + /// The type of laser burn that this NPC is inflicted with.
+ /// When set to 1, applies all accrued damage in a single hit. When set to 2, deals constant flat damage + extra flat damage from stacks. + ///
+ public int laserBurnType = 0; + public int laserBurnDamage = 0; // Only used if laser burn type is 1 + public const int laserBurnTime = 300; + public int laserBurnTimer = 0; + public int laserBurnStacks = 0; + + public bool hyperiusMarked = false; + public int hyperiusDamage = 0; + public static int hyperiusOverflowTime = 100; + public int hyperiusOverflowTimer = hyperiusOverflowTime; + public static float hyperiusLifePercentThreshold = 0.07f; // The % of max life the damage stacks must reach before they start to overflow + public int hyperiusFxTimer = 0; + /// /// Tracks the strength of Calamity's cursor effect; increments by 2 on every frame.
/// If this value reaches , the enemy is afflicted with True Vulnerability Hex. @@ -374,7 +395,7 @@ namespace CalamityMod.NPCs public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; - /// If greater than 0, this NPC has been "shocked" by Amidias' Spark's on hurt effect. + /// If greater than 0, this NPC has been "shocked" by Ilmeris' Spark's on hurt effect. public int shocked = 0; public int voidfrost = 0; public int shellfishVore = 0; @@ -604,6 +625,15 @@ namespace CalamityMod.NPCs myClone.veriumDoomTimer = veriumDoomTimer; myClone.veriumDoomStacks = veriumDoomStacks; myClone.veriumDoomMarked = veriumDoomMarked; + myClone.laserBurnDamage = laserBurnDamage; + myClone.laserBurnMarked = laserBurnMarked; + myClone.laserBurnStacks = laserBurnStacks; + myClone.laserBurnTimer = laserBurnTimer; + myClone.laserBurnType = laserBurnType; + myClone.hyperiusDamage = hyperiusDamage; + myClone.hyperiusMarked = hyperiusMarked; + myClone.hyperiusOverflowTimer = hyperiusOverflowTimer; + myClone.hyperiusFxTimer = hyperiusFxTimer; myClone.cursorFocus = cursorFocus; myClone.demonSwordImpales = demonSwordImpales; myClone.impalePacketTimer = impalePacketTimer; @@ -2689,7 +2719,6 @@ namespace CalamityMod.NPCs case NPCID.EyeofCthulhu: case NPCID.BrainofCthulhu: case NPCID.QueenBee: - case NPCID.Corruptor: case NPCID.Crawdad: case NPCID.Crawdad2: case NPCID.ManEater: @@ -2801,7 +2830,6 @@ namespace CalamityMod.NPCs npc.defDamage = npc.damage; npc.defense /= 2; npc.defDefense = npc.defense; - canBreakPlayerDefense = true; break; case NPCID.Antlion: @@ -2872,9 +2900,9 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = true; break; - // Make Fishron and Anahita Bubbles immune to damage in Rev+ Master Mode + // Make Fishron and Anahita Bubbles immune to damage in Death Mode case NPCID.DetonatingBubble: - npc.dontTakeDamage = Main.masterMode && CalamityWorld.revenge; + npc.dontTakeDamage = CalamityWorld.death; break; default: @@ -3620,6 +3648,16 @@ namespace CalamityMod.NPCs #endregion #region Scale Expert Multiplayer Stats + private const float VanillaScalingFactor_2Players = 1.35f; + private const float VanillaScalingFactor_3Players = 1.9166666666666666f; + + /// + /// Applies Calamity's adjustments to difficulty-based player count stat scaling for NPCs. Calamity only adjusts the health of NPCs and does not touch any other stats. + /// + /// The NPC which is having its stats adjusted. + /// The number of players considered active for the purposes of stat scaling. + /// The vanilla Expert+ multiplayer health scalar value. + /// An arbitrary float to make Master Mode easier. On Master Mode, it is 0.85, otherwise it is 1.0. public override void ApplyDifficultyAndPlayerScaling(NPC npc, int numPlayers, float balance, float bossAdjustment) { // Do absolutely nothing in single player, or in multiplayer with only one player connected. @@ -3630,43 +3668,72 @@ namespace CalamityMod.NPCs bool scalesLikeBoss = countsAsBoss || BossHPScalingList.List.Contains(npc.type); bool isCalamityNPC = npc.ModNPC != null && npc.ModNPC.Mod == CalamityMod.Instance; - // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. - if (scalesLikeBoss || isCalamityNPC) + // 14APR2025: Ozzatron: Reworked how Calamity changes the health of Expert+ multiplayer bosses + // Non-boss enemies that receive scaling in Expert+ are still reduced via the old formula + // + // TL;DR: + // - 2 players goes from 135% health to 175% health + // - 3 players goes from 191.6% health to 225% health + // - 4 players and beyond are unedited (4 players is 262.8% for reference) + + // This case applies to all bosses: vanilla, Calamity, and other mods, and anything that is supposed to scale like a boss. + if (countsAsBoss || scalesLikeBoss) { - double scalar; - switch (numPlayers) // Decrease HP in multiplayer before vanilla scaling - { - case 1: - scalar = 1.0; - break; + double adjustmentFactor = 1.0; - case 2: - scalar = 0.9; // 1.8 - break; + // The 2-player boss case is too easy; 1.35x health does not even come close to justify being able to respawn. + if (numPlayers == 2) + adjustmentFactor = BalancingConstants.ExpertHealthScalingOverride_2Players / VanillaScalingFactor_2Players; - case 3: - scalar = 0.82; // 2.46 - break; + // Similarly, the 3-player boss case is too easy, given the considerably higher damage output available. + else if (numPlayers == 3) + adjustmentFactor = BalancingConstants.ExpertHealthScalingOverride_3Players / VanillaScalingFactor_3Players; - case 4: - scalar = 0.76; // 3.04 - break; + // Cases beyond 3 players are already sufficiently scaled by vanilla and continue to scale harder with more players. - case 5: - scalar = 0.71; // 3.55 - break; - - case 6: - scalar = 0.67; // 4.02 - break; - - default: - scalar = 0.64; // 4.48 + 0.64 per player beyond 7 - break; - } - - npc.lifeMax = (int)Math.Round(npc.lifeMax * scalar); + // Apply the adjustment factor, if any. No other changes are made to bosses or boss-like NPCs. + npc.life = (int)Math.Round(npc.life * adjustmentFactor); + return; } + + // Do not touch non-boss NPCs from vanilla or other mods. + if (!isCalamityNPC) + return; + + // Reduction to multiplayer HP scaling for non-boss Calamity enemies in Expert+ + double scalar; + switch (numPlayers) + { + case 1: + scalar = 1.0; + break; + + case 2: + scalar = 0.9; // 1.8 + break; + + case 3: + scalar = 0.82; // 2.46 + break; + + case 4: + scalar = 0.76; // 3.04 + break; + + case 5: + scalar = 0.71; // 3.55 + break; + + case 6: + scalar = 0.67; // 4.02 + break; + + default: + scalar = 0.64; // 4.48 + 0.64 per player beyond 7 + break; + } + + npc.lifeMax = (int)Math.Round(npc.lifeMax * scalar); } #endregion @@ -3845,6 +3912,11 @@ namespace CalamityMod.NPCs return calcDR; } + + public bool IsArmored() + { + return unbreakableDR && DR > 0.9f; + } #endregion #region Boss Head Slot @@ -3900,6 +3972,9 @@ namespace CalamityMod.NPCs { if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) Main.LocalPlayer.AddBuff(BuffType(), 2); + + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && npc.type == NPCType() && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) + Main.LocalPlayer.AddBuff(BuffType(), 2); } if (npc.type != NPCType()) @@ -4040,7 +4115,7 @@ namespace CalamityMod.NPCs return QueenBeeAI.BuffedQueenBeeAI(npc, Mod); } - if (Main.masterMode && CalamityWorld.revenge) + if (CalamityWorld.death) { if (npc.type == NPCID.DetonatingBubble) return DukeFishronAI.BuffedDetonatingBubbleAI(npc, Mod); @@ -4057,9 +4132,9 @@ namespace CalamityMod.NPCs { npc.TargetClosest(); - float velocity = Main.getGoodWorld ? 10f : (Main.masterMode || BossRushEvent.BossRushActive) ? 8f : 6f; + float velocity = Main.getGoodWorld ? 12f : (Main.masterMode || BossRushEvent.BossRushActive) ? 10.5f : 9f; if (npc.ai[1] == 70f) - velocity *= 0.6f; + velocity *= 0.4f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; } @@ -5776,6 +5851,9 @@ namespace CalamityMod.NPCs if (veriumDoomTimer > 0) veriumDoomTimer--; + if (laserBurnTimer > 0) + laserBurnTimer--; + if (veriumDoomTimer == 0 && veriumDoomMarked) { for (int d = 0; d < 14 + veriumDoomStacks; d++) @@ -5808,6 +5886,77 @@ namespace CalamityMod.NPCs spark.penetrate = 3; } } + if (hyperiusMarked) + { + if (hyperiusFxTimer < 20) + hyperiusFxTimer++; + else if (hyperiusFxTimer > 20) + hyperiusFxTimer = (int)Utils.Lerp(hyperiusFxTimer, 20, 0.2f); + + float threshold = ((float)(hyperiusDamage) / (float)(npc.lifeMax)); + int overflowSpeed = (int)Utils.Remap(threshold, hyperiusLifePercentThreshold, 0.35f, 1, 34); + if (threshold > hyperiusLifePercentThreshold) // If the stored damage is greater than the life % cap of the target's max health, rapily deal a % of the stored damage to the enemy to drain it + { + bool enemyIsNotArmored = (npc.defense < 1000 && !unbreakableDR && DR <= 0.9f && !npc.dontTakeDamage && !npc.immortal); + if (enemyIsNotArmored) + hyperiusOverflowTimer -= overflowSpeed; + if (hyperiusOverflowTimer <= 0) + { + hyperiusOverflowTimer = hyperiusOverflowTime; + + float damagePercent = 0.07f; // The % of stacks drained when you're over the cap + int damage = (int)Math.Max((int)((float)(hyperiusDamage) * damagePercent), 1); + hyperiusDamage -= damage; + + // Spawn "bleed" hit + // Uses a seperate projectile so that the hit takes defense and DR into account + Projectile overflow = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), damage, 0, -1, npc.whoAmI); + overflow.DamageType = DamageClass.Ranged; + if (hyperiusFxTimer >= 20) + hyperiusFxTimer = 35; + + if (hyperiusDamage <= 0) + { + hyperiusDamage = 0; + hyperiusMarked = false; + } + } + } + } + else if (hyperiusFxTimer > 0) + hyperiusFxTimer--; + + if ((laserBurnTimer <= 0 || laserBurnDamage >= npc.life * 1.5f) && laserBurnMarked && laserBurnType > 0) + { + if (laserBurnType == 1) // Applied damage + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), laserBurnDamage, 0, Main.myPlayer, npc.whoAmI); + if (laserBurnType == 2) // Flat damage + stacks + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), 70 + (20 * laserBurnStacks), 0, Main.myPlayer, npc.whoAmI); + + for (int d = 0; d < (int)(7 + laserBurnStacks * 0.4f); d++) + { + float partScale = Main.rand.NextFloat(0.7f, 1f); + Vector2 partVel = (new Vector2(10, 10) * (laserBurnStacks * 0.025f)).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + + Particle spark2 = new CustomSpark(npc.Center, partVel, "CalamityMod/Particles/BloomLineSoftEdge", false, 12, Main.rand.NextFloat(0.02f, 0.03f), Effects.ArsenalEffects.ArsenalLaserColor * 0.8f, new Vector2(1, 1), true, false, 0, false, false, 1f); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(npc.Center, Effects.ArsenalEffects.ArsenalLaserDust); + dust.velocity = (Vector2.UnitX * 5 * (laserBurnStacks * 0.05f)).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1f); + dust.scale = Main.rand.NextFloat(0.65f, 0.8f); + dust.noGravity = true; + dust.color = Color.Red; + } + + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/LaserBurn") { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, npc.Center); + laserBurnMarked = false; + laserBurnStacks = 0; + laserBurnTimer = 0; + laserBurnDamage = 0; + } + + // Queen Bee is completely immune to having her movement impaired if not in a high difficulty mode. + if (npc.type == NPCID.QueenBee && !CalamityWorld.revenge && !BossRushEvent.BossRushActive) + return; // Pearl Aura shard spawning // Slowing is handled in the general slowing code below @@ -6060,6 +6209,52 @@ namespace CalamityMod.NPCs break; + case NPCID.DevourerHead: + case NPCID.FaceMonster: + target.AddBuff(BuffID.Weak, 180); + break; + + case NPCID.Crawdad: + case NPCID.Crawdad2: + case NPCID.UndeadViking: + target.AddBuff(BuffID.BrokenArmor, 180); + break; + + case NPCID.ArmoredViking: + target.AddBuff(BuffID.BrokenArmor, 300); + break; + + case NPCID.Ghost: + case NPCID.PirateGhost: + target.AddBuff(BuffID.Cursed, 120); + target.AddBuff(BuffID.Silenced, 120); + break; + + case NPCID.ChaosElemental: + target.AddBuff(BuffID.Silenced, 180); + break; + + case NPCID.IlluminantBat: + target.AddBuff(BuffID.Confused, 120); + break; + + case NPCID.IlluminantSlime: + target.AddBuff(BuffID.Slow, 180); + break; + + case NPCID.Piranha: + target.AddBuff(BuffID.Bleeding, 180); + break; + + case NPCID.Arapaima: + case NPCID.BloodFeeder: + target.AddBuff(BuffID.Bleeding, 300); + break; + + case NPCID.ToxicSludge: + target.AddBuff(BuffID.Slow, 300); + break; + case NPCID.ShadowFlameApparition: target.AddBuff(BuffType(), 120); break; @@ -6243,7 +6438,7 @@ namespace CalamityMod.NPCs if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 12f) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 12f; - target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Rebecca").Format(target.name)), 1000.0, 0); + target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Rebecca").ToNetworkText(target.name)), 1000.0, 0); modifiers.SourceDamage *= target.statLifeMax2 * Main.rand.NextFloat(3f, 6f); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6261,6 +6456,11 @@ namespace CalamityMod.NPCs if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.1f; + if (IsArmored()) //Hide combat text so we can draw our own for armored NPCs + { + modifiers.HideCombatText(); + } + // True melee resists if (DesertScourgeIDList.Includes(npc.type) || EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc.type) || AquaticScourgeIDList.Includes(npc.type) || DestroyerIDList.Includes(npc.type) || @@ -6286,6 +6486,11 @@ namespace CalamityMod.NPCs MakeTownNPCsTakeMoreDamage(npc, projectile, Mod, ref modifiers); + if (IsArmored()) //Hide combat text so we can draw our own for armored NPCs + { + modifiers.HideCombatText(); + } + // Block natural falling stars from killing boss spawners randomly if ((projectile.type == ProjectileID.FallingStar && projectile.damage >= 1000) && (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType())) modifiers.SourceDamage *= 0f; @@ -6445,9 +6650,6 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.4f; } - if (PierceResistList.Includes(npc.type)) - PierceResistGlobal(projectile, npc, ref modifiers); - if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.1f; @@ -6457,29 +6659,38 @@ namespace CalamityMod.NPCs if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) EditWhipTagDamage(projectile, npc, ref modifiers); } + #endregion - // Generalized pierce resistance that stacks with all other resistances for some specific bosses defined in a list. - // The actual resistance formula isn't really a problem, but the implementation of this desperately needs refactoring. - private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) + #region OnHitBy overrides + public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { - // Thanatos segments do not trigger pierce resistance if they are closed - if (ThanatosIDList.Includes(npc.type) && unbreakableDR) - return; + if (IsArmored()) + { + CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); + } + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + float rate = (Main.GlobalTimeWrappedHourly * 3f); + List eColors = new List() + { + Color.Yellow, + Color.Magenta, + Color.Red, + Color.Cyan, + Color.Lime + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); - // Isolates projectiles which ignore pierce resist only on Leviathan and Astrum Aureus - if ((npc.type == NPCType() || npc.type == NPCType()) && PierceResistExceptionLeviAureusList.Includes(projectile.type)) - return; + CombatText.NewText(npc.Hitbox, usedColor, damagedone, hit.Crit, true); + } - float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; - if (damageReduction > CalamityGlobalProjectile.PierceResistCap) - damageReduction = CalamityGlobalProjectile.PierceResistCap; - - modifiers.FinalDamage *= 1f - damageReduction; - - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo) - projectile.Calamity().timesPierced++; } + #endregion + #region Whip Tag // Make whip tags multiplicative, by effectively reversing the process done to it private void EditWhipTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) { @@ -6596,7 +6807,8 @@ namespace CalamityMod.NPCs NPCType() }); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, randomType); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, randomType); } } @@ -6920,7 +7132,7 @@ namespace CalamityMod.NPCs WeightedRandom pool = new WeightedRandom(); pool.Add(NPCID.None, 0f); pool.Add(NPCType(), 0.025f); - pool.Add(NPCType(), 0.001f); + pool.Add(NPCType(), 0.01f); // Normal droids are replaced with plague droids in the Jungle Lab. if (nearPlagueLab) { @@ -7132,6 +7344,19 @@ namespace CalamityMod.NPCs DeerclopsAI.outerBorder = DeerclopsAI.maxDRIncreaseDistance * 5f; } + // Despawn Blazing Wheels and Spike Balls when a boss spawns so they're not annoying and stay in the arena + if (npc.boss) + { + foreach (NPC n in Main.ActiveNPCs) + { + if (n.type == NPCID.BlazingWheel || n.type == NPCID.SpikeBall) + { + n.active = false; + n.netUpdate = true; + } + } + } + if (npc.type != NPCID.VoodooDemon) return; @@ -7255,9 +7480,69 @@ namespace CalamityMod.NPCs if (heavybleeding > 0) HeavyBleeding.DrawEffects(npc, ref drawColor); + if (hyperiusFxTimer > 0) + { + float rate = (Main.GlobalTimeWrappedHourly * 5); + List eColors = new List() + { + Color.Yellow, + Color.Magenta, + Color.Red, + Color.Cyan, + Color.Lime + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Texture2D tex2 = Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D sparkle = Request("CalamityMod/Particles/BloomLineSoftEdge").Value; + Vector2 drawPosition = npc.Center - Main.screenPosition; + float drawRotation = npc.rotation + (npc.spriteDirection == -1 ? MathHelper.Pi : 0f); + + float power = (float)(Math.Pow(Utils.GetLerpValue(0, 20, hyperiusFxTimer, true), 3)) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 100, 1.4f, 0.5f); + for (int i = 0; i < 4; i++) + { + float iMult = (1 + 0.25f * i); + Main.EntitySpriteDraw(tex2, drawPosition, null, Color.Lerp(usedColor, Color.White, i * 0.1f) with { A = 0 } * 0.6f, Main.rand.NextFloat(-5f, 5f), tex2.Size() * 0.5f, new Vector2(1f, 0.8f) * 0.35f * Main.rand.NextFloat(0.9f, 1.1f) * iMult * power * (Utils.GetLerpValue(0, 20, hyperiusFxTimer)), SpriteEffects.None); + + for (int b = -1; b <= 1; b += 2) + { + float uncappedSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 8f / MathHelper.Pi); + float sine = MathHelper.Lerp(Math.Abs(uncappedSine), 0.75f, 0.75f); + Vector2 scale = new Vector2((0.25f / iMult) + (0.7f * (1 - sine)), 1.1f * sine * iMult) * power * 0.05f; + float rotation = MathHelper.PiOver4 * b * uncappedSine; + Main.EntitySpriteDraw(sparkle, drawPosition, null, Color.Lerp(usedColor, Color.White, i * 0.1f) with { A = 0 }, rotation, sparkle.Size() * 0.5f, scale, SpriteEffects.None); + } + } + } + if (laceration > 0) Laceration.DrawEffects(npc, ref drawColor); + if (laserBurnTimer > 0) + { + int particleChance = Math.Max(3, 10 - (laserBurnStacks / 3)); + if (laserBurnTimer % particleChance == 0) + { + Vector2 randPosition = new Vector2(npc.position.X + Main.rand.Next(0, npc.width), npc.position.Y + Main.rand.Next(0, npc.height)); + + Dust dust = Dust.NewDustPerfect(randPosition, Effects.ArsenalEffects.ArsenalLaserDust); + dust.velocity = ((Vector2.UnitX * 3 * (laserBurnStacks * 0.03f)).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1f)) + npc.velocity * 0.5f; + dust.scale = Main.rand.NextFloat(0.55f, 0.7f) + laserBurnStacks * 0.01f; + dust.noGravity = true; + dust.color = Color.Red; + dust.fadeIn = laserBurnStacks * 0.3f; + } + if (laserBurnType == 0) + { + Main.NewText("No Burn Type Set", Color.OrangeRed); + laserBurnMarked = false; + laserBurnTimer = 0; + } + } + // These draw effects do not include Miracle Blight's shader if (miracleBlight > 0) MiracleBlight.DrawEffects(npc, ref drawColor); @@ -7402,7 +7687,7 @@ namespace CalamityMod.NPCs if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); - if (npc.type == NPCID.KingSlime && Main.masterMode && CalamityWorld.revenge) + if (npc.type == NPCID.KingSlime && CalamityWorld.death) return NPC.AnyNPCs(NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; if (npc.type == NPCID.QueenBee && Main.zenithWorld) @@ -7598,10 +7883,10 @@ namespace CalamityMod.NPCs float drawPosX = totalLength >= 80f ? 40f : (float)(totalLength / 2); // The height of a single frame of the npc - float npcHeight = (float)(TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type] / 2) * npc.scale; + float npcHeight = (npc.height * npc.scale)/2;//(float)(TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type] / 2) * npc.scale; // Offset the debuff display based on the npc's graphical offset, and 16 units, to create some space between the sprite and the display - float drawPosY = npcHeight + npc.gfxOffY + 16f; + float drawPosY = npcHeight + npc.gfxOffY + 32f; // Iterate through the buff texture list for (int i = 0; i < currentDebuffs.Count; i++) @@ -8384,7 +8669,7 @@ namespace CalamityMod.NPCs // His afterimages I can't get to work, so fuck it else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { - Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? ExtraTextureRefs.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; + Texture2D npcTexture = (death && npc.type == NPCID.SkeletronPrime) ? ExtraTextureRefs.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; npc.frame.Y = (int)newAI[3]; @@ -8447,7 +8732,7 @@ namespace CalamityMod.NPCs spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); Color eyesColor = new Color(200, 200, 200, 0); - if (masterMode && revenge) + if (death) { int alpha = 192; eyesColor = npc.type == NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); @@ -8540,7 +8825,7 @@ namespace CalamityMod.NPCs public override bool? DrawHealthBar(NPC npc, byte hbPosition, ref float scale, ref Vector2 position) { - if ((CalamityWorld.revenge && Main.masterMode) || BossRushEvent.BossRushActive) + if (CalamityWorld.death || BossRushEvent.BossRushActive) { if (npc.type == NPCID.Creeper) { @@ -9757,5 +10042,34 @@ namespace CalamityMod.NPCs return result; } #endregion + + #region Type Name Changes + public override void ModifyTypeName(NPC npc, ref string typeName) + { + if ((Main.masterMode && CalamityWorld.death) || BossRushEvent.BossRushActive) + { + if (npc.type == NPCID.SkeletronPrime) + { + typeName = CalamityUtils.GetTextValue("NPCs.SkeletronOmega.DisplayName"); + } + if (npc.type == NPCID.PrimeSaw) + { + typeName = CalamityUtils.GetTextValue("NPCs.OmegaSaw.DisplayName"); + } + if (npc.type == NPCID.PrimeLaser) + { + typeName = CalamityUtils.GetTextValue("NPCs.OmegaLaser.DisplayName"); + } + if (npc.type == NPCID.PrimeVice) + { + typeName = CalamityUtils.GetTextValue("NPCs.AlphaVice.DisplayName"); + } + if (npc.type == NPCID.PrimeCannon) + { + typeName = CalamityUtils.GetTextValue("NPCs.AlphaCannon.DisplayName"); + } + } + } + #endregion } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 40e1b12dbe..0fbc8d96f7 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using CalamityMod.Events; using CalamityMod.Items; @@ -134,9 +135,27 @@ namespace CalamityMod.NPCs // Crawdad // Craw Carapace @ 14.29% Normal, 25% Expert+ + // Armor Polish @ 1% Normal, 2% Expert+ case NPCID.Crawdad: case NPCID.Crawdad2: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.ArmorPolish, 100, 50)); + break; + + // Toxic Sludge + // Fast Clock @ 1% Normal, 2% Expert+ + case NPCID.ToxicSludge: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.FastClock, 100, 50)); + break; + + // Medusa + // Pocket Mirror @ 10% Normal, 20% Expert+ + case NPCID.Medusa: + // Remove the vanilla loot rule for Pocket Mirror. + npcLoot.RemoveWhere((rule) => rule is CommonDrop conditionalRule && conditionalRule.itemId == ItemID.PocketMirror); + + // Define a replacement rule which has an increased chance. + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.PocketMirror, 10, 5)); break; // Tim @@ -218,6 +237,18 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); break; + // Desert Spirit + // Nazar @ 1% Normal, 2% Expert+ + case NPCID.DesertDjinn: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Nazar, 100, 50)); + break; + + // Dreamer Ghoul + // Trifold Map @ 1% Normal, 2% Expert+ + case NPCID.DesertGhoulHallow: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.TrifoldMap, 100, 50)); + break; + // Sand Elemental // Elemental in a Bottle @ 20% Normal, 33.33% Expert+ // Rare Elemental in a Bottle @ 10% Normal, 16.67% Expert+ @@ -231,21 +262,41 @@ namespace CalamityMod.NPCs #region Ice - // Ice Bat. + // Ice Bat // Frostbat Staff @ 6.67% case NPCID.IceBat: npcLoot.Add(ModContent.ItemType(), 15); break; + // Undead Viking, Armored Viking + // Armor Polish @ 1% Normal, 2% Expert + case NPCID.UndeadViking: + case NPCID.ArmoredViking: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.ArmorPolish, 100, 50)); + break; + // Icy Merman, Icy Tortoise, Ice Elemental, Wolf // Essence of Eleum @ 100% case NPCID.IcyMerman: - case NPCID.IceTortoise: case NPCID.IceElemental: case NPCID.Wolf: npcLoot.Add(ModContent.ItemType()); break; + // Modify Frozen Turtle Shell drop rate from 2% to 5% + case NPCID.IceTortoise: + npcLoot.Add(ModContent.ItemType()); + List rules = npcLoot.Get(false); + foreach (IItemDropRule rule in rules) + { + if (rule is CommonDrop drop && drop.itemId == ItemID.FrozenTurtleShell) + { + drop.chanceDenominator = 20; + return; + } + } + break; + // Ice Mimic // 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 @@ -330,6 +381,14 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 8, 5)); break; + // Piranha, Arapaima, Blood Feeder + // Adhesive Bandage @ 1% Normal, 2% Expert+ + case NPCID.Piranha: + case NPCID.Arapaima: + case NPCID.BloodFeeder: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.AdhesiveBandage, 100, 50)); + break; + // Shark // Shark Tooth Necklace @ 4% Normal, 6.67% Expert+ // Joyful Heart @ 5% @@ -349,6 +408,31 @@ namespace CalamityMod.NPCs #endregion #region Corruption, Crimson, Hallow + // Face Monster, Devourer + // Vitamins @ 1% Normal, 2% Expert+ + case NPCID.FaceMonster: + case NPCID.DevourerHead: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Vitamins, 100, 50)); + break; + + // Chaos Elemental + // Megaphone @ 1% Normal, 2% Expert+ + case NPCID.ChaosElemental: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Megaphone, 100, 50)); + break; + + // Illuminant Bat + // Trifold Map @ 1% Normal, 2% Expert+ + case NPCID.IlluminantBat: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.TrifoldMap, 100, 50)); + break; + + // Illuminant Slime + // Fast Clock @ 1% Normal, 2% Expert+ + case NPCID.IlluminantSlime: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.FastClock, 100, 50)); + break; + // Gastropod // 5-10 Pink Gel @ 100% case NPCID.Gastropod: @@ -487,6 +571,13 @@ namespace CalamityMod.NPCs npcLoot.ChangeDropRate(ItemID.Tabi, 1, 4); break; + // Necromancers + // Nazar @ 1% Normal, 2% Expert+ + case NPCID.Necromancer: + case NPCID.NecromancerArmored: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.FastClock, 100, 50)); + break; + // Paladin // Paladin's Hammer @ 15% INSTEAD OF 6.67% // Paladin's Shield @ 20% INSTEAD OF 9.33% @@ -505,9 +596,10 @@ namespace CalamityMod.NPCs break; // Fire Imp - // Ashen Stalactite @ 10% Normal, 16.67% Expert+ + // Ashen Stalactite @ 4%, 14.28% after defeating EoW/BoC case NPCID.FireImp: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 25); + npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 7); break; // Demon, Voodoo Demon @@ -545,8 +637,11 @@ namespace CalamityMod.NPCs break; // Ghost Bracelet @ 5% (Dandy requests this drops at a "high chance" but inventory clutter is real so) + // Nazar and Megaphone @ 1% Normal, 2% Expert case NPCID.Ghost: npcLoot.Add(ModContent.ItemType(), 20); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Nazar, 100, 50)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Megaphone, 100, 50)); break; #endregion @@ -648,6 +743,13 @@ namespace CalamityMod.NPCs rev.Add(ItemID.FlyingDutchmanMasterTrophy); rev.Add(ItemID.PirateShipMountItem, 4); break; + + // Pirate's Curse + // Nazar and Megaphone @ 1% Normal, 2% Expert + case NPCID.PirateGhost: + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Nazar, 100, 50)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Megaphone, 100, 50)); + break; #endregion #region Solar Eclipse @@ -1426,7 +1528,7 @@ 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, 25, 30)); + npcLoot.AddNormalOnly(DropHelper.PerPlayer(ModContent.ItemType(), 1, 30, 40)); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); // Master items drop in Revengeance @@ -1929,7 +2031,7 @@ DukeEditFailed: case NPCID.TheDestroyer: SetNewShopVariable(new int[] { NPCID.Demolitionist, 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); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss1 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -1941,7 +2043,7 @@ DukeEditFailed: if (lastTwinStanding) { SetNewShopVariable(new int[] { NPCID.Demolitionist, 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); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss2 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -1951,7 +2053,7 @@ DukeEditFailed: case NPCID.SkeletronPrime: SetNewShopVariable(new int[] { NPCID.Demolitionist, 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); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss3 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -1959,7 +2061,7 @@ DukeEditFailed: break; case NPCID.Plantera: - SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); + SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); SetNewBossJustDowned(npc); // Spawn Perennial Ore if Plantera has never been killed @@ -1983,19 +2085,19 @@ DukeEditFailed: break; case NPCID.Everscream: - SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedChristmasTree || !NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); + SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedChristmasTree || !NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); break; case NPCID.SantaNK1: - SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); + SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); break; case NPCID.IceQueen: - SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); + SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); break; case NPCID.Golem: - SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); + SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); SetNewBossJustDowned(npc); // If Golem has never been killed, send a message about the Plague. @@ -2030,7 +2132,7 @@ DukeEditFailed: break; case NPCID.MoonLordCore: - SetNewShopVariable(new int[] { NPCID.Princess, ModContent.NPCType() }, NPC.downedMoonlord); + SetNewShopVariable(new int[] { NPCID.Princess, ModContent.NPCType() }, NPC.downedMoonlord); SetNewBossJustDowned(npc); string key5 = "Mods.CalamityMod.Status.Progression.MoonBossText"; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 68a3d66585..e98c7a2da4 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -69,6 +69,7 @@ namespace CalamityMod.NPCs "Dazren", "Johnny Test", // <@!589966747977777197> (konorango) "Bling Bling Boy", // <@!522970788203069442> (phallguy) + "RICE", // <@!400107830889152524> (rice_xd.) }; private static readonly string[] ArmsDealerNames = { @@ -141,6 +142,7 @@ namespace CalamityMod.NPCs "Mihai", // <@!373941893467209730> (cmihaii.) "Cooler Kevin", // <@!614126424751603714> (exellent.) "Dinkleberg", // <@!581993958037520404> (hyperionzx) + "Wamy", }; private static readonly string[] MechanicNames = { @@ -188,6 +190,7 @@ namespace CalamityMod.NPCs "everquartz", // <@!451343554451865611> (everquartz) "Gwynevere", // <@!142752927348424704> (nuclearchaosazathoth) "Hael", // <@!641747280944431156> (kalebtull) + "Yumesaki Mirrin", // <@!100235144744415232> (milinen) }; private static readonly string[] SantaClausNames = { @@ -212,6 +215,7 @@ namespace CalamityMod.NPCs "Amber", // <@!114677116473180169> (mishirousui) "Faith", // <@!509050283871961123> (toasty1007) "Xsiana", // <@!625780237489143839> (lokistic) + "Lain", // <@!655201622863118337> (literallyadeerfr) }; private static readonly string[] TavernkeepNames = { @@ -223,6 +227,7 @@ namespace CalamityMod.NPCs private static readonly string[] TaxCollectorNames = { "Emmett", + "Casino King Gray", // <@!555512087711973390> (eternalgrayson) }; private static readonly string[] TravelingMerchantNames = { @@ -681,11 +686,11 @@ namespace CalamityMod.NPCs (NPCID.Cyborg,(Player player) => player.Calamity().newCyborgInventory, (Player player, bool enabled) =>{ player.Calamity().newCyborgInventory = enabled; }), (NPCID.Princess, (Player player) => player.Calamity().newPrincessInventory,(Player player, bool enabled) =>{ player.Calamity().newPrincessInventory = enabled; }), (NPCID.SkeletonMerchant, (Player player) => player.Calamity().newSkeletonMerchantInventory, (Player player, bool enabled) =>{ player.Calamity().newSkeletonMerchantInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newAmidiasInventory,(Player player, bool enabled) =>{ player.Calamity().newAmidiasInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newBanditInventory,(Player player, bool enabled) =>{ player.Calamity().newBanditInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newCirrusInventory,(Player player, bool enabled) =>{ player.Calamity().newCirrusInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newPermafrostInventory,(Player player, bool enabled) =>{ player.Calamity().newPermafrostInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newCalamitasInventory,(Player player, bool enabled) =>{ player.Calamity().newCalamitasInventory = enabled; }) // lol + (NPCType(), (Player player) => player.Calamity().newAmidiasInventory,(Player player, bool enabled) =>{ player.Calamity().newAmidiasInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newBanditInventory,(Player player, bool enabled) =>{ player.Calamity().newBanditInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newCirrusInventory,(Player player, bool enabled) =>{ player.Calamity().newCirrusInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newPermafrostInventory,(Player player, bool enabled) =>{ player.Calamity().newPermafrostInventory = enabled; }), + (NPCType(), (Player player) => player.Calamity().newCalamitasInventory,(Player player, bool enabled) =>{ player.Calamity().newCalamitasInventory = enabled; }) // lol }; public void TownNPCAlertSystem(NPC npc, Mod mod, SpriteBatch spriteBatch) @@ -763,10 +768,10 @@ namespace CalamityMod.NPCs #region NPC Chat public override void GetChat(NPC npc, ref string chat) { - int fapsol = NPC.FindFirstNPC(NPCType()); - int permadong = NPC.FindFirstNPC(NPCType()); - int seahorse = NPC.FindFirstNPC(NPCType()); - int thief = NPC.FindFirstNPC(NPCType()); + int cirrus = NPC.FindFirstNPC(NPCType()); + int permadong = NPC.FindFirstNPC(NPCType()); + int seahorse = NPC.FindFirstNPC(NPCType()); + int thief = NPC.FindFirstNPC(NPCType()); int angelstatue = NPC.FindFirstNPC(NPCID.Merchant); switch (npc.type) @@ -819,8 +824,8 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse"); else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom) { - if (Main.rand.NextBool() && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.DryadChat.DrunkPrincessShroom").Format(Main.npc[fapsol].GivenName); + if (Main.rand.NextBool() && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.DryadChat.DrunkPrincessShroom").Format(Main.npc[cirrus].GivenName); else chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom"); } @@ -862,8 +867,8 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.Eclipse"); else if (Main.rand.NextBool(5) && AcidRainEvent.AcidRainEventIsOngoing) chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.AcidRain"); - else if (Main.rand.NextBool(5) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.MechanicChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + else if (Main.rand.NextBool(5) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.MechanicChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Merchant: @@ -912,8 +917,8 @@ namespace CalamityMod.NPCs case NPCID.PartyGirl: if (Main.rand.NextBool(4) && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.PartyGirlChat.Eclipse" + Main.rand.Next(1, 2 + 1)); - else if (Main.rand.NextBool(10) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.PartyGirlChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + else if (Main.rand.NextBool(10) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.PartyGirlChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Pirate: @@ -921,7 +926,7 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.PreLeviathan"); else if (Main.rand.NextBool(5) && DownedBossSystem.downedAquaticScourge) chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.WetScourgeDefeated"); - else if (Main.rand.NextBool(5) && fapsol != -1) + else if (Main.rand.NextBool(5) && cirrus != -1) chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.DrunkPrincess"); else if (Main.rand.NextBool(5) && seahorse != -1) chat = CalamityUtils.GetText("Vanilla.PirateChat.SeaKing").Format(Main.npc[seahorse].GivenName); @@ -949,8 +954,12 @@ namespace CalamityMod.NPCs string worldEvil = Language.GetTextValue("LegacyMisc." + (WorldGen.crimson ? 102 : 101)); if (Main.rand.NextBool(15) && Main.hardMode) chat = CalamityUtils.GetText("Vanilla.StylistChat.Hardmode").Format(worldEvil); - if (Main.rand.NextBool(15) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.StylistChat.DrunkPrincess" + (ChildSafety.Disabled ? Main.rand.Next(1, 2 + 1) : 1)).Format(Main.npc[fapsol].GivenName); + if (Main.rand.NextBool(15) && cirrus != -1) + { + int noChildSafetyCirrusLines = NPC.downedMoonlord ? Main.rand.Next(2, 3 + 1) : Main.rand.Next(1, 2 + 1); + int childSafetyCirrusLines = NPC.downedMoonlord ? 3 : 1; + chat = CalamityUtils.GetText("Vanilla.StylistChat.DrunkPrincess" + (ChildSafety.Disabled ? noChildSafetyCirrusLines : childSafetyCirrusLines)).Format(Main.npc[cirrus].GivenName); + } if ((Main.rand.NextBool(npc.GivenName == "Amber" ? 10 : 15)) && Main.LocalPlayer.Calamity().pSoulArtifact) { if (Main.LocalPlayer.Calamity().profanedCrystalBuffs) @@ -963,8 +972,8 @@ namespace CalamityMod.NPCs case NPCID.DD2Bartender: if (Main.rand.NextBool(5) && !Main.dayTime && Main.moonPhase == 0) chat = CalamityUtils.GetTextValue("Vanilla.TavernkeepChat.FullMoon"); - else if (Main.rand.NextBool(10) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.TavernkeepChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + else if (Main.rand.NextBool(10) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.TavernkeepChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.TaxCollector: @@ -994,13 +1003,13 @@ namespace CalamityMod.NPCs break; case NPCID.TravellingMerchant: - if (Main.rand.NextBool(5) && fapsol != -1 && angelstatue != -1) - chat = CalamityUtils.GetText("Vanilla.TravellingMerchantChat.DrunkPrincessMerchant").Format(Main.npc[fapsol].GivenName, Main.npc[angelstatue].GivenName); + if (Main.rand.NextBool(5) && cirrus != -1 && angelstatue != -1) + chat = CalamityUtils.GetText("Vanilla.TravellingMerchantChat.DrunkPrincessMerchant").Format(Main.npc[cirrus].GivenName, Main.npc[angelstatue].GivenName); break; case NPCID.Truffle: - if (Main.rand.NextBool(4) && fapsol != -1) - chat = CalamityUtils.GetText("Vanilla.TruffleChat.DrunkPrincess").Format(Main.npc[fapsol].GivenName); + if (Main.rand.NextBool(4) && cirrus != -1) + chat = CalamityUtils.GetText("Vanilla.TruffleChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); else if (Main.rand.NextBool(8)) chat = CalamityUtils.GetTextValue("Vanilla.TruffleChat.Normal"); break; @@ -1115,7 +1124,7 @@ namespace CalamityMod.NPCs .AddWithCustomValue(ItemID.WormholePotion, Item.buyPrice(silver: 5), Condition.HappyEnoughToSellPylons); shop.Add(ItemID.Flare, hasFlareGunUpgrade) .Add(ItemID.BlueFlare, hasFlareGunUpgrade) - .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())) + .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())) .AddWithCustomValue(ItemID.Burger, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) .AddWithCustomValue(ItemID.Hotdog, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) .AddWithCustomValue(ItemID.CoffeeCup, Item.buyPrice(gold: 2), Condition.HappyEnoughToSellPylons); @@ -1150,8 +1159,8 @@ namespace CalamityMod.NPCs .Add(ItemType(), revengeance) .Add(ItemType(), revengeance) .AddWithCustomValue(ItemID.StylistKilLaKillScissorsIWish, Item.buyPrice(gold: 15)) - .Add(ItemType(), Condition.NpcIsPresent(NPCType()), drunk) - .AddWithCustomValue(ItemID.ChocolateChipCookie, Item.buyPrice(gold: 3), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCType())); + .Add(ItemType(), Condition.NpcIsPresent(NPCType()), drunk) + .AddWithCustomValue(ItemID.ChocolateChipCookie, Item.buyPrice(gold: 3), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCType())); } if (type == NPCID.Cyborg) @@ -1240,14 +1249,14 @@ namespace CalamityMod.NPCs if (type == NPCID.Princess) { - shop.AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(gold: 50)) + shop.AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(gold: 50), Condition.Hardmode) .Add(ItemType()) - .Add(ItemID.AppleJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.FruitJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.Lemonade, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.PrismaticPunch, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.SmoothieofDarkness, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.TropicalSmoothie, Condition.NpcIsPresent(NPCType())); + .Add(ItemID.AppleJuice, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.FruitJuice, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.Lemonade, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.PrismaticPunch, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.SmoothieofDarkness, Condition.NpcIsPresent(NPCType())) + .Add(ItemID.TropicalSmoothie, Condition.NpcIsPresent(NPCType())); } if (type == NPCID.SkeletonMerchant) diff --git a/NPCs/CalamityPierceResistance.cs b/NPCs/CalamityPierceResistance.cs new file mode 100644 index 0000000000..c69f0b3ad7 --- /dev/null +++ b/NPCs/CalamityPierceResistance.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using CalamityMod.Balancing; +using CalamityMod.Items.Accessories; +using CalamityMod.Projectiles; +using CalamityMod.Systems.Collections; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Core; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs +{ + public sealed class PierceResistNPC : GlobalNPC + { + private static HashSet exemptProjectiles; + private static HashSet pierceResistNPC; + private static HashSet singleHitboxNPC; + private static Dictionary singleHitboxExemptProjectiles; + + public override void Load() + { + exemptProjectiles = new(); + pierceResistNPC = new(); + singleHitboxNPC = new(); + singleHitboxExemptProjectiles = new(); + } + + public override void Unload() + { + exemptProjectiles?.Clear(); + exemptProjectiles = null; + pierceResistNPC?.Clear(); + pierceResistNPC = null; + singleHitboxNPC?.Clear(); + singleHitboxNPC = null; + singleHitboxExemptProjectiles?.Clear(); + singleHitboxExemptProjectiles = null; + } + + public override void SetStaticDefaults() + { + // Specific vanilla NPC's with pierce resistance + pierceResistNPC.Add(NPCID.EaterofWorldsHead); + pierceResistNPC.Add(NPCID.EaterofWorldsBody); + pierceResistNPC.Add(NPCID.EaterofWorldsTail); + pierceResistNPC.Add(NPCID.Creeper); + pierceResistNPC.Add(NPCID.TheDestroyer); + pierceResistNPC.Add(NPCID.TheDestroyerBody); + pierceResistNPC.Add(NPCID.TheDestroyerTail); + + // Specific vanilla projectile exemptions + exemptProjectiles.Add(ProjectileID.Arkhalis); + exemptProjectiles.Add(ProjectileID.ChargedBlasterLaser); + exemptProjectiles.Add(ProjectileID.ClingerStaff); + exemptProjectiles.Add(ProjectileID.FinalFractal); + exemptProjectiles.Add(ProjectileID.FlyingKnife); + exemptProjectiles.Add(ProjectileID.LastPrismLaser); + exemptProjectiles.Add(ProjectileType()); // Included here as it does not have a projectile + exemptProjectiles.Add(ProjectileID.MonkStaffT3); + exemptProjectiles.Add(ProjectileID.PiercingStarlight); + exemptProjectiles.Add(ProjectileID.SandnadoFriendly); + exemptProjectiles.Add(ProjectileID.Terragrim); + + // Specific vanilla projectile single hitbox exemptions + singleHitboxExemptProjectiles[ProjectileID.NettleBurstEnd] = true; + singleHitboxExemptProjectiles[ProjectileID.NettleBurstLeft] = true; + singleHitboxExemptProjectiles[ProjectileID.NettleBurstRight] = true; + singleHitboxExemptProjectiles[ProjectileID.PrincessWeapon] = true; + + var projectileTypes = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code) + .Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ModProjectile))); + + foreach (var type in projectileTypes) + { + try + { + var pierceResistException = type.GetCustomAttribute(); + if (pierceResistException == null) + continue; + + var projectileTypeMethod = typeof(ModContent).GetMethod(nameof(ModContent.ProjectileType)); + var projectileTypeActualMethod = projectileTypeMethod.MakeGenericMethod(type); + int projectileType = (int)projectileTypeActualMethod.Invoke(null, null); + + if (pierceResistException.OnlyForSingleHitbox) + { + singleHitboxExemptProjectiles[projectileType] = true; + continue; + } + else + { + exemptProjectiles.Add(projectileType); + } + } + catch (Exception e) + { + CalamityMod.Instance.Logger.Error($"Exception thrown while evaluating type \"{type.Name}\": {e}"); + } + } + + var npcTypes = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code) + .Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ModNPC))); + + foreach (var type in npcTypes) + { + try + { + var hasPierceResist = type.GetCustomAttribute(); + if (hasPierceResist == null) + continue; + + var npcTypeMethod = typeof(ModContent).GetMethod(nameof(ModContent.NPCType)); + var npcTypeActualMethod = npcTypeMethod.MakeGenericMethod(type); + int npcType = (int)npcTypeActualMethod.Invoke(null, null); + + pierceResistNPC.Add(npcType); + if (hasPierceResist.SingleHitbox) + singleHitboxNPC.Add(npcType); + } + catch (Exception e) + { + CalamityMod.Instance.Logger.Error($"Exception thrown while evaluating type \"{type.Name}\": {e}"); + } + } + } + + public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref NPC.HitModifiers modifiers) + { + // Skip if NPC does not have pierce resistance or projectile is exempt + if (!pierceResistNPC.Contains(npc.type) || exemptProjectiles.Contains(projectile.type)) + return; + + // Skip if the projectile is exempt on single hitboxes and the NPC is a single hitbox + if (singleHitboxExemptProjectiles.TryGetValue(projectile.type, out bool isSingleHitboxExempt) && isSingleHitboxExempt && singleHitboxNPC.Contains(npc.type)) + return; + + PierceResistGlobal(projectile, npc, ref modifiers); + } + + // Generalized pierce resistance that stacks with all other resistances for some specific bosses defined in a list. + private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) + { + // Thanatos segments do not trigger pierce resistance if they are closed + if (ThanatosIDList.Includes(npc.type) && npc.GetGlobalNPC().unbreakableDR) + return; + + float damageReduction = projectile.Calamity().timesPierced * BalancingConstants.PierceResistHarshness; + if (damageReduction > BalancingConstants.PierceResistCap) + damageReduction = BalancingConstants.PierceResistCap; + + modifiers.FinalDamage *= 1f - damageReduction; + + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo) + projectile.Calamity().timesPierced++; + } + } +} diff --git a/NPCs/CalamityTileCollisionHarmNPC.cs b/NPCs/CalamityTileCollisionHarmNPC.cs index c9b5f5f155..0e1c4d420a 100644 --- a/NPCs/CalamityTileCollisionHarmNPC.cs +++ b/NPCs/CalamityTileCollisionHarmNPC.cs @@ -25,6 +25,10 @@ namespace CalamityMod.NPCs private float terminalVelocityForFullFallDamage = 0; private bool CheckTiles = false; private Vector2 ForcedVel = Vector2.Zero; + /// + /// Set to true if you only want the npc to receive forced velocity and not receive damage. + /// + private bool ForceVelocityOnly = false; private bool hitVoid = false; private Player attacker; private int packetTimer = 0; @@ -43,7 +47,7 @@ namespace CalamityMod.NPCs } } - public bool FallDamageSusceptible => PotentialEnergyDamage > 0; + public bool FallDamageSusceptible => PotentialEnergyDamage > 0 || ForceVelocityOnly; public override bool InstancePerEntity => true; @@ -67,7 +71,7 @@ namespace CalamityMod.NPCs } /// - /// Sets up a NPC to recieve fall damage when they hit the ground. + /// Sets up a NPC to recieve forced velocity in a direction and receive fall damage when they hit the ground. /// /// The npc to apply fall damage to /// The player applying fall damage to the npc @@ -89,6 +93,27 @@ namespace CalamityMod.NPCs attacker = player; } + /// + /// Sets up a NPC to recieve forced velocity in a direction. + /// + /// The npc to apply velocity to + /// The player applying velocity to the npc + /// The velocity being applied to the npc + /// Will check for tiles in the collision instead of velocity + public void ApplyForcedVelocity(NPC npc, Player player, Vector2 forcedVel, bool checkTiles = false) + { + // NPCs that don't collide with tiles simply don't get velocity, lol. + if (npc.noTileCollide) + return; + + OldVelocity = npc.velocity; + OlderVelocity = npc.velocity; + CheckTiles = checkTiles; + ForcedVel = forcedVel; + attacker = player; + ForceVelocityOnly = true; + } + public override void PostAI(NPC npc) { if (FallDamageSusceptible) @@ -99,15 +124,18 @@ namespace CalamityMod.NPCs if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40)) { - int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); - Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI); - wallImpact.DamageType = DamageClass.Melee; + if (!ForceVelocityOnly) + { + int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI); + wallImpact.DamageType = DamageClass.Melee; + } PotentialEnergyDamage = 0; + ForceVelocityOnly = false; hitVoid = false; } - oldVelocity = npc.velocity.Length(); npc.Center += ForcedVel; ForcedVel *= 0.995f; if (packetTimer % 30 == 0) @@ -138,11 +166,15 @@ namespace CalamityMod.NPCs //If the npc hit a tile/Came to a stop after falling if (newVerticalVelocity == 0 && oldVerticalVelocity > 0) //Collision.SolidCollision(npc.Center, npc.width, npc.height)) { - int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); - Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI); - impact.DamageType = DamageClass.Melee; + if (!ForceVelocityOnly) + { + int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI); + impact.DamageType = DamageClass.Melee; + } PotentialEnergyDamage = 0; + ForceVelocityOnly = false; } OlderVelocity = OldVelocity; diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 41817f7e07..c7feec52c1 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.CeaselessVoid normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 52c4728c43..52f34259d9 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.CeaselessVoid { + [HasPierceResist] public class DarkEnergy : ModNPC { private bool start = true; diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index ebc7f6a7a6..4127344037 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -36,6 +36,8 @@ namespace CalamityMod.NPCs.Crabulon { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool stomping = false; + private const float TelegraphTimeBeforeBigJump = 20f; + private const float DelayBeforeBigJump = 50f; public static Asset AltTexture; public static Asset AttackTexture; @@ -128,7 +130,7 @@ namespace CalamityMod.NPCs.Crabulon public override void AI() { - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.3f, 0.7f); + Lighting.AddLight(NPC.Center, 0f, 0.3f, 0.7f); bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; @@ -144,17 +146,20 @@ namespace CalamityMod.NPCs.Crabulon // Phases bool phase2 = lifeRatio < 0.66f && expertMode; bool phase3 = lifeRatio < 0.33f && expertMode; + bool phase4 = lifeRatio < 0.15f && masterMode; + + int despawnDistanceInTiles = 500; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); Player player = Main.player[NPC.target]; - if (!player.active || player.dead) + if (!player.active || player.dead || Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) / 16f > despawnDistanceInTiles) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead) + if (!player.active || player.dead || Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) / 16f > despawnDistanceInTiles) { NPC.noTileCollide = true; @@ -209,8 +214,8 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.ai[0] < 2f) { - int mushBombAmt = phase3 ? 6 : phase2 ? 3 : 1; - float fireRate = phase3 ? 4f : phase2 ? 2f : 1f; + int mushBombAmt = phase4 ? 6 : phase3 ? 3 : phase2 ? 2 : 1; + float fireRate = phase4 ? 6f : phase3 ? 3f : phase2 ? 2f : 1f; NPC.localAI[3] += fireRate; if (NPC.ai[3] == 0f) { @@ -228,24 +233,15 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.ai[3] >= mushBombAmt) NPC.ai[3] = 0f; - float mushBombSpeed = phase3 ? 14f : phase2 ? 12f : 10f; + float mushBombSpeed = phase4 ? 16f : phase3 ? 14f : phase2 ? 12f : 10f; int type = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 mushBombDirection = NPC.Center; - float playerXDist = player.position.X + player.width * 0.5f - mushBombDirection.X; - float playerYDist = player.position.Y + player.height * 0.5f - mushBombDirection.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - playerDistance = mushBombSpeed / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - mushBombDirection.X += playerXDist; - mushBombDirection.Y += playerYDist; - float yVelocity = death ? 1f : expertMode ? 2.5f : 5f; - Vector2 mushBombVelocity = new Vector2(playerXDist, playerYDist - yVelocity); - Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection, mushBombVelocity, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); + float yVelocity = death ? 1f : expertMode ? 2.5f : 4f; + Vector2 projectileVelocity = (Vector2.Normalize(player.Center - NPC.Center) * mushBombSpeed) - Vector2.UnitY * yVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -261,19 +257,19 @@ namespace CalamityMod.NPCs.Crabulon if (phase2) NPC.ai[1] += 1f; if (phase3) - NPC.ai[1] += 2f; - if (NPC.justHit && masterMode) - NPC.ai[1] += 4f; + NPC.ai[1] += 1f; if (NPC.Distance(player.Center) < 160f) NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; - float idleTime = death ? 30f : expertMode ? 60f : 120f; + // Gets tired easily in final phase. - Fabsol + float idleTime = phase4 ? 480f : death ? 60f : expertMode ? 90f : 120f; if (NPC.ai[1] >= idleTime) { + bool deathModeTripleStomp = Main.rand.NextBool() && death && phase2; NPC.TargetClosest(); - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.ai[0] = 1f; + NPC.noGravity = !deathModeTripleStomp; + NPC.noTileCollide = !deathModeTripleStomp; + NPC.ai[0] = deathModeTripleStomp ? 5f : 1f; NPC.ai[1] = 0f; NPC.netUpdate = true; } @@ -287,6 +283,8 @@ namespace CalamityMod.NPCs.Crabulon if (phase2) walkingVelocity += 0.5f; if (phase3) + walkingVelocity += 0.75f; + if (phase4) walkingVelocity += 1f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) walkingVelocity *= 2f; @@ -307,10 +305,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.direction = playerLocation < 0 ? 1 : -1; float inertia = revenge ? 10f : 20f; - if (NPC.direction > 0) - NPC.velocity.X = (NPC.velocity.X * inertia + walkingVelocity) / (inertia + 1f); - if (NPC.direction < 0) - NPC.velocity.X = (NPC.velocity.X * inertia - walkingVelocity) / (inertia + 1f); + NPC.velocity.X = (NPC.velocity.X * inertia + walkingVelocity * NPC.direction) / (inertia + 1f); } 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) @@ -325,11 +320,11 @@ namespace CalamityMod.NPCs.Crabulon Vector2 collisionCheckPosition = new Vector2(NPC.Center.X - 40, NPC.position.Y + NPC.height - 20); bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f; - float acceleration = death ? 0.1f : expertMode ? 0.05f : 0.025f; - float acceleration2 = death ? 0.8f : expertMode ? 0.4f : 0.2f; + float acceleration = death ? 0.075f : expertMode ? 0.05f : 0.03f; + float acceleration2 = death ? 0.6f : expertMode ? 0.4f : 0.25f; if (fallDownOnTopOfTarget) { - float fallSpeed = death ? 2f : expertMode ? 1f : 0.5f; + float fallSpeed = death ? 1.5f : expertMode ? 1f : 0.5f; NPC.velocity.Y += fallSpeed; } else if (Collision.SolidCollision(collisionCheckPosition, 80, 20)) @@ -342,7 +337,7 @@ namespace CalamityMod.NPCs.Crabulon else NPC.velocity.Y -= acceleration2; - float upwardSpeedCap = death ? 16f : expertMode ? 8f : 4f; + float upwardSpeedCap = death ? 9f : expertMode ? 6f : 4f; if (NPC.velocity.Y < -upwardSpeedCap) NPC.velocity.Y = -upwardSpeedCap; } @@ -362,14 +357,14 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.Distance(player.Center) < 160f) NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; - float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 120f * (1f - lifeRatio) : 0f); + float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f); if (NPC.ai[1] >= stompPhaseGateValue) { NPC.noGravity = false; NPC.noTileCollide = false; - NPC.ai[0] = 2f; + NPC.ai[0] = (Main.rand.NextBool() && revenge && phase2) ? 4f : 2f; NPC.ai[1] = 0f; - NPC.netUpdate = true; + NPC.ForceNetUpdate(); } if (NPC.velocity.Y > 10f) @@ -411,6 +406,8 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += !revenge ? 2f : 1f; if (phase3) NPC.ai[1] += !revenge ? 2f : 1f; + if (phase4) + NPC.ai[1] += 1f; } float jumpGateValue = (bossRush ? 15f : expertMode ? 60f : 120f) / (enrageScale + 1f); @@ -420,7 +417,7 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[1] == -1f) { - float maxVelocityXIncrease = death ? 6f : 4f; + float maxVelocityXIncrease = death ? 4f : 3f; float maxVelocityYIncrease = death ? 3f : 2f; float velocityX = 6f + (expertMode ? (maxVelocityXIncrease * (1f - lifeRatio)) : 0f); float velocityY = 12f + (expertMode ? (maxVelocityYIncrease * (1f - lifeRatio)) : 0f); @@ -433,22 +430,49 @@ namespace CalamityMod.NPCs.Crabulon float velocityXAdjustment = velocityX; float velocityYAdjustment = velocityY / 3f; - switch ((int)NPC.ai[3]) + if (lifeRatio < 0.5f && death) { - case 0: // Normal - break; - case 1: // High - velocityY += velocityYAdjustment; - break; - case 2: // Low - velocityY -= velocityYAdjustment; - break; - case 3: // Long and low - velocityX += velocityXAdjustment; - velocityY -= velocityYAdjustment; - break; - default: - break; + // Crab smash + switch ((int)NPC.ai[3]) + { + case 0: // Normal + velocityX += velocityXAdjustment * 0.5f; + velocityY -= velocityYAdjustment; + break; + case 1: // High + velocityX += velocityXAdjustment * 0.5f; + break; + case 2: // Low + velocityX += velocityXAdjustment * 0.5f; + velocityY -= velocityYAdjustment * 2f; + break; + case 3: // Long and low + velocityX += velocityXAdjustment * 1.5f; + velocityY -= velocityYAdjustment * 2f; + break; + default: + break; + } + } + else + { + switch ((int)NPC.ai[3]) + { + case 0: // Normal + break; + case 1: // High + velocityY += velocityYAdjustment; + break; + case 2: // Low + velocityY -= velocityYAdjustment; + break; + case 3: // Long and low + velocityX += velocityXAdjustment; + velocityY -= velocityYAdjustment; + break; + default: + break; + } } if (distanceBelowTarget > 0f) @@ -484,7 +508,7 @@ namespace CalamityMod.NPCs.Crabulon } } } - else + else if (NPC.ai[0] == 3f) { if (NPC.velocity.Y == 0f) { @@ -505,7 +529,9 @@ namespace CalamityMod.NPCs.Crabulon Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = bossRush ? 48 : CalamityWorld.death ? 30 : 20; + + // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol + int numProj = bossRush ? 24 : phase4 ? 14 : CalamityWorld.death ? (phase3 ? 10 : 16) : 12; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -528,7 +554,9 @@ namespace CalamityMod.NPCs.Crabulon Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = bossRush ? 30 : CalamityWorld.death ? 18 : 12; + + // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol + int numProj = bossRush ? 16 : phase4 ? 8 : (phase3 && death) ? 6 : 8; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -608,30 +636,342 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) { - float slowDownMultiplier = death ? 0.84f : expertMode ? 0.92f : 0.96f; + float slowDownMultiplier = death ? 0.9f : expertMode ? 0.93f : 0.96f; NPC.velocity.X *= slowDownMultiplier; - float fallSpeedIncrease = death ? 0.24f : expertMode ? 0.12f : 0.06f; + float fallSpeedIncrease = phase4 ? 0.2f : death ? 0.15f : expertMode ? 0.12f : 0.09f; NPC.velocity.Y += fallSpeedIncrease; } else { - float velocityX = (death ? 0.2f : expertMode ? 0.15f : 0.1f) + 0.05f * enrageScale; + float velocityX = (death ? 0.15f : expertMode ? 0.125f : 0.1f) + 0.05f * enrageScale; if (NPC.direction < 0) NPC.velocity.X -= velocityX; else if (NPC.direction > 0) NPC.velocity.X += velocityX; - float topXSpeed = (death ? 5.5f : expertMode ? 4f : 2.5f) + enrageScale; - if (phase2) - topXSpeed += 1f; - if (phase3) - topXSpeed += 1f; + float maxVelocityXIncrease = death ? 4f : 3f; + float maxVelocityX = 6f + (expertMode ? (maxVelocityXIncrease * (1f - lifeRatio)) : 0f); - if (NPC.velocity.X < -topXSpeed) - NPC.velocity.X = -topXSpeed; - if (NPC.velocity.X > topXSpeed) - NPC.velocity.X = topXSpeed; + if (revenge) + { + float velocityXAdjustment = maxVelocityX; + + if (lifeRatio < 0.5f && death) + { + // Mega velocity + switch ((int)NPC.ai[3]) + { + case 0: // Normal + case 1: // High + case 2: // Low + maxVelocityX += velocityXAdjustment * 0.5f; + break; + + case 3: // Long and low + maxVelocityX += velocityXAdjustment * 1.5f; + break; + + default: + break; + } + } + else + { + switch ((int)NPC.ai[3]) + { + case 0: // Normal + case 1: // High + case 2: // Low + break; + + case 3: // Long and low + maxVelocityX += velocityXAdjustment; + break; + + default: + break; + } + } + } + + if (Math.Abs(NPC.velocity.X) > maxVelocityX) + NPC.velocity.X = NPC.velocity.X < 0f ? -maxVelocityX : maxVelocityX; + } + } + } + else if (NPC.ai[0] == 4f) + { + if (NPC.velocity.Y == 0f || NPC.ai[2] == 1f) + NPC.ai[1] += 1f; + + if (NPC.ai[1] >= DelayBeforeBigJump) + { + if (NPC.ai[1] == DelayBeforeBigJump && NPC.ai[2] == 0f) + { + Vector2 center = NPC.Center; + if (!player.dead && player.active && Math.Abs(NPC.Center.X - player.Center.X) / 16f <= despawnDistanceInTiles) + center = player.Center; + + center.Y -= 320f + Math.Abs(player.Center.Y - NPC.Center.Y); + center.X += Math.Abs(player.Center.X - NPC.Center.X) * ((player.Center.X - NPC.Center.X > 0f) ? 1 : -1); + + NPC.ai[2] = 1f; + NPC.ai[3] = NPC.Bottom.Y; + NPC.noTileCollide = true; + + float leapVelocity = bossRush ? 24f : death ? 18f : 16f; + NPC.velocity = center - NPC.Center; + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero); + NPC.velocity *= leapVelocity; + + float velocityMinY = -leapVelocity; + if (NPC.velocity.Y > velocityMinY) + NPC.velocity.Y = velocityMinY; + + NPC.ForceNetUpdate(); + } + else + { + float mushroomFireRate = death ? 20f : 10f; + if (NPC.ai[1] % mushroomFireRate == 0f) + { + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float yVelocity = death ? 3f : 2f; + if (death) + { + int numProj = 3; + Vector2 initialVelocity = (NPC.Center + Vector2.UnitY * 10f - NPC.Center).SafeNormalize(Vector2.UnitY); + float rotation = MathHelper.ToRadians(8); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = initialVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + else + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.UnitY * yVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + + // Collide with tiles if falling and beyond a certain threshold + if (NPC.velocity.Y >= 0f && NPC.Bottom.Y >= NPC.ai[3] - NPC.height) + NPC.noTileCollide = false; + + // Impact and create lines of mushrooms that spread out along the ground (similar to an old Providence attack) + if (NPC.Bottom.Y >= NPC.ai[3] || NPC.velocity.Y == 0f) + { + SoundEngine.PlaySound(SlamSound, NPC.Center); + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float xVelocity = death ? 2f : 1f; + int numProj = death ? 5 : 3; + Vector2 initialVelocity = Vector2.UnitX * xVelocity; + Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(0f, 8f); + + for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), initialVelocity - ((i / (float)numProj) * initialVelocity), type, damage, 0f, Main.myPlayer); + + for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation - new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), -(initialVelocity - ((i / (float)numProj) * initialVelocity)), type, damage, 0f, Main.myPlayer); + } + + for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20) + { + for (int k = 0; k < 4; k++) + { + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + + // Destroy tiles with stomps in Zenith seed + if (Main.zenithWorld) + { + int x = j / 16; + int y = (int)(NPC.position.Y + NPC.height) / 16; + Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (!walkTile.HasTile && walkTile.LiquidAmount == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) + { + walkTile.TileFrameY = 0; + walkTile.Get().Slope = SlopeType.Solid; + walkTile.Get().IsHalfBlock = false; + if (groundTile.TileType == TileID.MushroomGrass || groundTile.TileType == TileID.Mud) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.MushroomPlants; + walkTile.TileFrameX = (short)(Main.rand.Next(5) * 18); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y - 1, 1, TileChangeType.None); + } + } + } + } + } + } + } + else + NPC.velocity.X *= 0.8f; + } + + // Stomp three times quickly, creating lines of mushrooms and a column of mushrooms that slowly fall down + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.noTileCollide = false; + if (NPC.velocity.Y == 0f) + { + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + if (NPC.ai[1] % 15f == 14f) + NPC.netUpdate = true; + + float jumpGateValue = 10f; + if (NPC.ai[1] >= jumpGateValue) + { + NPC.ai[1] = -20f; + } + else if (NPC.ai[1] == -1f) + { + NPC.velocity.Y = -(2f + NPC.ai[2]); + + SoundEngine.PlaySound(JumpSound, NPC.Center); + + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + } + } + else if (NPC.ai[0] == 6f) + { + if (NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + SoundEngine.PlaySound(SlamSound, NPC.Center); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 3f) + { + // Columns of mushrooms + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int maxColumns = 5; + int mushroomsPerColumn = 8; + Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(210f, 8f); + Vector2 initialVelocity = Vector2.UnitY * 24f; + for (int i = 0; i < maxColumns; i++) + { + // 0 = 0.5, 1 = 0.25, 2 = 0, 3 = 0.25, 4 = 0.5 + initialVelocity -= Vector2.UnitY * 8f * Math.Abs(0.5f - (i / (float)(maxColumns - 1))); + + for (int j = 0; j < mushroomsPerColumn; j++) + { + initialVelocity += Vector2.UnitX * Main.rand.NextFloat(-0.5f, 0.5f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(70f * (i + 1), 0f), -(initialVelocity - ((j / (float)mushroomsPerColumn) * initialVelocity)), type, damage, 0f, Main.myPlayer, 1f, NPC.Bottom.Y - 16f); + } + + initialVelocity = Vector2.UnitY * 16f; + } + } + + NPC.ai[0] = 1f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + else + { + // Mushrooms along the ground + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float xVelocity = death ? 3f : 1.5f; + int numProj = 3; + Vector2 initialVelocity = Vector2.UnitX * xVelocity; + Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(0f, 8f); + + for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 41), 0f), initialVelocity - ((i / (float)numProj) * initialVelocity), type, damage, 0f, Main.myPlayer); + + for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation - new Vector2(Main.rand.Next(0, 41), 0f), -(initialVelocity - ((i / (float)numProj) * initialVelocity)), type, damage, 0f, Main.myPlayer); + } + + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + + NPC.ai[0] = 5f; + NPC.netUpdate = true; + } + + for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20) + { + for (int k = 0; k < 4; k++) + { + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + + // Destroy tiles with stomps in Zenith seed (this is going to be so awful with this attack lol) + if (Main.zenithWorld) + { + int x = j / 16; + int y = (int)(NPC.position.Y + NPC.height) / 16; + Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (!walkTile.HasTile && walkTile.LiquidAmount == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) + { + walkTile.TileFrameY = 0; + walkTile.Get().Slope = SlopeType.Solid; + walkTile.Get().IsHalfBlock = false; + if (groundTile.TileType == TileID.MushroomGrass || groundTile.TileType == TileID.Mud) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.MushroomPlants; + walkTile.TileFrameX = (short)(Main.rand.Next(5) * 18); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y - 1, 1, TileChangeType.None); + } + } + } + } + } + else + { + // Set damage + NPC.damage = NPC.defDamage; + + if (!player.dead) + { + if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f)) + NPC.noTileCollide = true; + else if ((NPC.velocity.Y > 0f && NPC.Bottom.Y > Main.player[NPC.target].Top.Y) || (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; } } } @@ -733,7 +1073,7 @@ namespace CalamityMod.NPCs.Crabulon { if (NPC.ai[0] > 1f) { - if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 2f) // Idle just before jump + if (NPC.velocity.Y == 0f && ((NPC.ai[1] >= 0f && (NPC.ai[0] == 2f || NPC.ai[0] == 5f)) || (NPC.ai[1] < (DelayBeforeBigJump - TelegraphTimeBeforeBigJump) && NPC.ai[0] == 4f && NPC.ai[2] == 0f))) // Idle just before jump { if (stomping) stomping = false; @@ -743,7 +1083,7 @@ namespace CalamityMod.NPCs.Crabulon int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - else if (NPC.velocity.Y <= 0f || NPC.ai[1] < 0f) // Prepare to jump and then jump + else if (NPC.velocity.Y <= 0f || (NPC.ai[1] < DelayBeforeBigJump && NPC.ai[0] == 4f && NPC.ai[2] == 0f) || NPC.ai[1] < 0f) // Prepare to jump and then jump { NPC.frameCounter += 1D; if (NPC.frameCounter > 12D) @@ -777,7 +1117,7 @@ namespace CalamityMod.NPCs.Crabulon if (stomping) stomping = false; - NPC.frameCounter += 0.15f; + NPC.frameCounter += 0.15; NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -806,8 +1146,9 @@ namespace CalamityMod.NPCs.Crabulon { Vector2 drawOrigin = new Vector2(textureIdle.Width / 2, textureIdle.Height / Main.npcFrameCount[Type] / 2); Vector2 drawPos = NPC.Center - screenPos + (Vector2.UnitX * textureIdle.Width * c * 1.6f); + // Jumping - if (NPC.ai[0] > 2f && NPC.velocity.Y != 0f) + if ((NPC.ai[0] > 2f && NPC.ai[0] != 5f) && NPC.velocity.Y != 0f) { drawOrigin = new Vector2(textureAttack.Width / 2, textureAttack.Height / 2); drawPos -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; @@ -816,6 +1157,7 @@ namespace CalamityMod.NPCs.Crabulon spriteBatch.Draw(textureAttack, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(glowAttack, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } + // Walking else if (NPC.ai[0] == 1f) { @@ -826,6 +1168,7 @@ namespace CalamityMod.NPCs.Crabulon spriteBatch.Draw(textureWalk, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(glowWalk, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } + // Standing still else { diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index cc397cdec9..bdf1c00e8a 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1450,9 +1450,9 @@ namespace CalamityMod.NPCs.Cryogen CalamityGlobalNPC.SetNewBossJustDowned(NPC); // Spawn Permafrost if he isn't in the world - int permafrostNPC = NPC.FindFirstNPC(ModContent.NPCType()); + int permafrostNPC = NPC.FindFirstNPC(ModContent.NPCType()); if (permafrostNPC == -1 && !BossRushEvent.BossRushActive) - NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); // If Cryogen has not been killed, notify players about Cryonic Ore if (!DownedBossSystem.downedCryogen) diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 3b033e67f9..3dd7b59380 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -20,10 +20,10 @@ namespace CalamityMod.NPCs.DesertScourge public bool flies = false; private bool tailSpawned = false; - public const float SegmentVelocity_Expert = 14f; - public const float SegmentVelocity_Master = 16.5f; + public const float SegmentVelocity_Expert = 11f; + public const float SegmentVelocity_Master = 13.5f; public const float SegmentVelocity_GoodWorld = 19f; - public const float SegmentVelocity_ZenithSeed = 21.5f; + public const float SegmentVelocity_ZenithSeed = 22f; public const float OpenMouthForBiteDistance = 220f; @@ -140,12 +140,12 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining. float lifeRatio = NPC.life / (float)NPC.lifeMax; - float speed = death ? 0.18f : 0.16f; - float turnSpeed = death ? 0.26f : 0.22f; + float speed = death ? 0.105f : 0.085f; + float turnSpeed = death ? 0.21f : 0.17f; speed += speed * 0.4f * (1f - lifeRatio); turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); - speed += 0.16f * enrageScale; - turnSpeed += 0.22f * enrageScale; + speed += 0.085f * enrageScale; + turnSpeed += 0.17f * enrageScale; if (Main.getGoodWorld) { @@ -247,7 +247,7 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int directChaseDistance = revenge ? 500 : 1000; + int directChaseDistance = death ? 400 : revenge ? 500 : 1000; bool shouldDirectlyChase = true; if (NPC.position.Y > Main.player[NPC.target].position.Y) { @@ -455,7 +455,7 @@ namespace CalamityMod.NPCs.DesertScourge } Vector2 destination = Main.player[NPC.target].Center; - if (NPC.Distance(destination) > 1000f) + if (NPC.Distance(destination) > (getMad ? 750f : 1000f)) NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; // Calculate contact damage based on velocity diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 55f0ff65dd..08784a1e62 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.DesertScourge public bool flies = false; private bool tailSpawned = false; - public const float SegmentVelocity_Expert = 12f; - public const float SegmentVelocity_Master = 14f; + public const float SegmentVelocity_Expert = 10f; + public const float SegmentVelocity_Master = 12f; public const float SegmentVelocity_GoodWorld = 16f; public const float SegmentVelocity_ZenithSeed = 18f; @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.DesertScourge bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - float enrageScale = bossRush ? 1f : getMad ? 0.25f : 0f; + float enrageScale = bossRush ? 1f : getMad ? 0.5f : 0f; if (biomeEnraged) { NPC.Calamity().CurrentlyEnraged = !bossRush; @@ -136,12 +136,12 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining. float lifeRatio = NPC.life / (float)NPC.lifeMax; - float speed = death ? 0.16f : 0.14f; - float turnSpeed = death ? 0.24f : 0.2f; + float speed = death ? 0.09f : 0.07f; + float turnSpeed = death ? 0.18f : 0.14f; speed += speed * 0.4f * (1f - lifeRatio); turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); - speed += 0.14f * enrageScale; - turnSpeed += 0.2f * enrageScale; + speed += 0.07f * enrageScale; + turnSpeed += 0.14f * enrageScale; if (Main.getGoodWorld) { @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; - if (getMad && NPC.Distance(Main.player[NPC.target].Center) > 240f) + if (NPC.Distance(Main.player[NPC.target].Center) > 360f) { if ((Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) NPC.Calamity().newAI[0] += 1f; @@ -171,8 +171,8 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (revenge ? 10f : 8f); - int numProj = death ? 6 : 4; - int spread = masterMode ? 28 : 20; + int numProj = death ? 6 : getMad ? 4 : 3; + int spread = masterMode ? 28 : getMad ? 22 : 20; if (masterMode) { numProj += 2; @@ -287,7 +287,7 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int directChaseDistance = revenge ? 500 : 1000; + int directChaseDistance = death ? 400 : revenge ? 500 : 1000; bool shouldDirectlyChase = true; if (NPC.position.Y > Main.player[NPC.target].position.Y) { @@ -496,7 +496,7 @@ namespace CalamityMod.NPCs.DesertScourge } Vector2 destination = Main.player[NPC.target].Center; - if (NPC.Distance(destination) > 1000f) + if (NPC.Distance(destination) > (getMad ? 750f : 1000f)) NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; // Calculate contact damage based on velocity diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 4f71aff1f7..522dbcd0ef 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(DesertScourgeHead))] public class DesertScourgeBody : ModNPC { diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index e39685f9e3..b9edf2b11a 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -32,6 +32,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class DesertScourgeHead : ModNPC { @@ -39,9 +40,9 @@ namespace CalamityMod.NPCs.DesertScourge private bool tailSpawned = false; public bool playRoarSound = false; - public const float SegmentVelocity_Normal = 12f; - public const float SegmentVelocity_Expert = 15f; - public const float SegmentVelocity_Master = 18f; + public const float SegmentVelocity_Normal = 10f; + public const float SegmentVelocity_Expert = 12.5f; + public const float SegmentVelocity_Master = 15f; public const float SegmentVelocity_GoodWorld = 21f; public const float SegmentVelocity_ZenithSeed = 24f; @@ -239,23 +240,23 @@ namespace CalamityMod.NPCs.DesertScourge float burrowDistance = hide ? BurrowDistance_Hide : bossRush ? BurrowDistance_BossRush : BurrowDistance; - float speed = death ? 0.15f : 0.12f; - float turnSpeed = death ? 0.3f : 0.24f; + float speed = death ? 0.105f : 0.085f; + float turnSpeed = death ? 0.21f : 0.17f; if (expertMode) { - speed += speed * 0.2f * (1f - lifeRatio); - turnSpeed += turnSpeed * 0.2f * (1f - lifeRatio); + speed += speed * 0.4f * (1f - lifeRatio); + turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); } if (revenge) { - speed += (death ? 0.05f : 0.04f) * (1f - lifeRatio); - turnSpeed += (death ? 0.1f : 0.08f) * (1f - lifeRatio); + speed += (death ? 0.03f : 0.02f) * (1f - lifeRatio); + turnSpeed += (death ? 0.06f : 0.04f) * (1f - lifeRatio); } - speed += 0.12f * enrageScale; - turnSpeed += 0.24f * enrageScale; + speed += 0.085f * enrageScale; + turnSpeed += 0.17f * enrageScale; if (Main.getGoodWorld) { @@ -303,7 +304,22 @@ namespace CalamityMod.NPCs.DesertScourge } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + { + Vector2 sandSplashSpawnPos = new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40); + Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + + if (death) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < 7; i++) + { + Vector2 sandSpitPos = new Vector2((i - 2) * 16f, -Math.Abs((i - 2) * 16f)); + Vector2 sandSpitVelocity = ((sandSplashSpawnPos + Vector2.UnitY * 80f) - (sandSplashSpawnPos + sandSpitPos)).SafeNormalize(Vector2.UnitY) * -((Math.Abs(i - 3) + 1) * 3f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos + sandSpitPos, sandSpitVelocity, type, damage, 0f, Main.myPlayer); + } + } + } } } } @@ -343,7 +359,22 @@ namespace CalamityMod.NPCs.DesertScourge } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + { + Vector2 sandSplashSpawnPos = new Vector2(headTileCenter.X * 16 + 8, bestY * 16 - 40); + Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + + if (death) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < 7; i++) + { + Vector2 sandSpitPos = new Vector2((i - 2) * 16f, -Math.Abs((i - 2) * 16f)); + Vector2 sandSpitVelocity = ((sandSplashSpawnPos + Vector2.UnitY * 80f) - (sandSplashSpawnPos + sandSpitPos)).SafeNormalize(Vector2.UnitY) * -((Math.Abs(i - 3) + 1) * 3f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos + sandSpitPos, sandSpitVelocity, type, damage, 0f, Main.myPlayer); + } + } + } } } } @@ -479,7 +510,7 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.localAI[1] = 1f; Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int directChaseDistance = expertMode ? 800 : 1000; + int directChaseDistance = death ? 600 : expertMode ? 800 : 1000; if (enrageScale > 0f) directChaseDistance = 100; diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 31d98c95c6..b969562016 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(DesertScourgeHead))] public class DesertScourgeTail : ModNPC { diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 51946e7d4c..c7d8ed7d33 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -13,6 +13,7 @@ using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))] public class CosmicGuardianBody : ModNPC { diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index d85e147d7e..1a9b1bd130 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [HasPierceResist] [LongDistanceNetSync] public class CosmicGuardianHead : ModNPC { diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 7bcc59229f..be71961cd5 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -13,6 +13,7 @@ using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))] public class CosmicGuardianTail : ModNPC { diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 5404aa006f..ce926f38ca 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -145,10 +145,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.frame = frame; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { @@ -217,67 +214,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.active = false; } - // Lasers - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!NPC.dontTakeDamage && NPC.Opacity >= 1f && invinceTime <= 0) - { - if (phase2) - { - // Fire lasers from every 15th (20th in normal mode) body segment if not in laser wall phase - float laserWallPhaseGateValue = DevourerofGodsHead.LaserWallCooldown - (bossRush ? 360f : death ? 180f : 0f); - if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] < laserWallPhaseGateValue - 180f) - { - NPC.localAI[0] += 1f; - float laserGateValue = bossRush ? 156f : death ? 180f : 192f; - if (Main.getGoodWorld) - laserGateValue *= 0.5f; - - if (NPC.localAI[0] >= laserGateValue && NPC.ai[0] % (expertMode ? 15f : 20f) == 0f) - { - NPC.localAI[0] = 0f; - if (!AnyTeleportRifts()) - { - NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.Item12, player.Center); - float maxProjectileVelocity = bossRush ? 24f : death ? 20f : revenge ? 18.25f : expertMode ? 17.5f : 16f; - float minProjectileVelocity = maxProjectileVelocity * LaserVelocityMultiplierMin; - float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * LaserVelocityDistanceMultiplier, minProjectileVelocity, maxProjectileVelocity); - Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocityVector, type, damage, 0f, Main.myPlayer); - } - } - } - } - else - { - // Fire lasers from every 20th (25th in normal mode) body segment if not in laser barrage phase - float laserBarrageGateValue = bossRush ? 1080f : death ? 1320f : 1440f; - float laserBarrageShootGateValue = bossRush ? 160f : 240f; - float laserBarragePhaseGateValue = laserBarrageGateValue - laserBarrageShootGateValue * 1.5f; - if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[1] < laserBarragePhaseGateValue) - { - NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 20f : 25f) == 0f) - { - NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.Item12, player.Center); - NPC.localAI[0] = 0f; - float maxProjectileVelocity = bossRush ? 22f : death ? 18f : revenge ? 16.25f : expertMode ? 15.5f : 14f; - float minProjectileVelocity = maxProjectileVelocity * LaserVelocityMultiplierMin; - float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * LaserVelocityDistanceMultiplier, minProjectileVelocity, maxProjectileVelocity); - Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocityVector, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - if (Main.npc[(int)NPC.ai[1]].Opacity >= 0.5f && (!setOpacity || (Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f && Main.npc[(int)NPC.ai[2]].localAI[2] > 0f))) { NPC.Opacity += 0.165f; @@ -357,16 +293,6 @@ namespace CalamityMod.NPCs.DevourerofGods } } - private bool AnyTeleportRifts() - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == ModContent.ProjectileType()) - return true; - } - return false; - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.realLife < 0 || NPC.realLife >= Main.maxNPCs || Main.npc[NPC.realLife] is null) @@ -448,15 +374,10 @@ namespace CalamityMod.NPCs.DevourerofGods { // viable???, done here since it's conditional if (Main.zenithWorld && projectile.type == ModContent.ProjectileType()) - { modifiers.SourceDamage *= 40f; - } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override bool CheckDead() { diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index d36c95b8ea..d89984b05c 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -2563,7 +2563,7 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedDoG); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedDoG); // If DoG has not been killed yet, notify players that the holiday moons are buffed if (!DownedBossSystem.downedDoG) @@ -2628,7 +2628,7 @@ namespace CalamityMod.NPCs.DevourerofGods normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 45, 55)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 65, 80)); normalOnly.Add(ModContent.ItemType(), 1, 150, 250); // Equipment @@ -2670,7 +2670,10 @@ namespace CalamityMod.NPCs.DevourerofGods GFBOnly.Add(ItemID.JungleTorch, dropRate, dropMin, dropMax, true); GFBOnly.Add(ItemID.MushroomTorch, dropRate, dropMin, dropMax, true); GFBOnly.Add(ItemID.ShimmerTorch, dropRate, dropMin, dropMax, true); - GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); + GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); + GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); + GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); + GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); GFBOnly.Add(ModContent.ItemType(), dropRate, dropMin, dropMax, true); diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index cc6792d10a..ac2e7d6dc6 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -146,10 +146,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.frame = frame; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { @@ -450,15 +447,10 @@ namespace CalamityMod.NPCs.DevourerofGods { // viable???, done here since it's conditional if (Main.zenithWorld && projectile.type == ModContent.ProjectileType()) - { modifiers.SourceDamage *= 40f; - } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override bool CheckDead() { diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 0aa51994f3..e78f4f714b 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -107,6 +107,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Variable to pick a different location after each attack private bool pickNewLocation = false; + // Variable used to prevent the fight from softlocking if one mech enters berserk before spawning the others + public bool berserkEarlyBugFix = false; + // Marks Apollo as a component of the Exo Mechdusa public bool exoMechdusa = false; @@ -277,6 +280,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo otherExoMechsAlive++; exoWormAlive = true; + // Spread the early berserk bug fix variable if it has been set + if ((Main.npc[CalamityGlobalNPC.draedonExoMechWorm].ModNPC as ThanatosHead).berserkEarlyBugFix) + berserkEarlyBugFix = true; } } if (CalamityGlobalNPC.draedonExoMechPrime != -1) @@ -288,6 +294,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo otherExoMechsAlive++; exoPrimeAlive = true; + // Spread the early berserk bug fix variable if it has been set + if ((Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ModNPC as AresBody).berserkEarlyBugFix) + berserkEarlyBugFix = true; } } @@ -669,6 +678,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); } + + // If the mech somehow got low enough to enter berserk phase here, trigger the bug fix variable + if (lifeRatio < 0.4f) + berserkEarlyBugFix = true; } } else @@ -852,14 +865,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo AIState = (float)Phase.Normal; // Enter the fight again if any of the other exo mechs is below 70% or dead and other mechs aren't berserk - // CIT 10FEB2025: Added checks for if the other mechs are alive, to fix softlocks if you somehow skip straight to berserk - if ((!exoWormAlive || exoWormLifeRatio < 0.7f || !exoPrimeAlive || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) + // CIT 24MAR2025: Actually fixed the early berserk softlock without affecting the normal fight + if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f || berserkEarlyBugFix) && !otherMechIsBerserk) { // Set Artemis variables if (exoMechTwinRedAlive) { Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] = - totalOtherExoMechLifeRatio > 5f ? (float)Artemis.Artemis.SecondaryPhase.Nothing : (float)Artemis.Artemis.SecondaryPhase.Passive; + totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[1] = 0f; Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].ai[2] = 0f; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 0eac5b0b48..c21a63a533 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -41,6 +41,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { [AutoloadBossHead] + [HasPierceResist] public class AresBody : ModNPC { // Used for loot @@ -125,6 +126,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Variable used to stop the arm spawning loop private bool armsSpawned = false; + // Variable used to prevent the fight from softlocking if one mech enters berserk before spawning the others + public bool berserkEarlyBugFix = false; + // Exo Mechdusa stuff public bool exoMechdusa = false; public int neurontimer = 0; @@ -318,17 +322,21 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { case 0: lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].localAI[0] = Main.rand.Next(240); break; case 1: lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].Calamity().newAI[3] = Main.rand.Next(240); Main.npc[lol].Calamity().newAI[1] = plasmaArmStartTimer; break; case 2: lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].localAI[0] = Main.rand.Next(240); Main.npc[lol].Calamity().newAI[1] = teslaArmStartTimer; break; case 3: lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].Calamity().newAI[3] = Main.rand.Next(240); break; default: break; @@ -377,7 +385,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 betweenR = NeuronRight + velocity * 650; Vector2 betweenL = NeuronLeft + velocity * 650; - Terraria.Audio.SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume - 0.2f, Pitch = CommonCalamitySounds.LaserCannonSound.Pitch + 0.2f }, NeuronRight); + SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume - 0.2f, Pitch = CommonCalamitySounds.LaserCannonSound.Pitch + 0.2f }, NeuronRight); Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenL, betweenL + velocity, ModContent.ProjectileType(), 111, 0f, Main.myPlayer, 7, NPC.whoAmI); Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenR, betweenR + velocity, ModContent.ProjectileType(), 111, 0f, Main.myPlayer, 7, NPC.whoAmI); @@ -442,6 +450,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { otherExoMechsAlive++; exoWormAlive = true; + // Spread the early berserk bug fix variable if it has been set + if ((Main.npc[CalamityGlobalNPC.draedonExoMechWorm].ModNPC as ThanatosHead).berserkEarlyBugFix) + berserkEarlyBugFix = true; } } @@ -452,6 +463,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { otherExoMechsAlive++; exoTwinsAlive = true; + // Spread the early berserk bug fix variable if it has been set + if ((Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ModNPC as Apollo.Apollo).berserkEarlyBugFix) + berserkEarlyBugFix = true; } } @@ -593,7 +607,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); - float baseVelocity = (EnragedState == (float)Enraged.Yes ? 28f : 20f) * baseVelocityMult; + float baseVelocity = (EnragedState == (float)Enraged.Yes ? 22f : 14f) * baseVelocityMult; float baseAcceleration = shouldGetBuffedByBerserkPhase ? 1.25f : 1f; float decelerationVelocityMult = 0.85f; @@ -674,6 +688,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); } + + // If the mech somehow got low enough to enter berserk phase here, trigger the bug fix variable + if (lifeRatio < 0.4f) + berserkEarlyBugFix = true; } } else @@ -751,8 +769,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case (int)SecondaryPhase.PassiveAndImmune: // Enter the fight again if any of the other exo mechs is below 70% or dead and other mechs aren't berserk - // CIT 10FEB2025: Added checks for if the other mechs are alive, to fix softlocks if you somehow skip straight to berserk - if (((!exoWormAlive || exoWormLifeRatio < 0.7f) || (!exoTwinsAlive || exoTwinsLifeRatio < 0.7f)) && !otherMechIsBerserk) + // CIT 24MAR2025: Actually fixed the early berserk softlock without affecting the normal fight + if ((exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f || berserkEarlyBugFix) && !otherMechIsBerserk) { // Tells Ares to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 29284604a7..7234ce1600 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresGaussNuke : ModNPC { public enum Phase @@ -231,6 +232,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.Opacity = 0f; } + // Global timer used for passive movement + NPC.Calamity().newAI[3]++; + if (NPC.Calamity().newAI[3] >= 240f) + NPC.Calamity().newAI[3] = 0f; + // Predictiveness float predictionAmt = bossRush ? 20f : death ? 15f : revenge ? 13.75f : expertMode ? 12.5f : 10f; if (nerfedAttacks) @@ -301,10 +307,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Default vector to fly to - float offsetX = 560f; - float offsetY = 0f; - float offsetX2 = 540f; - float offsetY2 = 540f; + Vector2 offset = new Vector2(560f, 20f * (float)Math.Sin(NPC.Calamity().newAI[3] * MathHelper.Pi / 120f)); + Vector2 offset2 = new Vector2(540f, 540f); switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3]) { case 0: @@ -315,12 +319,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case 1: case 2: case 5: - offsetX *= -1f; - offsetX2 *= -1f; - offsetY2 *= -1f; + offset.X *= -1f; + offset2 *= -1f; break; } - Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY); + Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? offset2 : offset); // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); @@ -420,8 +423,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - float offset = 40f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); + float nukeOffset = 40f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * nukeOffset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); } // Recoil diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 5aed8336db..81107f0d5a 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -21,6 +21,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresLaserCannon : ModNPC { public enum Phase @@ -118,6 +119,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares writer.Write(frameX); writer.Write(frameY); writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -127,6 +129,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -234,14 +237,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.Opacity = 0f; } + // Global timer used for passive movement + NPC.localAI[0]++; + if (NPC.localAI[0] >= 240f) + NPC.localAI[0] = 0f; + // Variable to fire normal lasers bool fireNormalLasers = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; // Default vector to fly to - float offsetX = -560f; - float offsetY = 0f; - float offsetX2 = -540f; - float offsetY2 = -540f; + Vector2 offset = new Vector2(-560f, AIState == (int)Phase.Deathray ? 0f : 20f * (float)Math.Sin(NPC.localAI[0] * MathHelper.Pi / 120f)); + Vector2 offset2 = new Vector2(-540f, -540f); bool flyLeft = true; switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3]) { @@ -253,13 +259,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case 1: case 2: case 5: - offsetX *= -1f; - offsetX2 *= -1f; - offsetY2 *= -1f; + offset.X *= -1f; + offset2 *= -1f; flyLeft = false; break; } - Vector2 destination = fireNormalLasers ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY); + Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (fireNormalLasers ? offset2 : offset); // Rotate the cannon to look at the target while not firing the beam // Rotate the cannon to look in the direction it will fire only while it's charging or while it's firing @@ -452,8 +457,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 laserVelocity = Vector2.Normalize(Main.player[targetIndex].Center - NPC.Center); - Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, Main.player[targetIndex].Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Vector2 laserOffset = laserVelocity * 70f + Vector2.UnitY * 16f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserOffset, Main.player[targetIndex].Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -482,9 +487,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - float offset = 84f; - float offset2 = 16f; - Vector2 source = horizontalLaserSweep ? new Vector2(NPC.Center.X - offset2 * NPC.direction, NPC.Center.Y + offset) : new Vector2(NPC.Center.X + offset * NPC.direction, NPC.Center.Y + offset2); + float beamOffset = 84f; + float beamOffset2 = 16f; + Vector2 source = horizontalLaserSweep ? new Vector2(NPC.Center.X - beamOffset2 * NPC.direction, NPC.Center.Y + beamOffset) : new Vector2(NPC.Center.X + beamOffset * NPC.direction, NPC.Center.Y + beamOffset2); Vector2 laserVelocity = Vector2.Normalize(lookAt - source); if (laserVelocity.HasNaNs()) laserVelocity = -Vector2.UnitY; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index fc227df3a3..65d8a89c91 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -20,6 +20,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresPlasmaFlamethrower : ModNPC { public enum Phase @@ -230,6 +231,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.Opacity = 0f; } + // Global timer used for passive movement + NPC.Calamity().newAI[3]++; + if (NPC.Calamity().newAI[3] >= 240f) + NPC.Calamity().newAI[3] = 0f; + // Predictiveness float predictionAmt = bossRush ? 20f : death ? 15f : revenge ? 13.75f : expertMode ? 12.5f : 10f; if (nerfedAttacks) @@ -313,10 +319,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Default vector to fly to - float offsetX = 375f; - float offsetY = 160f; - float offsetX2 = 540f; - float offsetY2 = -540f; + Vector2 offset = new Vector2(375f, 160f + 20f * (float)Math.Sin(NPC.Calamity().newAI[3] * MathHelper.Pi / 120f)); + Vector2 offset2 = new Vector2(540, -540f); switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3]) { case 0: @@ -327,12 +331,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case 2: case 3: - offsetX *= -1f; - offsetX2 *= -1f; - offsetY2 *= -1f; + offset.X *= -1f; + offset2 *= -1f; break; } - Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY); + Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? offset2 : offset); // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); @@ -442,12 +445,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; + Vector2 plasmaOffset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; if (boltsSplitLess) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + plasmaOffset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); else - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + plasmaOffset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); } // Recoil diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index e4dc3a1fb2..50617f35d7 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresTeslaCannon : ModNPC { public enum Phase @@ -113,6 +114,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares writer.Write(frameX); writer.Write(frameY); writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[0]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -122,6 +124,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -229,6 +232,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.Opacity = 0f; } + // Global timer used for passive movement + NPC.localAI[0]++; + if (NPC.localAI[0] >= 240f) + NPC.localAI[0] = 0f; + // Predictiveness float predictionAmt = bossRush ? 40f : death ? 30f : revenge ? 27.5f : expertMode ? 25f : 20f; if (nerfedAttacks) @@ -314,10 +322,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Default vector to fly to - float offsetX = -375f; - float offsetY = 160f; - float offsetX2 = -540f; - float offsetY2 = 540f; + Vector2 offset = new Vector2(-375f, 160f + 20f * (float)Math.Sin(NPC.localAI[0] * MathHelper.Pi / 120f)); + Vector2 offset2 = new Vector2(-540f, 540f); switch ((int)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3]) { case 0: @@ -328,12 +334,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case 2: case 3: - offsetX *= -1f; - offsetX2 *= -1f; - offsetY2 *= -1f; + offset.X *= -1f; + offset2 *= -1f; break; } - Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX2, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY2) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + offsetX, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + offsetY); + Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? offset2 : offset); // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); @@ -439,9 +444,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; + Vector2 orbOffset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; float identity = fireMoreOrbs ? -2f : calamityGlobalNPC.newAI[3] + (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + orbOffset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); } // Recoil diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 5527da2298..d0e4c41861 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -794,7 +794,7 @@ namespace CalamityMod.NPCs.ExoMechs if (NPC.life > 0) return; - if (!Main.dedServ && !HasBeenKilled) + if (!Main.dedServ && !HasBeenKilled && HologramEffectTimer > 0f) { for (int i = 1; i <= 4; i++) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index b34e664e92..e2eda50072 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosBody1 : ModNPC { @@ -442,7 +443,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.1f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 51fbaba5ae..411630ec67 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosBody2 : ModNPC { @@ -441,7 +442,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.1f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 7b418c793b..3c7fa5266d 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -22,6 +22,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync] public class ThanatosHead : ModNPC { @@ -121,6 +122,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Variable used to stop the segment spawning loop private bool tailSpawned = false; + // Variable used to prevent the fight from softlocking if one mech enters berserk before spawning the others + public bool berserkEarlyBugFix = false; + // Used in the lerp to smoothly scale velocity up and down private float chargeVelocityScalar = 0f; @@ -262,6 +266,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos otherExoMechsAlive++; exoPrimeAlive = true; + // Spread the early berserk bug fix variable if it has been set + if ((Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ModNPC as AresBody).berserkEarlyBugFix) + berserkEarlyBugFix = true; } } @@ -272,6 +279,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { otherExoMechsAlive++; exoTwinsAlive = true; + // Spread the early berserk bug fix variable if it has been set + if ((Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ModNPC as Apollo.Apollo).berserkEarlyBugFix) + berserkEarlyBugFix = true; } } return otherExoMechsAlive; @@ -574,6 +584,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); NPC.SpawnOnPlayer(Main.player[targetIndex].whoAmI, ModContent.NPCType()); } + + // If the mech somehow got low enough to enter berserk phase here, trigger the bug fix variable + if (lifeRatio < 0.4f) + berserkEarlyBugFix = true; } } else @@ -672,8 +686,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIState = (float)Phase.UndergroundLaserBarrage; // Enter the fight again if any of the other exo mechs is below 70% or dead and other mechs aren't berserk - // CIT 10FEB2025: Added checks for if the other mechs are alive, to fix softlocks if you somehow skip straight to berserk - if ((!exoPrimeAlive || exoPrimeLifeRatio < 0.7f || !exoTwinsAlive || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk) + // CIT 24MAR2025: Actually fixed the early berserk softlock without affecting the normal fight + if ((exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f || berserkEarlyBugFix) && !otherMechIsBerserk) { // Tells Thanatos to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed @@ -963,7 +977,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.1f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index e3758fb789..8faffda3d8 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosTail : ModNPC { @@ -441,7 +442,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = vulnerable; // Adjust DR based on vulnerable - NPC.Calamity().DR = vulnerable ? 0.15f : 0.9999f; + NPC.Calamity().DR = vulnerable ? 0.1f : 0.9999f; NPC.Calamity().unbreakableDR = !vulnerable; // Vent noise and steam diff --git a/NPCs/HasPierceResistAttribute.cs b/NPCs/HasPierceResistAttribute.cs new file mode 100644 index 0000000000..6c568d6568 --- /dev/null +++ b/NPCs/HasPierceResistAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + /// + /// This attribute gives an NPC universal pierce resistance + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public sealed class HasPierceResistAttribute : Attribute + { + /// + /// Set this to true to indicate this NPC has a single large hitbox which typical piercing projectiles can hit multiple times. Certain weapons are exempt from pierce resistance on single-hitbox targets. + /// + public bool SingleHitbox { get; } + + public HasPierceResistAttribute(bool singleHitbox = false) + { + SingleHitbox = singleHitbox; + } + } +} diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 9d4e8db3e6..56c9153f18 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.HiveMind acceleration *= 2f; } - if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f) + if (NPC.position.Y > Main.player[NPC.target].position.Y - 400f) { if (NPC.velocity.Y > 0f) NPC.velocity.Y *= deceleration; @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + acceleration, -velocity, velocity * 1.5f); } - bool dropRain = NPC.Bottom.Y < Main.player[NPC.target].position.Y - 300f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); + bool dropRain = NPC.Bottom.Y < Main.player[NPC.target].position.Y - 350f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); float distanceX = masterMode ? 200f : 400f; if (NPC.Center.X > Main.player[NPC.target].Center.X + distanceX) { @@ -128,7 +128,7 @@ namespace CalamityMod.NPCs.HiveMind if (dropRain && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] += 1f; - float rainDropRate = Main.getGoodWorld ? 10f : death ? 20f : revenge ? 25f : 30f; + float rainDropRate = Main.getGoodWorld ? 10f : death ? 15f : revenge ? 20f : 30f; if (NPC.ai[0] >= rainDropRate) { NPC.ai[0] = 0f; @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.HiveMind public override void OnKill() { int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + if (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); } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index d8dcab9b15..7e68b4a507 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -66,8 +66,14 @@ namespace CalamityMod.NPCs.HiveMind private int lungeDelay = 90; // # of ticks long hive mind spends sliding to a stop before lunging private int lungeTime = 33; private int lungeFade = 15; // Divide 255 by this for duration of hive mind spin before slowing for lunge + private int lungeAmount = 1; + private int lungesPerformed = 0; + private bool performingLungeCombo = false; private double lungeRots = 0.2; // Number of revolutions made while spinning/fading in for lunge private bool dashStarted = false; + private int rainDashAmount = 1; + private int rainDashesPerformed = 0; + private bool performingRainDashCombo = false; private int vileSpitFireRate = 24; // Fire rate for Expert-exclusive Vile Spits during phase 1 teleports private int phase2timer = 360; private int rotationDirection; @@ -177,6 +183,8 @@ namespace CalamityMod.NPCs.HiveMind if (death) { lungeRots = 0.4; + lungeAmount = 3; + rainDashAmount = 2; minimumDriftTime = 60; reelbackFade = 6; lungeTime = 23; @@ -256,6 +264,10 @@ namespace CalamityMod.NPCs.HiveMind writer.Write(rotation); writer.Write(previousState); writer.Write(reelCount); + writer.Write(lungesPerformed); + writer.Write(performingLungeCombo); + writer.Write(rainDashesPerformed); + writer.Write(performingRainDashCombo); } public override void ReceiveExtraAI(BinaryReader reader) @@ -276,6 +288,10 @@ namespace CalamityMod.NPCs.HiveMind rotation = reader.ReadDouble(); previousState = reader.ReadInt32(); reelCount = reader.ReadInt32(); + lungesPerformed = reader.ReadInt32(); + performingLungeCombo = reader.ReadBoolean(); + rainDashesPerformed = reader.ReadInt32(); + performingRainDashCombo = reader.ReadBoolean(); } public override void FindFrame(int _) @@ -358,11 +374,11 @@ namespace CalamityMod.NPCs.HiveMind bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - int maxSpawns = death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + int maxSpawns = death ? Main.rand.Next(3, 5) : revenge ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; for (int i = 0; i < maxSpawns; i++) { - int type = NPCID.EaterofSouls; - int choice = -1; + int type = 0; + int choice = masterMode ? 1 : -1; do { choice++; @@ -370,22 +386,26 @@ namespace CalamityMod.NPCs.HiveMind { case 0: case 1: - type = NPCID.EaterofSouls; + type = NPC.CountNPCS(NPCID.EaterofSouls) < 2 ? NPCID.EaterofSouls : 0; break; + case 2: - type = NPCID.DevourerHead; + type = NPC.CountNPCS(NPCID.DevourerHead) < 2 ? NPCID.DevourerHead : 0; break; + case 3: case 4: - type = ModContent.NPCType(); + type = NPC.CountNPCS(ModContent.NPCType()) < 2 ? ModContent.NPCType() : 0; break; + default: + type = -1; break; } } - while (NPC.AnyNPCs(type) && choice < 5); + while (type == 0); - if (choice < 5) + if (type > 0) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), type); } @@ -482,6 +502,25 @@ namespace CalamityMod.NPCs.HiveMind Gore.NewGore(NPC.GetSource_FromAI(), NPC.Center, NPC.velocity, Mod.Find("HiveMindGore" + i).Type, 1f); } + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 35; j++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } + SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); NPC.position = NPC.Center; @@ -751,7 +790,7 @@ namespace CalamityMod.NPCs.HiveMind if (nextState == 0) { NPC.TargetClosest(); - if (revenge && lifeRatio < 0.5f) + if (revenge && lifeRatio < 0.6f) { if (death) { @@ -760,7 +799,7 @@ namespace CalamityMod.NPCs.HiveMind while (nextState == previousState); previousState = nextState; } - else if (lifeRatio < 0.25f) + else if (lifeRatio < 0.3f) { do nextState = Main.rand.Next(3, 6); @@ -845,13 +884,16 @@ namespace CalamityMod.NPCs.HiveMind phase2timer--; - // Use an attack sooner if being hit - if (NPC.justHit && masterMode) - phase2timer -= 4; + if (masterMode) + { + // Use an attack sooner if being hit + if (NPC.justHit) + phase2timer -= 4; - // Use an attack sooner if target is close - if (NPC.Distance(player.Center) < 160f) - phase2timer -= 2; + // Use an attack sooner if target is close + if (NPC.Distance(player.Center) < 160f) + phase2timer -= 2; + } if (phase2timer <= -180) // No stalling drift mode forever { @@ -925,21 +967,24 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity = Vector2.Zero; dashStarted = false; - if (revenge && lifeRatio < 0.53f) + if (revenge && lifeRatio < 0.6f && lungesPerformed == 0 && rainDashesPerformed == 0) { state = nextState; nextState = 0; previousState = state; } else - state = 3; + state = performingRainDashCombo ? 5 : 3; - if (player.velocity.X > 0) - rotationDirection = 1; - else if (player.velocity.X < 0) - rotationDirection = -1; - else - rotationDirection = player.direction; + if (!performingRainDashCombo) + { + if (player.velocity.X > 0) + rotationDirection = 1; + else if (player.velocity.X < 0) + rotationDirection = -1; + else + rotationDirection = player.direction; + } } break; @@ -965,7 +1010,7 @@ namespace CalamityMod.NPCs.HiveMind } rotation += rotationIncrement * rotationDirection; - phase2timer = lungeDelay; + phase2timer = lungesPerformed > 0 ? (lungeDelay / (lungesPerformed + 1)) : lungeDelay; NPC.alpha -= lungeFade; if (NPC.alpha < 0) @@ -1016,6 +1061,7 @@ namespace CalamityMod.NPCs.HiveMind // Avoid cheap bullshit NPC.damage = 0; + performingLungeCombo = death; state = 6; phase2timer = 0; deceleration = NPC.velocity / decelerationTime; @@ -1065,7 +1111,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); phase2timer++; - if (phase2timer == (int)arcTime / 6) + if (phase2timer == (int)(arcTime / 6f)) { phase2timer = 0; NPC.ai[0] += 1f; @@ -1104,7 +1150,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.Center = player.Center; NPC.position.Y -= teleportRadius; - NPC.position.X += teleportRadius * rotationDirection; + NPC.position.X += (death ? (teleportRadius * 1.5f) : teleportRadius) * (rainDashesPerformed == 0 ? rotationDirection : -rotationDirection); } NPC.alpha -= masterMode ? 10 : 5; @@ -1123,7 +1169,7 @@ namespace CalamityMod.NPCs.HiveMind dashStarted = true; SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.velocity.X = teleportRadius / arcTime * 3; - NPC.velocity *= -rotationDirection; + NPC.velocity *= (rainDashesPerformed == 0 ? -rotationDirection : rotationDirection); NPC.ForceNetUpdate(); } else @@ -1132,7 +1178,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.damage = NPC.defDamage; phase2timer++; - if (phase2timer == (int)arcTime / 20) + if (phase2timer == (int)(arcTime / (death ? 15f : 20f))) { phase2timer = 0; NPC.ai[0] += 1f; @@ -1147,6 +1193,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.ai[0] == 10f) { + performingRainDashCombo = death; state = 6; NPC.ai[0] = 0f; deceleration = NPC.velocity / decelerationTime; @@ -1166,8 +1213,42 @@ namespace CalamityMod.NPCs.HiveMind phase2timer++; if (phase2timer == decelerationTime) { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); - state = 0; + if (performingRainDashCombo) + { + rainDashesPerformed++; + if (rainDashesPerformed < rainDashAmount) + { + state = 2; + } + else + { + phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + performingRainDashCombo = false; + rainDashesPerformed = 0; + state = 0; + } + } + else if (performingLungeCombo) + { + lungesPerformed++; + if (lungesPerformed < lungeAmount) + { + state = 2; + } + else + { + phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + performingLungeCombo = false; + lungesPerformed = 0; + state = 0; + } + } + else + { + phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + state = 0; + } + NPC.ForceNetUpdate(); } @@ -1185,8 +1266,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.ai[3] = NPC.life; - int maxDarkHearts = ((revenge && lifeRatio < 0.25f) || death) ? 2 : 1; - if (NPC.CountNPCS(ModContent.NPCType()) < maxDarkHearts) + if (!NPC.AnyNPCs(ModContent.NPCType())) { SoundEngine.PlaySound(SoundID.NPCDeath22, NPC.Center); @@ -1211,8 +1291,8 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); - int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); + int x = (int)(NPC.position.X + Main.rand.Next(NPC.width)); + int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height)); int type = ModContent.NPCType(); int tenPercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); Main.npc[tenPercentMinions].SetDefaults(type); @@ -1282,9 +1362,15 @@ namespace CalamityMod.NPCs.HiveMind { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.rand.NextBool(60)) + if (Main.rand.NextBool(30)) { if (NPC.CountNPCS(NPCID.EaterofSouls) < 3) + NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()); + } + + if (Main.rand.NextBool(60)) + { + if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 91b399e929..04d468c868 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -634,7 +634,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.ai[1] += 1f; float attackDivisor = 140f - (int)(30f * enrageScale); - float telegraphOffset = (masterMode && revenge) ? 45f : 60f; + float telegraphOffset = death ? 45f : 60f; if (!leviAlive || phase4) { attackDivisor -= (float)Math.Ceiling(50f * (1f - lifeRatio)); diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 8a7e1f5543..59dded4f7f 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -6,6 +6,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -299,5 +300,7 @@ namespace CalamityMod.NPCs.Leviathan } } } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.AdhesiveBandage, 100, 50)); } } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 3e991ea360..ee17a56ea4 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -34,6 +34,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Leviathan { [AutoloadBossHead] + [HasPierceResist(singleHitbox: true)] public class Leviathan : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/CloudElemental.cs similarity index 99% rename from NPCs/NormalNPCs/ThiccWaifu.cs rename to NPCs/NormalNPCs/CloudElemental.cs index 1af0826051..11bbb3861e 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/CloudElemental.cs @@ -20,7 +20,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.NormalNPCs { - public class ThiccWaifu : ModNPC + public class CloudElemental : ModNPC { public enum AttackState { @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.NormalNPCs { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.Rain, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ThiccWaifu") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CloudElemental") }); } diff --git a/NPCs/NormalNPCs/ThiccWaifu.png b/NPCs/NormalNPCs/CloudElemental.png similarity index 100% rename from NPCs/NormalNPCs/ThiccWaifu.png rename to NPCs/NormalNPCs/CloudElemental.png diff --git a/NPCs/NormalNPCs/ThiccWaifuAttack.png b/NPCs/NormalNPCs/CloudElementalAttack.png similarity index 100% rename from NPCs/NormalNPCs/ThiccWaifuAttack.png rename to NPCs/NormalNPCs/CloudElementalAttack.png diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 18f99bbfbf..71ef2aa14a 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -2,9 +2,11 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class CrimulanBlightSlime : ModNPC @@ -89,6 +91,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Gel, 1, 10, 14); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Blindfold, 100, 50)); npcLoot.Add(ModContent.ItemType(), 1, 15, 21); } } diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 0511fb85cf..98a2b2a496 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -2,9 +2,11 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class EbonianBlightSlime : ModNPC @@ -89,6 +91,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Gel, 1, 10, 14); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Vitamins, 100, 50)); npcLoot.Add(ModContent.ItemType(), 1, 15, 21); } } diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 0877b823af..af1c94e9ad 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -401,15 +401,17 @@ namespace CalamityMod.NPCs.NormalNPCs bool instakill = false; List metarexNames = new List { "LordMetarex", "Metarex" }; foreach (string s in metarexNames) + { if (s.ToLower() == target.name.ToLower()) { instakill = true; break; } + } if (instakill) { - target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Goldfish").Format(target.name)), 1000.0, 0, false); + target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Goldfish").ToNetworkText(target.name)), 1000.0, 0, false); modifiers.FinalDamage *= target.statLifeMax2 * Main.rand.NextFloat(2.0f, 3.5f); } } diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 5dd4b71209..0bd649cac1 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -4,6 +4,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -104,6 +105,10 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), target.Center, Vector2.Zero, ProjectileID.SolarWhipSwordExplosion, 0, 0f, Main.myPlayer); + + // Ouch, don't get hit twice in a row :) + if (hurtInfo.Damage > 0) + target.AddBuff(BuffID.BrokenArmor, 300, true); } public override void FindFrame(int frameHeight) @@ -125,6 +130,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.AddIf(() => NPC.downedPlantBoss, ModContent.ItemType(), 5); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.ArmorPolish, 100, 50)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index c27214493c..71a8eab684 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -3,9 +3,11 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class Rotdog : ModNPC @@ -136,7 +138,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemID.AdhesiveBandage, 50); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.AdhesiveBandage, 100, 50)); npcLoot.Add(ModContent.ItemType(), 8); } } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index d9fd23d8cd..a0aa82aad3 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -411,7 +411,7 @@ namespace CalamityMod.NPCs.OldDuke CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedBoomerDuke); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedBoomerDuke); // Mark Old Duke as dead DownedBossSystem.downedBoomerDuke = true; diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 2154470e3a..cbc5e97425 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadLarge))] public class PerforatorBodyLarge : ModNPC { @@ -106,13 +107,6 @@ namespace CalamityMod.NPCs.Perforator NPC.active = false; } - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -167,6 +161,32 @@ namespace CalamityMod.NPCs.Perforator float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } + + if (Main.npc[(int)NPC.ai[1]].alpha >= 85) + { + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + else if (NPC.alpha > 0) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index a15339120e..6678323c28 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadMedium))] public class PerforatorBodyMedium : ModNPC { @@ -79,6 +80,9 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + NPC.realLife = -1; // Target @@ -88,13 +92,6 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) { if (NPC.ai[0] == 0f) @@ -110,8 +107,17 @@ namespace CalamityMod.NPCs.Perforator } // Splitting effect + bool spawnedBlob = false; if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active) { + if (death) + { + spawnedBlob = true; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + NPC.life = 0; NPC.HitEffect(0, 10.0); NPC.checkDead(); @@ -120,6 +126,14 @@ namespace CalamityMod.NPCs.Perforator } if (!Main.npc[(int)NPC.ai[1]].active || Main.npc[(int)NPC.ai[1]].aiStyle != NPC.aiStyle) { + if (death && !spawnedBlob) + { + spawnedBlob = true; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + NPC.type = ModContent.NPCType(); int whoAmI = NPC.whoAmI; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -128,11 +142,19 @@ namespace CalamityMod.NPCs.Perforator NPC.life = (int)(NPC.lifeMax * lifeRatio); NPC.ai[0] = ai0; NPC.TargetClosest(true); - NPC.netUpdate = true; + NPC.ForceNetUpdate(); NPC.whoAmI = whoAmI; + NPC.alpha = 0; } if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPC.aiStyle) { + if (death && !spawnedBlob) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + int whoAmI2 = NPC.whoAmI; float otherLifeRatio = NPC.life / (float)NPC.lifeMax; float ai1 = NPC.ai[1]; @@ -140,8 +162,9 @@ namespace CalamityMod.NPCs.Perforator NPC.life = (int)(NPC.lifeMax * otherLifeRatio); NPC.ai[1] = ai1; NPC.TargetClosest(true); - NPC.netUpdate = true; + NPC.ForceNetUpdate(); NPC.whoAmI = whoAmI2; + NPC.alpha = 0; } if (!NPC.active && Main.dedServ) @@ -199,6 +222,32 @@ namespace CalamityMod.NPCs.Perforator float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } + + if (Main.npc[(int)NPC.ai[1]].alpha >= 85) + { + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, Main.rand.NextBool() ? DustID.Ichor : DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + else if (NPC.alpha > 0) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 552626f6b9..da460fae1f 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadSmall))] public class PerforatorBodySmall : ModNPC { @@ -101,13 +102,6 @@ namespace CalamityMod.NPCs.Perforator NPC.active = false; } - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -163,6 +157,32 @@ namespace CalamityMod.NPCs.Perforator float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } + + if (Main.npc[(int)NPC.ai[1]].alpha >= 85) + { + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + else if (NPC.alpha > 0) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index af7e943b92..4e0c906fef 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class PerforatorHeadLarge : ModNPC { @@ -154,23 +155,92 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - float speed = 0.09f; - float turnSpeed = 0.06f; + float speed = 0.1f; + float turnSpeed = 0.07f; if (expertMode) { - float velocityScale = (death ? 0.12f : 0.1f) * enrageScale; + float velocityScale = (death ? 0.1f : 0.07f) * enrageScale; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.12f : 0.1f) * enrageScale; + float accelerationScale = (death ? 0.07f : 0.05f) * enrageScale; turnSpeed += accelerationScale * (1f - lifeRatio); } if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; + // Spit attack in Rev + // Spit ichor blobs in Death + float spitDistance = 800f; + float tooCloseToSpitDistance = 160f; + bool canSpit = (NPC.Distance(player.Center) <= spitDistance && NPC.Distance(player.Center) > tooCloseToSpitDistance && + (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation() && + Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) || NPC.Calamity().newAI[1] == 1f; + + if (canSpit) + { + NPC.Calamity().newAI[0] += 1f; + float spitGateValue = 180f; + bool spit = NPC.Calamity().newAI[0] >= spitGateValue; + float telegraphSpitGateValue = spitGateValue - 30f; + bool telegraphSpit = NPC.Calamity().newAI[0] >= telegraphSpitGateValue; + Vector2 spitLocation = NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 20f; + if (telegraphSpit) + { + NPC.Calamity().newAI[1] = 1f; + Vector2 dustVelocity = spitLocation - spitLocation; + int dustType = Main.rand.NextBool() ? DustID.Ichor : DustID.Blood; + for (int k = 0; k < 10; k++) + { + int dust = Dust.NewDust(spitLocation, 0, 0, dustType); + Main.dust[dust].position = spitLocation + Main.rand.NextVector2CircularEdge(25f, 25f); + Main.dust[dust].velocity = spitLocation - Main.dust[dust].position; + Main.dust[dust].scale = dustType == DustID.Ichor ? 1f : 3f; + Main.dust[dust].noGravity = true; + } + } + + if (spit) + { + NPC.Calamity().newAI[0] = 0f; + NPC.Calamity().newAI[1] = 0f; + + SoundEngine.PlaySound(SoundID.NPCDeath13, spitLocation); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spitProjectileAmount = 8; + float spitProjectileBaseVelocity = 12f; + float spitProjectileRandomVelocityLimit = 3f; + for (int i = 0; i < spitProjectileAmount; i++) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), + spitLocation + Main.rand.NextVector2CircularEdge(8f, 8f), + NPC.velocity.SafeNormalize(Vector2.UnitY) * spitProjectileBaseVelocity + Main.rand.NextVector2CircularEdge(spitProjectileRandomVelocityLimit, spitProjectileRandomVelocityLimit), + type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + + // Spit blobs + if (death) + { + int spitBlobAmount = 3; + float spitBlobBaseVelocity = 8f; + float spitBlobRandomVelocityLimit = 2f; + for (int i = 0; i < spitBlobAmount; i++) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), + spitLocation + Main.rand.NextVector2CircularEdge(8f, 8f), + NPC.velocity.SafeNormalize(Vector2.UnitY) * spitBlobBaseVelocity + Main.rand.NextVector2CircularEdge(spitBlobRandomVelocityLimit, spitBlobRandomVelocityLimit), + type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + } + } + } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -282,31 +352,32 @@ namespace CalamityMod.NPCs.Perforator } // This is possibly the best or worst idea ever conceived - float laserOffset = 1500f; - float laserVelocity = 4f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (Main.zenithWorld) - NPC.Calamity().newAI[3]++; - - if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast { - if (NPC.Calamity().newAI[3] % 60 == 59) - { - SoundEngine.PlaySound(SoundID.Item12, player.Center); - for (int i = -7; i < 8; i++) // 15 lasers - { - float laserGap = (i * 128f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } + float laserOffset = 1500f; + float laserVelocity = 4f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); - if (NPC.Calamity().newAI[3] >= 300f) - NPC.Calamity().newAI[3] = -300f; + NPC.Calamity().newAI[3]++; + if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast + { + if (NPC.Calamity().newAI[3] % 60 == 59) + { + SoundEngine.PlaySound(SoundID.Item12, player.Center); + for (int i = -7; i < 8; i++) // 15 lasers + { + float laserGap = (i * 128f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + + if (NPC.Calamity().newAI[3] >= 300f) + NPC.Calamity().newAI[3] = -300f; + } } float speedCopy = speed; @@ -386,115 +457,78 @@ namespace CalamityMod.NPCs.Perforator if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))) { if (NPC.velocity.X < playerX) - { NPC.velocity.X = NPC.velocity.X + turnSpeedCopy; - } else if (NPC.velocity.X > playerX) - { NPC.velocity.X = NPC.velocity.X - turnSpeedCopy; - } if (NPC.velocity.Y < targettingPosition) - { NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy; - } else if (NPC.velocity.Y > targettingPosition) - { NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy; - } } if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)) { if (NPC.velocity.X < playerX) - { NPC.velocity.X = NPC.velocity.X + speedCopy; - } else if (NPC.velocity.X > playerX) - { NPC.velocity.X = NPC.velocity.X - speedCopy; - } if (NPC.velocity.Y < targettingPosition) - { NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } else if (NPC.velocity.Y > targettingPosition) - { NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } if ((double)Math.Abs(targettingPosition) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f))) { if (NPC.velocity.Y > 0f) - { NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f; - } else - { NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f; - } } if ((double)Math.Abs(playerX) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f))) { if (NPC.velocity.X > 0f) - { NPC.velocity.X = NPC.velocity.X + speedCopy * 2f; - } else - { NPC.velocity.X = NPC.velocity.X - speedCopy * 2f; - } } } else if (absoluteTargetX > absoluteTargetPos) { if (NPC.velocity.X < playerX) - { NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f; - } else if (NPC.velocity.X > playerX) - { NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f; - } if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.Y > 0f) - { NPC.velocity.Y = NPC.velocity.Y + speedCopy; - } else - { NPC.velocity.Y = NPC.velocity.Y - speedCopy; - } } } else { if (NPC.velocity.Y < targettingPosition) - { NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f; - } else if (NPC.velocity.Y > targettingPosition) - { NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f; - } if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5) { if (NPC.velocity.X > 0f) - { NPC.velocity.X = NPC.velocity.X + speedCopy; - } else - { NPC.velocity.X = NPC.velocity.X - speedCopy; - } } } } + if (NPC.Distance(player.Center) > 1280f) + NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + // Calculate contact damage based on velocity float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; float minimalDamageVelocity = maxChargeSpeed * 0.5f; @@ -527,6 +561,23 @@ namespace CalamityMod.NPCs.Perforator if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) NPC.netUpdate = true; + + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -557,23 +608,18 @@ namespace CalamityMod.NPCs.Perforator return false; } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 10; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index e3cf886284..57460d4cef 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -16,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class PerforatorHeadMedium : ModNPC { @@ -114,17 +115,23 @@ namespace CalamityMod.NPCs.Perforator if (!Main.player[NPC.target].ZoneCrimson || bossRush) enrageScale += 1f; - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; + // Total body segments + float totalSegments = GetMediumPerforatorSegmentsCount(); - float speed = 0.08f; - float turnSpeed = 0.06f; + // Count body segments remaining + float segmentCount = NPC.CountNPCS(ModContent.NPCType()); + + // Percent body segments remaining + float lifeRatio = MathHelper.Clamp(segmentCount / totalSegments, 0f, 1f); + + float speed = 0.125f; + float turnSpeed = 0.085f; if (expertMode) { - float velocityScale = (death ? 0.08f : 0.07f) * enrageScale; + float velocityScale = (death ? 0.125f : 0.085f) * enrageScale; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.08f : 0.07f) * enrageScale; + float accelerationScale = (death ? 0.085f : 0.06f) * enrageScale; turnSpeed += accelerationScale * (1f - lifeRatio); } @@ -140,15 +147,10 @@ namespace CalamityMod.NPCs.Perforator Player player = Main.player[NPC.target]; - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) { if (NPC.ai[0] == 0f) { - int totalSegments = death ? 14 : revenge ? 13 : expertMode ? 12 : 10; NPC.ai[2] = totalSegments; NPC.ai[0] = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (NPC.width / 2)), (int)(NPC.position.Y + NPC.height), ModContent.NPCType(), NPC.whoAmI); Main.npc[(int)NPC.ai[0]].ai[1] = NPC.whoAmI; @@ -157,8 +159,17 @@ namespace CalamityMod.NPCs.Perforator } // Splitting effect + bool spawnedBlob = false; if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active) { + if (death) + { + spawnedBlob = true; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + NPC.life = 0; NPC.HitEffect(0, 10.0); NPC.checkDead(); @@ -167,6 +178,13 @@ namespace CalamityMod.NPCs.Perforator } if (!Main.npc[(int)NPC.ai[0]].active) { + if (death && !spawnedBlob) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + NPC.life = 0; NPC.HitEffect(0, 10.0); NPC.checkDead(); @@ -420,6 +438,9 @@ namespace CalamityMod.NPCs.Perforator } } + if (NPC.Distance(player.Center) > 1280f) + NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + // Calculate contact damage based on velocity float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; float minimalDamageVelocity = maxChargeSpeed * 0.5f; @@ -452,6 +473,28 @@ namespace CalamityMod.NPCs.Perforator if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) NPC.netUpdate = true; + + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, Main.rand.NextBool() ? DustID.Ichor : DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + + public static int GetMediumPerforatorSegmentsCount() + { + return CalamityWorld.LegendaryMode ? 20 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 14 : CalamityWorld.revenge ? 13 : Main.expertMode ? 12 : 10; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 1931ce9a48..a1eed6c54b 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class PerforatorHeadSmall : ModNPC { @@ -147,7 +148,7 @@ namespace CalamityMod.NPCs.Perforator { float velocityScale = (death ? 0.15f : 0.1f) * enrageScale; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.12f : 0.1f) * enrageScale; + float accelerationScale = (death ? 0.1f : 0.07f) * enrageScale; turnSpeed += accelerationScale * (1f - lifeRatio); } @@ -164,10 +165,6 @@ namespace CalamityMod.NPCs.Perforator Player player = Main.player[NPC.target]; - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned) @@ -454,6 +451,9 @@ namespace CalamityMod.NPCs.Perforator } } + if (NPC.Distance(player.Center) > 1280f) + NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; + // Calculate contact damage based on velocity float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; float minimalDamageVelocity = maxChargeSpeed * 0.5f; @@ -486,6 +486,23 @@ namespace CalamityMod.NPCs.Perforator if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) NPC.netUpdate = true; + + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 6968d2f8cc..2adbe829cf 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -111,12 +111,18 @@ namespace CalamityMod.NPCs.Perforator { writer.Write(biomeEnrageTimer); writer.Write(wormsAlive); + writer.Write(small); + writer.Write(medium); + writer.Write(large); } public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); wormsAlive = reader.ReadInt32(); + small = reader.ReadBoolean(); + medium = reader.ReadBoolean(); + large = reader.ReadBoolean(); } public override void AI() @@ -147,6 +153,7 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; + bool phase3 = lifeRatio < 0.4f && revenge; // Enrage if ((!player.ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) @@ -266,37 +273,38 @@ namespace CalamityMod.NPCs.Perforator if (Main.getGoodWorld && lifeRatio < 0.5f) { if (lifeRatio > 0.35f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 1); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); else if (lifeRatio > 0.2f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 1); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); else if (lifeRatio > 0.05f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 1); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); } else - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, wormType, 1); + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), wormType, 1); + + // Spawn two small worms in Death + if (death) + { + if (wormType == ModContent.NPCType()) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), wormType, 1); + } + } NPC.TargetClosest(); SoundEngine.PlaySound(WormSpawn, NPC.Center); for (int i = 0; i < 16; i++) - { - int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); - Main.dust[ichorDust].velocity *= 2f; - if (Main.rand.NextBool()) - { - Main.dust[ichorDust].scale = 0.25f; - Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor); for (int j = 0; j < 32; j++) { - int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); + int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood); Main.dust[bloodDust].noGravity = true; - Main.dust[bloodDust].velocity *= 3f; - bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1f); - Main.dust[bloodDust].velocity *= 2f; + Main.dust[bloodDust].scale = 3f; + bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood); + Main.dust[bloodDust].scale = 2f; } } } @@ -314,7 +322,7 @@ namespace CalamityMod.NPCs.Perforator // Emit ichor blobs if (phase2) { - if (wormsAlive == 0 || bossRush || floatAboveToFireBlobs || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (wormsAlive == 0 || large || bossRush || floatAboveToFireBlobs || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) { NPC.ai[2] += 1f; if (NPC.ai[2] >= blobPhaseGateValue) @@ -334,38 +342,40 @@ namespace CalamityMod.NPCs.Perforator for (int i = 0; i < 32; i++) { - int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); + int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor); float dustVelocityYAdd = Math.Abs(Main.dust[ichorDust].velocity.Y) * 0.5f; if (Main.dust[ichorDust].velocity.Y < 0f) Main.dust[ichorDust].velocity.Y = 2f + dustVelocityYAdd; + if (Main.rand.NextBool()) - { - Main.dust[ichorDust].scale = 0.25f; - Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Main.dust[ichorDust].scale = 0.5f; } - int numBlobs = expertMode ? 6 : 3; + bool ichorBlobBigWormPhase = wormsAlive > 0 && large; + int numBlobs = expertMode ? (ichorBlobBigWormPhase ? 4 : 6) : (ichorBlobBigWormPhase ? 2 : 4); if (Main.getGoodWorld) numBlobs *= 2; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); + int blobSpread = expertMode ? (ichorBlobBigWormPhase ? 66 : 100) : (ichorBlobBigWormPhase ? 33 : 66); for (int i = 0; i < numBlobs; i++) { - Vector2 blobVelocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + Vector2 blobVelocity = new Vector2(Main.rand.Next(-blobSpread, blobSpread + 1), Main.rand.Next(-blobSpread, blobSpread + 1)); blobVelocity.Normalize(); blobVelocity *= Main.rand.Next(400, 801) * (bossRush ? 0.02f : 0.01f); if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) blobVelocity *= Main.rand.NextFloat() + 1f; - float blobVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.5f; + float blobVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.25f; if (blobVelocity.Y < 2f) blobVelocity.Y = 2f + blobVelocityYAdd; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 50f, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + // Fall a bit further or shorter depending on which blob it is + float fallFurtherDistance = 48f * (i - numBlobs / 2); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 50f, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y + fallFurtherDistance); } } @@ -384,44 +394,40 @@ namespace CalamityMod.NPCs.Perforator NPC.damage = 0; if (revenge) - Movement(player, 6f + velocityEnrageIncrease, 0.3f, 450f); + Movement(player, 9f + velocityEnrageIncrease, 0.3f, 450f); else - Movement(player, 5f + velocityEnrageIncrease, 0.2f, 450f); + Movement(player, 6f + velocityEnrageIncrease, 0.2f, 450f); return; } if (Main.netMode != NetmodeID.MultiplayerClient) { + // Side mouth starts spitting when it opens (WIP) + if (phase3) + { + NPC.localAI[2] += 1f; + if (NPC.frame.Y / (TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]) == 5 && NPC.localAI[2] >= 0f) + { + // Ensure it only spits once + NPC.localAI[2] = -10f; + + //SoundEngine.PlaySound(SoundID.Item17, ); + } + } + NPC.localAI[0] += 1f; if (NPC.localAI[0] >= (revenge ? 200f : 250f) + wormsAlive * 150f && NPC.position.Y + NPC.height < player.position.Y && Vector2.Distance(player.Center, NPC.Center) > 80f) { NPC.localAI[0] = 0f; SoundEngine.PlaySound(GeyserShoot, NPC.Center); - for (int i = 0; i < 8; i++) - { - int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor, 0f, 0f, 100, default, 1f); - Main.dust[ichorDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[ichorDust].scale = 0.25f; - Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - for (int j = 0; j < 16; j++) - { - int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); - Main.dust[bloodDust].noGravity = true; - Main.dust[bloodDust].velocity *= 5f; - bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 1f); - Main.dust[bloodDust].velocity *= 2f; - } - - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + bool ichor = Main.rand.NextBool(); + int type = ichor ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); int numProj = death ? 16 : revenge ? 14 : expertMode ? 12 : 10; + if (phase3) + numProj = death ? 12 : revenge ? 10 : expertMode ? 8 : 6; if (Main.getGoodWorld) numProj *= 2; @@ -434,7 +440,30 @@ namespace CalamityMod.NPCs.Perforator { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Vector2 randomVelocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() - 0.5f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 50f, perturbedSpeed + randomVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Vector2 projectileSpawnLocation = NPC.Center + Vector2.Normalize(perturbedSpeed) * 50f; + Vector2 projectileVelocityRandomized = perturbedSpeed + randomVelocity; + + if (ichor) + { + for (int j = 0; j < 4; j++) + { + int ichorDust = Dust.NewDust(NPC.position, 12, 12, DustID.Ichor); + Main.dust[ichorDust].position = projectileSpawnLocation; + Main.dust[ichorDust].velocity = projectileVelocityRandomized; + } + } + else + { + for (int j = 0; j < 4; j++) + { + int bloodDust = Dust.NewDust(NPC.position, 12, 12, DustID.Blood); + Main.dust[bloodDust].position = projectileSpawnLocation; + Main.dust[bloodDust].velocity = projectileVelocityRandomized; + Main.dust[bloodDust].scale = 3f; + } + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawnLocation, projectileVelocityRandomized, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -449,13 +478,13 @@ namespace CalamityMod.NPCs.Perforator NPC.damage = NPC.defDamage; if (large || death) - Movement(player, 11f + velocityEnrageIncrease, death ? 0.1125f : 0.0975f, 20f); + Movement(player, 13f + velocityEnrageIncrease, death ? 0.115f : 0.1f, 20f); else if (medium) - Movement(player, 10f + velocityEnrageIncrease, death ? 0.105f : 0.09f, 30f); + Movement(player, 12f + velocityEnrageIncrease, death ? 0.11f : 0.095f, 30f); else if (small) - Movement(player, 9f + velocityEnrageIncrease, death ? 0.0975f : 0.0825f, 40f); + Movement(player, 11f + velocityEnrageIncrease, death ? 0.105f : 0.09f, 40f); else - Movement(player, 8f + velocityEnrageIncrease, death ? 0.09f : 0.075f, 50f); + Movement(player, 10f + velocityEnrageIncrease, death ? 0.1f : 0.085f, 50f); break; @@ -464,7 +493,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 6f + velocityEnrageIncrease, 0.15f, 350f); + Movement(player, 8f + velocityEnrageIncrease, 0.2f, 350f); break; @@ -473,7 +502,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 6f + velocityEnrageIncrease, 0.15f, 275f); + Movement(player, 8f + velocityEnrageIncrease, 0.2f, 275f); break; @@ -482,7 +511,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 6f + velocityEnrageIncrease, 0.15f, 200f); + Movement(player, 8f + velocityEnrageIncrease, 0.2f, 200f); break; } @@ -492,7 +521,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 6f + velocityEnrageIncrease, 0.075f, 350f); + Movement(player, 6f + velocityEnrageIncrease, 0.15f, 350f); } } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 20cfe2cf62..a16079a3c2 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadLarge))] public class PerforatorTailLarge : ModNPC { @@ -101,13 +102,6 @@ namespace CalamityMod.NPCs.Perforator NPC.active = false; } - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -163,6 +157,32 @@ namespace CalamityMod.NPCs.Perforator float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } + + if (Main.npc[(int)NPC.ai[1]].alpha >= 85) + { + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + else if (NPC.alpha > 0) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 5363704b89..66712f3c70 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadMedium))] public class PerforatorTailMedium : ModNPC { @@ -79,6 +80,9 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + NPC.realLife = -1; // Target @@ -88,18 +92,20 @@ namespace CalamityMod.NPCs.Perforator if (Main.player[NPC.target].dead) NPC.TargetClosest(false); - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - if (Main.netMode != NetmodeID.MultiplayerClient) { // Splitting effect + bool spawnedBlob = false; if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active) { + if (death) + { + spawnedBlob = true; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + NPC.life = 0; NPC.HitEffect(0, 10.0); NPC.checkDead(); @@ -108,6 +114,13 @@ namespace CalamityMod.NPCs.Perforator } if (!Main.npc[(int)NPC.ai[1]].active) { + if (death && !spawnedBlob) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + } + NPC.life = 0; NPC.HitEffect(0, 10.0); NPC.checkDead(); @@ -170,6 +183,32 @@ namespace CalamityMod.NPCs.Perforator float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } + + if (Main.npc[(int)NPC.ai[1]].alpha >= 85) + { + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, Main.rand.NextBool() ? DustID.Ichor : DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + else if (NPC.alpha > 0) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index da90401b93..433f7586b5 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadSmall))] public class PerforatorTailSmall : ModNPC { @@ -101,13 +102,6 @@ namespace CalamityMod.NPCs.Perforator NPC.active = false; } - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - if (Main.player[NPC.target].dead) NPC.TargetClosest(false); @@ -164,6 +158,32 @@ namespace CalamityMod.NPCs.Perforator float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); } + + if (Main.npc[(int)NPC.ai[1]].alpha >= 85) + { + if (NPC.alpha > 0 && NPC.life > 0) + { + for (int dustIndex = 0; dustIndex < 2; dustIndex++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + if ((NPC.position - NPC.oldPosition).Length() > 2f) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + } + else if (NPC.alpha > 0) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/PierceResistExceptionAttribute.cs b/NPCs/PierceResistExceptionAttribute.cs new file mode 100644 index 0000000000..f4a410ab94 --- /dev/null +++ b/NPCs/PierceResistExceptionAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + /// + /// This attribute makes projectiles exempt from pierce resistance + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public sealed class PierceResistExceptionAttribute : Attribute + { + /// + /// Set this to true to indicate this projectile is only exempt from piercing resistance when attacking NPCs with a single large hitbox. + /// + public bool OnlyForSingleHitbox { get; } + + public PierceResistExceptionAttribute(bool onlyForSingleHitbox = false) + { + OnlyForSingleHitbox = onlyForSingleHitbox; + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index e9b5eeeb5b..3058434821 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1358,7 +1358,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Materials normalOnly.Add(ItemID.Stinger, 1, 3, 5); normalOnly.Add(ModContent.ItemType(), 1, 15, 20); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 30, 40)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index dba87d1578..037e3f2fce 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1013,7 +1013,7 @@ namespace CalamityMod.NPCs.Polterghast normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 7, 15)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 20, 25)); normalOnly.Add(ModContent.ItemType(), 1, 30, 40); // Vanity diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index c4fc204d4b..474cbd48f6 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -1215,7 +1215,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npcLoot.Add(ModContent.ItemType(), 5); npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType()); - npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 10, 15, 15, 20)); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 15, 20, 20, 25)); // Furniture npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index cf2bb60939..34c3782b94 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ProfanedGuardians { + [HasPierceResist] public class ProfanedRocks : ModNPC { private bool start = true; diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 378213ad2d..ee8f6aa180 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -29,7 +29,6 @@ namespace CalamityMod.NPCs.Providence public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.Calamity().canBreakPlayerDefense = true; NPC.npcSlots = 1f; NPC.aiStyle = -1; NPC.damage = 0; diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 2466f1a134..e9295deaa6 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -29,7 +29,6 @@ namespace CalamityMod.NPCs.Providence public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.Calamity().canBreakPlayerDefense = true; NPC.npcSlots = 1f; NPC.aiStyle = -1; NPC.damage = 0; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 2130aad947..77afca26e2 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -2052,7 +2052,7 @@ namespace CalamityMod.NPCs.Providence { Providence prov = info.npc.ModNPC(); return prov.hasBeenGivenFullPower; - }, ModContent.ItemType(), 1, 30, 40); + }, ModContent.ItemType(), 1, 75, 90); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -2075,8 +2075,8 @@ namespace CalamityMod.NPCs.Providence normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials - normalOnly.Add(ModContent.ItemType(), 1, 25, 30); - normalOnly.Add(ModContent.ItemType(), 1, 20, 30); + normalOnly.Add(ModContent.ItemType(), 1, 50, 60); + normalOnly.Add(ModContent.ItemType(), 1, 30, 40); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -2960,7 +2960,7 @@ namespace CalamityMod.NPCs.Providence Target.statLife -= NegativeHealValue; if (Target.statLife < 0) { - PlayerDeathReason CustomSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Target.name)); + PlayerDeathReason CustomSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").ToNetworkText(Target.name)); Target.KillMe(CustomSource, NegativeHealValue, 0); } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index d891497c47..720ecc8c7e 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerClawLeft : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 731b46802d..01abdb3fb5 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerClawRight : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index e181a9e65d..ecdcb25659 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerHead : ModNPC { public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 14e5723fe7..6c55b7750e 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerLegLeft : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index b3be683e4a..41f8232445 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerLegRight : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 344b2dbdec..b5e58a6487 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.Signus NPC.width = 130; NPC.height = 130; NPC.defense = 60; - NPC.LifeMaxNERB(300000, 360000, 320000); + NPC.LifeMaxNERB(320000, 375000, 380000); NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.knockBackResist = 0f; NPC.aiStyle = -1; @@ -951,7 +951,7 @@ namespace CalamityMod.NPCs.Signus normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 535de4f3b2..4e1e008508 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -97,7 +98,7 @@ namespace CalamityMod.NPCs.SlimeGod } } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Vitamins, 50); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Vitamins, 100, 50)); public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index d080f997f1..c4b73a5b34 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -5,6 +5,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -109,7 +110,7 @@ namespace CalamityMod.NPCs.SlimeGod } } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Blindfold, 50); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Blindfold, 100, 50)); public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 2f75e80e5b..1322a3b560 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -171,7 +172,7 @@ namespace CalamityMod.NPCs.SlimeGod 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 ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Blindfold, 100, 50)); public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index a91575514b..2f5ffefcc7 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -407,7 +407,6 @@ namespace CalamityMod.NPCs.SlimeGod case 2: NPC.ai[0] = 1f; break; - } if (NPC.ai[0] == 1f) diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 90e0b51f13..e3683fc811 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(StormWeaverHead))] public class StormWeaverBody : ModNPC { diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 6132f87145..50195f7e5f 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -33,6 +33,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [HasPierceResist] [LongDistanceNetSync] public class StormWeaverHead : ModNPC { @@ -997,7 +998,7 @@ namespace CalamityMod.NPCs.StormWeaver normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 7)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 13bc6f7fc9..0d33b1f0a0 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(StormWeaverHead))] public class StormWeaverTail : ModNPC { diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 4c7bda3af5..3a06c588b5 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 25; NPC.width = 50; NPC.height = 36; diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 0f3fb7b17c..664d6123eb 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -525,9 +525,9 @@ namespace CalamityMod.NPCs.SunkenSea { // Spawn Amidias if he isn't in the world // This doesn't check for Desert Scourge because Giant Clam only spawns post-Desert Scourge - int amidiasNPC = NPC.FindFirstNPC(ModContent.NPCType()); + int amidiasNPC = NPC.FindFirstNPC(ModContent.NPCType()); if (amidiasNPC == -1 && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); // Mark Giant Clam as dead DownedBossSystem.downedCLAM = true; diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index adca018fa0..e571268cbe 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { + [HasPierceResist] public class BrimstoneHeart : ModNPC { public int ChainHeartIndex => (int)NPC.ai[0]; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 73e8d2c5f5..9b61f820d5 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -794,7 +794,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Make the town NPC spawn. if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); } NPC.active = false; @@ -3447,7 +3447,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Spawn the SCal NPC directly where the boss was if (!BossRushEvent.BossRushActive) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); // Mark Calamitas as defeated DownedBossSystem.downedCalamitas = true; diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/Archmage.cs similarity index 98% rename from NPCs/TownNPCs/DILF.cs rename to NPCs/TownNPCs/Archmage.cs index d95b687593..1be98d5a41 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/Archmage.cs @@ -25,7 +25,8 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class DILF : ModNPC + [LegacyName("DILF")] + public class Archmage : ModNPC { public override void SetStaticDefaults() { @@ -71,7 +72,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DILF") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Archmage") }); } diff --git a/NPCs/TownNPCs/DILF.png b/NPCs/TownNPCs/Archmage.png similarity index 100% rename from NPCs/TownNPCs/DILF.png rename to NPCs/TownNPCs/Archmage.png diff --git a/NPCs/TownNPCs/DILF_Head.png b/NPCs/TownNPCs/Archmage_Head.png similarity index 100% rename from NPCs/TownNPCs/DILF_Head.png rename to NPCs/TownNPCs/Archmage_Head.png diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/Bandit.cs similarity index 98% rename from NPCs/TownNPCs/THIEF.cs rename to NPCs/TownNPCs/Bandit.cs index 575123f552..b102150c3c 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -24,7 +24,8 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class THIEF : ModNPC + [LegacyName("THIEF")] + public class Bandit : ModNPC { public static Asset AltTexture; @@ -76,7 +77,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.THIEF") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bandit") }); } @@ -156,12 +157,12 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Night2")); } - int witch = NPC.FindFirstNPC(ModContent.NPCType()); + int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); //please help me I'm stuck in a children's video game - Fabsol - int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); + int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrusIndex != -1) dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrusIndex].GivenName)); diff --git a/NPCs/TownNPCs/THIEF.png b/NPCs/TownNPCs/Bandit.png similarity index 100% rename from NPCs/TownNPCs/THIEF.png rename to NPCs/TownNPCs/Bandit.png diff --git a/NPCs/TownNPCs/THIEFAlt.png b/NPCs/TownNPCs/BanditAlt.png similarity index 100% rename from NPCs/TownNPCs/THIEFAlt.png rename to NPCs/TownNPCs/BanditAlt.png diff --git a/NPCs/TownNPCs/THIEF_Head.png b/NPCs/TownNPCs/Bandit_Head.png similarity index 100% rename from NPCs/TownNPCs/THIEF_Head.png rename to NPCs/TownNPCs/Bandit_Head.png diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/BrimstoneWitch.cs similarity index 99% rename from NPCs/TownNPCs/WITCH.cs rename to NPCs/TownNPCs/BrimstoneWitch.cs index bf23526d8f..29717bcce1 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/BrimstoneWitch.cs @@ -22,7 +22,8 @@ using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class WITCH : ModNPC + [LegacyName("WITCH")] + public class BrimstoneWitch : ModNPC { public override void SetStaticDefaults() { @@ -71,7 +72,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WITCH") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BrimstoneWitch") }); } @@ -672,11 +673,11 @@ namespace CalamityMod.NPCs.TownNPCs } } - int fab = NPC.FindFirstNPC(NPCType()); - if (fab != -1 && ChildSafety.Disabled) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[fab].GivenName), 1.45); + int cirrus = NPC.FindFirstNPC(NPCType()); + if (cirrus != -1 && ChildSafety.Disabled) + dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName), 1.45); - if (NPC.AnyNPCs(NPCType())) + if (NPC.AnyNPCs(NPCType())) dialogue.Add(this.GetLocalizedValue("Chat.SeaKing"), 1.45); if (BirthdayParty.PartyIsUp) diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/BrimstoneWitch.png similarity index 100% rename from NPCs/TownNPCs/WITCH.png rename to NPCs/TownNPCs/BrimstoneWitch.png diff --git a/NPCs/TownNPCs/WITCH_Head.png b/NPCs/TownNPCs/BrimstoneWitch_Head.png similarity index 100% rename from NPCs/TownNPCs/WITCH_Head.png rename to NPCs/TownNPCs/BrimstoneWitch_Head.png diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/Cirrus.cs similarity index 90% rename from NPCs/TownNPCs/FAP.cs rename to NPCs/TownNPCs/Cirrus.cs index 98715a768a..cc9e7b0623 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/Cirrus.cs @@ -28,9 +28,11 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class FAP : ModNPC + [LegacyName("FAP")] + public class Cirrus : ModNPC { public static Asset AltTexture; + public static Asset WorkoutTexture; public override void SetStaticDefaults() { @@ -42,6 +44,7 @@ namespace CalamityMod.NPCs.TownNPCs NPCID.Sets.AttackTime[Type] = 60; NPCID.Sets.AttackAverageChance[Type] = 15; NPCID.Sets.ShimmerTownTransform[Type] = false; + // Happiness is so fucking dogshit, I swear to christ. - Fabsol NPC.Happiness .SetBiomeAffection(AffectionLevel.Love) .SetBiomeAffection(AffectionLevel.Like) @@ -49,7 +52,7 @@ namespace CalamityMod.NPCs.TownNPCs .SetBiomeAffection(AffectionLevel.Hate) .SetNPCAffection(NPCID.Stylist, AffectionLevel.Love) .SetNPCAffection(NPCID.BestiaryGirl, AffectionLevel.Love) - .SetNPCAffection(NPCID.Truffle, AffectionLevel.Like) + .SetNPCAffection(NPCID.DyeTrader, AffectionLevel.Like) .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Like) .SetNPCAffection(NPCID.DD2Bartender, AffectionLevel.Dislike) .SetNPCAffection(NPCID.TaxCollector, AffectionLevel.Dislike) @@ -63,6 +66,7 @@ namespace CalamityMod.NPCs.TownNPCs if (!Main.dedServ) { AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + WorkoutTexture = ModContent.Request(Texture + "_Workout", AssetRequestMode.AsyncLoad); } } @@ -87,12 +91,19 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.FAP") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cirrus") }); } public override void FindFrame(int frameHeight) { + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + bool workoutOutfit = Main.dayTime && beLessDrunk; + if (workoutOutfit) + frameHeight = 50; + int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); if (NPC.velocity.Y == 0f) { @@ -650,6 +661,17 @@ namespace CalamityMod.NPCs.TownNPCs CalamityWorld.spawnedCirrus = true; } + // I'm not sure what to do here, because she's always called Cirrus. - Fabsol + /*public override void ModifyTypeName(ref string typeName) + { + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + + if (beLessDrunk) + typeName = "Cirrus"; + }*/ + public override bool CanTownNPCSpawn(int numTownNPCs) { if (NPC.AnyNPCs(ModContent.NPCType()) && Main.zenithWorld) @@ -676,12 +698,19 @@ namespace CalamityMod.NPCs.TownNPCs Player player = Main.LocalPlayer; if (Main.zenithWorld) { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).Format(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); + player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); } + bool worldIsSafer = NPC.downedMoonlord; + if (CalamityUtils.AnyBossNPCS()) - return this.GetLocalizedValue("Chat.BossAlive"); + { + if (!worldIsSafer) + return this.GetLocalizedValue("Chat.BossAlive"); + else + return this.GetLocalizedValue("Chat.BossAliveAlt"); + } if (NPC.homeless) return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); @@ -690,8 +719,8 @@ namespace CalamityMod.NPCs.TownNPCs bool isHappy = Main.ShopHelper.GetShoppingSettings(player, NPC).PriceAdjustment < 1D; bool wifeIsAround = wife != -1; bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; - bool worldIsSafer = NPC.downedMoonlord; bool beLessDrunk = wifeIsAround && worldIsSafer; + bool workoutOutfit = Main.dayTime && beLessDrunk; if (Main.bloodMoon) { @@ -699,7 +728,7 @@ namespace CalamityMod.NPCs.TownNPCs { if (!beLessDrunk) { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).Format(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); ; + player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); ; SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); return this.GetLocalizedValue("Chat.BloodMoonSlap1"); } @@ -715,7 +744,9 @@ namespace CalamityMod.NPCs.TownNPCs { dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); + + if (Main.zenithWorld) + dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); if (ChildSafety.Disabled) dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); @@ -728,6 +759,9 @@ namespace CalamityMod.NPCs.TownNPCs if (ChildSafety.Disabled) dialogue.Add(this.GetLocalization("Chat.Normal4Alt").Format(Main.npc[wife].GivenName)); + + if (workoutOutfit) + dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); } int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); @@ -740,11 +774,11 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Tavernkeep3")); } - int permadong = NPC.FindFirstNPC(ModContent.NPCType()); + int permadong = NPC.FindFirstNPC(ModContent.NPCType()); if (permadong != -1) dialogue.Add(this.GetLocalization("Chat.Archmage").Format(Main.npc[permadong].GivenName)); - int witch = NPC.FindFirstNPC(ModContent.NPCType()); + int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); @@ -812,54 +846,85 @@ namespace CalamityMod.NPCs.TownNPCs else { dialogue.Add(this.GetLocalizedValue("Chat.Night1")); - dialogue.Add(this.GetLocalizedValue("Chat.Night2")); - dialogue.Add(this.GetLocalizedValue("Chat.Night3")); + + if (!isHappy) + { + if (Main.zenithWorld) + dialogue.Add(this.GetLocalizedValue("Chat.Night2")); + + dialogue.Add(this.GetLocalizedValue("Chat.Night3")); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Night2Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Night3Alt")); + } + dialogue.Add(this.GetLocalizedValue("Chat.Night4")); - dialogue.Add(this.GetLocalizedValue("Chat.Night5")); if (wifeIsAround) dialogue.Add(this.GetLocalization("Chat.NightStylist").Format(Main.npc[wife].GivenName)); } + // She needs to be drunk to enjoy festive events, otherwise, she dislikes them. - Fabsol if (BirthdayParty.PartyIsUp) - dialogue.Add(this.GetLocalizedValue("Chat.Party")); + { + if (!beLessDrunk) + dialogue.Add(this.GetLocalizedValue("Chat.Party")); + else + dialogue.Add(this.GetLocalizedValue("Chat.PartyAlt")); + } + // She loves her hair and freaks out if it's threatened. Also a reference to the wicked witch of the west. - Fabsol if (AcidRainEvent.AcidRainEventIsOngoing) dialogue.Add(this.GetLocalizedValue("Chat.AcidRain")); + // ayy lmao meme reference (this isn't 4th-wall breaking enough to be put in GFB-only imo). - Fabsol if (Main.invasionType == InvasionID.MartianMadness) dialogue.Add(this.GetLocalizedValue("Chat.Martians")); + // Reference to insane thoughts I had years ago. - Fabsol if (DownedBossSystem.downedCryogen && ChildSafety.Disabled) dialogue.Add(this.GetLocalizedValue("Chat.CryogenDefeated")); + // Reference to the old Leviathan sprite. - Fabsol if (DownedBossSystem.downedLeviathan) dialogue.Add(this.GetLocalizedValue("Chat.LeviathanDefeated")); - if (NPC.downedMoonlord) + // Risque tentacle implication... - Fabsol + if (NPC.downedMoonlord && ChildSafety.Disabled) dialogue.Add(this.GetLocalizedValue("Chat.MoonLordDefeated")); + // Reference to some crazy shit I thought up at one point. - Fabsol if (DownedBossSystem.downedPolterghast) dialogue.Add(this.GetLocalizedValue("Chat.PolterghastDefeated")); - if (DownedBossSystem.downedDoG) + // MGS2 meme line. - Fabsol + if (DownedBossSystem.downedDoG && Main.zenithWorld) dialogue.Add(this.GetLocalizedValue("Chat.DoGDefeated")); + // Cirrus doesn't like the creature. - Fabsol if (player.Calamity().chibii) - dialogue.Add(this.GetLocalizedValue("Chat.HasChibii")); + { + if (!isHappy) + dialogue.Add(this.GetLocalizedValue("Chat.HasChibii")); + else + dialogue.Add(this.GetLocalizedValue("Chat.HasChibiiAlt")); + } - if (player.Calamity().aquaticHeart && !player.Calamity().aquaticHeartHide && ChildSafety.Disabled) + // She likes fish people (including Amidias, but she has no comments for him yet). - Fabsol + if (player.Calamity().aquaticHeart && !player.Calamity().aquaticHeartHide && ChildSafety.Disabled && isHappy) dialogue.Add(this.GetLocalizedValue("Chat.HasAnahitaTrans")); if (player.Calamity().cirrusVodka) dialogue.Add(this.GetLocalizedValue("Chat.HasVodka")); - if (player.HasItem(ModContent.ItemType())) + // These are all a bit too risque for children to be seeing lol - Fabsol + if (player.HasItem(ModContent.ItemType()) && ChildSafety.Disabled) { dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn1")); dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn2")); - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn3")); + dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn3")); } return dialogue; @@ -870,8 +935,17 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.LocalPlayer.Calamity().trippy) return false; + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; + bool workoutOutfit = Main.dayTime && beLessDrunk; var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + + Rectangle frame = NPC.frame; + if (workoutOutfit && !BirthdayParty.PartyIsUp) + frame = new Rectangle(0, NPC.frame.Y, WorkoutTexture.Width(), WorkoutTexture.Height() / Main.npcFrameCount[Type]); + + spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : workoutOutfit ? WorkoutTexture.Value : TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, workoutOutfit ? 3f : 6f), frame, drawColor, NPC.rotation, frame.Size() / 2, NPC.scale, something, 0); return false; } diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/Cirrus.png similarity index 100% rename from NPCs/TownNPCs/FAP.png rename to NPCs/TownNPCs/Cirrus.png diff --git a/NPCs/TownNPCs/FAPAlt.png b/NPCs/TownNPCs/CirrusAlt.png similarity index 100% rename from NPCs/TownNPCs/FAPAlt.png rename to NPCs/TownNPCs/CirrusAlt.png diff --git a/NPCs/TownNPCs/FAPShimmered_Head.png b/NPCs/TownNPCs/CirrusShimmered_Head.png similarity index 100% rename from NPCs/TownNPCs/FAPShimmered_Head.png rename to NPCs/TownNPCs/CirrusShimmered_Head.png diff --git a/NPCs/TownNPCs/FAP_Head.png b/NPCs/TownNPCs/Cirrus_Head.png similarity index 100% rename from NPCs/TownNPCs/FAP_Head.png rename to NPCs/TownNPCs/Cirrus_Head.png diff --git a/NPCs/TownNPCs/Cirrus_Head_Alt.png b/NPCs/TownNPCs/Cirrus_Head_Alt.png new file mode 100644 index 0000000000..ceb019d692 Binary files /dev/null and b/NPCs/TownNPCs/Cirrus_Head_Alt.png differ diff --git a/NPCs/TownNPCs/FAP_Shimmered.png b/NPCs/TownNPCs/Cirrus_Shimmered.png similarity index 100% rename from NPCs/TownNPCs/FAP_Shimmered.png rename to NPCs/TownNPCs/Cirrus_Shimmered.png diff --git a/NPCs/TownNPCs/Cirrus_Workout.png b/NPCs/TownNPCs/Cirrus_Workout.png new file mode 100644 index 0000000000..f657fe0c7c Binary files /dev/null and b/NPCs/TownNPCs/Cirrus_Workout.png differ diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SeaKing.cs similarity index 97% rename from NPCs/TownNPCs/SEAHOE.cs rename to NPCs/TownNPCs/SeaKing.cs index de394643ba..9e2c6cd3e8 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SeaKing.cs @@ -20,7 +20,8 @@ using Terraria.Utilities; namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] - public class SEAHOE : ModNPC + [LegacyName("SEAHOE")] + public class SeaKing : ModNPC { public override void SetStaticDefaults() { @@ -67,7 +68,7 @@ namespace CalamityMod.NPCs.TownNPCs bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SEAHOE") + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaKing") }); } @@ -109,11 +110,11 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalization("Chat.Angler2").Format(Main.npc[lilBitch].GivenName)); } - int witch = NPC.FindFirstNPC(ModContent.NPCType()); + int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalizedValue("Chat.BrimstoneWitch")); - int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); + int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); if (cirrus != -1) dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName)); diff --git a/NPCs/TownNPCs/SEAHOE.png b/NPCs/TownNPCs/SeaKing.png similarity index 100% rename from NPCs/TownNPCs/SEAHOE.png rename to NPCs/TownNPCs/SeaKing.png diff --git a/NPCs/TownNPCs/SEAHOE_Head.png b/NPCs/TownNPCs/SeaKing_Head.png similarity index 100% rename from NPCs/TownNPCs/SEAHOE_Head.png rename to NPCs/TownNPCs/SeaKing_Head.png diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index f239af92eb..e458db81c1 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.crimsonBoss = npc.whoAmI; bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -43,7 +42,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.CrimstoneUnsafe) enrage = false; - float enrageScale = bossRush ? 1.5f : masterMode ? 0.5f : 0f; + float enrageScale = bossRush ? 1.5f : death ? 0.5f : 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -153,19 +152,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool phase7 = lifeRatio < 0.1f; // Spawn Creepers in Master Mode - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && masterMode && phase3) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && death && phase3) { npc.localAI[0] = 2f; SpawnMasterModeCreepers(); } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && masterMode && phase5) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && death && phase5) { npc.localAI[0] = 3f; SpawnMasterModeCreepers(); } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && masterMode && phase7) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && death && phase7) { npc.localAI[0] = 4f; SpawnMasterModeCreepers(); @@ -237,20 +236,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float velocityScale = death ? 6f : 4.5f; float velocityBoost = velocityScale * (1f - lifeRatio); - float nonChargeSpeed = (masterMode ? 24f : 18f) + velocityBoost + 3f * enrageScale; + float nonChargeSpeed = (death ? 24f : 18f) + velocityBoost + 3f * enrageScale; if (Main.getGoodWorld) nonChargeSpeed *= 1.15f; - float minInertia = death ? 60f : 75f; - float maxInertia = death ? 80f : 100f; - if (masterMode) - { - minInertia -= 10f; - maxInertia -= 10f; - } + float minInertia = death ? 50f : 75f; + float maxInertia = death ? 70f : 100f; float inertia = MathHelper.Lerp(minInertia, maxInertia, lifeRatio); - Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero); + Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY) * nonChargeSpeed; npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } @@ -296,7 +290,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); // Velocity - npc.velocity = (Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; + npc.velocity = (Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; if (Main.getGoodWorld) npc.velocity *= 1.15f; } @@ -340,7 +334,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] -= 1f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); - if (masterMode) + if (death) npc.velocity *= 1.5f; if (Main.getGoodWorld) npc.velocity *= 1.15f; @@ -430,23 +424,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodShot; int damage = npc.GetProjectileDamage(type); - int numProj = death ? 6 : 4; - int spread = death ? 22 : 15; + int numProj = death ? 9 : 4; + int spread = death ? 32 : 15; if (phase7) { - numProj = death ? 4 : 2; - spread = death ? 15 : 10; + numProj = death ? 7 : 2; + spread = death ? 25 : 10; } else if (phase5) { - numProj = death ? 5 : 3; - spread = death ? 30 : 20; - } - - if (masterMode) - { - numProj += 3; - spread += 10; + numProj = death ? 8 : 3; + spread = death ? 40 : 20; } float rotation = MathHelper.ToRadians(spread); @@ -469,28 +457,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodNautilusShot; int damage = npc.GetProjectileDamage(type); - int numProj = death ? 9 : 7; - int spread = death ? 45 : 40; + int numProj = death ? 13 : 7; + int spread = death ? 60 : 40; if (phase7) { - numProj = death ? 3 : 2; - spread = death ? 8 : 5; + numProj = death ? 7 : 2; + spread = death ? 23 : 5; } else if (phase5) { - numProj = death ? 4 : 2; - spread = death ? 15 : 10; + numProj = death ? 8 : 2; + spread = death ? 30 : 10; } else if (phase4) { - numProj = death ? 5 : 3; - spread = death ? 15 : 10; - } - - if (masterMode) - { - numProj += 4; - spread += 15; + numProj = death ? 9 : 3; + spread = death ? 30 : 10; } float rotation = MathHelper.ToRadians(spread); @@ -535,7 +517,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); + int maxRandomTime = phase7 ? (death ? 10 : 30) : (death ? 20 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; npc.localAI[1] = 0f; npc.alpha = 0; @@ -687,7 +669,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? (masterMode ? 10 : 30) : (masterMode ? 20 : 60); + int maxRandomTime = phase7 ? (death ? 10 : 30) : (death ? 20 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; } else @@ -744,7 +726,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); - float maxMoveVelocity = (death ? (masterMode ? 4f : 2f) : (masterMode ? 3f : 1.5f)) + velocityScale; + float maxMoveVelocity = (death ? 4f : 1.5f) + velocityScale; if (Main.getGoodWorld) maxMoveVelocity *= 2f; @@ -769,7 +751,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!despawn) npc.localAI[1] += (death ? 2f : 1f) + velocityScale; - if (npc.localAI[1] >= (masterMode ? 540f : 360f)) + if (npc.localAI[1] >= (death ? 540f : 360f)) { // Teleport location npc.localAI[1] = 0f; @@ -877,7 +859,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -885,7 +866,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, default); float enrageScaleMax = 2f; - float enrageScale = bossRush ? enrageScaleMax : masterMode ? 0.5f : 0f; + float enrageScale = bossRush ? enrageScaleMax : death ? 0.5f : 0f; if ((npc.position.Y / 16f) < Main.worldSurface) enrageScale += 0.5f; if (!Main.player[npc.target].ZoneCrimson) @@ -903,7 +884,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); float creeperRatio = 1f; - if (masterMode && brainIsInPhase2) + if (death && brainIsInPhase2) { bool brainIsInPhase3 = Main.npc[NPC.crimsonBoss].localAI[0] == 2f; bool brainIsInPhase5 = Main.npc[NPC.crimsonBoss].localAI[0] == 3f; @@ -948,7 +929,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); - float velocity = (death ? (masterMode ? 16f : 12f) : (masterMode ? 12f : 8f)) + chargeAggressionScale; + float velocity = (death ? 16f : 8f) + chargeAggressionScale; velocity += 2f * enrageScale; if (brainIsInPhase2) { @@ -1004,7 +985,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Always fully visible while charging npc.alpha = 0; - float chargeVelocity = (death ? (masterMode ? 12f : 9f) : (masterMode ? 9f : 6f)) + chargeAggressionScale; + float chargeVelocity = (death ? 12f : 6f) + chargeAggressionScale; chargeVelocity += 2f * enrageScale; float returnToBrainGateValue = 1f; if (!brainIsInPhase2) @@ -1012,7 +993,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - Vector2 destination = Main.player[npc.target].Center + (masterMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero); + Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f : Vector2.Zero); Vector2 targetDirection = destination - npc.Center; targetDirection = targetDirection.SafeNormalize(Vector2.UnitY); if (Main.getGoodWorld) @@ -1023,12 +1004,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { targetDirection *= chargeVelocity; - float inertia = masterMode ? 75f : 100f; + float inertia = death ? 75f : 100f; npc.velocity = (npc.velocity * (inertia - 1f) + targetDirection) / inertia; } // Return to Brain after a set time - float chargeDistance = masterMode ? 900f : 600f; + float chargeDistance = death ? 900f : 600f; returnToBrainGateValue = chargeDistance / chargeVelocity; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index f37fe91619..2e195a2c06 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -36,15 +36,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.85f || masterMode; - bool phase3 = lifeRatio < 0.7f || masterMode; - bool phase4 = lifeRatio < (masterMode ? 0.8f : 0.55f); - bool phase5 = lifeRatio < (masterMode ? 0.6f : 0.4f); - bool phase6 = lifeRatio < (masterMode ? 0.4f : 0.25f); - bool phase7 = masterMode && lifeRatio < 0.2f; - bool phase8 = masterMode && lifeRatio < 0.1f; + bool phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.7f || death; + bool phase4 = lifeRatio < (death ? 0.8f : 0.55f); + bool phase5 = lifeRatio < (death ? 0.6f : 0.4f); + bool phase6 = lifeRatio < (death ? 0.4f : 0.25f); + bool phase7 = death && lifeRatio < 0.2f; + bool phase8 = death && lifeRatio < 0.1f; // Variables bool isCultist = npc.type == NPCID.CultistBoss; @@ -52,7 +51,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float predictionDistance = 480f; float distanceAboveTarget = -240f; - float moveSpeed = masterMode ? (death ? 300f : 150f) : (death ? 100f : 75f); + float moveSpeed = death ? 300f : 75f; int iceMistDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossIceMist) : 0; int fireballDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossFireBall) : npc.GetProjectileDamage(ProjectileID.CultistBossFireBallClone); @@ -61,9 +60,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int iceMistFireRate = phase2 ? 50 : 60; float iceMistSpeed = (phase6 ? 12f : 10f) + (death ? (1f - lifeRatio) : 0f); int iceMistAmt = phase3 ? 2 : 1; - int fireballFireRate = (phase5 ? 10 : 12) - (masterMode ? 6 : 0); + int fireballFireRate = (phase5 ? 10 : 12) - (death ? 6 : 0); float fireballSpeed = ((phase7 ? 8f : phase6 ? 7f : 6f) + (death ? (1f - lifeRatio) : 0f)) * (isCultist ? 1f : 0.5f); - int fireballAmt = masterMode ? 20 : 4; + int fireballAmt = death ? 20 : 4; int lightningOrbPhaseTime = phase2 ? 90 : 120; int ancientLightSpawnRate = phase7 ? 20 : phase4 ? 25 : 30; int ancientLightAmt = phase7 ? 4 : phase4 ? 3 : 2; @@ -607,8 +606,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + (masterMode ? 210f : -100f), 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); - if (masterMode) + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + (death ? 210f : -100f), 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); + if (death) { Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + 210f, npc.Center.Y - 210f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - 210f, npc.Center.Y - 210f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); @@ -1103,12 +1102,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedAncientDoomAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; npc.damage = npc.defDamage = 0; float duration = 420f; float spawnAnimTime = 120f; - int rateOfChange = masterMode ? 2 : 1; + int rateOfChange = death ? 2 : 1; float splitProjVelocity = death ? 4.5f : 3f; // Percent life remaining for Cultist or Eidolon Wyrm @@ -1212,7 +1210,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : masterMode ? 5 : 4; + int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : death ? 5 : 4; float radians = MathHelper.TwoPi / totalProjectiles; Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); for (int k = 0; k < totalProjectiles; k++) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index f89cc0576c..e981b3ac3c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Projectile types and damage @@ -267,8 +266,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (float)scoopRubbleGateValue) { Point sourceTileCoords = npc.Top.ToTileCoordinates(); - int numRubble = death ? (masterMode ? 60 : 40) : (masterMode ? 32 : 20); - int distancedByThisManyTiles = death ? (masterMode ? 3 : 4) : (masterMode ? 4 : 5); + int numRubble = death ? 60 : 20; + int distancedByThisManyTiles = death ? 3 : 5; sourceTileCoords.X += npc.direction * 3; sourceTileCoords.Y -= 10; int screenShakeGateValue = (int)npc.ai[1] - scoopRubbleGateValue; @@ -315,11 +314,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = (masterMode ? 7 : 5) + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); + int totalProjectiles = (death ? 7 : 5) + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); float velocityMultIncrement = ((totalProjectiles + 1) / (float)totalProjectiles) - 1f; - float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, masterMode ? 270f : 180f, 1f - lifeRatio)); + float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, death ? 270f : 180f, 1f - lifeRatio)); float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; - float velocity = (masterMode ? 9f : 7f) + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); + float velocity = (death ? 9f : 7f) + MathHelper.Lerp(0f, 3.5f, 1f - lifeRatio); Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { @@ -376,7 +375,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int handAmount = (int)MathHelper.Lerp(masterMode ? 5f : 3f, masterMode ? 12f : 10f, 1f - lifeRatio); + int handAmount = (int)MathHelper.Lerp(death ? 5f : 3f, death ? 12f : 10f, 1f - lifeRatio); for (int i = 0; i < handAmount; i++) { RandomizeInsanityShadowFor(Main.player[npc.target], death, isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 60cacab362..2d1b34725c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -68,7 +68,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < DRIncreaseTime; @@ -77,8 +76,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on life percentage - bool phase2 = lifeRatio < 0.85f || masterMode; - bool phase3 = lifeRatio < 0.7f || masterMode; + bool phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.7f || death; bool startFlightPhase = lifeRatio < 0.5f; bool phase4 = lifeRatio < (death ? 0.4f : 0.25f); bool phase5 = lifeRatio < (death ? 0.2f : 0.1f); @@ -182,7 +181,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - if (masterMode && !bossRush && npc.localAI[3] == 1f) + if (death && !bossRush && npc.localAI[3] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -215,14 +214,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool spitLaserSpreads = death; // Height of the box used to calculate whether The Destroyer should fly at its target or not - int noFlyZoneBoxHeight = masterMode ? 1500 : 1800; + int noFlyZoneBoxHeight = death ? 1500 : 1800; // Speed and movement variables - float speed = masterMode ? 0.2f : 0.1f; - float turnSpeed = masterMode ? 0.3f : 0.15f; + float speed = death ? 0.2f : 0.1f; + float turnSpeed = death ? 0.3f : 0.15f; // Max velocity - float segmentVelocity = flyAtTarget ? (masterMode ? 22.5f : 15f) : (masterMode ? 30f : 20f); + float segmentVelocity = flyAtTarget ? (death ? 22.5f : 15f) : (death ? 30f : 20f); // Increase velocity based on distance float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; @@ -290,7 +289,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Regenerate Probes in Master Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) // This doesn't happen if Oblivion is alive - if (masterMode && probeLaunched && !oblivionAlive) + if (death && probeLaunched && !oblivionAlive) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 600f) @@ -410,8 +409,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (masterMode ? 9 : 7) : (masterMode ? 6 : 4); - int spread = masterMode ? 38 : 26; + int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (death ? 9 : 7) : (death ? 6 : 4); + int spread = death ? 38 : 26; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { @@ -442,7 +441,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set laser color and type if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched) { - if (Main.rand.NextBool(masterMode ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) + if (Main.rand.NextBool(death ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) { int random = phase3 ? 4 : phase2 ? 3 : 2; switch (Main.rand.Next(random)) @@ -473,8 +472,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Laser rate of fire - float shootProjectileTime = death ? (masterMode ? (phase5 ? 120f : phase4 ? 150f : 180f) : 270f) : (masterMode ? (phase5 ? 150f : phase4 ? 210f : 270f) : 450f); - float bodySegmentTime = npc.ai[0] * (masterMode ? 20f : 30f); + float shootProjectileTime = death ? (phase5 ? 120f : phase4 ? 150f : 180f) : 450f; + float bodySegmentTime = npc.ai[0] * (death ? 20f : 30f); float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; float laserTimerIncrement = (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; if (ableToFireLaser) @@ -528,7 +527,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shoot nothing if probe has been launched if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue && ableToFireLaser) { - if (!masterMode) + if (!death) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -545,7 +544,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - if (masterMode) + if (death) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -561,7 +560,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Laser speed - float projectileSpeed = (masterMode ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; + float projectileSpeed = (death ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; projectileSpeed += enrageScale; // Set projectile damage and type @@ -607,14 +606,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; - if (masterMode) + if (death) { calamityGlobalNPC.destroyerLaserColor = -1; npc.SyncDestroyerLaserColor(); } } - if (!masterMode) + if (!death) { calamityGlobalNPC.destroyerLaserColor = -1; npc.SyncDestroyerLaserColor(); @@ -846,7 +845,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!shouldFly) { npc.velocity.Y += 0.15f; - if (masterMode && npc.velocity.Y > 0f && Math.Abs(npc.Center.Y - player.Center.Y) > 360f) + if (death && npc.velocity.Y > 0f && Math.Abs(npc.Center.Y - player.Center.Y) > 360f) npc.velocity.Y += 0.05f; if (npc.velocity.Y > segmentVelocity) @@ -1037,7 +1036,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Force the fucker to turn around in ground phase in Master // Turns slower if Oblivion is alive, for fairness - if (npc.type == NPCID.TheDestroyer && masterMode && !flyAtTarget) + if (npc.type == NPCID.TheDestroyer && death && !flyAtTarget) { if (npc.Distance(player.Center) > 2000f) npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? speed : turnSpeed); @@ -1742,7 +1741,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedProbeAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; bool oblivionAlive = npc.ai[1] == 1f; // Get a target @@ -1754,8 +1753,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; - float velocity = bossRush ? 12f : masterMode ? 8.4f : 7.2f; - float acceleration = bossRush ? 0.1f : masterMode ? 0.07f : 0.06f; + float velocity = bossRush ? 12f : death ? 8.4f : 7.2f; + float acceleration = bossRush ? 0.1f : death ? 0.07f : 0.06f; float deceleration = 1f - acceleration; if (targetDead) @@ -1785,7 +1784,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < Main.maxNPCs; i++) { - if (masterMode && !bossRush && npc.ai[1] == 0f) + if (death && !bossRush && npc.ai[1] == 0f) { if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) npc.ai[1] = 1f; @@ -1860,7 +1859,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.dontTakeDamage = false; npc.localAI[0] += 1f; - if ((npc.justHit && !masterMode) || targetDead) + if ((npc.justHit && !death) || targetDead) npc.localAI[0] = 0f; float laserGateValue = NPC.IsMechQueenUp ? ProbeLaserGateValue_Mechdusa : bossRush ? ProbeLaserGateValue_BossRush : ProbeLaserGateValue_Rev; @@ -1883,7 +1882,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - int totalProjectiles = oblivionAlive ? 2 : (CalamityWorld.death || bossRush) ? 3 : 1; + int totalProjectiles = oblivionAlive ? 2 : death ? 3 : 1; Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 35155e34b6..744526387f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -20,12 +20,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Variables bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; - bool masterModeSurprise = lifeRatio >= 0.9f && masterMode; - bool phase2 = lifeRatio < (masterMode ? 0.6f : 0.7f); - bool phase3 = lifeRatio < (masterMode ? 0.3f : 0.4f); - bool phase4 = lifeRatio < (masterMode ? 0.1f : 0.2f); + bool masterModeSurprise = lifeRatio >= 0.9f && death; + bool phase2 = lifeRatio < (death ? 0.6f : 0.7f); + bool phase3 = lifeRatio < (death ? 0.3f : 0.4f); + bool phase4 = lifeRatio < (death ? 0.1f : 0.2f); bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -180,7 +179,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (masterMode) + if (death) { idlePhaseTimer -= 6; idlePhaseAcceleration *= 1.2f; @@ -202,7 +201,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[0] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || death) ? 1 : 0); npc.netUpdate = true; } @@ -426,7 +425,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; if (enrage) npc.ai[2] = sharknadoPhaseTimer - 40; - else if (masterMode) + else if (death) npc.ai[2] = sharknadoPhaseTimer - 60; } @@ -805,7 +804,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || death) ? 1 : 0); npc.ai[2] += 1f; if (npc.ai[2] >= sharknadoPhaseTimer) @@ -1024,7 +1023,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Spawn bubbles during charge in Master Mode (these bubbles have special behavior that makes them float upward, doing no damage, before returning to their normal behavior) - if (masterMode && phase4) + if (death && phase4) { if (npc.ai[2] % (bubbleBelchPhaseDivisor * 2) == 0f) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index 0a14411d83..8794a125ec 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -13,6 +13,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class EaterOfWorldsAI { + private const float ProjectileTelegraphDuration = 30f; private const int TotalMasterModeWorms = 4; public const float DRIncreaseTime = 600f; @@ -21,7 +22,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Causes it to split far more in death mode @@ -70,17 +70,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases // Cursed Flame phase - bool phase2 = lifeRatio < 0.8f || masterMode; + bool phase2 = lifeRatio < 0.8f || death; // Boost velocity by 20% phase - bool phase3 = lifeRatio < 0.4f || masterMode; + bool phase3 = lifeRatio < 0.4f || death; // Boost velocity by 50% phase - bool phase4 = lifeRatio < (masterMode ? 0.5f : 0.2f); + bool phase4 = lifeRatio < (death ? 0.5f : 0.2f); // Go fucking crazy in Master Mode - bool phase5 = lifeRatio < 0.1f && masterMode; - bool phase6 = lifeRatio < 0.05f && masterMode; + bool phase5 = lifeRatio < 0.1f && death; + bool phase6 = lifeRatio < 0.05f && death; // Fire projectiles if (Main.netMode != NetmodeID.MultiplayerClient) @@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.localAI[1] -= 1f; - int vileSpitGateValue = (int)MathHelper.Lerp(masterMode ? 45f : 90f, 900f, lifeRatio); + int vileSpitGateValue = (int)MathHelper.Lerp(death ? 45f : 90f, 900f, lifeRatio); if (Main.getGoodWorld) vileSpitGateValue = (int)(vileSpitGateValue * 0.5f); @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 0f; } - if (npc.localAI[1] > vileSpitGateValue - 30f) + if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) { Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); @@ -122,18 +122,29 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (phase2) { - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - calamityGlobalNPC.newAI[0] += ((npc.justHit && masterMode && calamityGlobalNPC.newAI[0] < 30f) ? 10f : 1f); - else - calamityGlobalNPC.newAI[0] -= 1f; - - float timer = enrageScale > 0f ? 60f : 90f; - float shootBoost = lifeRatio * 60f; + float timer = enrageScale > 0f ? 90f : 120f; + float shootBoost = lifeRatio * 90f; timer += shootBoost; if (enrageScale >= 2f) timer = 60f; + float showTelegraphGateValue = timer - ProjectileTelegraphDuration; + + if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + if (npc.justHit && death && calamityGlobalNPC.newAI[0] < showTelegraphGateValue) + { + calamityGlobalNPC.newAI[0] += 10f; + if (calamityGlobalNPC.newAI[0] > showTelegraphGateValue) + calamityGlobalNPC.newAI[0] = showTelegraphGateValue; + } + else + calamityGlobalNPC.newAI[0] += 1f; + } + else + calamityGlobalNPC.newAI[0] -= 1f; + if (calamityGlobalNPC.newAI[0] >= timer) { if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && @@ -158,7 +169,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (calamityGlobalNPC.newAI[0] > timer - 30f) + if (calamityGlobalNPC.newAI[0] > showTelegraphGateValue) { Vector2 dustCenter = npc.Center + Main.rand.NextVector2CircularEdge(10f, 10f); int dustType = (death && phase3) ? DustID.Shadowflame : DustID.CursedTorch; @@ -190,10 +201,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.type == NPCID.EaterofWorldsHead) { // Amount of segments to spawn. - int segmentSpawnAmount = (int)(masterMode ? (totalSegments / TotalMasterModeWorms) : totalSegments); + int segmentSpawnAmount = (int)(death ? (totalSegments / TotalMasterModeWorms) : totalSegments); // Spawn additional worms of reduced length in Master Mode. - if (masterMode) + if (death) { Vector2 additionalWormSpawnLocation = new Vector2(spawnX, spawnY); int randomXLimit = 80; @@ -345,12 +356,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!inTiles && npc.type == NPCID.EaterofWorldsHead) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = death ? 800 : 900; + int noFlyZone = death ? (800 - (phase5 ? 400 : 200)) : 900; noFlyZone -= (int)(enrageScale * 200f); - - if (masterMode) - noFlyZone -= phase5 ? 400 : 200; - if (noFlyZone < 100) noFlyZone = 100; @@ -382,26 +389,26 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase6) { - segmentVelocity += (death ? 2.4f : 4f) * (enrageScale + 1f); - segmentAcceleration += 0.2f * (enrageScale + 1f); + segmentVelocity += 2.4f * (enrageScale + 1f); + segmentAcceleration += 0.12f * (enrageScale + 1f); } else if (phase5) { - segmentVelocity += (death ? 2.2f : 3f) * (enrageScale + 1f); - segmentAcceleration += 0.15f * (enrageScale + 1f); + segmentVelocity += 1.8f * (enrageScale + 1f); + segmentAcceleration += 0.09f * (enrageScale + 1f); } else if (phase4) { - segmentVelocity += 2f * (enrageScale + 1f); - segmentAcceleration += 0.1f * (enrageScale + 1f); + segmentVelocity += 1.2f * (enrageScale + 1f); + segmentAcceleration += 0.06f * (enrageScale + 1f); } else if (phase3) { - segmentVelocity += 0.8f * (enrageScale + 1f); - segmentAcceleration += 0.04f * (enrageScale + 1f); + segmentVelocity += 0.6f * (enrageScale + 1f); + segmentAcceleration += 0.03f * (enrageScale + 1f); } - if (masterMode) + if (death) { segmentVelocity += (npc.justHit ? 8f : 2f); segmentAcceleration += (npc.justHit ? 0.16f : 0.04f); @@ -472,7 +479,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!inTiles) { npc.velocity.Y += death ? 0.1375f : 0.11f; - if (masterMode && npc.velocity.Y > 0f) + if (death && npc.velocity.Y > 0f) npc.velocity.Y += 0.07f; if (npc.velocity.Y > segmentVelocity) @@ -737,7 +744,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int dustIndex = 0; dustIndex < 2; dustIndex++) { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default(Color), 2f); + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; } @@ -796,7 +803,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 0f; } - if (npc.localAI[1] > vileSpitGateValue - 30f) + if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) { Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); @@ -826,7 +833,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 0f; } - if (npc.localAI[1] > vileSpitGateValue - 30f) + if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) { Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); @@ -1281,7 +1288,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int num80 = 0; num80 < 2; num80++) { - int num81 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default(Color), 2f); + int num81 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default, 2f); Main.dust[num81].noGravity = true; Main.dust[num81].noLight = true; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 38e7b92ae5..778d63ffa4 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -18,7 +18,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Difficulty bools. bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Rotation @@ -30,8 +29,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Percent life remaining. float lifeRatio = npc.life / (float)npc.lifeMax; - float phase2LifeRatio = masterMode ? 0.7f : 0.6f; - float phase3LifeRatio = masterMode ? 0.3f : 0.15f; + float phase2LifeRatio = death ? 0.7f : 0.6f; + float phase3LifeRatio = death ? 0.3f : 0.15f; bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); bool phase3 = lifeRatio <= phase3LifeRatio; @@ -450,7 +449,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? (masterMode ? 30f : 36f) : (masterMode ? 60f : 72f)) + 30f * lessTimeSpentPerPhaseMultiplier; + extraPhaseTime = (dayTimeEnrage ? (death ? 30f : 36f) : (death ? 60f : 72f)) + 30f * lessTimeSpentPerPhaseMultiplier; if (npc.ai[1] >= 60f + extraPhaseTime) { npc.ai[0] = 1f; @@ -494,7 +493,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float lanceGateValue = masterMode ? 75f : 100f; + float lanceGateValue = death ? 75f : 100f; if (npc.ai[1] >= 6f && npc.ai[1] < 54f) { @@ -514,7 +513,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < lanceAmount; i++) { int lanceFrequency = (int)(npc.ai[1] / (dayTimeEnrage ? 2f : 3f)); - lanceRotation += (masterMode ? 5 : 4) * i; + lanceRotation += (death ? 5 : 4) * i; Vector2 lanceDirection = Vector2.UnitX.RotatedBy((float)Math.PI / (lanceRotation * 2) + lanceFrequency * ((float)Math.PI / lanceRotation)); if (calamityGlobalNPC.newAI[3] == 0f) lanceDirection.X += (lanceDirection.X > 0f) ? 0.5f : -0.5f; @@ -651,7 +650,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase3) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * (masterMode ? 3f : 2f) * initialVelocity, projectileType2, projectileDamage2, 0f, Main.myPlayer, npc.target, projRotationMultiplier); + Projectile.NewProjectile(npc.GetSource_FromAI(), everlastingRainbowSpawn + spinningpoint.RotatedBy(-MathHelper.PiOver2) * 30f, spinningpoint * (death ? 3f : 2f) * initialVelocity, projectileType2, projectileDamage2, 0f, Main.myPlayer, npc.target, projRotationMultiplier); } } @@ -710,7 +709,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? (masterMode ? 105f : 110f) : (masterMode ? 140f : 150f)) + 30f * lessTimeSpentPerPhaseMultiplier; // 112.5 is too little + extraPhaseTime = (dayTimeEnrage ? (death ? 105f : 110f) : (death ? 140f : 150f)) + 30f * lessTimeSpentPerPhaseMultiplier; // 112.5 is too little if (npc.ai[1] >= totalSunDancePhaseTime + extraPhaseTime) { npc.ai[0] = 1f; @@ -745,8 +744,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float totalProjectiles = masterMode ? 18f : 15f; - float lanceSpacing = masterMode ? 150f : 175f; + float totalProjectiles = death ? 18f : 15f; + float lanceSpacing = death ? 150f : 175f; float lanceWallSize = totalProjectiles * lanceSpacing; Vector2 lanceSpawnOffset = targetData9.Center; @@ -758,7 +757,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lanceWallSizeMult = 1.4f; totalProjectiles += 5f; lanceSpacing += 50f; - lanceWallSize *= (masterMode ? 0.75f : 0.5f); + lanceWallSize *= (death ? 0.75f : 0.5f); float direction = 1f; int randomLanceWallType; @@ -1021,7 +1020,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) SoundEngine.PlaySound(SoundID.Item162, npc.Center); - float lanceGateValue2 = masterMode ? 75f : 100f; + float lanceGateValue2 = death ? 75f : 100f; if (npc.ai[1] >= 6f && npc.ai[1] < 54f) { @@ -1145,7 +1144,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = ProjectileID.HallowBossRainbowStreak; int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; - Vector2 vector = new Vector2(0f, (death ? -24f : -22f) - (phase3 ? ((masterMode ? 6f : 4f) * streakHomeTime) : 0f)).RotatedBy(MathHelper.TwoPi * streakHomeTime); + Vector2 vector = new Vector2(0f, (death ? -24f : -22f) - (phase3 ? ((death ? 6f : 4f) * streakHomeTime) : 0f)).RotatedBy(MathHelper.TwoPi * streakHomeTime); if (Main.netMode != NetmodeID.MultiplayerClient) { int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, streakHomeTime); @@ -1180,7 +1179,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; extraPhaseTime = (dayTimeEnrage ? 36f : 72f) + 30f * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= (masterMode ? 105f : 120f) + extraPhaseTime) + if (npc.ai[1] >= (death ? 105f : 120f) + extraPhaseTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index 16ace81fa3..a44b972fce 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -24,15 +24,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Phases - float phase2LifeRatio = masterMode ? 0.75f : 0.6f; - float phase3LifeRatio = masterMode ? 0.4f : 0.3f; - float finalPhaseRevLifeRatio = masterMode ? 0.2f : 0.15f; - float penultimatePhaseDeathLifeRatio = masterMode ? 0.3f : 0.2f; - float finalPhaseDeathLifeRatio = masterMode ? 0.15f : 0.1f; + float phase2LifeRatio = death ? 0.75f : 0.6f; + float phase3LifeRatio = death ? 0.4f : 0.3f; + float finalPhaseRevLifeRatio = death ? 0.2f : 0.15f; + float penultimatePhaseDeathLifeRatio = death ? 0.3f : 0.2f; + float finalPhaseDeathLifeRatio = death ? 0.15f : 0.1f; bool phase2 = lifeRatio < phase2LifeRatio; bool phase3 = lifeRatio < phase3LifeRatio; bool finalPhaseRev = lifeRatio < finalPhaseRevLifeRatio; @@ -42,9 +41,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lineUpDist = death ? 15f : 20f; // Servant and projectile velocity, the projectile velocity is multiplied by 2 - float servantAndProjectileVelocity = (death ? 8f : 6f) + (masterMode ? 2f : 0f); + float servantAndProjectileVelocity = death ? 10f : 6f; - float enrageScale = bossRush ? 2.25f : masterMode ? 0.5f : 0f; + float enrageScale = bossRush ? 2.25f : death ? 0.5f : 0f; if (Main.IsItDay()) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -151,7 +150,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hoverAcceleration += 0.08f; } - float attackSwitchTimer = (masterMode ? 120f : 180f) - (death ? 180f * (1f - lifeRatio) : 0f); + float attackSwitchTimer = death ? (120f - 180f * (1f - lifeRatio)) : 180f; bool timeToCharge = npc.ai[2] >= attackSwitchTimer; Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 400f; Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - attackSwitchTimer) * 0.01f) : 0f)); @@ -173,7 +172,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.player[npc.target].dead) npc.ai[3] += 1f; - float servantSpawnGateValue = death ? (masterMode ? 10f : 20f) : (masterMode ? 25f : 40f); + float servantSpawnGateValue = death ? 10f : 40f; if (Main.getGoodWorld) servantSpawnGateValue *= 0.8f; @@ -240,13 +239,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - int chargeDelay = masterMode ? 75 : 95; - if (death) - chargeDelay -= (int)Math.Round(30f * (1f - lifeRatio)); + int chargeDelay = death ? (75 - (int)Math.Round(30f * (1f - lifeRatio))) : 95; if (Main.getGoodWorld) chargeDelay -= 30; - float slowDownGateValue = chargeDelay * (death ? (masterMode ? 0.85f : 0.75f) : (masterMode ? 0.75f : 0.65f)); + float slowDownGateValue = chargeDelay * (death ? 0.85f : 0.65f); npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) @@ -258,7 +255,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (decelerationScalar < 0f) decelerationScalar = 0f; - npc.velocity *= (MathHelper.Lerp(masterMode ? 0.76f : 0.92f, masterMode ? 0.88f : 0.96f, decelerationScalar)); + npc.velocity *= (MathHelper.Lerp(death ? 0.76f : 0.92f, death ? 0.88f : 0.96f, decelerationScalar)); if (Main.getGoodWorld) npc.velocity *= 0.99f; @@ -333,7 +330,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += phaseChangeRate; if (npc.ai[1] % servantSpawnGateValue == 0f) { - float servantVelocity = masterMode ? 11.3f : 5.65f; + float servantVelocity = death ? 11.3f : 5.65f; Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(servantVelocity, servantVelocity); if (Main.getGoodWorld) servantSpawnVelocity *= 3f; @@ -342,7 +339,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int spawnType = NPCID.ServantofCthulhu; - if (masterMode) + if (death) { int maxBloodServants = 2; bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; @@ -466,13 +463,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hoverAcceleration += 0.1f; } - float phaseLimit = (masterMode ? 160f : 200f) - (death ? 150f * (phase2LifeRatio - lifeRatio) : 0f); + float phaseLimit = death ? (160f - 150f * (phase2LifeRatio - lifeRatio)) : 200f; bool timeToCharge = npc.ai[2] >= phaseLimit; Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.01f) : 0f)); npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.001f) : 0f)); npc.ai[2] += 1f; - float projectileGateValue = (lifeRatio < 0.5f && death) ? (masterMode ? 40f : 50f) : (masterMode ? 60f : 80f); + float projectileGateValue = (lifeRatio < 0.5f && death) ? 40f : (death ? 60f : 80f); if (npc.ai[2] % projectileGateValue == 0f && shootProjectile) { Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity * 2f; @@ -481,8 +478,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodNautilusShot; int damage = npc.GetProjectileDamage(type); - int numProj = masterMode ? 4 : 3; - int spread = masterMode ? 12 : 10; + int numProj = death ? 4 : 3; + int spread = death ? 12 : 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { @@ -532,11 +529,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = setDamage; - int phase2ChargeDelay = masterMode ? 70 : 85; - if (death) - phase2ChargeDelay -= (int)Math.Round(25f * (phase2LifeRatio - lifeRatio)); + int phase2ChargeDelay = death ? (70 - (int)Math.Round(25f * (phase2LifeRatio - lifeRatio))) : 85; - float slowDownGateValue = phase2ChargeDelay * (death ? (masterMode ? 0.9f : 0.85f) : (masterMode ? 0.85f : 0.75f)); + float slowDownGateValue = phase2ChargeDelay * (death ? 0.9f : 0.75f); npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) @@ -548,7 +543,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (decelerationScalar < 0f) decelerationScalar = 0f; - npc.velocity *= (MathHelper.Lerp(masterMode ? 0.6f : 0.9f, masterMode ? 0.7f : 0.95f, decelerationScalar)); + npc.velocity *= (MathHelper.Lerp(death ? 0.6f : 0.9f, death ? 0.7f : 0.95f, decelerationScalar)); if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) @@ -605,10 +600,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float targetVelocity = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; targetVelocity += 10f - targetVelocity; - if (targetVelocity < (masterMode ? 2f : 5f)) - targetVelocity = (masterMode ? 2f : 5f); - if (targetVelocity > (masterMode ? 6f : 15f)) - targetVelocity = (masterMode ? 6f : 15f); + if (targetVelocity < (death ? 2f : 5f)) + targetVelocity = (death ? 2f : 5f); + if (targetVelocity > (death ? 6f : 15f)) + targetVelocity = (death ? 6f : 15f); if (npc.ai[2] == -1f) { @@ -763,7 +758,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int spawnType = NPCID.ServantofCthulhu; bool spawnServant = false; float enrageScaleToPass = enrageScale; - if (masterMode) + if (death) { int maxBloodServants = 2; bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; @@ -860,9 +855,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } - calamityGlobalNPC.newAI[0] += ((masterMode && calamityGlobalNPC.newAI[0] % 2f != 0f) ? Main.rand.Next(2) + 1f : 1f); + calamityGlobalNPC.newAI[0] += ((death && calamityGlobalNPC.newAI[0] % 2f != 0f) ? Main.rand.Next(2) + 1f : 1f); if (calamityGlobalNPC.newAI[0] > 3f) - calamityGlobalNPC.newAI[0] = masterMode ? Main.rand.Next(2) : 0f; + calamityGlobalNPC.newAI[0] = death ? Main.rand.Next(2) : 0f; npc.SyncExtraAI(); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index 8f28c3ad03..e75fd3ccdd 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -23,7 +23,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; @@ -33,7 +32,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - int numFists = masterMode ? 2 : 1; + int numFists = death ? 2 : 1; for (int i = 0; i < numFists; i++) { float fistPunchTimeOffset = i * 30f; @@ -231,7 +230,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] > 0f) { - npc.ai[1] += (masterMode ? 2f : 1f); + npc.ai[1] += (death ? 2f : 1f); if (Main.getGoodWorld) npc.ai[1] += 100f; @@ -263,7 +262,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - if (masterMode) + if (death) { float straightUpJumpHeight = 640f; if (npc.ai[3] == 0f) @@ -283,7 +282,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.ai[2] += 1f; - float jumpVelocity = death ? 26f : 24f; + float jumpVelocity = 26f; if (enrage) jumpVelocity *= 1.25f; if (turboEnrage) @@ -368,7 +367,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.ai[2] += 1f; - float jumpVelocity = death ? 23f : 21f; + float jumpVelocity = 21f; if (enrage) jumpVelocity *= 1.25f; if (turboEnrage) @@ -420,7 +419,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses void NormalJump() { float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - float velocityX = (masterMode ? 9f : 6f) + velocityBoost; + float velocityX = (death ? 9f : 6f) + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -519,9 +518,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[fiery2].velocity.X *= 2f; } - float projectileVelocity = masterMode ? 9f : 7.5f; - if (death) - projectileVelocity *= 1.25f; + float projectileVelocity = death ? 11.25f : 7.5f; if (enrage) projectileVelocity *= 1.5f; if (turboEnrage) @@ -533,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses destination.Normalize(); destination *= projectileVelocity; int totalFireballsPerSide = 3; - int totalIterations = (turboEnrage && Main.getGoodWorld) ? 11 : masterMode ? 25 : 35; + int totalIterations = (turboEnrage && Main.getGoodWorld) ? 11 : death ? 25 : 35; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < totalIterations; i++) { @@ -605,7 +602,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Bottom.Y < Main.player[npc.target].position.Y || npc.ai[2] == 1f) { float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); - float fallSpeed = (masterMode ? 0.3f : 0.2f) + fallSpeedBoost; + float fallSpeed = (death ? 0.3f : 0.2f) + fallSpeedBoost; if (enrage) fallSpeed *= 2f; @@ -615,14 +612,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { float velocityChangeBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); - float velocityXChange = (masterMode ? 0.3f : 0.2f) + velocityChangeBoost; + float velocityXChange = (death ? 0.3f : 0.2f) + velocityChangeBoost; if (npc.direction < 0) npc.velocity.X -= velocityXChange; else if (npc.direction > 0) npc.velocity.X += velocityXChange; float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - float velocityXCap = (masterMode ? 9f : 6f) + velocityBoost; + float velocityXCap = (death ? 9f : 6f) + velocityBoost; if (enrage) velocityXCap *= 3f; @@ -703,7 +700,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Player player = Main.player[npc.target]; bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Enrage if the target isn't inside the temple @@ -727,7 +723,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (bossRush || Main.getGoodWorld) enrage = true; - float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? (masterMode ? 1.7f : 1.5f) : (masterMode ? 1.4f : 1f); + float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? 1.7f : 1f; Vector2 fistCenter = golem.Center + golem.velocity + new Vector2(0f, -9f * npc.scale); fistCenter.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; @@ -755,7 +751,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool canPunch = npc.alpha == 0 && (npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > player.Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < player.Center.X); if (canPunch) { - float fistShootSpeed = masterMode ? Main.rand.NextFloat(aggression * 0.5f, aggression * 2f) : aggression; + float fistShootSpeed = death ? Main.rand.NextFloat(aggression * 0.5f, aggression * 2f) : aggression; npc.ai[1] += fistShootSpeed; if (npc.life < npc.lifeMax / 2) npc.ai[1] += fistShootSpeed; @@ -763,7 +759,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += fistShootSpeed; } - float fistPunchGateValue = masterMode ? 120f : 40f; + float fistPunchGateValue = death ? 120f : 40f; if (npc.ai[1] >= fistPunchGateValue) { if (canPunch) @@ -775,7 +771,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; // Net update in Master due to rng - if (masterMode) + if (death) npc.ForceNetUpdate(); } } @@ -896,7 +892,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float maxPunchDistance = 700f; int explosionLimit = 2; - if (masterMode) + if (death) { if (npc.life < npc.lifeMax / 2) { @@ -918,7 +914,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.ai[0] = 0f; - if (masterMode) + if (death) { int type = ProjectileID.InfernoHostileBlast; bool shootExplosion = true; @@ -1024,7 +1020,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Count body parts @@ -1093,7 +1088,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); - int fireballAmount = masterMode ? 2 : 1; + int fireballAmount = death ? 2 : 1; Vector2 fireballVelocity = new Vector2(headFireballTargetX, headFireballTargetY); for (int i = 0; i < fireballAmount; i++) Projectile.NewProjectile(npc.GetSource_FromAI(), headCent, fireballVelocity * (1f / (i + 1)), type, damage, 0f, Main.myPlayer); @@ -1145,7 +1140,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.Fireball; int damage = npc.GetProjectileDamage(type); - int fireballAmount = masterMode ? 3 : 1; + int fireballAmount = death ? 3 : 1; Vector2 fireballVelocity = new Vector2(fireballFistsDedTargetX, fireballFistsDedTargetY); for (int i = 0; i < fireballAmount; i++) { @@ -1179,7 +1174,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else projectileFirePos.X += 18f * npc.scale; - float laserSpeed = masterMode ? 15f : 12f; + float laserSpeed = death ? 15f : 12f; float laserTargetXDist = Main.player[npc.target].Center.X - projectileFirePos.X; float laserTargetYDist = Main.player[npc.target].Center.Y - projectileFirePos.Y; float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); @@ -1208,7 +1203,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.localAI[1] == 1f) projectileFirePos.X += 30f * npc.scale; - float extraLaserSpeed = masterMode ? 15f : 12f; + float extraLaserSpeed = death ? 15f : 12f; float extraLaserTargetX = Main.player[npc.target].Center.X - projectileFirePos.X; float extraLaserTargetY = Main.player[npc.target].Center.Y - projectileFirePos.Y; float extraLaserTargetDist = (float)Math.Sqrt(extraLaserTargetX * extraLaserTargetX + extraLaserTargetY * extraLaserTargetY); @@ -1274,11 +1269,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || masterMode; - bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f || masterMode; - bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f || masterMode; + bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f || death; + bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f || death; // Enrage if the target isn't inside the temple bool enrage = true; @@ -1449,7 +1443,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); float freeHeadSpeed = turboEnrage ? 24f : enrage ? 18f : 6f; - if (masterMode) + if (death) freeHeadSpeed *= 1.25f; float freeHeadTargetX = Main.player[npc.target].Center.X - freeHeadCenter.X; @@ -1460,7 +1454,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses freeHeadTargetX *= freeHeadTargetDist; freeHeadTargetY *= freeHeadTargetDist; - int projectileType = (phase3 || masterMode) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; + int projectileType = (phase3 || death) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; int damage = npc.GetProjectileDamage(projectileType); float ai0 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.X : 0f; float ai1 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.Y : 0f; @@ -1497,7 +1491,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses freeHeadProjSpawn.X += 14f * npc.scale; float freeHeadProjSpeed = 5f + (death ? 5f * (1f - combinedLifeRatio) : 3f * (1f - combinedLifeRatio)); - if (masterMode) + if (death) { if (i == 0) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index 08a9375b6c..b41e77b6e9 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Phases based on life percentage @@ -52,22 +51,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool spawnBlueCrystal = lifeRatio < 0.3f; // Check if the crystals are alive - bool crystalAlive = true; + bool redCrystalAlive = true; bool blueCrystalAlive = false; bool greenCrystalAlive = true; if (spawnGreenCrystal) { - if (masterMode) + if (death) greenCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); } if (phase3) - crystalAlive = NPC.AnyNPCs(ModContent.NPCType()); + redCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); if (spawnBlueCrystal) { - if (masterMode) + if (death) blueCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); } @@ -83,8 +82,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Dust color when the blue crystal is alive Color dustColor = Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); - // Master Mode Crystal spawning - if (masterMode) + // Death Mode Crystal spawning + if (death) { if (spawnGreenCrystal && npc.Calamity().newAI[0] == 0f) { @@ -242,7 +241,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Faster fall if (npc.velocity.Y > 0f) { - float fallSpeedBonus = (bossRush ? 0.1f : death ? 0.05f : 0f) + (!crystalAlive ? 0.1f : 0f) + (masterMode ? 0.1f : 0f); + float fallSpeedBonus = (bossRush ? 0.2f : death ? 0.15f : 0f) + (!redCrystalAlive ? 0.1f : 0f); npc.velocity.Y += fallSpeedBonus; } @@ -285,7 +284,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get closer to activating teleport 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) > (masterMode ? 160f : 320f)) + 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) > (death ? 160f : 320f)) npc.ai[2] += death ? 3f : 2f; else npc.ai[2] += 1f; @@ -300,8 +299,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses teleporting = true; npc.aiAction = 1; - float teleportRate = crystalAlive ? 1f : 2f; - if (masterMode) + float teleportRate = redCrystalAlive ? 1f : 2f; + if (death) teleportRate *= 2f; npc.ai[0] += teleportRate; @@ -350,8 +349,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses teleporting = true; npc.aiAction = 0; - float teleportRate = crystalAlive ? 1f : 2f; - if (masterMode) + float teleportRate = redCrystalAlive ? 1f : 2f; + if (death) teleportRate *= 2f; if (npc.ai[0] == 0f) @@ -487,7 +486,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y *= 0.6f; } - if (masterMode) + if (death) npc.velocity.X *= 1.4f; if (bossRush) @@ -503,8 +502,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Change jump velocity else if (npc.target < Main.maxPlayers) { - float jumpVelocityLimit = crystalAlive ? 3f : 4.5f; - if (masterMode) + float jumpVelocityLimit = redCrystalAlive ? 3f : 4.5f; + if (death) jumpVelocityLimit += 3f; if (Main.getGoodWorld) jumpVelocityLimit = 8f; @@ -514,13 +513,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) { npc.velocity.X += (bossRush ? 0.4f : death ? 0.25f : 0.2f) * npc.direction; - if (masterMode) + if (death) npc.velocity.X += 0.3f * npc.direction; } else { npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f; - if (masterMode) + if (death) npc.velocity.X *= 0.9f; } } @@ -573,11 +572,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.life + slimeSpawnThreshold < npc.ai[3]) { npc.ai[3] = npc.life; - int slimeAmt = Main.rand.Next(1, 3); + int slimeAmt = death ? 1 : Main.rand.Next(1, 3); for (int i = 0; i < slimeAmt; i++) { - float minLowerLimit = death ? 5f : 0f; - float maxLowerLimit = death ? 7f : 2f; + float minLowerLimit = 0f; + float maxLowerLimit = 2f; int minTypeChoice = (int)MathHelper.Lerp(minLowerLimit, 5f, 1f - lifeRatio2); int maxTypeChoice = (int)MathHelper.Lerp(maxLowerLimit, 7f, 1f - lifeRatio2); @@ -613,7 +612,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (((Main.raining && Main.hardMode) || bossRush) && Main.rand.NextBool(50)) npcType = NPCID.RainbowSlime; - if (masterMode) + if (death) { switch (Main.rand.Next(3)) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index f849a006f7..b228164acb 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -46,10 +45,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phase2LifeRatio = 0.5f; bool addThornBallsToGatlingAttack = lifeRatio < 0.85f; bool addSporeGasBlastToGatlingAttack = lifeRatio < 0.75f; - bool useNewGatlingAttackVariant = addSporeGasBlastToGatlingAttack && masterMode; + bool useNewGatlingAttackVariant = addSporeGasBlastToGatlingAttack && death; bool phase2 = lifeRatio <= phase2LifeRatio; bool phase3 = lifeRatio < 0.35f; - bool vomitFreeTentacles = lifeRatio < 0.25f && masterMode; + bool vomitFreeTentacles = lifeRatio < 0.25f && death; bool phase4 = lifeRatio < 0.2f; // Contact damage values for phase 2 @@ -63,8 +62,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Check for Jungle bool surface = !bossRush && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; - // Tentacle limites - int maxTentaclesAfterFirstTentaclePhase = death ? (masterMode ? 4 : 3) : (masterMode ? 3 : 2); + // Tentacle limits + int maxTentaclesAfterFirstTentaclePhase = death ? 4 : 2; int maxFreeTentaclesAfterFirstTentaclePhase = maxTentaclesAfterFirstTentaclePhase * 2; float speedUpDistance = 480f; @@ -162,14 +161,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - velocity += velocity * 0.25f * (1f - lifeRatio); - acceleration += acceleration * 0.25f * (1f - lifeRatio); - } - - if (masterMode) - { - velocity += velocity * 0.1f * (1f - lifeRatio); - acceleration += acceleration * 0.1f * (1f - lifeRatio); + velocity += velocity * 0.35f * (1f - lifeRatio); + acceleration += acceleration * 0.35f * (1f - lifeRatio); if (phase2) { float aggressionScale = (phase2LifeRatio - lifeRatio) / phase2LifeRatio; @@ -306,7 +299,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (addSporeGasBlastToGatlingAttack) { SoundEngine.PlaySound(SoundID.Item74, npc.Center); - int totalProjectiles = masterMode ? 36 : 30; + int totalProjectiles = death ? 36 : 30; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -316,7 +309,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; - float randomSpeed = Main.rand.NextFloat(0.8f, masterMode ? 1.5f : 1.2f); + float randomSpeed = Main.rand.NextFloat(0.8f, death ? 1.5f : 1.2f); int dustType = 74; Vector2 dustVelocity = projectileVelocity * randomSpeed; @@ -350,7 +343,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (doneWithTentaclePhase && !charging && !despawn) { float timeToChargeIncrement = phase4 ? 2f : phase3 ? 1.5f : 1f; - if (masterMode) + if (death) timeToChargeIncrement *= 2f; npc.ai[3] += timeToChargeIncrement; @@ -367,7 +360,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses velocity *= MathHelper.Lerp(MovementVelocityMultiplierForSlowAttacks, 1f, (float)Math.Pow(absValueOfTimer / SeedGatlingDuration, 2D)); // Shoot homing pink bulb projectiles that leave behind lingering pink clouds - float shootBulbGateValue = death ? (masterMode ? 150f : 90f) : (masterMode ? 200f : 120f); + float shootBulbGateValue = death ? 150f : 120f; if (addSporeGasBlastToGatlingAttack) shootBulbGateValue *= 0.8f; @@ -407,9 +400,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[3] <= StopChargeGateValue) { bool canChargeAgain = phase4 ? true : phase3 ? Main.rand.NextBool() : false; - bool chargeAgain = canChargeAgain && masterMode && calamityGlobalNPC.newAI[2] == 0f; + bool chargeAgain = canChargeAgain && death && calamityGlobalNPC.newAI[2] == 0f; npc.ai[3] = chargeAgain ? -2f : 0f; - calamityGlobalNPC.newAI[2] = (masterMode && calamityGlobalNPC.newAI[2] == 0f && chargeAgain) ? 1f : 0f; + calamityGlobalNPC.newAI[2] = (death && calamityGlobalNPC.newAI[2] == 0f && chargeAgain) ? 1f : 0f; npc.SyncExtraAI(); if (!vomitFreeTentacles && !secondCharge) @@ -443,7 +436,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int projectileType = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(projectileType); - float randomVelocityMultiplier = secondCharge ? 0.05f : masterMode ? 0.3f : 0.2f; + float randomVelocityMultiplier = secondCharge ? 0.05f : death ? 0.3f : 0.2f; Vector2 projectileVelocity = npc.velocity * Main.rand.NextVector2CircularEdge(randomVelocityMultiplier, randomVelocityMultiplier); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 30f; @@ -504,7 +497,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } float timeToLineUpChargeDecrement = phase4 ? 2f : 1f; - if (masterMode) + if (death) timeToLineUpChargeDecrement *= 2f; npc.ai[3] -= timeToLineUpChargeDecrement; @@ -537,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; - float randomSpeed = Main.rand.NextFloat(0.8f, secondCharge ? 1f : masterMode ? 1.5f : 1.2f); + float randomSpeed = Main.rand.NextFloat(0.8f, secondCharge ? 1f : death ? 1.5f : 1.2f); int dustType = 74; Vector2 dustVelocity2 = projectileVelocity * randomSpeed; @@ -574,9 +567,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase3) maxDistanceFromHooks += 150f; if (death) + { maxDistanceFromHooks += maxDistanceFromHooks * 0.2f * (1f - lifeRatio); - if (masterMode) maxDistanceFromHooks += 200f; + } if (distanceFromTarget >= maxDistanceFromHooks) { @@ -658,7 +652,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.getGoodWorld) npc.localAI[1] += 1f; - float shootProjectileGateValue = death ? (masterMode ? 30f : 40f) : (masterMode ? 45f : 60f); + float shootProjectileGateValue = death ? 30f : 60f; if (npc.localAI[1] >= shootProjectileGateValue) { npc.localAI[1] = 0f; @@ -682,9 +676,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - bool shootPoisonSeed = (CalamityWorld.LegendaryMode || Main.rand.NextBool(masterMode ? 2 : 4)) && !shootThornBall; + bool shootPoisonSeed = (CalamityWorld.LegendaryMode || Main.rand.NextBool(death ? 2 : 4)) && !shootThornBall; int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; - float projectileSpeed = masterMode ? 16f : 14f; + float projectileSpeed = death ? 16f : 14f; int damage = npc.GetProjectileDamage(projectileType); Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; @@ -734,7 +728,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] == 1f) { npc.localAI[0] = 2f; - int totalTentacles = death ? (masterMode ? 12 : 10) : (masterMode ? 10 : 8); + int totalTentacles = death ? 12 : 8; if (Main.getGoodWorld) totalTentacles += 6; if (CalamityWorld.LegendaryMode) @@ -771,7 +765,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool noAttachedTentacles = !NPC.AnyNPCs(NPCID.PlanterasTentacle); bool noFreeTentacles = !NPC.AnyNPCs(ModContent.NPCType()); float tentacleIdleTimerDecrement = (noAttachedTentacles && noFreeTentacles) ? 4f : noAttachedTentacles ? 2f : 1f; - if (masterMode) + if (death) tentacleIdleTimerDecrement *= 2f; npc.ai[2] -= tentacleIdleTimerDecrement; @@ -889,7 +883,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (masterMode && Main.netMode != NetmodeID.MultiplayerClient) + if (death && Main.netMode != NetmodeID.MultiplayerClient) { float sporeSpeed = 12f; Vector2 sporeVelocity = projectileVelocity * sporeSpeed; @@ -976,7 +970,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Variables bool enrage = BossRushEvent.BossRushActive; bool despawn = false; - bool masterMode = Main.masterMode || enrage; bool death = CalamityWorld.death || enrage; // Despawn if Plantera is gone @@ -1019,7 +1012,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 0f; // Timer dictating whether to pick a new location or not - float moveBoost = death ? (masterMode ? 6f : 4f) * (1f - lifeRatio) : (masterMode ? 3f : 2f) * (1f - lifeRatio); + float moveBoost = death ? 6f * (1f - lifeRatio) : 2f * (1f - lifeRatio); npc.localAI[0] -= 1f + moveBoost; if (enrage) npc.localAI[0] -= 6f; @@ -1088,7 +1081,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] > 0f && npc.ai[1] > 0f) { // Hook movement velocity - float velocityBoost = death ? (masterMode ? 9f : 6f) * (1f - lifeRatio) : (masterMode ? 5f : 3f) * (1f - lifeRatio); + float velocityBoost = death ? 9f * (1f - lifeRatio) : 3f * (1f - lifeRatio); float velocity = 7f + velocityBoost; if (enrage) velocity *= 2f; @@ -1145,7 +1138,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses dust.fadeIn = 0.7f; } - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Main.getGoodWorld) @@ -1218,7 +1210,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float tentacleDistance = MathHelper.Lerp(50f, 100f + (extendedDistanceFromPlantera * 300f), npc.localAI[0] / extendTime); float deceleration = (death ? 0.5f : 0.8f) / (1f + extendedDistanceFromPlantera); - if (masterMode) + if (death) { tentacleAcceleration *= 1.2f; extendedDistanceFromPlantera *= 1.1f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 0082f2844f..79474e1803 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -24,7 +24,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; bool enrage = true; @@ -61,7 +60,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Bee spawn limit - int beeLimit = masterMode ? 9 : 15; + int beeLimit = death ? 9 : 15; // Queen Bee Bee count int totalBees = 0; @@ -86,7 +85,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool hornetLimitReached = false; // Only run this when necessary - if (masterMode) + if (death) { // Queen Bee Hornet count int totalHornets = 0; @@ -128,7 +127,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Despawn float distanceFromTarget = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (npc.ai[0] != 6f) + if (npc.ai[0] != 7f) { if (npc.timeLeft < 60) npc.timeLeft = 60; @@ -136,7 +135,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] = 4f; } if (Main.player[npc.target].dead) - npc.ai[0] = 6f; + npc.ai[0] = 7f; // Adjust slowing debuff immunity bool immuneToSlowingDebuffs = npc.ai[0] == 0f; @@ -160,7 +159,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Despawn phase - if (npc.ai[0] == 6f) + if (npc.ai[0] == 7f) { // Avoid cheap bullshit npc.damage = 0; @@ -203,9 +202,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int phase; - int maxRandom = phase4 ? 5 : 4; + int maxRandom = phase4 ? (death ? 6 : 5) : 4; do phase = Main.rand.Next(maxRandom); - while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (masterMode && phase6 && phase == 3)); + while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (death && phase6 && phase == 3)); bool charging = phase == 0; @@ -213,6 +212,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase == 4) phase = 5; + // 6 is beenade vomit + if (phase == 5) + phase = 6; + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); npc.ai[0] = phase; npc.ai[1] = 0f; @@ -221,13 +224,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = (phase == 5 && phase5) ? (Main.rand.NextBool() ? 1f : -1f) : phase == 5 ? 1f : 0f; // Velocity for the charges - if (masterMode) + if (death) npc.ai[3] = charging ? ((phase6 ? 27f : phase5 ? 16f : phase4 ? 27f : phase2 ? 22f : 17f) + 3f * enrageScale) : 0f; else npc.ai[3] = charging ? ((phase6 ? 25f : phase5 ? 14f : phase4 ? 25f : phase2 ? 20f : 15f) + 3f * enrageScale) : 0f; // Distance for the charges - if (masterMode) + if (death) calamityGlobalNPC.newAI[1] = charging ? ((phase6 ? 700f : phase5 ? 300f : phase4 ? 600f : phase2 ? 500f : 400f) - 50f * enrageScale) : 0f; else calamityGlobalNPC.newAI[1] = charging ? ((phase6 ? 750f : phase5 ? 350f : phase4 ? 650f : phase2 ? 550f : 450f) - 50f * enrageScale) : 0f; @@ -248,7 +251,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; int masterModeChargeLimit = death ? (phase5 ? 2 : 1) : (phase5 ? 3 : 2); - if (masterMode && chargeAmt > masterModeChargeLimit) + if (death && chargeAmt > masterModeChargeLimit) chargeAmt = masterModeChargeLimit; // Switch to a random phase if chargeAmt has been exceeded @@ -274,9 +277,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float chargeDistanceY = phase6 ? 100f : phase4 ? 50f : 20f; chargeDistanceY += 50f * enrageScale; if (death) + { chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - lifeRatio); - if (masterMode) chargeDistanceY *= 2f; + } float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); @@ -316,7 +320,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float chargeAccelerationX = (phase4 ? 0.9f : phase2 ? 0.7f : 0.5f) + 0.25f * enrageScale; float chargeAccelerationY = (phase4 ? 0.45f : phase2 ? 0.35f : 0.25f) + 0.125f * enrageScale; - if (masterMode) + if (death) { chargeVelocityX += 2f; chargeVelocityY += 4f; @@ -389,7 +393,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses shouldCharge = true; } if (enrageScale > 0f && shouldCharge) - npc.velocity *= MathHelper.Lerp(0.5f, masterMode ? 0.9f : 1f, 1f - enrageScale / maxEnrageScale); + npc.velocity *= MathHelper.Lerp(0.5f, death ? 0.9f : 1f, 1f - enrageScale / maxEnrageScale); // Keep moving if (npc.ai[2] != 1f) @@ -399,7 +403,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.X = velocity * npc.direction; float accelerateGateValue = phase6 ? 30f : phase5 ? 10f : 90f; - if (masterMode) + if (death) accelerateGateValue *= 0.75f; if (enrageScale > 0f) accelerateGateValue *= 0.75f; @@ -410,11 +414,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); float velocityXLimit = velocity * 2f; if (Math.Abs(npc.velocity.X) < velocityXLimit) - npc.velocity.X *= (masterMode ? 1.02f : 1.01f); + npc.velocity.X *= (death ? 1.02f : 1.01f); } // Spawn bees - float beeSpawnGateValue = masterMode ? 16f : 20f; + float beeSpawnGateValue = death ? 16f : 20f; bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % beeSpawnGateValue == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (spawnBee) { @@ -430,7 +434,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else spawnType = NPCID.Hellbat; } - else if (masterMode) + else if (death) { int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); switch (random) @@ -491,9 +495,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Slow down npc.localAI[0] = 0f; - npc.velocity *= (masterMode ? 0.8f : 0.9f); + npc.velocity *= (death ? 0.8f : 0.9f); - float chargeDeceleration = masterMode ? 0.2f : 0.1f; + float chargeDeceleration = death ? 0.2f : 0.1f; if (phase2) { npc.velocity *= 0.9f; @@ -531,14 +535,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.spriteDirection = npc.direction; // Get target location - float beeAttackAccel = death ? 0.3f : 0.24f; + float beeAttackAccel = death ? 0.6f : 0.24f; float beeAttackSpeed = 12f + enrageScale * 3f; - if (masterMode) - { - beeAttackAccel *= 2f; + if (death) beeAttackSpeed *= 1.5f; - } bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); float distanceAboveTarget = !canHitTarget ? 0f : 320f; @@ -547,7 +548,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Go to bee spawn phase calamityGlobalNPC.newAI[0] += 1f; - if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= (masterMode ? 90f : 180f)) + if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= (death ? 90f : 180f)) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -570,13 +571,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get target location and spawn bees from ass float beeAttackHoverSpeed = 16f + enrageScale * 4f; - float beeAttackHoverAccel = death ? 0.4f : 0.3f; + float beeAttackHoverAccel = death ? 0.8f : 0.3f; - if (masterMode) - { - beeAttackHoverAccel *= 2f; + if (death) beeAttackHoverSpeed *= 1.5f; - } Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); @@ -626,7 +624,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else spawnType = NPCID.Hellbat; } - else if (masterMode) + else if (death) { int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); switch (random) @@ -684,7 +682,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.spriteDirection = npc.direction; // Go to a random phase - float numSpawns = phase3 ? (masterMode ? 1f : 2f) : (masterMode ? 3f : 5f); + float numSpawns = phase3 ? (death ? 1f : 2f) : (death ? 3f : 5f); if (npc.ai[2] > numSpawns || (beeLimitReached && hornetLimitReached)) { npc.ai[0] = -1f; @@ -711,7 +709,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (enrageScale > 0f) stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.3f : 0.24f, phase6 ? 0.6f : 0.48f, enrageScale / maxEnrageScale); - if (masterMode) + if (death) { stingerAttackSpeed *= 1.1f; stingerAttackAccel *= 1.2f; @@ -735,7 +733,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { float stingerSpeed = (phase3 ? 6f : 5f) + enrageScale; - if (masterMode) + if (death) stingerSpeed += 1f; float stingerTargetX = Main.player[npc.target].Center.X - stingerSpawnLocation.X; @@ -770,7 +768,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Go to a random phase float numStingerShots = phase6 ? 5f : phase2 ? 8f : 15f; - if (masterMode) + if (death) numStingerShots = (float)Math.Round(numStingerShots * 0.5f); if (npc.ai[1] > stingerAttackTimer * numStingerShots) @@ -824,7 +822,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (enrageScale > 0f) stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.9f : 0.7f, phase6 ? 2.4f : 1.8f, enrageScale / maxEnrageScale); - if (masterMode) + if (death) { stingerAttackSpeed *= 1.1f; stingerAttackAccel *= 1.2f; @@ -858,7 +856,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { float stingerSpeed = (phase6 ? 5f : 4f) + enrageScale; - if (masterMode) + if (death) stingerSpeed += 1f; Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * stingerSpeed; @@ -866,7 +864,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int numProj = death ? (phase6 ? 7 : phase5 ? 11 : 15) : (phase6 ? 5 : phase5 ? 9 : 13); int spread = phase6 ? 30 : phase5 ? 50 : 60; - if (masterMode) + if (death) { numProj += (phase6 ? 2 : phase5 ? 4 : 6); spread += (phase6 ? 10 : phase5 ? 15 : 20); @@ -903,7 +901,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.velocity *= 0.8f; - float idleTime = masterMode ? 120f : 180f; + float idleTime = death ? 120f : 180f; if (npc.ai[1] >= phaseLimit + idleTime) { npc.ai[0] = -1f; @@ -916,6 +914,46 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); } + // Spit beenades + else if (npc.ai[0] == 6f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + float beenadeAttackSpeed = 20f + 4f * enrageScale; + float beenadeAttackAccel = 0.75f; + Vector2 targetVector = Main.player[npc.target].Center + Vector2.UnitY * 240f; + + if (npc.Distance(targetVector) > 80f) + npc.SimpleFlyMovement(npc.SafeDirectionTo(targetVector) * beenadeAttackSpeed, beenadeAttackAccel); + else + npc.velocity *= 0.8f; + + float phaseLimit = 180f; + npc.ai[1] += 1f; + if (npc.ai[1] >= phaseLimit) + { + npc.ai[0] = -1f; + npc.ai[1] = 5f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] % 61f == 0f) + { + Vector2 beenadeSpawnLocation = npc.Center + new Vector2(20f * npc.direction, -40f); + SoundEngine.PlaySound(SoundID.Item76, beenadeSpawnLocation); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(npc.GetSource_FromAI(), beenadeSpawnLocation, Vector2.UnitX * 6f * npc.direction, type, damage, 0f, Main.myPlayer); + } + } + if (Main.dedServ) npc.ForceNetUpdate(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index ef5b7d0e3c..9e895f7809 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -16,7 +16,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Percent life remaining @@ -25,9 +24,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float slimeScale = 1f; bool teleported = false; bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio <= (masterMode ? 0.5f : 0.4f); - bool phase4 = lifeRatio <= (masterMode ? 0.5f : 0.2f); - bool phase5 = lifeRatio <= 0.25f && masterMode; + bool phase3 = lifeRatio <= (death ? 0.5f : 0.4f); + bool phase4 = lifeRatio <= (death ? 0.5f : 0.2f); + bool phase5 = lifeRatio <= 0.25f && death; // Spawn settings if (npc.localAI[0] == 0f) @@ -60,7 +59,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Teleport - float teleportGateValue = masterMode ? 300f : 600f; + float teleportGateValue = death ? 300f : 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 @@ -315,7 +314,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown); // Spawn spread of projectiles in Master Mode - if (masterMode) + if (death) { int numGelProjectiles = 12; if (Main.getGoodWorld) @@ -445,7 +444,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; } - if (masterMode) + if (death) npc.velocity.X *= (death ? 1.4f : 1.2f); npc.noTileCollide = true; @@ -455,16 +454,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.target >= Main.maxPlayers) break; - float jumpVelocity = bossRush ? 9f : death ? (masterMode ? 7f : 5.5f) : (masterMode ? 6f : 4.5f); + float jumpVelocity = bossRush ? 9f : death ? 7f : 4.5f; if (Main.getGoodWorld) jumpVelocity = 12f; if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity)) { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) - npc.velocity.X += (bossRush ? 1f : death ? (masterMode ? 0.45f : 0.35f) : (masterMode ? 0.4f : 0.3f)) * npc.direction; + npc.velocity.X += (bossRush ? 1f : death ? 0.45f : 0.3f) * npc.direction; else - npc.velocity.X *= bossRush ? 0.8f : death ? (masterMode ? 0.85f : 0.9f) : (masterMode ? 0.88f : 0.91f); + npc.velocity.X *= bossRush ? 0.8f : death ? 0.85f : 0.91f; } if (!Main.player[npc.target].dead) @@ -515,7 +514,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, damage, 0f, Main.myPlayer); // Line of explosions in Master Mode - if (masterMode) + if (death) { float expandDelay = 0f; int maxSmashes = death ? 22 : 16; @@ -537,7 +536,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Eruption of crystals in phase 3 if (npc.ai[0] == 6f && phase3) { - float projectileVelocity = masterMode ? (death ? 18f : 15f) : 12f; + float projectileVelocity = death ? 18f : 12f; type = ProjectileID.QueenSlimeMinionBlueSpike; damage = npc.GetProjectileDamage(type); Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center).SafeNormalize(Vector2.UnitY); @@ -638,7 +637,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileAmt = 2; int type = ProjectileID.QueenSlimeMinionBlueSpike; int damage = npc.GetProjectileDamage(type); - Vector2 velocityIncrease = masterMode ? (Vector2.UnitY * (death ? 4f : 2f)) : Vector2.Zero; + Vector2 velocityIncrease = death ? (Vector2.UnitY * 4f) : Vector2.Zero; for (int i = 0; i < projectileAmt; i++) { int totalProjectiles = 2; @@ -691,7 +690,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.velocity = center - npc.Center; npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= bossRush ? 30f : death ? (masterMode ? 27.3f : 26f) : (masterMode ? 25.2f : 24f); + npc.velocity *= bossRush ? 30f : death ? 27.3f : 24f; } else npc.velocity.Y *= 0.95f; @@ -845,7 +844,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn small slimes // Don't spawn any slimes in final phase - if (npc.life <= 0 || (phase4 && !masterMode)) + if (npc.life <= 0 || (phase4 && !death)) return false; if (Main.netMode == NetmodeID.MultiplayerClient) @@ -862,7 +861,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } float slimeSpawnHealthGateValue = CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f; - if (masterMode) + if (death) slimeSpawnHealthGateValue *= 0.5f; int slimeSpawnThreshold = (int)(npc.lifeMax * slimeSpawnHealthGateValue); @@ -1645,15 +1644,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode; - bool death = CalamityWorld.death; + bool death = CalamityWorld.death || bossRush; npc.noTileCollide = true; npc.noGravity = true; - float flyVelocity = bossRush ? 24f : death ? (masterMode ? 21f : 18f) : (masterMode ? 19f : 16f); - float flyAcceleration = bossRush ? 0.3f : death ? (masterMode ? 0.18f : 0.14f) : (masterMode ? 0.16f : 0.12f); - float flyDistanceY = masterMode ? 350f : 450f; + float flyVelocity = bossRush ? 24f : death ? 21f : 16f; + float flyAcceleration = bossRush ? 0.3f : death ? 0.18f : 0.12f; + float flyDistanceY = death ? 350f : 450f; Vector2 desiredVelocity = npc.Center; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index a26d087d4d..d182231f38 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -23,19 +23,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - float phase2LifeRatio = masterMode ? 1f : 0.85f; - float phase3LifeRatio = masterMode ? 0.9f : 0.7f; + float phase2LifeRatio = death ? 1f : 0.85f; + float phase3LifeRatio = death ? 0.9f : 0.7f; float respawnHandsLifeRatio = 0.5f; - float phase4LifeRatio = masterMode ? 0.4f : 0.3f; - float useSkullSpreadsAfterChargeLifeRatio = masterMode ? 0.3f : 0.2f; - float phase5LifeRatio = masterMode ? 0.2f : 0.1f; + float phase4LifeRatio = death ? 0.4f : 0.3f; + float useSkullSpreadsAfterChargeLifeRatio = death ? 0.3f : 0.2f; + float phase5LifeRatio = death ? 0.2f : 0.1f; // Begin firing spreads of skulls phase bool phase2 = lifeRatio < phase2LifeRatio; @@ -88,13 +87,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses void SpawnHands() { int skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = masterMode ? -1.3f : -1f; + Main.npc[skeletronHand].ai[0] = death ? -1.3f : -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].target = npc.target; Main.npc[skeletronHand].netUpdate = true; skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = masterMode ? 1.3f : 1f; + Main.npc[skeletronHand].ai[0] = death ? 1.3f : 1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = 150f; Main.npc[skeletronHand].Calamity().newAI[2] = 150f; @@ -105,7 +104,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = masterMode ? -1.3f : -1f; + Main.npc[skeletronHand].ai[0] = -1.3f; Main.npc[skeletronHand].Calamity().newAI[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = respawnHands ? -75f : 0f; @@ -114,7 +113,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[skeletronHand].netUpdate = true; skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[skeletronHand].ai[0] = masterMode ? 1.3f : 1f; + Main.npc[skeletronHand].ai[0] = 1.3f; Main.npc[skeletronHand].Calamity().newAI[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = respawnHands ? 75f : 150f; @@ -194,7 +193,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Reduce the amount of skulls per spread in later phases due to near-constant teleporting - if (!masterMode && numProj > 3) + if (!death && numProj > 3) { if (phase4) numProj--; @@ -340,7 +339,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && (!(npc.ai[1] == 1f && phase3) || masterMode)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && (!(npc.ai[1] == 1f && phase3) || death)) { // Teleport dust for (int m = 0; m < 30; m++) @@ -365,7 +364,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Skull shooting - if ((handsDead || masterMode) && npc.ai[1] == 0f && !phase4) + if ((handsDead || death) && npc.ai[1] == 0f && !phase4) { float skullProjFrequency = bossRush ? 15f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; if (Main.getGoodWorld) @@ -391,7 +390,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, damage, 0f, Main.myPlayer, -1f); Main.projectile[skullProjectile].timeLeft = 600; - if (masterMode && handsDead) + if (death && handsDead) { skullProjDirection = new Vector2(skullProjTargetX, skullProjTargetY).SafeNormalize(Vector2.UnitY); skullProjDirection *= skullProjSpeed * 2f; @@ -411,7 +410,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; calamityGlobalNPC.newAI[1] += 1f; - float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 8f : 6f) : (((masterMode && death) ? 6f : 4f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); + float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 8f : 6f) : ((death ? 6f : 4f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); if (!handsDead) chargePhaseChangeRateBoost *= 0.5f; @@ -422,10 +421,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[1] > chargePhaseGateValue) npc.localAI[1] = chargePhaseGateValue; - float forcedMoveAwayTime = death ? 30f : 45f; - if (masterMode) - forcedMoveAwayTime *= 0.5f; - + float forcedMoveAwayTime = death ? 15f : 45f; float canChargeDistance = phase3 ? 480f : 320f; // 20 tile distance, 30 tile distance in phase 3 bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime; bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance; @@ -448,11 +444,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - float headYAcceleration = (Main.getGoodWorld ? 0.07f : masterMode ? 0.06f : 0.04f) + (death ? 0.04f * (1f - lifeRatio) : 0f); + float headYAcceleration = (Main.getGoodWorld ? 0.07f : death ? (0.06f + 0.04f * (1f - lifeRatio)) : 0.04f); float headYTopSpeed = headYAcceleration * 100f; - float headXAcceleration = (Main.getGoodWorld ? 0.21f : masterMode ? 0.16f : 0.08f) + (death ? 0.08f * (1f - lifeRatio) : 0f); + float headXAcceleration = (Main.getGoodWorld ? 0.21f : death ? (0.16f + 0.08f * (1f - lifeRatio)) : 0.08f); float headXTopSpeed = headXAcceleration * 100f; - float deceleration = Main.getGoodWorld ? 0.83f : masterMode ? 0.86f : 0.89f; + float deceleration = Main.getGoodWorld ? 0.83f : death ? 0.86f : 0.89f; if (bossRush) { @@ -620,10 +616,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 240f) { - float shadowFlameProjectileSpeed = death ? 5f : 4f; - if (masterMode) - shadowFlameProjectileSpeed *= 1.2f; - + float shadowFlameProjectileSpeed = death ? 6f : 4f; Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed; int type = ProjectileID.Shadowflames; int damage = npc.GetProjectileDamage(type); @@ -646,7 +639,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool dontGoMach10 = false; - float dashPhaseTime = masterMode ? 210f : 300f; + float dashPhaseTime = death ? 210f : 300f; if (npc.ai[2] >= dashPhaseTime) { if (Main.getGoodWorld) @@ -691,7 +684,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 perturbedSpeed = initialProjectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, k / (float)(chargeSkullAmt - 1))); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, -1f); Main.projectile[proj].timeLeft = 600; - if (masterMode) + if (death) { int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, -2f); Main.projectile[proj2].timeLeft = 600; @@ -731,12 +724,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses headSpinVelocityMult += velocityBoost; } - float altDashStopDistance = death ? (masterMode ? 320f : 360f) : (masterMode ? 360f : 400f); + float altDashStopDistance = death ? 320f : 400f; float headSpeedIncreaseDist = phase3 ? altDashStopDistance : 160f; if (headSpinTargetDist > headSpeedIncreaseDist) { float velocityMult = phase3 ? 0.00075f : 0.0015f; - float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - headSpeedIncreaseDist) * 0.0015f, 0.05f, masterMode ? 2f : 1.5f); + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headSpinTargetDist - headSpeedIncreaseDist) * 0.0015f, 0.05f, death ? 2f : 1.5f); headSpinVelocityMult *= baseDistanceVelocityMult; } @@ -834,7 +827,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -844,7 +836,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float yMultiplier = 1f; if (calamityGlobalNPC.newAI[0] != 0f) yMultiplier = calamityGlobalNPC.newAI[0]; - if (masterMode) + if (death) yMultiplier *= 1.3f; // Inflict 0 damage for 3 seconds after spawning @@ -906,9 +898,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocityMultiplier = MathHelper.Lerp(death ? 0.6f : 0.7f, 1f, skeletronLifeRatio); float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.4f : 0.3f, 1f - skeletronLifeRatio); float handSwipeVelocity = MathHelper.Lerp(16f, death ? 24f : 20f, 1f - skeletronLifeRatio); - float deceleration = Main.getGoodWorld ? 0.78f : masterMode ? 0.82f : 0.86f; + float deceleration = Main.getGoodWorld ? 0.78f : death ? 0.82f : 0.86f; - if (masterMode) + if (death) { velocityMultiplier *= 0.75f; velocityIncrement *= 1.5f; @@ -916,11 +908,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses deceleration *= 0.75f; } - float handSwipeDistance = masterMode ? HandSwipeDistance_Master : HandSwipeDistance; + float handSwipeDistance = death ? HandSwipeDistance_Master : HandSwipeDistance; float handSwipeDuration = handSwipeDistance / handSwipeVelocity; float slapGateValue = HandSlapGateValue; - float slapTimerIncrement = MathHelper.Lerp(masterMode ? 1.5f : 1f, masterMode ? 3f : 2f, 1f - skeletronLifeRatio); + float slapTimerIncrement = MathHelper.Lerp(death ? 1.5f : 1f, death ? 3f : 2f, 1f - skeletronLifeRatio); if (phase3) slapTimerIncrement *= (death ? 2.5f : 2f); else if (phase2) @@ -1094,7 +1086,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; // Spawn projectiles - if (masterMode && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !cancelSlap) + if (death && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !cancelSlap) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1153,7 +1145,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; // Spawn projectiles - if (masterMode && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !cancelSlap) + if (death && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !cancelSlap) { if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 91ae7eb218..8d032b1f72 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -44,7 +43,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Spawn second head in Master Mode // The main head owns the Saw and the Laser in Master Mode - if (masterMode) + if (death) { int head = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); Main.npc[head].ai[0] = npc.whoAmI; @@ -64,6 +63,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[arm].target = npc.target; Main.npc[arm].netUpdate = true; Main.npc[arm].ai[3] = 150f; + + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Main.npc[head].TypeName), 175, 75); + else if (Main.dedServ) + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[head].GetTypeNetName()), new Color(175, 75, 255)); } else { @@ -99,7 +103,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); } - if (masterMode) + if (death) { if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { @@ -178,9 +182,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool phase2 = lifeRatio < 0.66f; - bool spawnDestroyer = lifeRatio < 0.75f && masterMode && !bossRush && npc.localAI[2] == 0f; + bool spawnDestroyer = lifeRatio < 0.75f && death && !bossRush && npc.localAI[2] == 0f; bool phase3 = lifeRatio < 0.33f; - bool spawnRetinazer = lifeRatio < 0.5f && masterMode && !bossRush && npc.localAI[2] == 1f; + bool spawnRetinazer = lifeRatio < 0.5f && death && !bossRush && npc.localAI[2] == 1f; // Spawn The Destroyer in Master Mode (just like Oblivion from Avalon) if (spawnDestroyer) @@ -305,16 +309,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Start other phases; if arms are dead, start with spin phase bool otherHeadChargingOrSpinning = Main.npc[(int)npc.ai[0]].ai[1] == 5f || Main.npc[(int)npc.ai[0]].ai[1] == 1f; - if (phase2 || CalamityWorld.LegendaryMode || allArmsDead || masterMode) + if (phase2 || CalamityWorld.LegendaryMode || allArmsDead || death) { // Start spin phase after 1.5 seconds npc.ai[2] += phase3 ? 1.5f : 1f; - if (npc.ai[2] >= (90f - (death ? (masterMode ? 15f : 60f) * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || !masterMode || phase3) && (canUseAttackInMaster || !masterMode)) + if (npc.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || !death || phase3) && (canUseAttackInMaster || !death)) { bool shouldSpinAround = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 320f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; - bool shouldCharge = masterMode && !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; + bool shouldCharge = death && !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; if (shouldCharge) { npc.ai[2] = 0f; @@ -342,7 +346,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.X / 15f; - float acceleration = (bossRush ? 0.16f : masterMode ? 0.12f : 0.1f) + (death ? 0.05f * (1f - lifeRatio) : 0f); + float acceleration = bossRush ? 0.2f : (death ? (0.12f + 0.05f * (1f - lifeRatio)) : 0.1f); float accelerationMult = 1f; if (!cannonAlive) { @@ -358,11 +362,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += 0.0125f; if (!sawAlive) acceleration += 0.0125f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.7f : 0.85f; + float deceleration = death ? 0.7f : 0.85f; float headDecelerationUpDist = 0f; float headDecelerationDownDist = 0f; @@ -435,7 +439,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 24 : death ? (masterMode ? 15 : 18) : 12; + int totalProjectiles = bossRush ? 24 : death ? 15 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); @@ -493,7 +497,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float headTargetY = Main.player[npc.target].Center.Y - headPosition.Y; float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); - float speed = bossRush ? 12f : (masterMode ? 8f : 6f); + float speed = bossRush ? 12f : death ? 8f : 6f; if (phase2) speed += 0.5f; if (phase3) @@ -645,9 +649,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 50f; - float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round((masterMode ? 3f : 5f) * (1f - lifeRatio)) : 15f; + float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round(3f * (1f - lifeRatio)) : 15f; float totalSkulls = 12f; - int skullSpread = bossRush ? 250 : death ? (masterMode ? 125 : 150) : 100; + int skullSpread = bossRush ? 250 : death ? 125 : 100; // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning @@ -688,7 +692,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 headCenter = npc.Center; - float enragedHeadSpeed = (masterMode ? 5f : 4f) + (death ? (masterMode ? 1f : 2f) * (1f - lifeRatio) : 0f); + float enragedHeadSpeed = death ? (5f + (1f - lifeRatio)) : 4f; float enragedHeadSkullTargetX = Main.player[npc.target].Center.X - headCenter.X + Main.rand.Next(-20, 21); float enragedHeadSkullTargetY = Main.player[npc.target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); @@ -717,7 +721,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] % 3f == 0f) { - int probeLimit = death ? (masterMode ? 3 : 4) : 2; + int probeLimit = death ? 3 : 2; if (NPC.CountNPCS(NPCID.Probe) < probeLimit) NPC.NewNPC(npc.GetSource_FromAI(), (int)headCenter.X, (int)headCenter.Y + 30, NPCID.Probe); } @@ -756,14 +760,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 24f : death ? 21f : 18f; - float flightAcceleration = bossRush ? 1f : death ? 0.8f : 0.6f; - - if (masterMode) - { - flightVelocity += 4f; - flightAcceleration += 0.16f; - } + float flightVelocity = bossRush ? 29f : death ? 25f : 18f; + float flightAcceleration = bossRush ? 1.12f : death ? 0.96f : 0.6f; Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 420f); npc.SimpleFlyMovement((destination - npc.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); @@ -772,8 +770,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[3] += 1f; if (Vector2.Distance(npc.Center, destination) < 80f || npc.ai[2] > 0f || npc.localAI[3] > 120f) { - float missileSpawnDivisor = death ? 8f : (masterMode ? 10f : 12f); - float totalMissiles = masterMode ? 12f : 10f; + float missileSpawnDivisor = death ? 10f : 12f; + float totalMissiles = death ? 12f : 10f; npc.ai[2] += 1f; if (npc.ai[2] % missileSpawnDivisor == 0f) { @@ -825,7 +823,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -885,7 +882,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool normalLaserRotation = npc.localAI[1] % 2f == 0f; // Movement - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -896,11 +893,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += 0.025f; if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 70f) { @@ -960,7 +957,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 200f : 800f)) + if (npc.ai[3] >= (death ? 200f : 800f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.localAI[0] = 0f; @@ -1056,7 +1053,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 32 : (masterMode ? 24 : 16); + int totalProjectiles = bossRush ? 32 : death ? 24 : 16; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); @@ -1094,7 +1091,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -1171,7 +1167,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 200f : 800f)) + if (npc.ai[3] >= (death ? 200f : 800f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.localAI[0] = 0f; @@ -1208,7 +1204,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Movement - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!laserAlive) { @@ -1219,11 +1215,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += 0.025f; if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 70f) { @@ -1374,7 +1370,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeViceAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -1439,7 +1434,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Return to the head if (npc.ai[2] == 99f) { - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1453,11 +1448,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) { @@ -1521,7 +1516,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 150f : 600f)) + if (npc.ai[3] >= (death ? 150f : 600f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.ai[2] += 1f; @@ -1529,7 +1524,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1543,11 +1538,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!sawAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 100f) { @@ -1601,7 +1596,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge towards the player if (npc.ai[2] == 1f) { - float deceleration = masterMode ? 0.75f : 0.8f; + float deceleration = death ? 0.75f : 0.8f; if (npc.velocity.Y > 0f) npc.velocity.Y *= deceleration; @@ -1743,7 +1738,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeSawAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -1806,7 +1800,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 99f) { - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1820,11 +1814,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!viceAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 20f) { @@ -1884,7 +1878,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!viceAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= (masterMode ? 90f : 180f)) + if (npc.ai[3] >= (death ? 90f : 180f)) { npc.target = Main.npc[(int)npc.ai[1]].target; npc.ai[2] += 1f; @@ -1892,7 +1886,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = (bossRush ? 0.6f : death ? (masterMode ? 0.375f : 0.3f) : (masterMode ? 0.3125f : 0.25f)); + float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1906,11 +1900,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (!viceAlive) acceleration += 0.025f; - if (masterMode) + if (death) acceleration *= accelerationMult; float topVelocity = acceleration * 100f; - float deceleration = masterMode ? 0.6f : 0.8f; + float deceleration = death ? 0.6f : 0.8f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 100f) { @@ -1968,7 +1962,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float sawArmChargeTargetY = Main.npc[(int)npc.ai[1]].position.Y + 230f - sawArmChargePos.Y; npc.rotation = (float)Math.Atan2(sawArmChargeTargetY, sawArmChargeTargetX) + MathHelper.PiOver2; - float deceleration = masterMode ? 0.875f : 0.9f; + float deceleration = death ? 0.875f : 0.9f; npc.velocity.X *= deceleration; npc.velocity.Y -= 0.5f; if (npc.velocity.Y < -12f) @@ -2022,7 +2016,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeVelocity += 1.5f; if (!viceAlive) chargeVelocity += 1.5f; - if (masterMode) + if (death) chargeVelocity *= 1.25f; Vector2 sawArmOtherChargePos = npc.Center; @@ -2033,11 +2027,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses sawArmOtherChargeTargetX *= sawArmOtherChargeTargetDist; sawArmOtherChargeTargetY *= sawArmOtherChargeTargetDist; - float acceleration = bossRush ? 0.3f : death ? 0.1f : 0.08f; - if (masterMode) - acceleration *= 1.25f; - - float deceleration = masterMode ? 0.6f : 0.8f; + float acceleration = bossRush ? 0.3f : death ? 0.125f : 0.08f; + float deceleration = death ? 0.6f : 0.8f; if (npc.velocity.X > sawArmOtherChargeTargetX) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 867dc6f4b9..e77b34c8f2 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -18,7 +18,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -29,7 +28,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; + float enrageScale = bossRush ? 0.5f : death ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -79,7 +78,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Check for Oblivion in Master Mode bool oblivionAlive = false; - if (masterMode && !bossRush && npc.localAI[3] == 1f) + if (death && !bossRush && npc.localAI[3] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -92,9 +91,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Foveanator spawn - if (!oblivionAlive && masterMode && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) + if (!oblivionAlive && death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) { - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); calamityGlobalNPC.newAI[0] = 1f; npc.SyncExtraAI(); } @@ -102,25 +101,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; - float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables - float phase1MaxSpeedIncrease = masterMode ? 2f : 4f; - float phase1MaxAccelerationIncrease = masterMode ? 0.025f : 0.05f; - float phase1MaxChargeSpeedIncrease = masterMode ? 3f : 6f; + float phase1MaxSpeedIncrease = death ? 2f : 4f; + float phase1MaxAccelerationIncrease = death ? 0.025f : 0.05f; + float phase1MaxChargeSpeedIncrease = death ? 3f : 6f; // Phase duration variables - float phase1MaxLaserPhaseDurationDecrease = masterMode ? 120f : 300f; + float phase1MaxLaserPhaseDurationDecrease = death ? 120f : 300f; // If Oblivion is alive reduce aggression of all attacks if (oblivionAlive) { - phase1MaxSpeedIncrease = masterMode ? 1f : 2f; - phase1MaxAccelerationIncrease = masterMode ? 0.0125f : 0.025f; - phase1MaxChargeSpeedIncrease = masterMode ? 1.5f : 3f; + phase1MaxSpeedIncrease = death ? 1f : 2f; + phase1MaxAccelerationIncrease = death ? 0.0125f : 0.025f; + phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - phase1MaxLaserPhaseDurationDecrease = masterMode ? 60f : 150f; + phase1MaxLaserPhaseDurationDecrease = death ? 60f : 150f; } // Phase checks @@ -199,7 +198,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); - float phaseGateValue = (masterMode ? 300f : 450f) - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float phaseGateValue = death ? (300f - phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 450f; float laserGateValue = oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f; if (NPC.IsMechQueenUp) { @@ -283,13 +282,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; npc.ai[2] += 1f; - float decelerateGateValue = (masterMode ? 36f : 32f) + (death ? (masterMode ? 6f : 12f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerateGateValue = (death ? 36f : 32f) + (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (npc.ai[2] >= decelerateGateValue) { // Avoid cheap bullshit npc.damage = 0; - float decelerationMultiplier = (masterMode ? 0.84f : 0.92f) - (death ? (masterMode ? 0.16f : 0.32f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerationMultiplier = (death ? 0.84f : 0.92f) - (death ? 0.16f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); npc.velocity *= decelerationMultiplier; if (Math.Abs(npc.velocity.X) < 0.1) @@ -300,7 +299,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - float delayBeforeChargingAgain = (masterMode ? 48f : 56f) - (death ? (masterMode ? 3f : 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (npc.ai[2] >= delayBeforeChargingAgain + (oblivionAlive ? 15f : 0f)) { npc.ai[3] += 1f; @@ -366,7 +365,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation += npc.ai[2]; npc.ai[1] += 1f; - if (masterMode && npc.ai[2] >= 0.2f) + if (death && npc.ai[2] >= 0.2f) { if (npc.ai[1] % 10f == 0f) { @@ -603,7 +602,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[2] += spazAlive ? 1f : 1.5f; - if (npc.ai[2] >= (masterMode ? 150f : 180f) - (death ? (masterMode ? 60f : 90f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + if (npc.ai[2] >= (death ? 150f : 180f) - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) { npc.ai[1] = finalPhase ? 4f : 0f; npc.ai[2] = 0f; @@ -707,7 +706,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; float chargeIncrement = 1f; - if (masterMode && Main.rand.NextBool() && npc.ai[3] < (spazAlive ? 1f : 3f)) + if (death && Main.rand.NextBool() && npc.ai[3] < (spazAlive ? 1f : 3f)) { chargeIncrement = 2f; @@ -781,7 +780,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Get a target @@ -792,7 +790,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; + float enrageScale = bossRush ? 0.5f : death ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -847,7 +845,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Check for Oblivion in Master Mode bool oblivionAlive = false; - if (masterMode && !bossRush && npc.localAI[3] == 1f) + if (death && !bossRush && npc.localAI[3] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -862,27 +860,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; - float finalPhaseLifeRatio = masterMode ? 0.3f : 0.15f; + float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float finalPhaseLifeRatio = death ? 0.3f : 0.15f; // Movement variables - float phase1MaxSpeedIncrease = masterMode ? 2.25f : 4.5f; - float phase1MaxAccelerationIncrease = masterMode ? 0.075f : 0.15f; - float phase1MaxChargeSpeedIncrease = masterMode ? 3f : 6f; + float phase1MaxSpeedIncrease = death ? 2.25f : 4.5f; + float phase1MaxAccelerationIncrease = death ? 0.075f : 0.15f; + float phase1MaxChargeSpeedIncrease = death ? 3f : 6f; // Phase duration variables - float phase1MaxCursedFlamePhaseDurationDecrease = masterMode ? 80f : 200f; - float phase1MaxChargesDecrease = masterMode ? 2f : 4f; + float phase1MaxCursedFlamePhaseDurationDecrease = death ? 80f : 200f; + float phase1MaxChargesDecrease = death ? 2f : 4f; // If Oblivion is alive reduce aggression of all attacks if (oblivionAlive) { - phase1MaxSpeedIncrease = masterMode ? 1.125f : 2.25f; - phase1MaxAccelerationIncrease = masterMode ? 0.0375f : 0.075f; - phase1MaxChargeSpeedIncrease = masterMode ? 1.5f : 3f; + phase1MaxSpeedIncrease = death ? 1.125f : 2.25f; + phase1MaxAccelerationIncrease = death ? 0.0375f : 0.075f; + phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - phase1MaxCursedFlamePhaseDurationDecrease = masterMode ? 40f : 100f; - phase1MaxChargesDecrease = masterMode ? 1f : 2f; + phase1MaxCursedFlamePhaseDurationDecrease = death ? 40f : 100f; + phase1MaxChargesDecrease = death ? 1f : 2f; } // Phase checks @@ -1041,7 +1039,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; - float timeBeforeSlowDown = masterMode ? 30f : 10f; + float timeBeforeSlowDown = death ? 30f : 10f; if (npc.ai[2] >= timeBeforeSlowDown) { // Avoid cheap bullshit @@ -1059,7 +1057,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charge 8 times - float chargeTime = masterMode ? 45f : 25f; + float chargeTime = death ? 45f : 25f; if (npc.ai[2] >= chargeTime + (oblivionAlive ? 15f : 0f)) { // Reset AI array and go to cursed fireball phase @@ -1126,7 +1124,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation += npc.ai[2]; npc.ai[1] += 1f; - if (masterMode && npc.ai[2] >= 0.2f) + if (death && npc.ai[2] >= 0.2f) { if (npc.ai[1] % 10f == 0f) { @@ -1236,7 +1234,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Boost speed if too far from target if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : masterMode ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); + maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -1302,7 +1300,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses flamethrowerVelocity = (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * flamethrowerSpeed + npc.velocity * 0.5f; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - if (masterMode && npc.ai[3] % 30f == 0f) + if (death && npc.ai[3] % 30f == 0f) { type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; damage = npc.GetProjectileDamage(type); @@ -1526,7 +1524,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ForceNetUpdate(false); float chargeIncrement = 1f; - if (masterMode && Main.rand.NextBool() && npc.ai[3] < (retAlive ? 2f : 3f)) + if (death && Main.rand.NextBool() && npc.ai[3] < (retAlive ? 2f : 3f)) chargeIncrement = 2f; npc.ai[3] += chargeIncrement; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 59a4702655..9b0df45190 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -21,7 +21,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Despawn @@ -82,7 +81,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; if (npc.ai[2] == 0f) { - if (masterMode) + if (death) npc.ai[1] += 2f; if (phase2) @@ -113,11 +112,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (NPC.CountNPCS(NPCID.LeechHead) < 10) { int leechSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.Center.Y + 20f), NPCID.LeechHead, 1); - int leechVelocity = masterMode ? 12 : 9; + int leechVelocity = death ? 12 : 9; Main.npc[leechSpawn].velocity.X = npc.direction * leechVelocity; } - if (phase2 || masterMode) + if (phase2 || death) { // Get target vector Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * npc.velocity.Length(); @@ -128,7 +127,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.projectile[proj].timeLeft = 600; Main.projectile[proj].tileCollide = false; - if (masterMode) + if (death) { float fireballVelocity = npc.velocity.Length() + 3f; projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * fireballVelocity; @@ -250,7 +249,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float halfAverageScreenWidth = 960f; float distanceBeforeSlowingDown = 640f; - float timeBeforeEnrage = (masterMode ? 150f : 600f) - (death ? (masterMode ? 130f : 390f) * (1f - lifeRatio) : 0f); + float timeBeforeEnrage = death ? (150f - 130f * (1f - lifeRatio)) : 600f; float speedMult = 1f; if (bossRush) @@ -309,7 +308,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses speedMult += 0.2f; float masterModeVelocityBoost = 0f; - if (masterMode) + if (death) { float velocityBoostStartDistance = distanceBeforeSlowingDown; float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; @@ -325,7 +324,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + masterModeVelocityBoost + velocityBoost; velocityX *= speedMult; - if (masterMode) + if (death) velocityX *= 1.2f; if (Main.getGoodWorld) @@ -442,7 +441,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (bossRush) chance /= 4; - else if (masterMode) + else if (death) chance /= 2; if (chance < 2) @@ -450,7 +449,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.rand.NextBool(chance)) { - int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(masterMode ? 2f : 1f, masterMode ? 8f : 4f, npc.life / (float)npc.lifeMax)); + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(death ? 2f : 1f, death ? 8f : 4f, npc.life / (float)npc.lifeMax)); if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { int hungryAmt = 0; @@ -466,7 +465,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int maxValue = 1 + hungryAmt * 2; - if (masterMode) + if (death) maxValue /= 2; if (maxValue < 2) @@ -513,21 +512,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses mouthYPosition = (mouthYPosition + Main.wofDrawAreaTop) / 2f; int eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI); Main.npc[eyeSpawn].ai[0] = 1f; - if (masterMode) + if (death) Main.npc[eyeSpawn].ai[3] = 1f; mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; eyeSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.WallofFleshEye, npc.whoAmI); Main.npc[eyeSpawn].ai[0] = -1f; - if (masterMode) + if (death) Main.npc[eyeSpawn].ai[3] = -1f; mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - int maxHungries = masterMode ? 16 : 11; - float maxOffset = masterMode ? (0.2f / 3f) : 0.1f; + int maxHungries = death ? 16 : 11; + float maxOffset = death ? (0.2f / 3f) : 0.1f; for (int j = 0; j < maxHungries; j++) { int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); @@ -549,22 +548,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + CalamityUtils.CalamityTargeting(npc, default); - float acceleration = Main.masterMode ? 0.15f : 0.12f; + float acceleration = death ? 0.15f : 0.12f; float distanceFromWall = 300f; npc.damage = npc.defDamage; npc.defense = npc.defDefense; if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) { - npc.damage = Main.masterMode ? 180 : 120; + npc.damage = death ? 180 : 120; npc.defense = 30; - acceleration += Main.masterMode ? 0.1f : 0.08f; + acceleration += death ? 0.1f : 0.08f; } else if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75) { - npc.damage = Main.masterMode ? 135 : 90; + npc.damage = death ? 135 : 90; npc.defense = 20; - acceleration += Main.masterMode ? 0.05f : 0.04f; + acceleration += death ? 0.05f : 0.04f; } if (npc.whoAmI % 4 == 0) @@ -652,7 +654,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (wallLifeRatio < 0.1f) velocityBoost += 0.9f; - velocityBoost *= Main.masterMode ? 1.5f : 1.25f; + velocityBoost *= death ? 1.5f : 1.25f; velocityBoost += 0.3f; maxVelocity += velocityBoost * 0.35f; if (npc.Center.X < Main.npc[Main.wofNPCIndex].Center.X && Main.npc[Main.wofNPCIndex].velocity.X > 0f) @@ -701,7 +703,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || bossRush; bool death = CalamityWorld.death || bossRush; // Avoid cheap bullshit @@ -729,7 +730,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity, direction, and position bool shouldFireLasers = true; float phase2LifeRatio = 0.5f; - bool masterModeDetach = lifeRatio < phase2LifeRatio && masterMode; + bool masterModeDetach = lifeRatio < phase2LifeRatio && death; 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 (!masterModeDetach) { diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index e7165ba3ad..9a30ff4d0a 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -3000,7 +3000,7 @@ namespace CalamityMod.NPCs.Yharon normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 35, 40)); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); @@ -3037,7 +3037,7 @@ namespace CalamityMod.NPCs.Yharon if (BossRushEvent.BossRushActive) return; - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedYharon); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedYharon); CalamityGlobalNPC.SetNewBossJustDowned(NPC); // If Yharon has not been killed yet, notify players of Auric Ore diff --git a/Packets/Worlds/WantToRefundReforgesPacket.cs b/Packets/Worlds/WantToRefundReforgesPacket.cs index fd019a0ab4..440cd6791b 100644 --- a/Packets/Worlds/WantToRefundReforgesPacket.cs +++ b/Packets/Worlds/WantToRefundReforgesPacket.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Packets if (!Main.dedServ) return; - int banditIdx = NPC.FindFirstNPC(ModContent.NPCType()); + int banditIdx = NPC.FindFirstNPC(ModContent.NPCType()); if (banditIdx == -1) return; @@ -37,7 +37,7 @@ namespace CalamityMod.Packets if (bandit == null || !bandit.active) return; - THIEF.DoRefund(bandit); + Bandit.DoRefund(bandit); } } } diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index ee6649cf23..cebbf59dee 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -56,7 +56,20 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(NewTexture).Value; - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(tex.Size().X / joke.Size().X, tex.Size().Y / joke.Size().Y, 0.5f)); + Main.NewText(scaleMult); + tex = joke; + UseAltVisual = true; + } + } + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish * scaleMult, SpriteEffects.None, 0); } } diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs index f0fdc3c22b..72087bb46b 100644 --- a/Particles/CustomSpark.cs +++ b/Particles/CustomSpark.cs @@ -20,13 +20,15 @@ namespace CalamityMod.Particles public Vector2 Stretch = new Vector2(0.5f, 1.6f); public float ShrinkSpeed = 0; public bool FlipHorizontal = false; + public bool NoShrink = false; + public float Spin = 0; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public bool AltVisual = true; public override bool UseAdditiveBlend => AltVisual; public override bool SetLifetime => true; public override bool UseCustomDraw => true; - public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false) + public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0) { Position = relativePosition; Velocity = velocity; @@ -46,18 +48,21 @@ namespace CalamityMod.Particles GlowCenterScale = glowCenterScale; GlowOpacity = glowOpacity; FlipHorizontal = flipHorizontal; + NoShrink = noShrink; FadeIn = fadeIn; if (FadeIn) Scale = 0f; + Spin = spin; } public override void Update() { if (!FadeIn) { - Scale *= 0.95f; + if (!NoShrink) + Scale *= 0.95f; Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); } else @@ -77,6 +82,7 @@ namespace CalamityMod.Particles Velocity.X *= 0.94f; Velocity.Y += 0.25f; } + ExtraRotation += Spin; Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; Stretch.X *= (1 - 0.2f * ShrinkSpeed); @@ -88,6 +94,19 @@ namespace CalamityMod.Particles Vector2 scale = Stretch * Scale; Texture2D texture = ModContent.Request(NewTexture).Value; + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + AltVisual = true; + } + } + Color col = Color; if (AffectedByLight) @@ -95,9 +114,9 @@ namespace CalamityMod.Particles col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); } - spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } } diff --git a/Particles/CustomSprite.cs b/Particles/CustomSprite.cs index 0b18707b4d..2fee8656b7 100644 --- a/Particles/CustomSprite.cs +++ b/Particles/CustomSprite.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Particles { bool addBlend = false; bool important = false; - bool AffectedByGravity = false; - string Tex = ""; + Texture2D Tex; int frames = 1; int currentFrame = 1; @@ -31,6 +30,22 @@ namespace CalamityMod.Particles public override int FrameVariants => frames; public CustomSprite(Vector2 relativePosition, Vector2 velocity, int lifetime, string tex, float scale, Color color, float grav = 0f, bool AddativeBlend = true, bool needed = false, int frameCount = 1, int frame = 0) + { + maxGravity = grav; + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + addBlend = AddativeBlend; + important = needed; + Color = color; + Tex = ModContent.Request(tex).Value; + frames = frameCount; + currentFrame = frame; + } + + // Overload which takes a Texture2D instead of a string for the texture to use + public CustomSprite(Vector2 relativePosition, Vector2 velocity, int lifetime, Texture2D tex, float scale, Color color, float grav = 0f, bool AddativeBlend = true, bool needed = false, int frameCount = 1, int frame = 0) { maxGravity = grav; Position = relativePosition; @@ -70,11 +85,9 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Asset tex = ModContent.Request(Tex); + Rectangle fr = Tex.Frame(1, frames, 0, currentFrame); - Rectangle fr = tex.Frame(1, frames, 0, currentFrame); - - Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, fr, Color.Lerp(Color.Transparent, Color, Opacity), Rotation, new Vector2(tex.Width() * 0.5f, tex.Height() / frames * 0.5f), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(Tex, Position - Main.screenPosition, fr, Color.Lerp(Color.Transparent, Color, Opacity), Rotation, new Vector2(Tex.Width * 0.5f, Tex.Height / frames * 0.5f), 1f, SpriteEffects.None); } } } diff --git a/Particles/DualTrail.png b/Particles/DualTrail.png new file mode 100644 index 0000000000..ba91236d23 Binary files /dev/null and b/Particles/DualTrail.png differ diff --git a/Particles/GlowBlade.png b/Particles/GlowBlade.png new file mode 100644 index 0000000000..3b0ee2a739 Binary files /dev/null and b/Particles/GlowBlade.png differ diff --git a/Particles/GlowSparkParticle.cs b/Particles/GlowSparkParticle.cs index 7e81b9a9c4..c2f7729ba3 100644 --- a/Particles/GlowSparkParticle.cs +++ b/Particles/GlowSparkParticle.cs @@ -66,9 +66,21 @@ namespace CalamityMod.Particles Vector2 scale = Squash * Scale; Texture2D texture = ModContent.Request(Texture).Value; - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); if (Glowing) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f) * scaleMult, 0, 0f); } } } diff --git a/Particles/GlowSquareFading.png b/Particles/GlowSquareFading.png new file mode 100644 index 0000000000..d14e66bf43 Binary files /dev/null and b/Particles/GlowSquareFading.png differ diff --git a/Particles/GlowSquareParticleThick.png b/Particles/GlowSquareParticleThick.png new file mode 100644 index 0000000000..09dd34cbde Binary files /dev/null and b/Particles/GlowSquareParticleThick.png differ diff --git a/Particles/MammothParticle.png b/Particles/MammothParticle.png new file mode 100644 index 0000000000..7d4f3fbb7f Binary files /dev/null and b/Particles/MammothParticle.png differ diff --git a/Particles/SeaPrismParticle.cs b/Particles/SeaPrismParticle.cs index 5df125c14e..9c33915342 100644 --- a/Particles/SeaPrismParticle.cs +++ b/Particles/SeaPrismParticle.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Particles if (FadeIn) Scale = 0f; - Variant = Main.rand.Next(6); + Variant = Main.rand.Next(3); } public override void Update() diff --git a/Particles/SmokeExplosion.png b/Particles/SmokeExplosion.png new file mode 100644 index 0000000000..e5fc5b2953 Binary files /dev/null and b/Particles/SmokeExplosion.png differ diff --git a/Particles/SquareRotated.png b/Particles/SquareRotated.png new file mode 100644 index 0000000000..259d177399 Binary files /dev/null and b/Particles/SquareRotated.png differ diff --git a/Particles/VelChangingSpark .cs b/Particles/VelChangingSpark .cs index f917530522..6329ef2c06 100644 --- a/Particles/VelChangingSpark .cs +++ b/Particles/VelChangingSpark .cs @@ -96,9 +96,22 @@ namespace CalamityMod.Particles col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); } - spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + AltVisual = true; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * 0.8f * scaleMult, 0, 0f); } } } diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index b99150bbcb..6e413c3fd5 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -12,9 +12,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles { public abstract class BaseCustomUseStyleProjectile : ModProjectile { - + public bool whenSpawned = true; public override void SetDefaults() { + // Width and height are set here so it can destroy cobwebs better lol + Projectile.width = (int)Math.Max(HitboxSize.X, 1); + Projectile.height = (int)Math.Max(HitboxSize.Y, 1); Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; @@ -149,6 +152,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles ///
public virtual void ResetStyle() { } + /// + /// Determines the behavior of the projectile when spawned. (but it is multiplayer synced) + /// + public virtual void WhenSpawned() { } /// /// Determines the behavior of the projectile when the item is in use. /// @@ -167,6 +174,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { + if (whenSpawned) + { + WhenSpawned(); + whenSpawned = false; + Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.netUpdate = true; + } + bool ItemAnimationActive = Owner.ItemAnimationActive; if (Owner.HeldItem.type != AssignedItemID || Owner.dead) diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 116e59a084..e657cca25b 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -178,6 +178,9 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45f, targetHitbox); + // Explodes on contact + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => Projectile.Kill(); + public override void OnKill(int timeLeft) { // Nuke explosion sound. diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 143bd0df9f..f97ab9edf4 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -323,7 +323,7 @@ namespace CalamityMod.Projectiles.Boss string path = Main.zenithWorld ? "GFB" : ""; path += Main.rand.Next(1, 4).ToString(); if (Main.myPlayer == player.whoAmI && player.statLife <= 0) - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.WhisperingMaelstrom" + path).Format(player.name)), 1000, -1); + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.WhisperingMaelstrom" + path).ToNetworkText(player.name)), 1000, -1); // Still do not allow a standard hit, but the player should surely be feeling the pain soon... return false; diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index 8ff63ebb1e..b432ef06c5 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -42,18 +42,11 @@ namespace CalamityMod.Projectiles.Boss Time++; if (Time == TotalRitualTime - PulseTime) { - int idx = NPC.NewNPC(Projectile.GetSource_FromThis(), (int)Projectile.Center.X, (int)Projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); - if (idx != -1) + if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, Projectile.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { + int idx = NPC.NewNPC(Projectile.GetSource_FromThis(), (int)Projectile.Center.X, (int)Projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); + if (idx != -1) CalamityUtils.BossAwakenMessage(idx); - } - else - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); - } } } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 3b31f317a9..fb7b61c8e4 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss } } } - else + else if (Main.rand.NextBool()) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.8f); Main.dust[dust].noGravity = true; @@ -86,17 +87,17 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D texture = TextureAssets.Projectile[Type].Value; int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D texture = TextureAssets.Projectile[Type].Value; int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -104,21 +105,16 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 20; - 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 i = 0; i < 4; i++) + + for (int i = 0; i < 3; i++) { - int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1f); Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { @@ -126,9 +122,10 @@ namespace CalamityMod.Projectiles.Boss Main.dust[shroomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int j = 0; j < 12; j++) + + for (int j = 0; j < 9; j++) { - int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); Main.dust[shroomDust2].noGravity = true; Main.dust[shroomDust2].velocity *= 2f; Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 5645ec3df9..61adeb46bc 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss } } } - else + else if (Main.rand.NextBool()) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.8f); Main.dust[dust].noGravity = true; @@ -75,12 +76,12 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - float velocityYLimit = BossRushEvent.BossRushActive ? 12f : CalamityWorld.death ? 6f : 5f; - float velocityYIncrement = BossRushEvent.BossRushActive ? 0.24f : CalamityWorld.death ? 0.12f : 0.1f; + float velocityYLimit = Projectile.ai[0] == 1f ? 1f : BossRushEvent.BossRushActive ? 12f : CalamityWorld.death ? 6f : 5f; + float velocityYIncrement = Projectile.ai[0] == 1f ? 0.1f : BossRushEvent.BossRushActive ? 0.24f : CalamityWorld.death ? 0.12f : 0.1f; if (Projectile.velocity.Y < velocityYLimit) Projectile.velocity.Y += velocityYIncrement; - if (Math.Abs(Projectile.velocity.X) > 2f) + if (Math.Abs(Projectile.velocity.X) > (Projectile.ai[0] == 1f ? 0f : 2f)) Projectile.velocity.X *= 0.995f; } @@ -90,7 +91,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D texture = TextureAssets.Projectile[Type].Value; int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; @@ -98,31 +99,26 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } public override void PostDraw(Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D texture = TextureAssets.Projectile[Type].Value; int height = texture.Height / Main.projFrames[Type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 20; - 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 i = 0; i < 4; i++) + + for (int i = 0; i < 3; i++) { - int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1f); Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { @@ -130,9 +126,10 @@ namespace CalamityMod.Projectiles.Boss Main.dust[shroomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int j = 0; j < 12; j++) + + for (int j = 0; j < 9; j++) { - int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); Main.dust[shroomDust2].noGravity = true; Main.dust[shroomDust2].velocity *= 2f; Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); @@ -142,9 +139,7 @@ namespace CalamityMod.Projectiles.Boss { int crab = NPC.NewNPC(Projectile.GetSource_FromAI(), (int)Projectile.Center.X, (int)Projectile.Center.Y, NPCID.Crab); if (crab.WithinBounds(Main.maxNPCs)) - { Main.projectile[crab].timeLeft = 1200; - } } } } diff --git a/Projectiles/Boss/MushBombGround.cs b/Projectiles/Boss/MushBombGround.cs new file mode 100644 index 0000000000..c2eacefa36 --- /dev/null +++ b/Projectiles/Boss/MushBombGround.cs @@ -0,0 +1,111 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class MushBombGround : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/Boss/MushBomb"; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 14; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + } + + public override void AI() + { + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + if (Main.rand.NextBool()) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + } + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); + + float xVelocityMultiplier = 1.025f; + float xVelocityLimit = BossRushEvent.BossRushActive ? 24f : 12f; + if (Math.Abs(Projectile.velocity.X) < xVelocityLimit) + Projectile.velocity.X *= xVelocityMultiplier; + } + + public override Color? GetAlpha(Color drawColor) => Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + int height = texture.Height / Main.projFrames[Type]; + int drawStart = height * Projectile.frame; + Vector2 origin = Projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/MushBombGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + + for (int i = 0; i < 3; i++) + { + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1f); + Main.dust[shroomDust].velocity *= 1.5f; + if (Main.rand.NextBool()) + { + Main.dust[shroomDust].scale = 0.5f; + Main.dust[shroomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + + for (int j = 0; j < 9; j++) + { + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + Main.dust[shroomDust2].noGravity = true; + Main.dust[shroomDust2].velocity *= 2f; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + } + } + } +} diff --git a/Projectiles/Boss/QueenBeenade.cs b/Projectiles/Boss/QueenBeenade.cs new file mode 100644 index 0000000000..904fc5a5eb --- /dev/null +++ b/Projectiles/Boss/QueenBeenade.cs @@ -0,0 +1,111 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class QueenBeenade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.Beenade}"; + + public override void SetDefaults() + { + Projectile.Calamity().DealsDefenseDamage = true; + Projectile.width = 14; + Projectile.height = 22; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 180; + } + + public override void AI() + { + if (Projectile.ai[0] > 5f) + { + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + { + Projectile.velocity.X *= 0.97f; + if (Math.Abs(Projectile.velocity.X) < 0.01f) + { + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; + } + } + + Projectile.velocity.Y += 0.2f; + } + else + Projectile.ai[0] += 1f; + + Projectile.rotation += Projectile.velocity.X * 0.1f; + + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + + public override bool? CanDamage() => Projectile.timeLeft <= 0; + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = oldVelocity.X * -0.5f; + + if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) + Projectile.velocity.Y = oldVelocity.Y * -0.5f; + + return false; + } + + public override void OnKill(int timeLeft) + { + int newSize = 40; + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = newSize; + Projectile.Center = Projectile.position; + Projectile.Damage(); + + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + + for (int i = 0; i < 20; i++) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); + + if (!Main.dedServ) + { + int gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y += 1f; + Main.gore[gore].velocity *= 0.3f; + gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y += 1f; + Main.gore[gore].velocity *= 0.3f; + gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y -= 1f; + Main.gore[gore].velocity *= 0.3f; + gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y -= 1f; + Main.gore[gore].velocity *= 0.3f; + } + + if (Projectile.owner == Main.myPlayer) + { + int beeAmount = Main.rand.Next(5, 8); + int type = ModContent.ProjectileType(); + float minVelocity = 8f; + float maxVelocity = 16f; + for (int i = 0; i < beeAmount; i++) + { + float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; + float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; + Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, new Vector2(speedX, speedY), type, (int)Math.Round(Projectile.damage * 0.85), 0f, Main.myPlayer, 0f, minVelocity, maxVelocity); + } + } + } + } +} diff --git a/Projectiles/Boss/QueenBeenadeBee.cs b/Projectiles/Boss/QueenBeenadeBee.cs new file mode 100644 index 0000000000..b4eb7d0644 --- /dev/null +++ b/Projectiles/Boss/QueenBeenadeBee.cs @@ -0,0 +1,139 @@ +using System; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class QueenBeenadeBee : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.GiantBee}"; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 420; + } + + public override void AI() + { + // Animation + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 4) + Projectile.frame = 0; + + // Direction and rotation + Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; + Projectile.rotation = Projectile.velocity.X * 0.1f; + + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + + // Get a target and calculate distance from it + int target = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; + + // Set AI to stop homing, start accelerating + float stopHomingDistance = bossRush ? 80f : 120f; + if (distanceFromTarget.Length() < stopHomingDistance || Projectile.ai[0] == 1f || Projectile.timeLeft < 120) + { + Projectile.ai[0] = 1f; + + if (Projectile.velocity.Length() < Projectile.ai[2]) + Projectile.velocity *= 1.05f; + + return; + } + + // Fly off for a bit before homing + if (Projectile.timeLeft > 300) + { + if (Projectile.velocity.Length() < Projectile.ai[1]) + Projectile.velocity *= 1.05f; + + return; + } + + // Home in on target + float scaleFactor = Projectile.velocity.Length(); + float inertia = bossRush ? 12f : 16f; + distanceFromTarget.Normalize(); + distanceFromTarget *= scaleFactor; + Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; + + // Fly away from other bees + float pushForce = bossRush ? 0.06f : 0.05f; + float pushDistance = bossRush ? 90f : 60f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < pushDistance) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(BuffID.Poisoned, 120); + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); + return false; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 6; i++) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 150, Projectile.velocity.X, Projectile.velocity.Y, 50); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f; + } + } + } +} diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index 60a4894904..a4e68db418 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; @@ -7,6 +9,7 @@ namespace CalamityMod.Projectiles.Boss public class ShadeNimbusHostile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Type] = 6; @@ -19,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.hostile = true; - Projectile.timeLeft = 360; + Projectile.timeLeft = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 480 : 360; Projectile.penetrate = -1; } @@ -31,12 +34,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; Projectile.frame++; if (Projectile.frame > 5) - { Projectile.frame = 0; - } } + Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 300f) + if (Projectile.ai[1] >= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 420f : 300f)) { Projectile.alpha += 5; if (Projectile.alpha > 255) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index ad32facac2..4d91d08a39 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -12,6 +12,7 @@ using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -73,11 +74,6 @@ namespace CalamityMod.Projectiles /// Constant variable used as a speed cap for boss laser projectiles with 2 extra updates. public const float AcceleratingBossLaserVelocityCap = 8f; - /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. - public const float PierceResistHarshness = 0.12f; - /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. - public const float PierceResistCap = 0.8f; - /// /// Used for executing frame one hacks. Things set during this include: ///
* Reducing projectile damage for Hardmode enemies and in Master Mode. @@ -203,7 +199,7 @@ namespace CalamityMod.Projectiles ///
public float pointBlankShotDistanceTravelled = 0f; /// Constant variable which stores how many frames a projectile is allowed to deal point-blank damage. - public const int DefaultPointBlankDuration = 18; // 18 frames + public const int DefaultPointBlankDuration = 18; /// Constant variable which stores the maximum distance a projectile can travel to deal point-blank damage, in pixels. public const float PointBlankShotDistanceLimit = 240f; // 15 tiles @@ -526,7 +522,7 @@ namespace CalamityMod.Projectiles homingEndTime += 60f; // Stop homing when within a certain distance of the target - if (Vector2.Distance(projectile.Center, Main.player[num133].Center) < (revSkeletronPrimeHomingSkull ? (((Main.masterMode && CalamityWorld.revenge) || BossRushEvent.BossRushActive) ? 192f : 120f) : 96f) && projectile.ai[1] < homingEndTime) + if (Vector2.Distance(projectile.Center, Main.player[num133].Center) < (revSkeletronPrimeHomingSkull ? ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 192f : 120f) : 96f) && projectile.ai[1] < homingEndTime) projectile.ai[1] = homingEndTime; if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime) @@ -1246,16 +1242,16 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.HallowBossRainbowStreak && projectile.hostile) { - bool revMasterMode = (Main.masterMode && CalamityWorld.revenge) || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool spreadOut = false; bool homeIn = false; float spreadOutCutoffTime = EmpressRainbowStreakSpreadOutCutoff; - float homeInCutoffTime = NPC.ShouldEmpressBeEnraged() ? (revMasterMode ? 55f : 65f) : (revMasterMode ? 70f : 80f); + float homeInCutoffTime = NPC.ShouldEmpressBeEnraged() ? (death ? 55f : 65f) : (death ? 70f : 80f); float spreadDeceleration = 0.97f; - float minAcceleration = revMasterMode ? 0.075f : 0.05f; - float maxAcceleration = revMasterMode ? 0.15f : 0.1f; - float homingVelocity = revMasterMode ? 36f : 30f; + float minAcceleration = death ? 0.075f : 0.05f; + float maxAcceleration = death ? 0.15f : 0.1f; + float homingVelocity = death ? 36f : 30f; float maxVelocity = homingVelocity * 1.5f; float accelerationToMaxVelocity = 1.01f; @@ -4147,8 +4143,13 @@ namespace CalamityMod.Projectiles if (forcedCrit) modifiers.SetCrit(); - if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike) + if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike && !modPlayer.vampiricTalisman) target.AddBuff(BuffType(), RottenDogtooth.ArmorCrunchDebuffTime); + else if (modPlayer.vampiricTalisman && projectile.Calamity().stealthStrike) + { + target.AddBuff(BuffType(), VampiricTalisman.ArmorCrunchDebuffTime); + target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); + } if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); @@ -4218,6 +4219,48 @@ namespace CalamityMod.Projectiles } #endregion + #region On Hit NPC + public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) + { + // Hyperius Overflow + if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) + { + int damage = 0; + if (target.Calamity().hyperiusDamage < damageDone) + damage = damageDone - target.Calamity().hyperiusDamage; + else + damage = damageDone; + target.Calamity().hyperiusDamage -= damage; + + // Spawn overflow hit + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, projectile.owner, target.whoAmI); + overflow.DamageType = projectile.DamageType; + overflow.ArmorPenetration = projectile.ArmorPenetration; // Takes the armor pen from what did the hit + + if (target.Calamity().hyperiusDamage <= 0) + { + target.Calamity().hyperiusDamage = 0; + target.Calamity().hyperiusMarked = false; + } + } + + // Implementation of shared static iframes. + // If this projectile does not use static iframes, or is not registered to share them, then do nothing. + if (!projectile.usesIDStaticNPCImmunity || !SharedStaticIFrames.Includes(projectile.type)) + return; + + // Get the set of shared static iframe projectile types. + // If it's empty, then do nothing. + IList sharedWithProjectiles = SharedStaticIFrames.GetSharedStaticIFrames(projectile.type); + if (sharedWithProjectiles.Count <= 0) + return; + + // Apply the appropriate shared static iframes to all projectile types with which it is shared. + foreach (int projType in sharedWithProjectiles) + Projectile.perIDStaticNPCImmunity[projType][target.whoAmI] = Main.GameUpdateCount + (uint)projectile.idStaticNPCHitCooldown; + } + #endregion + #region Can Damage + Can Hit public override bool? CanDamage(Projectile projectile) { diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index ca4d8b8321..dcab273bc2 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Projectiles { // Various shorthands for projectiles which receive very simple changes, such as setting one flag. IProjectileTweak[] defenseDamage = Do(DefenseDamage); - IProjectileTweak[] trueMelee = Do(TrueMelee); - IProjectileTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed); + IProjectileTweak[] trueMelee = Do(TrueMelee, DefaultIDStaticIFrames); // All the tweaked true melee projectiles need to be changed from global to static as well + IProjectileTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed, DefaultIDStaticIFrames); IProjectileTweak[] pointBlank = Do(PointBlank); IProjectileTweak[] standardBulletTweaks = Do(PointBlank, ExtraUpdatesDelta(+2)); IProjectileTweak[] standardChainsawTweaks = Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5)); IProjectileTweak[] standardDrillTweaks = Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+25), LocalIFrames(5)); - IProjectileTweak[] counterweightTweaks = Do(MaxUpdatesExact(2), IDStaticIFrames(10)); + IProjectileTweak[] counterweightTweaks = Do(MaxUpdatesExact(2), DefaultIDStaticIFrames); // Shorthand for changing all the stats of a yoyo at once. This handles extra update related math for you. // For topSpeed, put in how fast you want the yoyo to be EXACTLY: it will be divided out in extra updates for you. @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles { ProjectileID.Gradient, RebalanceYoyo(-1f, 384f, 36f, 1, 12) }, // original: 12s lifetime | 275px range | 15px/f top speed | 0 extra updates - { ProjectileID.HelFire, RebalanceYoyo(-1f, 368f, 42f, 2, 12) }, + { ProjectileID.HelFire, RebalanceYoyo(-1f, 352f, 42f, 2, 12) }, // original: 11s lifetime | 225px range | 14px/f top speed | 0 extra updates { ProjectileID.HiveFive, RebalanceYoyo(24f, 320f, 20f, 0, 15) }, @@ -116,14 +116,14 @@ namespace CalamityMod.Projectiles { ProjectileID.AdamantiteChainsaw, standardChainsawTweaks }, { ProjectileID.AdamantiteDrill, standardDrillTweaks }, { ProjectileID.AdamantiteGlaive, Do(TrueMelee, LocalIFrames(7)) }, - { ProjectileID.Anchor, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Arkhalis, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, - { ProjectileID.Bee, Do(PiercingExact(2)) }, - { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1)) }, + { ProjectileID.Anchor, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.Arkhalis, Do(TrueMeleeNoSpeed, ScaleExact(1.25f), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.Bee, Do(PiercingExact(2), DefaultIDStaticIFrames) }, + { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.BlackCounterweight, counterweightTweaks }, { ProjectileID.BlueCounterweight, counterweightTweaks }, { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Bullet, standardBulletTweaks }, + { ProjectileID.Bullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.BulletHighVelocity, Do(PointBlank, LocalIFrames(-1)) }, { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, @@ -132,45 +132,45 @@ namespace CalamityMod.Projectiles { ProjectileID.CobaltChainsaw, standardChainsawTweaks }, { ProjectileID.CobaltDrill, standardDrillTweaks }, { ProjectileID.CobaltNaginata, Do(TrueMelee, LocalIFrames(9)) }, - { ProjectileID.CrystalBullet, standardBulletTweaks }, + { ProjectileID.CrystalBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.CrystalVileShardHead, Do(LocalIFrames(23)) }, { ProjectileID.CrystalVileShardShaft, Do(LocalIFrames(23)) }, - { ProjectileID.CursedBullet, standardBulletTweaks }, + { ProjectileID.CursedBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.ClusterRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterFragmentsI, Do(IDStaticIFrames(15)) }, { ProjectileID.ClusterRocketII, Do(LocalIFrames(15)) }, { ProjectileID.ClusterFragmentsII, Do(IDStaticIFrames(15)) }, - { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, + { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterSnowmanRocketII, Do(LocalIFrames(15)) }, - { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3)) }, // Flying Dragon + { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3), DefaultIDStaticIFrames) }, // Flying Dragon { ProjectileID.EmeraldBolt, Do(NoPiercing) }, { ProjectileID.EmpressBlade, Do(LocalIFrames(30)) }, // Terraprisma - { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.ExplosiveBullet, standardBulletTweaks }, + { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.ExplosiveBullet, Do(PointBlank, ExtraUpdatesDelta(+2), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert - { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150)) }, - { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2)) }, + { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150), DefaultIDStaticIFrames) }, + { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames - { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor { ProjectileID.FlowerPow, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.GiantBee, Do(PiercingExact(2)) }, + { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.GiantBee, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GladiusStab, Do(TrueMelee, LocalIFrames(-1)) }, - { ProjectileID.GoldenBullet, standardBulletTweaks }, - { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2)) }, + { ProjectileID.GoldenBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Hamdrax, standardDrillTweaks }, // Drax (never internally renamed since 1.1) - { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.IceSickle, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.IchorBullet, standardBulletTweaks }, + { ProjectileID.IchorBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2)) }, + { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, { ProjectileID.LaserDrill, Do(ArmorPenetrationDelta(+25), LocalIFrames(5)) }, - { ProjectileID.LightDisc, Do(MaxUpdatesExact(3)) }, + { ProjectileID.LightDisc, Do(MaxUpdatesExact(3), DefaultIDStaticIFrames) }, { ProjectileID.LostSoulHostile, Do(TileCollide) }, // Ragged Caster { ProjectileID.MeteorShot, standardBulletTweaks }, { ProjectileID.Meowmere, Do(PiercingExact(3), LocalIFrames(-1)) }, @@ -181,14 +181,14 @@ namespace CalamityMod.Projectiles { ProjectileID.MythrilChainsaw, standardChainsawTweaks }, { ProjectileID.MythrilDrill, standardDrillTweaks }, { ProjectileID.MythrilHalberd, Do(TrueMelee, LocalIFrames(8)) }, - { ProjectileID.NanoBullet, standardBulletTweaks }, + { ProjectileID.NanoBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.NebulaDrill, standardDrillTweaks }, { ProjectileID.NebulaLaser, Do(ExtraUpdatesDelta(-1)) }, { ProjectileID.OrichalcumChainsaw, standardChainsawTweaks }, { ProjectileID.OrichalcumDrill, standardDrillTweaks }, { ProjectileID.PalladiumChainsaw, standardChainsawTweaks }, { ProjectileID.PalladiumDrill, standardDrillTweaks }, - { ProjectileID.PartyBullet, standardBulletTweaks }, + { ProjectileID.PartyBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.PoisonFang, Do(LocalIFrames(10)) }, { ProjectileID.PurpleCounterweight, counterweightTweaks }, { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, @@ -200,20 +200,20 @@ namespace CalamityMod.Projectiles { ProjectileID.RocketFireworkYellow, Do(TimeLeftDelta(+45)) }, { ProjectileID.SawtoothShark, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(6)) }, { ProjectileID.ShadowBeamHostile, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.SolarFlareDrill, standardDrillTweaks }, { ProjectileID.StardustDrill, standardDrillTweaks }, - { ProjectileID.Starfury, Do(TimeLeftExact(75)) }, + { ProjectileID.Starfury, Do(TimeLeftExact(75), DefaultIDStaticIFrames) }, { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2)) }, // Beam Sword projectile - { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, - { ProjectileID.ThunderStaffShot, Do(PiercingExact(3)) }, //Thunder Zapper projectile + { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, // Beam Sword projectile + { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.ThunderStaffShot, Do(PiercingExact(3), DefaultIDStaticIFrames) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, { ProjectileID.TitaniumDrill, standardDrillTweaks }, - { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.TrueNightsEdge, Do(PiercingExact(4)) }, - { ProjectileID.VenomBullet, standardBulletTweaks }, + { ProjectileID.VenomBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, @@ -236,7 +236,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ObsidianSwordfish, trueMelee }, { ProjectileID.OrichalcumHalberd, trueMelee }, { ProjectileID.PalladiumPike, trueMelee }, - { ProjectileID.PiercingStarlight, trueMelee }, + { ProjectileID.PiercingStarlight, Do(TrueMelee, IDStaticIFrames(4)) }, // Has an exception in Vanilla iframe code, uses 4 iframes { ProjectileID.PlatinumShortswordStab, trueMelee }, { ProjectileID.RulerStab, trueMelee }, { ProjectileID.ShadowJoustingLance, trueMelee }, @@ -254,41 +254,41 @@ namespace CalamityMod.Projectiles #endregion #region CATEGORY 4: Point Blank support - { ProjectileID.Blizzard, pointBlank }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. - { ProjectileID.BlueFlare, pointBlank }, - { ProjectileID.BoneArrow, pointBlank }, - { ProjectileID.CandyCorn, pointBlank }, - { ProjectileID.ChlorophyteArrow, pointBlank }, - { ProjectileID.ChlorophyteBullet, pointBlank }, - { ProjectileID.CrimsandBallGun, pointBlank }, - { ProjectileID.CrystalDart, pointBlank }, - { ProjectileID.CursedArrow, pointBlank }, - { ProjectileID.CursedDart, pointBlank }, + { ProjectileID.Blizzard, Do(PointBlank, DefaultIDStaticIFrames) }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. + { ProjectileID.BlueFlare, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.BoneArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CandyCorn, Do(PointBlank, IDStaticIFrames(7)) }, // Has an exception in Vanilla iframe code, uses 7 iframes + { ProjectileID.ChlorophyteArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.ChlorophyteBullet, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CrimsandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CrystalDart, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CursedArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CursedDart, Do(PointBlank, DefaultIDStaticIFrames) }, { ProjectileID.DD2PhoenixBowShot, pointBlank }, // Phantom Phoenix - { ProjectileID.EbonsandBallGun, pointBlank }, - { ProjectileID.FireArrow, pointBlank }, - { ProjectileID.Flare, pointBlank }, - { ProjectileID.FrostburnArrow, pointBlank }, + { ProjectileID.EbonsandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.FireArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.Flare, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.FrostburnArrow, Do(PointBlank, DefaultIDStaticIFrames) }, { ProjectileID.Harpoon, pointBlank }, - { ProjectileID.Hellwing, pointBlank }, - { ProjectileID.HellfireArrow, pointBlank }, - { ProjectileID.HolyArrow, pointBlank }, - { ProjectileID.IchorArrow, pointBlank }, - { ProjectileID.JestersArrow, pointBlank }, + { ProjectileID.Hellwing, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.HellfireArrow, Do(PointBlank, ExtraUpdatesDelta(+2)) }, + { ProjectileID.HolyArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.IchorArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.JestersArrow, Do(PointBlank, DefaultIDStaticIFrames) }, { ProjectileID.MoonlordArrow, pointBlank }, // Luminite Arrow - { ProjectileID.PainterPaintball, pointBlank }, - { ProjectileID.PearlSandBallGun, pointBlank }, - { ProjectileID.PhantasmArrow, pointBlank }, - { ProjectileID.PoisonDartBlowgun, pointBlank }, - { ProjectileID.PulseBolt, pointBlank }, - { ProjectileID.SandBallGun, pointBlank }, - { ProjectileID.Seed, pointBlank }, - { ProjectileID.ShadowFlameArrow, pointBlank }, - { ProjectileID.SnowBallFriendly, pointBlank }, - { ProjectileID.Stake, pointBlank }, - { ProjectileID.UnholyArrow, pointBlank }, - { ProjectileID.VenomArrow, pointBlank }, - { ProjectileID.WoodenArrowFriendly, pointBlank }, + { ProjectileID.PainterPaintball, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PearlSandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PhantasmArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PoisonDartBlowgun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PulseBolt, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.SandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.Seed, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.ShadowFlameArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.SnowBallFriendly, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.Stake, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.UnholyArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.VenomArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.WoodenArrowFriendly, Do(PointBlank, DefaultIDStaticIFrames) }, #endregion #region CATEGORY 5: Defense Damage support @@ -327,6 +327,314 @@ namespace CalamityMod.Projectiles { ProjectileID.ThornBall, Do(Main.zenithWorld ? IgnoreWater : DontIgnoreWater, DefenseDamage) }, // Plantera bouncing thorn balls { ProjectileID.UnholyTridentHostile, defenseDamage }, #endregion + + #region CATEGORY 6: ID-Static Immunity Frame changes + {ProjectileID.AbigailCounter, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Ale, Do(DefaultIDStaticIFrames)}, + {ProjectileID.AmberBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.AmethystBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.AshBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BallofFire, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BallofFrost, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bananarang, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bat, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BeeHive, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Beenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BlackCat, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodArrow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodButcherer, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodNautilusTears, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodWater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodyMachete, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BombFish, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bone, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoneArrowFromMerchant, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoneDagger, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BookOfSkullsSkull, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BookStaffShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Boulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoulderStaffOfEarth, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyBoulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyDynamite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoxingGlove, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bubble, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bunny, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CannonballFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CavelingGardener, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2Rocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2RocketExplosive, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2RocketExplosiveLarge, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2RocketLarge, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2Weapon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChainGuillotine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChainKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChargedBlasterCannon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChargedBlasterLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChargedBlasterOrb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChlorophytePartisan, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClothiersCurse, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterMineI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterMineII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterSnowmanFragmentsI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterSnowmanFragmentsII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CoinPortal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CopperCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CorruptSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrimsandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrimsonHeart, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrimsonSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalLeaf, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalLeafShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalPulse, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalPulse2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalShard, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalStorm, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CursedDartFlame, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CursedFlameFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CursedFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DD2PhoenixBow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DemonScythe, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DiamondBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtStickyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DripplerFlailExtraBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryadsWardCircle, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DrySnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Dynamite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EatersBite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EbonsandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EighthNote, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Electrosphere, Do(IDStaticIFrames(8))}, // Has an exception in Vanilla iframe code, uses 8 iframes + {ProjectileID.ElectrosphereMissile, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EnchantedBeam, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Explosives, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FallingStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Flairon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FlamesTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FlowerPowPetal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FrostArrow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FrostDaggerfish, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GasTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GelBalloon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Geode, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GeyserTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GoldCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GolemFist, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GreenLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Grenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HallowSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HallowStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HeatRay, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HolyWater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneySnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HornetStinger, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoundiusShootiusFireball, Do(DefaultIDStaticIFrames)}, + {ProjectileID.IceBlock, Do(DefaultIDStaticIFrames)}, + {ProjectileID.IceBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.IchorDart, Do(DefaultIDStaticIFrames)}, + {ProjectileID.JackOLantern, Do(DefaultIDStaticIFrames)}, + {ProjectileID.JavelinFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Landmine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LaserMachinegun, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LaserMachinegunLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LastPrism, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LastPrismLaser, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.LavaBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LavaMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LavaRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LavaSnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Leaf, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LifeCrystalBoulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MagicMissile, Do(IDStaticIFrames(8))}, // Has an exception in Vanilla iframe code, uses 8 iframes + {ProjectileID.MagnetSphereBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MedusaHead, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MedusaHeadRay, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Meteor1, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.Meteor2, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.Meteor3, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.MinecartMechLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniBoulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniMinotaur, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeMineI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeMineII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeRocketI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeRocketII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeSnowmanRocketI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeSnowmanRocketII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniRetinaLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniSharkron, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovCocktail, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovFire, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovFire2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovFire3, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MonkStaffT3_AltShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MudBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Mushroom, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MushroomSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NailFriendly, Do(IDStaticIFrames(1))}, // Has an exception in Vanilla iframe code, uses 1 iframe + {ProjectileID.NebulaArcanumExplosionShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NebulaArcanumExplosionShotShard, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NebulaBlaze1, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.NebulaBlaze2, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.NettleBurstEnd, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NettleBurstLeft, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NettleBurstRight, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NightBeam, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NorthPoleSnowflake, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NorthPoleSpear, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NorthPoleWeapon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NurseSyringeHeal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NurseSyringeHurt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.OrnamentFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.OrnamentStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PaladinsHammerFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PaperAirplaneA, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PaperAirplaneB, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PartyGirlGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PearlSandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PewMaticHornShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Phantasm, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PineNeedleFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PlatinumCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PoisonDart, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PoisonDartTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PoisonedKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PossessedHatchet, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PrincessWeapon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineIII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineIV, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PureSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PurificationPowder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PurpleLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PygmySpear, Do(DefaultIDStaticIFrames)}, + {ProjectileID.QuarterNote, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RainbowFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxBlue, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxGreen, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxRed, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxYellow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketIII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketIV, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanIII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanIV, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RollingCactus, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RollingCactusSpike, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RottenEgg, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RubyBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SandSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SantaBombs, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SantankMountRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SapphireBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ScarabBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ScutlixLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ScutlixLaserFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SeedlerNut, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SeedlerThorn, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShadowBeamFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShadowFlameKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShellPileFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShimmerArrow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShimmerFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Shuriken, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SiltBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SilverBullet, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SilverCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SkyFracture, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SlushBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SnowSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SolarCounter, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SolarFlareRay, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SoulDrain, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpearTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpelunkerFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Spider, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpiderEgg, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpikyBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpikyBallTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpiritFlame, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.SporeGas, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeGas2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeGas3, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeTrap2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StarAnise, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StarCannonStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StardustCellMinion, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StardustGuardianExplosion, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StickyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StickyDynamite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StickyGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StormTigerGem, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Stynger, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes + {ProjectileID.StyngerShrapnel, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TentacleSpike, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThornChakram, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThrowingKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThunderSpear, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThunderSpearShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TiedEighthNote, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TitaniumStormShard, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TopazBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicBubble, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicCloud, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicCloud2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicCloud3, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicFlask, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Truffle, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TruffleSpore, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Typhoon, Do(IDStaticIFrames(6))}, // Has an exception in Vanilla iframe code, uses 6 iframes + {ProjectileID.UFOLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.UFOMinion, Do(DefaultIDStaticIFrames)}, + {ProjectileID.UnholyTridentFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.UnholyWater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VampireKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VenomDartTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ViciousPowder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VilePowder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VilethornBase, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VilethornTip, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexBeater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexBeaterRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexVortexLightning, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexVortexPortal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Waffle, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WandOfFrostingFrost, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WandOfSparkingSpark, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WaterBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WaterStream, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Web, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetSnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Wisp, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WoodenBoomerang, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Xenopopper, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ZapinatorLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ZoologistStrikeGreen, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ZoologistStrikeRed, Do(DefaultIDStaticIFrames)}, + + #endregion + }; } @@ -472,6 +780,7 @@ namespace CalamityMod.Projectiles } } internal static IProjectileTweak IDStaticIFrames(int f) => new IDStaticIFrameRule(f); + internal static IProjectileTweak DefaultIDStaticIFrames => new IDStaticIFrameRule(10); #endregion #region Ignore Water diff --git a/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs b/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs new file mode 100644 index 0000000000..6c281e0cd0 --- /dev/null +++ b/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AerialTrackerLaser : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public float Time + { + get => Projectile.localAI[0]; + set => Projectile.localAI[0] = value; + } + public Projectile disk; + public Vector2 laserStart; + public Vector2 laserEnd; + public int lifetime = 15; + public NPC targeted; + public float fade => (float)Math.Pow(Utils.GetLerpValue(0, lifetime, Projectile.timeLeft), 3); + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = lifetime; + Projectile.ArmorPenetration = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Time == 0) + { + disk = Main.projectile[(int)Projectile.ai[1]]; + targeted = Main.npc[(int)Projectile.ai[2]]; + if (disk != null) + laserStart = disk.Center; + else + laserStart = Projectile.Center; + if (targeted != null) + laserEnd = targeted.Center; + else + laserEnd = Projectile.Center; + } + if (targeted.active && targeted.life > 0) + { + laserEnd = targeted.Center; + Projectile.Center = targeted.Center; + } + + Time++; + } + public override bool? CanHitNPC(NPC target) + { + return (Projectile.numHits > 0 ? false : null); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Handles giving the NPC the laser burn effect + CalamityGlobalNPC modNPC = target.Calamity(); + if (!modNPC.laserBurnMarked) + { + modNPC.laserBurnMarked = true; + modNPC.laserBurnType = 1; + modNPC.laserBurnTimer = CalamityGlobalNPC.laserBurnTime; + } + + modNPC.laserBurnTimer -= modNPC.laserBurnStacks * 2; + modNPC.laserBurnDamage += (int)(Projectile.damage * 0.2f); + + modNPC.laserBurnStacks++; + + Projectile.damage = 1; + modifiers.HideCombatText(); + + } + public override void OnKill(int timeLeft) + { + /* + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 267); + dust.velocity = (Projectile.velocity * 3 * Projectile.scale).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f); + dust.scale = Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale; + dust.noGravity = true; + dust.color = Color.Red; + } + */ + } + 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) + { + // So unless placed here the position of projectile updates is inconsistent and will cause offsets + if (disk != null && disk.active && disk.type == ModContent.ProjectileType()) + { + laserStart = disk.Center; + } + else + { + disk = null; + } + + if (laserStart == Vector2.Zero || laserEnd == Vector2.Zero) + return false; + + Player player = Main.player[Projectile.owner]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lineTex = ModContent.Request("CalamityMod/Particles/BloomLineSoftEdge").Value; + float distance = Utils.Distance(laserStart, laserEnd); + int drawSeperation = 10; + int startSeperation = drawSeperation; + Vector2 toPoint = Utils.DirectionTo(laserStart, laserEnd); + for (int i = startSeperation; i < distance - drawSeperation; i += drawSeperation) + { + float completion = MathHelper.Lerp(0.8f, 3f, 1 - (i / distance)); + for (int y = 0; y < 2; y++) + Main.EntitySpriteDraw(lineTex, laserStart - Main.screenPosition + toPoint * i, null, (y == 1 ? Color.White : Effects.ArsenalEffects.ArsenalLaserColor) with { A = 0 } * fade, toPoint.ToRotation() + MathHelper.PiOver2, lineTex.Size() * 0.5f, new Vector2((y == 1 ? 0.3f : 1) * MathHelper.Max(fade, 0.3f) * completion, 1.3f) * Projectile.scale * 0.01f, SpriteEffects.None); + } + Texture2D glowTex = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Main.EntitySpriteDraw(glowTex, laserStart - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 }, Projectile.rotation, glowTex.Size() * 0.5f, 0.3f * fade, SpriteEffects.None, 0); + Main.EntitySpriteDraw(glowTex, laserStart - Main.screenPosition, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, glowTex.Size() * 0.5f, 0.15f * fade, SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/AerialTrackerProjectile.cs similarity index 51% rename from Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs rename to Projectiles/DraedonsArsenal/AerialTrackerProjectile.cs index 5bb2ae7fd9..a5c01d981e 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/AerialTrackerProjectile.cs @@ -2,16 +2,19 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { - public class TrackingDiskProjectile : ModProjectile, ILocalizedModType + public class AerialTrackerProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/TrackingDisk"; + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/AerialTracker"; + public NPC extraShotTarget; public bool ReturningToPlayer { @@ -25,40 +28,49 @@ namespace CalamityMod.Projectiles.DraedonsArsenal set => Projectile.ai[1] = value; } - public const int LaserFireRate = 22; - public const int LaserFireRateStealth = 18; - public const int MaxLaserCountPerShot = 4; // This only applies to stealth strikes. - public const float MaxTargetSearchDistance = 480f; + public const int LaserFireRate = 19; + public const int LaserFireRateStealth = 25; + public const int MaxLaserCountPerShot = 2; // This only applies to stealth strikes. + public const float MaxTargetSearchDistance = 600f; public const float MaxTargetSearchStealth = 800f; public const float ReturnAccelerationFactor = 0.0012f; - public const float ReturnMaxSpeed = 12f; + public const float ReturnMaxSpeed = 6f; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 4; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = 52; + Projectile.height = 40; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { - Lighting.AddLight(Projectile.Center, Color.Red.ToVector3()); + Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, 0.5f).ToVector3() * 0.5f); Player player = Main.player[Projectile.owner]; Time++; + + if (Time == 5 && !Projectile.Calamity().stealthStrike) + Projectile.tileCollide = true; + if (Time < 100 && Time > 10 && Projectile.Calamity().stealthStrike) + Projectile.velocity = Projectile.velocity.RotatedBy(-0.029f * Projectile.ai[2]); + if (!ReturningToPlayer) { - if (Time >= 45f) + if (Time >= 55f) { ReturningToPlayer = true; Projectile.tileCollide = false; @@ -72,13 +84,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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. - Vector2 idealVelocity = (player.Center - Projectile.Center) / distanceFromPlayer * ReturnMaxSpeed; + Vector2 idealVelocity = (player.Center - Projectile.Center) / distanceFromPlayer * ReturnMaxSpeed * (Projectile.Calamity().stealthStrike ? Utils.GetLerpValue(90, 300, Time, true) * 1.5f : Utils.GetLerpValue(60, 300, Time, true)); Projectile.velocity.X += Math.Sign(idealVelocity.X - Projectile.velocity.X) * (ReturnAccelerationFactor * Time); Projectile.velocity.Y += Math.Sign(idealVelocity.Y - Projectile.velocity.Y) * (ReturnAccelerationFactor * Time); if (Time % (Projectile.Calamity().stealthStrike ? LaserFireRateStealth : LaserFireRate) == 0f) - AttemptToFireLasers((int)(Projectile.damage * 0.25)); + AttemptToFireLasers(Projectile.damage); if (Main.myPlayer == Projectile.owner) { @@ -87,7 +99,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - Projectile.rotation += 0.25f; + if (ReturningToPlayer) + { + Projectile.rotation += 0.28f * Utils.GetLerpValue(30, 300, Time, true); + } + else + Projectile.rotation += 0.15f; } public void AttemptToFireLasers(int damage) @@ -105,16 +122,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (targetCount >= MaxLaserCountPerShot) break; + Vector2 spawnLocation = Projectile.Center + new Vector2(25, 0).RotatedBy(Projectile.rotation * Utils.GetLerpValue(300, 30, Time, true)); Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, - Projectile.SafeDirectionTo(target.Center) * 4f, - ModContent.ProjectileType(), - (int)(damage * 0.6f), - Projectile.knockBack, - Projectile.owner, - 1f); - laser.scale *= 1.6f; + Vector2.Zero, + ModContent.ProjectileType(), + (int)(damage), + Projectile.knockBack, + Projectile.owner, + 1f, Projectile.whoAmI, target.whoAmI); + laser.scale *= 1.4f; laser.netUpdate = true; targetCount++; + extraShotTarget = target; + } + if (targetCount == 1) + { + Vector2 spawnLocation = Projectile.Center + new Vector2(25, 0).RotatedBy(-Projectile.rotation * Utils.GetLerpValue(300, 30, Time, true)); + Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, + Vector2.Zero, + ModContent.ProjectileType(), + (int)(damage), + Projectile.knockBack, + Projectile.owner, + -1f, Projectile.whoAmI, extraShotTarget.whoAmI); } } else @@ -122,7 +152,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal NPC potentialTarget = Projectile.Center.ClosestNPCAt(MaxTargetSearchDistance); if (potentialTarget != null) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 3f, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner); + Vector2 spawnLocation = Projectile.Center + new Vector2(25, 0).RotatedBy(Projectile.rotation * 0.4f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0, Projectile.whoAmI, potentialTarget.whoAmI); } } } @@ -141,7 +172,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, ProjectileID.Sets.TrailCacheLength[Type]); + Asset texture = ModContent.Request(Texture); + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[Projectile.type], null, true, false); + + Main.EntitySpriteDraw(texture.Value, drawPosition, null, lightColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; } } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs deleted file mode 100644 index fae768a21d..0000000000 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs +++ /dev/null @@ -1,120 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class FrequencyManipulatorProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/FrequencyManipulator"; - - public float Time - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - public const int TotalSpins = 2; - public const float SpinTime = 30f; - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 180; - Projectile.penetrate = 2; - Projectile.extraUpdates = 1; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 45; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, Color.Purple.ToVector3()); - - Time++; - Player player = Main.player[Projectile.owner]; - if (Time <= SpinTime) - { - Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.TwoPi * TotalSpins / SpinTime); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - Projectile.Center = player.itemLocation + Projectile.velocity; - ManipulatePlayerItemValues(player); - } - else if (Time == SpinTime + 1f) - { - Projectile.tileCollide = true; - RingDustEffect(player.itemLocation, 1f, 1f, 5f, 2f); - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * player.ActiveItem().shootSpeed; - } - } - - public void ManipulatePlayerItemValues(Player player) - { - player.ChangeDir(Projectile.direction); - player.heldProj = Projectile.whoAmI; - player.itemRotation = Projectile.rotation; - player.itemTime = player.itemAnimation; - } - - public void RingDustEffect(Vector2 spawnPosition, float scale, float fadeIn, float ringSpeed, float secondaryRingSpeedMultiplier) - { - if (Main.dedServ) - return; - for (int i = 0; i < 36; i++) - { - float angle = MathHelper.TwoPi * i / 36f; - Dust dust = Dust.NewDustPerfect(spawnPosition, 234); - dust.scale = scale; - dust.fadeIn = scale; - dust.velocity = angle.ToRotationVector2() * ringSpeed; - - dust = Dust.NewDustPerfect(spawnPosition, 173); - dust.scale = scale; - dust.fadeIn = scale; - dust.velocity = angle.ToRotationVector2() * ringSpeed * secondaryRingSpeedMultiplier; - } - } - - public void OnHitEffects() - { - if (Main.myPlayer != Projectile.owner) - return; - // Explode if the projectile is a stealth strike projectile. - int totalEnergyParticlesToSpawn = 3; - if (Projectile.Calamity().stealthStrike) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - totalEnergyParticlesToSpawn = 4; - RingDustEffect(Projectile.Center, 1.6f, 1.4f, 7f, 2.6f); - Projectile.ExpandHitboxBy(160); - Projectile.damage /= 2; - Projectile.Damage(); - Projectile.damage *= 2; - Projectile.ExpandHitboxBy(34); - } - - for (int i = 0; i < totalEnergyParticlesToSpawn; i++) - { - float offsetAngle = MathHelper.Lerp(-0.35f, 0.35f, i / (float)totalEnergyParticlesToSpawn); - Vector2 velocity = -Projectile.oldVelocity.RotatedBy(offsetAngle) * 0.66f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + velocity * 1.8f, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - OnHitEffects(); - } - public override bool OnTileCollide(Vector2 oldVelocity) - { - OnHitEffects(); - return true; - } - } -} diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs deleted file mode 100644 index c45efa1f29..0000000000 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class GaussRifleBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public float Time - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Time++; - Projectile.tileCollide = Time > 3f; - if (!Main.dedServ) - { - // Idle dust. - for (int i = 0; i < 10; i++) - { - float angle = i / 10f * MathHelper.TwoPi; - for (int j = 0; j < 4; j++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 263); - dust.velocity = angle.ToRotationVector2().RotatedByRandom(0.25f) * Main.rand.NextFloat(6f, 8f); - dust.noGravity = true; - dust.scale = 1.6f; - } - } - // Ring dust. - for (int i = 0; i < 4; i++) - { - float angle = Projectile.velocity.ToRotation() + (i / 4f * MathHelper.TwoPi) + Time / 24f; - float radius = (float)Math.Sin(Time / 7.5f) * 40f + 10f; - Dust dust = Dust.NewDustPerfect(Projectile.Center + angle.ToRotationVector2() * radius, 226); - dust.velocity = Vector2.Zero; - dust.noGravity = true; - dust.scale = 1.5f; - } - } - } - - public override void OnKill(int timeLeft) - { - if (Main.myPlayer == Projectile.owner) - { - SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - } -} diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs deleted file mode 100644 index 4b65478c95..0000000000 --- a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class GaussRifleExplosion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public float Time - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 500; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 20; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; - } - - public override void AI() - { - Time++; - if (!Main.dedServ) - { - for (int i = 0; i < 50; i++) - { - float angle = i / 30f * MathHelper.TwoPi; - Dust dust = Dust.NewDustPerfect(Projectile.Center, 261); - dust.velocity = angle.ToRotationVector2(); - dust.velocity = dust.velocity.RotatedByRandom(0.4f); - dust.velocity = dust.velocity.RotatedBy(Time / 60f * MathHelper.ToRadians(720f)); - dust.velocity *= Main.rand.NextFloat(20f, 50f); - dust.scale = Main.rand.NextFloat(1.2f, 1.6f); - dust.noGravity = true; - } - } - } - } -} diff --git a/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs b/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs new file mode 100644 index 0000000000..4e18c7eadf --- /dev/null +++ b/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs @@ -0,0 +1,195 @@ +using CalamityMod.Items; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class HolofiberImmolatorHoldout : BaseGunHoldoutProjectile + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -0f; + public override float BaseOffsetY => -0f; + public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => 0.45f; + + public static float BulletSpeed = 12f; + public SlotId ChargeSlot; + public int time = 0; + + public ref float CurrentChargingFrames => ref Projectile.ai[0]; + public ref float ShotsLoaded => ref Projectile.ai[1]; + public int chargeMax = 0; + public int downtime = 0; + public bool ChargeLV1 => CurrentChargingFrames >= chargeMax; + + public override void KillHoldoutLogic() + { + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + public override void OnSpawn(IEntitySource source) + { + OffsetLengthFromArm = 15; + Player Owner = Main.player[Projectile.owner]; + chargeMax = (int)(Owner.itemAnimationMax * 1.5f); + + SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorCharge"); + ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } + + public override void HoldoutAI() + { + CalamityGlobalItem modItem = Owner.ActiveItem().Calamity(); + Vector2 mountedCenter = Owner.MountedCenter; + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter; + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if ((Owner.CantUseHoldout() || Owner.Calamity().mouseRight) && downtime == 0 && time >= 1) + { + KeepRefreshingLifetime = false; + + Projectile.timeLeft = Owner.Calamity().mouseRight ? Owner.itemAnimationMax * 2 : Owner.itemAnimationMax; + downtime = Owner.itemAnimationMax; + if (Owner.Calamity().mouseRight) + CurrentChargingFrames = 0; + + // Big Shot mode + if (ChargeLV1) + { + ChargeSound?.Stop(); + SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorFire"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = 0.3f }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + int charge2Damage = (int)(Projectile.damage * 2.5f); + float charge2KB = Projectile.knockBack * 3f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2, ModContent.ProjectileType(), charge2Damage, charge2KB, Projectile.owner); + + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlasmaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 1.3f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + } + CurrentChargingFrames = 0; + } + // Spread Fire mode + else + { + ChargeSound?.Stop(); + SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorFire"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + for (int i = 0; i < 3; i++) + { + Vector2 fireVec = shootVelocity.RotatedBy((i == 0 ? 0.4f : i == 2 ? -0.4f : 0) * Utils.GetLerpValue(chargeMax * 1.1f, 0, CurrentChargingFrames, true)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec * MathHelper.Clamp((2 * (Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true))), 0.5f, 2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlasmaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 2; + } + CurrentChargingFrames = 0; + } + } + else if (downtime == 0) + { + CurrentChargingFrames++; + // Charge-up visuals + if (CurrentChargingFrames >= 10) + { + float particleScale = Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true); + float strength = particleScale; + Vector3 DustLight = Effects.ArsenalEffects.ArsenalPlasmaColor.ToVector3(); + Lighting.AddLight(GunTipPosition, DustLight * strength); + } + + // Full charge dusts + if (CurrentChargingFrames == chargeMax) + { + ChargeSound?.Stop(); + for (int i = 0; i < 20; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, Effects.ArsenalEffects.ArsenalDust); + chargefull.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 4f + Owner.velocity * 0.5f; + chargefull.scale = Main.rand.NextFloat(0.6f, 0.8f); + chargefull.noGravity = false; + chargefull.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + } + SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorChargeLoop"); + ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } + + if (CurrentChargingFrames > chargeMax && Main.rand.NextBool()) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, Effects.ArsenalEffects.ArsenalDust); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(5, 9); + chargefull.scale = Main.rand.NextFloat(0.2f, 0.4f); + chargefull.noGravity = true; + chargefull.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + } + } + + if (downtime == 1 && !Owner.Calamity().mouseRight) + Projectile.Kill(); + + if (downtime > 0) + downtime--; + + time++; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 10f; + + float fade = Utils.GetLerpValue(chargeMax / 3, chargeMax, CurrentChargingFrames, true); + + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolator").Value; + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D pointTexture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + if (CurrentChargingFrames > 0 && downtime == 0) + { + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.15f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite); + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ImmolationArrow.cs b/Projectiles/DraedonsArsenal/ImmolationArrow.cs new file mode 100644 index 0000000000..313f5887a1 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ImmolationArrow.cs @@ -0,0 +1,255 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ImmolationArrow : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + + public NPC chosenTarget; + public bool stuckInTarget = false; + public bool stuckInGround = false; + public bool canDamage = true; + public bool canStick = true; + public int stuckTimer = 90; + public Vector2 placementCenter; + float placementDistance; + Vector2 placementVelocity; + public Vector2 storedVelocity; + public bool collideWithTiles = true; + public Vector2 startingVel; + + NPC closestTarget; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 180; + Projectile.extraUpdates = 4; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (closestTarget != null && closestTarget.life <= 0) + closestTarget = null; + + if (time == 0) + { + startingVel = Projectile.velocity; + closestTarget = (Projectile.Center + Projectile.velocity * 2).ClosestNPCAt(150); + } + else + { + NPC attemptGetTarget = (Projectile.Center + Projectile.velocity * 2).ClosestNPCAt(150); + if (attemptGetTarget != null) + closestTarget = attemptGetTarget; + } + + if (stuckInGround) + { + Projectile.extraUpdates = 2; + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.PiOver2; + stuckTimer--; + + if (stuckTimer <= 0) + { + Projectile.Kill(); + } + } + if (!stuckInTarget && !stuckInGround) + { + storedVelocity = Projectile.velocity; + Projectile.rotation = (storedVelocity).ToRotation() + MathHelper.PiOver2; + if (time > 5 && !stuckInTarget) + { + if (Main.rand.NextBool(3) && canStick) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + } + + if (targetDist < 1400f) + { + Particle spark = new SparkParticle(Projectile.Center, -Projectile.velocity, false, 13, 1.3f, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool(6)) + { + Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(12, 12); + float speed = Main.rand.NextFloat(0.2f, 0.7f); + Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlasmaColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + } + else if (stuckInTarget) + { + Projectile.extraUpdates = 2; + Projectile.rotation = (storedVelocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; + + placementCenter = chosenTarget.Center + placementVelocity * placementDistance; + + Projectile.Center = placementCenter; + + stuckTimer--; + + if (chosenTarget.life <= 0) + stuckTimer = 0; + + if (stuckTimer <= 0) + { + Projectile.Kill(); + } + } + if (stuckInTarget || stuckInGround) + { + if (Main.rand.NextBool(8)) + { + float speed = Main.rand.NextFloat(0.2f, 1.5f); + Particle spark = new SparkParticle(Projectile.Center, -storedVelocity * speed, false, 23, 0.7f * speed, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : ModContent.DustType(), -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + } + } + time++; + + if (collideWithTiles && Collision.SolidCollision(Projectile.Center, 4, 4)) // Vanilla tile collision messes with velocity so we use this instead + { + canDamage = false; + stuckInGround = true; + + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit1"); + SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.6f) }, Projectile.Center); + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.PiOver2; + collideWithTiles = false; + SoundStyle sound2 = new("CalamityMod/Sounds/Item/ImmolatorPreExplode"); + SoundEngine.PlaySound(sound2 with { Volume = 0.3f, Pitch = 0.5f }, Projectile.Center); + SoundEngine.PlaySound(HolofiberImmolator.PlasmaSound with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + + if (!stuckInTarget && canStick) + { + if (Projectile.timeLeft < 600) + Projectile.timeLeft = 600; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + for (int i = 0; i < 12; i++) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center + storedVelocity.SafeNormalize(Vector2.UnitX) * 38 + Main.rand.NextVector2Circular(12, 12), dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.velocity = storedVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.4f, 1.5f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 1.5f; + } + SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorPreExplode"); + SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.5f }, Projectile.Center); + SoundEngine.PlaySound(HolofiberImmolator.PlasmaSound with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + } + } + public override void OnKill(int timeLeft) + { + float bonus = (stuckInGround ? 3f : 1.5f); + float explosionDamage = (stuckInGround ? 2.3f : 0.5f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * explosionDamage), Projectile.knockBack * 2, Projectile.owner, 0, stuckInGround ? 1 : 0); + blast.scale = (stuckInGround ? 2 : 1); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.2f * bonus, 26); + GeneralParticleHandler.SpawnParticle(bolt2); + + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * bonus, 16); + GeneralParticleHandler.SpawnParticle(bolt3); + + for (int i = 0; i < (int)(15 * bonus); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : stuckInGround ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.9f, 1.8f); + dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + if (dust.type == Effects.ArsenalEffects.ArsenalPlasmaDust) + dust.fadeIn = 2f; + } + + SoundStyle sound = new("CalamityMod/Sounds/Item/PlasmaBig"); + SoundEngine.PlaySound(sound with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool PreDraw(ref Color lightColor) + { + if (time < 1) + return false; + + Asset tex = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ImmolationArrow"); + + if (!stuckInGround && !stuckInTarget && false) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 }, 1, tex.Value); + + float randSize = Main.rand.NextFloat(0.8f, 1.1f); + for (int i = 0; i < 20; i++) + { + Vector2 scale = Projectile.scale * new Vector2(0.5f, 1) * 1.5f * randSize; + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 3; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.2f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); + } + Vector2 scale2 = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale2, SpriteEffects.None); + if (stuckInTarget || stuckInGround) + { + Vector2 scale = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * Utils.GetLerpValue(90, 30, stuckTimer, true), Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ImmolationArrow.png b/Projectiles/DraedonsArsenal/ImmolationArrow.png new file mode 100644 index 0000000000..cda292fffe Binary files /dev/null and b/Projectiles/DraedonsArsenal/ImmolationArrow.png differ diff --git a/Projectiles/DraedonsArsenal/ImmolationBurst.cs b/Projectiles/DraedonsArsenal/ImmolationBurst.cs new file mode 100644 index 0000000000..21557b8120 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ImmolationBurst.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ImmolationBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 235; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 2; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (Projectile.ai[1] == 1) + Projectile.scale = 2f; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = (int)(5 * Projectile.scale); + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + } +} diff --git a/Projectiles/DraedonsArsenal/ImmolationSpray.cs b/Projectiles/DraedonsArsenal/ImmolationSpray.cs new file mode 100644 index 0000000000..d30ccaafbd --- /dev/null +++ b/Projectiles/DraedonsArsenal/ImmolationSpray.cs @@ -0,0 +1,102 @@ +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ImmolationSpray : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; + Projectile.penetrate = 4; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time > 5 && targetDist < 1400f) + { + Projectile.velocity.Y += 0.18f; + Projectile.velocity.X *= 0.9835f; + + if (Main.rand.NextBool(3)) + { + Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(8, 8); + float speed = Main.rand.NextFloat(0.2f, 0.7f); + Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlasmaColor); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.2f, 0.5f) : Main.rand.NextFloat(0.4f, 1.1f); + dust.velocity = (new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + } + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + SoundEngine.PlaySound(HolofiberImmolator.PlasmaSound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (targetDist < 1400) + { + Vector2 vel = oldVelocity.SafeNormalize(Vector2.UnitX); + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 5, dustStyle, (-vel * Main.rand.NextFloat(5, 8)).RotatedByRandom(0.7f)); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 1.2f; + } + } + return true; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 1) + return false; + + Asset tex = ModContent.Request("CalamityMod/Particles/GlowSpark"); + + float squash = Utils.GetLerpValue(-3, 10, Projectile.velocity.Length(), true); + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.6f, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, squash) * 0.045f * (i == 0 ? 0.6f : 1), SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs deleted file mode 100644 index 8e084688a8..0000000000 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class LaserRifleShot : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private int dust = 127; - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); - - float createDustVar = 12f; - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > createDustVar) - { - for (int i = 0; i < 2; i++) - { - int laserDust = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, Projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f); - Main.dust[laserDust].noGravity = true; - Main.dust[laserDust].position = Projectile.Center; - Main.dust[laserDust].velocity = Projectile.velocity; - } - } - - if (Projectile.localAI[0] == createDustVar) - LaserBurst(1.8f, 3f); - } - - public override void OnKill(int timeLeft) - { - int height = 60; - 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(); - - LaserBurst(2.4f, 4.2f); // 60 dusts - - for (int i = 0; i < 100; i++) - { - int killDust = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f); - float killDustX = Main.dust[killDust].velocity.X; - float killDustY = Main.dust[killDust].velocity.Y; - - if (killDustX == 0f && killDustY == 0f) - killDustX = 1f; - - float killDustVelocity = (float)Math.Sqrt(killDustX * killDustX + killDustY * killDustY); - killDustVelocity = 4f / killDustVelocity; - killDustX *= killDustVelocity; - killDustY *= killDustVelocity; - - Dust dust2 = Main.dust[killDust]; - dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + killDustX; - dust2.velocity.Y = dust2.velocity.Y + killDustY; - dust2.noGravity = true; - } - } - - private void LaserBurst(float speed1, float speed2) - { - float angleRandom = 0.05f; - - for (int i = 0; i < 20; i++) - { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - int burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); - Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[burstDust].noGravity = true; - - Dust dust2 = Main.dust[burstDust]; - dust2.velocity *= 3f; - dust2 = Main.dust[burstDust]; - - burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); - Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - - dust2 = Main.dust[burstDust]; - dust2.velocity *= 2f; - - Main.dust[burstDust].noGravity = true; - Main.dust[burstDust].fadeIn = 1f; - Main.dust[burstDust].color = Color.Orange * 0.5f; - - dust2 = Main.dust[burstDust]; - } - for (int j = 0; j < 10; j++) - { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - int burstDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); - Main.dust[burstDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[burstDust2].noGravity = true; - - Dust dust2 = Main.dust[burstDust2]; - dust2.velocity *= 0.5f; - dust2 = Main.dust[burstDust2]; - } - } - } -} diff --git a/Projectiles/DraedonsArsenal/NidhoggBottom.png b/Projectiles/DraedonsArsenal/NidhoggBottom.png new file mode 100644 index 0000000000..c082408c47 Binary files /dev/null and b/Projectiles/DraedonsArsenal/NidhoggBottom.png differ diff --git a/Projectiles/DraedonsArsenal/NidhoggExplosion.cs b/Projectiles/DraedonsArsenal/NidhoggExplosion.cs new file mode 100644 index 0000000000..428ab220d0 --- /dev/null +++ b/Projectiles/DraedonsArsenal/NidhoggExplosion.cs @@ -0,0 +1,85 @@ +using System; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class NidhoggExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float sine = 0; + public float shrink = 1; + public int strongTimer = 0; + public bool strong => strongTimer < 10; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 250; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.timeLeft = 420; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel.SafeNormalize(Vector2.UnitX) * 120, ModContent.DustType(), -dustVel, 0, default, Main.rand.NextFloat(0.5f, 1f)); + dust.noGravity = true; + dust.fadeIn = 0.05f; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC target = Main.npc[i]; + if (target != null && target.CanBeMoved(true)) + { + if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 500) + { + Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); + target.velocity = Vector2.Lerp(target.velocity, moveDir * 8, 0.12f); + target.Center += moveDir * 1.5f; + } + } + } + Projectile.rotation += 0.07f; + if (shrink > 0) + shrink -= strong ? 0.03f : 0.03f; + else + shrink = 1; + + if (!strong) + time++; + strongTimer++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (!strong) + modifiers.SourceDamage *= 0.1f; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + public override bool PreDraw(ref Color lightColor) + { + float shrinkFade = Math.Min(Utils.GetLerpValue(1, 0.7f, shrink, true), Utils.GetLerpValue(0f, 0.3f, shrink, true)); + float sine = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.5f / MathHelper.Pi), 0.4f, 0.8f)); + float sine2 = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.7f / MathHelper.Pi), 0.4f, 0.8f)); + float fade = (float)Math.Pow(Utils.GetLerpValue(0, 10, Projectile.timeLeft, true), 3); + float areaScale = (strong ? 1f : 1) * fade; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowSquareParticleBig").Value; + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * (strong ? 0.5f : 0.3f) * shrinkFade; + + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2), SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/NidhoggHoldout.cs b/Projectiles/DraedonsArsenal/NidhoggHoldout.cs new file mode 100644 index 0000000000..a8b14bd9f5 --- /dev/null +++ b/Projectiles/DraedonsArsenal/NidhoggHoldout.cs @@ -0,0 +1,264 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class NidhoggHoldout : BaseGunHoldoutProjectile + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override int AssociatedItemID => ModContent.ItemType(); + + public Player Owner => Main.player[Projectile.owner]; + public float offsetBase = 30; + public override float MaxOffsetLengthFromArm => offsetBase; + public override float RecoilResolveSpeed => (shootingTimer < 0) ? 0.02f : 0.1f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => charging ? 0.75f : 0.4f; + public SlotId SoundSlot; + public bool charging => Projectile.ai[2] == 5; + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float chargeTimer => ref Projectile.ai[1]; + public int fireRate => Owner.HeldItem.useAnimation; + public int chargeRate => 222; // It's spesifically this to line up with the charge sound + public int time = 0; + public float lightSine = 0; + float charge = 0; // multiplier for vfx based on charge of the weapon + + public override void KillHoldoutLogic() + { + if (Owner.dead) + { + StopSounds(); + Projectile.Kill(); + } + } + public void StopSounds() + { + if (SoundEngine.TryGetActiveSound(SoundSlot, out var audio2) && audio2.IsPlaying) + { + audio2?.Stop(); + } + } + public override void HoldoutAI() + { + if (time == 0) + { + OffsetLengthFromArm = offsetBase; + if (!charging) + shootingTimer = fireRate; + } + + if (shootingTimer < 0) + { + if (charge > 0) + charge = 1 - (float)Math.Pow(Utils.GetLerpValue(-50, -20, shootingTimer, true), 8); + shootingTimer++; + if (charge == 0) // Make a sound when the jaws close + { + SoundStyle close = new("CalamityMod/Sounds/NPCHit/ExoHit2"); + SoundEngine.PlaySound(close with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.3f, 0.4f) }, Projectile.Center); + charge -= 0.001f; + } + if (shootingTimer == 0) + { + shootingTimer = fireRate; + } + + return; + } + + if (HeldItem.type != Owner.ActiveItem().type) + { + StopSounds(); + Projectile.Kill(); + return; + } + if (!charging) + { + StopSounds(); + } + if (shootingTimer == 0) + { + if (!charging || Owner.Calamity().arsenalCooldown > 0) + { + if (Owner.Calamity().mouseRight) + { + Projectile.ai[2] = 5; + shootingTimer = 1; // This is just so you dont fire when you stop using it + return; + } + Shoot(false); + } + else // Charging mode + { + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalGaussColor.ToVector3() * 2f * MathHelper.Lerp(Math.Abs(lightSine), 0.5f, 0.3f)); + + if (chargeTimer == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/NidhoggCharge"); + SoundSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center); + } + if (chargeTimer == chargeRate) // Reached max charge + { + Shoot(true); + } + else + chargeTimer++; + } + } + else + { + if (!Owner.Calamity().mouseRight && !Main.mouseLeft && shootingTimer > 0) + { + StopSounds(); + Projectile.Kill(); + } + } + + if (shootingTimer > 0) + shootingTimer--; + + time++; + + if (SoundEngine.TryGetActiveSound(SoundSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + if (shootingTimer >= 0) + charge = (float)(Math.Pow(chargeTimer / chargeRate, 3)); + } + public void Shoot(bool isBig) + { + if (isBig) + { + Owner.velocity += -Projectile.velocity * 12; + OffsetLengthFromArm -= 15; + StopSounds(); + Owner.Calamity().arsenalCooldown = 540; + Owner.AddCooldown(ArsenalPower.ID, 540); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + int chargeDamage = (int)(Projectile.damage * 33); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 6, ModContent.ProjectileType(), chargeDamage, 0, Projectile.owner); + + SoundStyle sound = new("CalamityMod/Sounds/Item/NidhoggBigShot"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.9f, MaxInstances = 2, Pitch = (i == 0 ? -0.4f : 0) }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 8f; + + for (int i = 0; i < 40; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Main.rand.NextBool(3) ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalGaussDust, (shootVelocity * 25).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(1.2f, 1.9f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + } + for (float i = 0.6f; i <= 1; i += 0.4f) + { + Particle pulse3 = new CustomSpark(Projectile.Center, Projectile.velocity * (20 - 10 * i), "CalamityMod/Particles/GlowSquareFading", false, 19, 0.9f * i, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1.2f, 0.7f), shrinkSpeed: -0.1f, extraRotation: MathHelper.Pi); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + shootingTimer = (-50); + chargeTimer = 0; + Projectile.ai[2] = 0; + } + else + { + OffsetLengthFromArm -= 5; + SoundStyle sound = new("CalamityMod/Sounds/Item/NidhoggFire"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + + for (int i = 0; i < 9; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Main.rand.NextBool(3) ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalGaussDust, (shootVelocity * 4).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 1.1f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + } + + shootingTimer = fireRate; + } + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(SoundSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D topJaw = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/NidhoggTop").Value; + Texture2D bottomJaw = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/NidhoggBottom").Value; + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/NidhoggGlow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 jawVec = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2 * Projectile.direction); + + float randSize = Main.rand.NextFloat(0.9f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D aimTex = ModContent.Request("CalamityMod/Particles/BloomLineThick").Value; + Texture2D ringTex = ModContent.Request("CalamityMod/Particles/GlowSquareFading").Value; + Texture2D pointTexture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Texture2D centerTex = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + if (charging) + { + drawPosition += Projectile.velocity * Main.rand.NextFloat(-6 * charge, 6 * charge); + + for (int i = 1; i <= 5; i++) // Sightlines + { + float sine = (float)Math.Sin(((charge * 60f + time * 0.15f) + MathHelper.ToRadians(216) * i) / MathHelper.Pi); + float angle = MathHelper.ToRadians(36) * sine * Math.Max(1 - charge * 1.06f, 0); + Color lineColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * Math.Abs(sine) * Math.Min(chargeTimer / (chargeRate * 0.3f), 1) * 0.2f; + Main.EntitySpriteDraw(aimTex, Projectile.Center - Main.screenPosition + Projectile.velocity * 10, null, lineColor, Projectile.rotation + angle - MathHelper.PiOver2, new Vector2(aimTex.Size().X * 0.5f, 0), new Vector2(0.2f - Math.Abs(sine) * 0.12f, 8) * 0.07f, SpriteEffects.FlipVertically, 0); + } + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(centerTex, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, null, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, i * 0.3f) with { A = 0 }, drawRotation, centerTex.Size() * 0.5f, new Vector2(2.1f, 0.9f) * ((0.04f + 0.1f * (float)Math.Pow(charge, 3)) - 0.02f * i), flipSprite); + } + // Oh boy I love perfectly placing multiple textures together!!! + Vector2 topJawPlace = drawPosition - jawVec * (5 + 10 * (float)Math.Pow(charge, 3)); + Vector2 bottomJawPlace = drawPosition + jawVec * (4 + 10 * (float)Math.Pow(charge, 3)) + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6; + Vector2 glowPlace = topJawPlace + jawVec; + for (int i = 0; i < 14; i++) + { + Color auraColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * 0.25f * charge; + Vector2 drawOffset = (MathHelper.TwoPi * i / 14f).ToRotationVector2() * 3 * charge; + Main.EntitySpriteDraw(bottomJaw, bottomJawPlace + drawOffset, null, auraColor, drawRotation, bottomJaw.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(topJaw, topJawPlace + drawOffset, null, auraColor, drawRotation, topJaw.Size() * 0.5f, Projectile.scale, flipSprite); + } + + Main.EntitySpriteDraw(bottomJaw, bottomJawPlace, null, drawColor, drawRotation, bottomJaw.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(topJaw, topJawPlace, null, drawColor, drawRotation, topJaw.Size() * 0.5f, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(glowTexture, glowPlace, null, Color.White, drawRotation, glowTexture.Size() * 0.5f, Projectile.scale, flipSprite); + if (charging) + { + for (int i = 1; i <= 3; i++) // "Rings" + { + lightSine = (float)Math.Sin(((charge * 100f + time * 0.15f) + MathHelper.ToRadians(360) * i) / MathHelper.Pi); + float angle = MathHelper.ToRadians(36) * lightSine * (1 - charge); + Vector2 posOffset = Projectile.velocity * 20 * lightSine; + Color lineColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * Math.Min(chargeTimer / (chargeRate * 0.3f), 1) * 0.7f; + Main.EntitySpriteDraw(ringTex, Projectile.Center - Main.screenPosition + posOffset, null, lineColor, Projectile.rotation + MathHelper.PiOver2, ringTex.Size() * 0.5f, new Vector2(1 + 0.5f * (float)Math.Pow(charge, 3), 1) * (0.12f + i * 0.025f), SpriteEffects.FlipVertically, 0); + } + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/NidhoggRailgunBigShot.cs b/Projectiles/DraedonsArsenal/NidhoggRailgunBigShot.cs new file mode 100644 index 0000000000..a05b781b79 --- /dev/null +++ b/Projectiles/DraedonsArsenal/NidhoggRailgunBigShot.cs @@ -0,0 +1,115 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class NidhoggRailgunBigShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 60; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 900; + Projectile.extraUpdates = 80; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (targetDist < 1400 && time > 7) + { + if (time % 2 == 0) + { + Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 48, 0.375f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 2f), true, true, glowCenterScale: 0.7f, shrinkSpeed: 0.05f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (time % 3 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), ModContent.DustType()); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(10f, 30f); + dust.scale = Main.rand.NextFloat(1.3f, 1.7f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = time % 6 != 0; + dust.fadeIn = -0.6f; + } + + if (time % 12 == 0) + { + Particle trail2 = new VelChangingSpark(Projectile.Center, -Projectile.velocity * 0.1f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/GlowSquareFading", 35, 0.33f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 0.8f), shrinkSpeed: 0f, lerpRate: 0.1f); + GeneralParticleHandler.SpawnParticle(trail2); + } + } + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 20 && projectile.active && projectile.type == ModContent.ProjectileType()) + { + projectile.Kill(); + Projectile.velocity = Projectile.Center.DirectionTo(Owner.Center) * 6; + Projectile.hostile = true; + Projectile.friendly = false; + } + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + impactDust(); + + bool onKill = (target.life <= 0 && target.realLife == -1); + if (onKill && Projectile.numHits > 0) + Projectile.numHits--; + + modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult + critDamage; + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 20; + target.MoveNPC(launchVel, launchPower, true); + } + + public override void OnKill(int timeLeft) + { + impactDust(); + } + public void impactDust() + { + for (int i = 0; i < MathHelper.Clamp(12 - Projectile.numHits * 2, 1, 12); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalGaussDust); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(14f, 37f); + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/NidhoggRailgunBlast.cs b/Projectiles/DraedonsArsenal/NidhoggRailgunBlast.cs new file mode 100644 index 0000000000..ba71ef2c53 --- /dev/null +++ b/Projectiles/DraedonsArsenal/NidhoggRailgunBlast.cs @@ -0,0 +1,101 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class NidhoggRailgunBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 80; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (targetDist < 1400 && time > 7) + { + if (time % 3 == 0) + { + Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 8, 0.15f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 2.5f), true, true, glowCenterScale: 0.7f, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (time % 3 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), Effects.ArsenalEffects.ArsenalGaussDust); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.1f, 0.2f); + dust.scale = Main.rand.NextFloat(0.7f, 0.85f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = time % 9 != 0; + dust.fadeIn = 0.3f; + } + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 8, MathHelper.Clamp(0.06f - Projectile.numHits * 0.01f, 0f, 0.06f), Effects.ArsenalEffects.ArsenalGaussColor * 0.9f, new Vector2(1f, 0.5f), true, true, 0.9f); + GeneralParticleHandler.SpawnParticle(spark); + + if (Projectile.numHits == 0) + { + Particle bolt2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/GlowSquareParticleThick", false, 8, 1f, Effects.ArsenalEffects.ArsenalGaussColor * 0.6f, Vector2.One, true, true, glowOpacity: 0.5f, glowCenterScale: 1.15f, extraRotation: MathHelper.PiOver4); + GeneralParticleHandler.SpawnParticle(bolt2); + + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == Projectile.owner) + { + if (p.timeLeft > 10) + p.timeLeft = 10; + } + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, 0f, 0f); + } + impactDust(); + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 6; + target.MoveNPC(launchVel, launchPower, true); + } + + public override void OnKill(int timeLeft) + { + impactDust(); + } + public void impactDust() + { + for (int i = 0; i < MathHelper.Clamp(5 - Projectile.numHits, 1, 5); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(8f, 13f); + dust.scale = Main.rand.NextFloat(0.8f, 1.35f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/NidhoggTop.png b/Projectiles/DraedonsArsenal/NidhoggTop.png new file mode 100644 index 0000000000..cd159f151e Binary files /dev/null and b/Projectiles/DraedonsArsenal/NidhoggTop.png differ diff --git a/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs b/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs new file mode 100644 index 0000000000..9903b3f728 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs @@ -0,0 +1,368 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PhalanxSurgeHoldout : BaseGunHoldoutProjectile + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override int AssociatedItemID => ModContent.ItemType(); + + public Player Owner => Main.player[Projectile.owner]; + public float offsetBase = 30; + public override float MaxOffsetLengthFromArm => doingChargeAttack ? 100f : offsetBase; + public override float RecoilResolveSpeed => doingChargeAttack ? 2f : (shootingTimer < 0) ? 0.2f : 0.1f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => (shootingTimer < 0 ? 0 : 0.35f); + public SlotId ChargeSlot; + public SlotId StartSlot; + public bool charging => Projectile.ai[2] == 5; + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float chargeTimer => ref Projectile.ai[1]; + public int fireRate => Owner.HeldItem.useAnimation; + public int chargeRate => 65; + public bool fullyCharged = false; + public bool doingChargeAttack = false; + public bool startChargeLoop = true; + public int time = 0; + float charge = 0; // multiplier for vfx based on charge of the weapon + public bool didDash = false; + + public override void KillHoldoutLogic() + { + if (Owner.dead) + { + StopSounds(); + Projectile.Kill(); + } + } + public void StopSounds() + { + if (SoundEngine.TryGetActiveSound(StartSlot, out var audio) && audio.IsPlaying) + { + audio?.Stop(); + } + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var audio2) && audio2.IsPlaying) + { + audio2?.Stop(); + } + } + public override void HoldoutAI() + { + if (time == 0) + { + OffsetLengthFromArm = offsetBase; + if (!charging) + shootingTimer = fireRate; + } + + if (shootingTimer < 0) + { + if (Projectile.localAI[0] > 0) + { + Owner.velocity = -Projectile.velocity * (didDash ? 25 : (5 + 10 * Projectile.localAI[0])); + didDash = false; + Projectile.localAI[0] = 0; + } + if (didDash) + { + Owner.velocity = Projectile.velocity * 25; + if (!Collision.SolidCollision(GunTipPosition, 10, 10)) + { + Owner.Center += Projectile.velocity * 40; + Projectile.Center += Projectile.velocity * 40; + } + float fxScale = Utils.GetLerpValue(10, 25, Owner.velocity.Length(), true); + for (int i = 0; i < 3; i++) + { + Particle spark2 = new CustomSpark(Owner.Center + Main.rand.NextVector2Circular(20, 20), -Owner.velocity * Main.rand.NextFloat(0.4f, 1.2f), "CalamityMod/Particles/BloomLineSoftEdge", false, 12, Main.rand.NextFloat(0.02f, 0.03f) * fxScale, Effects.ArsenalEffects.ArsenalLaserColor * 0.8f, new Vector2(1, 1), true, false, 0, false, false, 1f * fxScale); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + Owner.direction = Projectile.direction; + shootingTimer++; + if (shootingTimer == 0) + { + didDash = false; + shootingTimer = fireRate; + } + return; + } + + if (HeldItem.type != Owner.ActiveItem().type) + { + StopSounds(); + Projectile.Kill(); + return; + } + if (!charging) + { + StopSounds(); + } + if (shootingTimer == 0) + { + if (!charging || Owner.Calamity().arsenalCooldown > 0) + { + if (Owner.Calamity().mouseRight) + { + Projectile.ai[2] = 5; + shootingTimer = 1; // This is just so you dont fire when you stop using it + return; + } + Shoot(false); + } + else // Charging mode + { + if (Owner.Calamity().mouseRight && !doingChargeAttack) // Charge up the skewer + { + for (int i = 0; i < 4; i++) + { + Vector2 place = GunTipPosition + Main.rand.NextVector2Circular(5, 5) + Projectile.velocity * 12; + int dir = Main.rand.NextBool() ? 1 : -1; + Particle chargeParticles = new CustomSpark(place, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(8, 30), "CalamityMod/Particles/BloomLineSoftEdge", false, 6, 0.015f * charge, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 0.7f), shrinkSpeed: 1.4f); + GeneralParticleHandler.SpawnParticle(chargeParticles); + + if (i % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(place, Effects.ArsenalEffects.ArsenalLaserDust, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(4, 20), 0, default, Main.rand.NextFloat(0.4f, 0.9f) * charge); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + } + } + + bool soundPlaying = (SoundEngine.TryGetActiveSound(StartSlot, out var audio) && audio != null); + if (chargeTimer == chargeRate && (!SoundEngine.TryGetActiveSound(ChargeSlot, out var audio3) || !audio3.IsPlaying)) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/PhalanxSurgeChargeLoop"); + ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } + if ((!soundPlaying || !audio.IsPlaying) && startChargeLoop) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/PhalanxSurgeCharge"); + StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center); + startChargeLoop = false; + } + if (chargeTimer == chargeRate) // Reached max charge + { + SoundStyle sound = new("CalamityMod/Sounds/Item/PhalanxSurgeChargeMax"); + StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); + + fullyCharged = true; + chargeTimer = 0; + OffsetLengthFromArm -= 7f; + } + if (!fullyCharged) + chargeTimer++; + } + else + { + if (fullyCharged) + { + doingChargeAttack = true; + int chargeAnimMax = (int)(chargeRate * 0.2f); + float completion = (chargeTimer / chargeAnimMax); + + if (chargeTimer <= chargeAnimMax) // Do the pullback pre fire animation here + { + float inMin = 10; + float outMax = 60; + float inOutPoint = 0.5f; + if (completion >= inOutPoint) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(inOutPoint, 1f, completion, true), 5); + OffsetLengthFromArm = MathHelper.Lerp(inMin, outMax, completionLerp); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, inOutPoint, completion, true), 3); + OffsetLengthFromArm = MathHelper.Lerp(offsetBase, inMin, completionLerp); + } + } + if (chargeTimer == chargeAnimMax) + { + Shoot(true); + fullyCharged = false; + startChargeLoop = true; + doingChargeAttack = false; + chargeTimer = 0; + Projectile.ai[2] = 0; // Return to regular firing mode + } + chargeTimer++; + } + else // Failure to full charge + { + shootingTimer = (int)(-fireRate * 0.5f); + chargeTimer = 0; + startChargeLoop = true; + Projectile.ai[2] = 0; // Return to regular firing mode + } + } + } + } + else + { + if (!Owner.Calamity().mouseRight && !Main.mouseLeft && shootingTimer > 0) + { + StopSounds(); + Projectile.Kill(); + } + } + + if (shootingTimer > 0) + shootingTimer--; + + time++; + + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + if (SoundEngine.TryGetActiveSound(StartSlot, out var StartSound) && StartSound.IsPlaying) + { + StartSound.Position = Projectile.Center; + } + charge = (float)(fullyCharged ? 1 : Math.Pow(chargeTimer / chargeRate, 4)); + } + public void Shoot(bool isSkewer) + { + if (isSkewer) + { + if (Main.mouseLeft) + { + SoundStyle sound2 = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(sound2 with { Volume = 0.9f, Pitch = 0.4f }, Projectile.Center); + Particle pulse3 = new CustomSpark(Owner.Center, Projectile.velocity * 7, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 26, 0.09f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(pulse3); + didDash = true; + } + + StopSounds(); + Owner.Calamity().arsenalCooldown = 300; + Owner.AddCooldown(ArsenalPower.ID, 300); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); + int chargeDamage = (int)(Projectile.damage * (35 + (didDash ? 10 : 0))); // Used to be 50x - 60x, skewed the damage way too much to the lance even with it being the special + float chargeKB = Projectile.knockBack * 3f; + Projectile skewer = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2, ModContent.ProjectileType(), chargeDamage, chargeKB, Projectile.owner,0,0, (didDash ? 5 : 0)); + skewer.timeLeft = (didDash ? 25 : 10); + SoundStyle sound = new("CalamityMod/Sounds/Item/PhalanxSurgeChargeShoot"); + SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 6f; + + float mult = didDash ? 2 : 1; + for (int i = 0; i < 20 * mult; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalLaserDust, (shootVelocity * 20).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f) * mult, 0, default, Main.rand.NextFloat(0.5f, 1.3f) * mult); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + } + + + shootingTimer = (didDash ? -25 : -10); + } + else + { + OffsetLengthFromArm -= 10; + SoundStyle sound = new("CalamityMod/Sounds/Item/PhalanxSurgeShoot"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 6f; + float angle1 = MathHelper.ToRadians(2f); + int projType = ModContent.ProjectileType(); + for (int i = 0; i < 2; i++) + { + Vector2 corVel1 = shootVelocity.RotatedBy(angle1 * 1.25f) * 0.8f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 2, corVel1, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 1); + Vector2 corVel2 = shootVelocity.RotatedBy(angle1 * 0.75f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 10, corVel2, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0.65f); + angle1 *= -1; + } + float angle2 = MathHelper.ToRadians(5f); + for (int i = 0; i < 2; i++) + { + Vector2 corVel3 = shootVelocity.RotatedBy(angle2) * 0.9f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 4, corVel3, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0.8f); + angle2 *= -1; + } + + for (int i = 0; i < 9; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalLaserDust, (shootVelocity * 5).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.5f, 0.8f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + } + + shootingTimer = fireRate; + } + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + if (SoundEngine.TryGetActiveSound(StartSlot, out var StartSound)) + StartSound?.Stop(); + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PhalanxSurge").Value; + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PhalanxSurgeGlow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3); + + + float randSize = Main.rand.NextFloat(0.9f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/ArchSmear").Value; + Texture2D pointTexture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + + if (charging) + { + float rumble = (fullyCharged ? 0 : charge); + drawPosition += Main.rand.NextVector2Circular(5 * rumble, 5 * rumble); + + for (int i = 0; i < 8; i++) + { + float thin = (1 - i * 0.15f); + float fat = (1 + i * 0.3f) * charge; + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition + Projectile.velocity * 10, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * 0.35f * charge, Projectile.rotation + MathHelper.PiOver2, rechargeTexture.Size() * 0.5f, new Vector2(thin, fat) * 0.3f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition + Projectile.velocity * 10, null, Color.White with { A = 0 } * 0.25f * charge, Projectile.rotation + MathHelper.PiOver2, rechargeTexture.Size() * 0.5f, new Vector2(thin, fat) * 0.2f * randSize, SpriteEffects.None, 0); + } + } + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + if (charging) + { + for (int i = 0; i < 4; i++) + { + Color auraColor = Color.White with { A = 0 } * 0.6f * charge; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 48f).ToRotationVector2() * charge; + rotationalDrawOffset *= 3; + Main.EntitySpriteDraw(glowTexture, drawPosition + rotationalDrawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + } + } + + + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/PhalanxSurgeLance.cs b/Projectiles/DraedonsArsenal/PhalanxSurgeLance.cs new file mode 100644 index 0000000000..8fcacbe4d0 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PhalanxSurgeLance.cs @@ -0,0 +1,170 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PhalanxSurgeLance : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Vector2 startVel = Vector2.Zero; + public int time = 0; + public bool didDash => Projectile.ai[2] == 5; + public override void SetDefaults() + { + Projectile.width = 35; + Projectile.height = 35; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserColor.ToVector3()); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time == 0) + { + startVel = Projectile.velocity; + for (int i = 0; i <= 15; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(40, 40), Effects.ArsenalEffects.ArsenalLaserDust); + chargefull.velocity = (Projectile.velocity * 10).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 2f); + chargefull.scale = Main.rand.NextFloat(0.4f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Effects.ArsenalEffects.ArsenalLaserColor; + } + for (int i = 0; i < 20; i++) + { + Vector2 place = Projectile.Center + startVel * 20 + Main.rand.NextVector2Circular(5, 5); + int dir = Main.rand.NextBool() ? 1 : -1; + Particle chargeParticles = new CustomSpark(place, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(12, 35), "CalamityMod/Particles/BloomLineSoftEdge", false, 7, 0.025f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 0.7f), shrinkSpeed: 1.3f); + GeneralParticleHandler.SpawnParticle(chargeParticles); + + if (i % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(place, Effects.ArsenalEffects.ArsenalLaserDust, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(4, 20), 0, default, Main.rand.NextFloat(0.7f, 1.2f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + } + } + } + Projectile.rotation = startVel.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; + Projectile.Center = Owner.Center + startVel * 30; + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + bool onKill = (target.life <= 0 && target.realLife == -1); + Player Owner = Main.player[Projectile.owner]; + float distMult = Utils.GetLerpValue(400, 10, Utils.Distance(target.Center, Projectile.Center), true); + Vector2 launchVel = startVel; + target.MoveNPC(launchVel, 10 + 35 * distMult, true); + + if (Projectile.numHits == 0) + { + if (!onKill || !didDash) + { + for (int i = -5; i <= 5; i++) + { + if (i == 0) + i++; + Particle spark2 = new CustomSpark(target.Center, startVel * i * 2, "CalamityMod/Particles/BloomLineSoftEdge", false, 12, 0.085f - Math.Abs(i) * 0.012f, Effects.ArsenalEffects.ArsenalLaserColor * 1f, new Vector2((6 - Math.Abs(i)) * 0.4f, 1), true, true, 0, false, false, 1.2f, glowOpacity: 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Projectile.timeLeft > 10) + Projectile.timeLeft = 10; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner) + { + projectile.localAI[0] = distMult; // Tell the holdout that you hit a target and how much recoil + } + } + } + else if (didDash) + { + int extention = 25; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.owner == Projectile.owner && projectile.ai[0] > -extention) + { + projectile.ai[0] -= extention; + } + } + if (Projectile.timeLeft < extention) + Projectile.timeLeft = extention; + } + + SoundStyle sound = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center); + } + for (int i = 0; i < MathHelper.Clamp(25 - Projectile.numHits * 3, 1, 10); i++) + { + Vector2 velocity = startVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(8f, 20f); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserDust, velocity, 0, default, Main.rand.NextFloat(0.9f, 1.8f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + dust.fadeIn = -3; + } + if (onKill) + Projectile.numHits--; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.4f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (startVel == Vector2.Zero) + return false; + // If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough. + if (projHitbox.Intersects(targetHitbox)) + return true; + // Otherwise, perform an AABB line collision check to check the whole beam. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Projectile.Center + startVel * 145, Projectile.width * Projectile.scale, ref _); + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 1) + return false; + Texture2D pointTexture = ModContent.Request("CalamityMod/Particles/BloomLineFade").Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + float fade = Utils.GetLerpValue(0, 5, Projectile.timeLeft, true); + Vector2 distVel = startVel * 10; + for (int i = 0; i < 6; i++) + Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition + (distVel * (3 + i)), null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fade, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.5f * (1 - i * 0.08f) * fade, 0.8f * (1 + i * 0.07f)) * 0.11f, SpriteEffects.None); + for (int i = 0; i < 6; i++) + Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition + (distVel * (3 + i)), null, Color.White with { A = 0 } * 0.8f * fade, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.5f * (1 - i * 0.08f) * fade, 0.8f * (1 + i * 0.07f)) * 0.07f, SpriteEffects.None); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(bloomTexture, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fade, Projectile.rotation, bloomTexture.Size() * 0.5f, new Vector2(0.6f, 1) * 0.8f, SpriteEffects.None); + Main.EntitySpriteDraw(bloomTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fade, Projectile.rotation, bloomTexture.Size() * 0.5f, new Vector2(0.5f, 1) * 0.65f, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs b/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs new file mode 100644 index 0000000000..5c1d41f657 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs @@ -0,0 +1,78 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PhalanxSurgeLaser : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private int dust = 127; + public int time = 0; + public override void SetDefaults() + { + Projectile.width = 7; + Projectile.height = 7; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 7; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserColor.ToVector3() * 0.4f); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time > 15 && targetDist < 1400) + { + if (Projectile.timeLeft % 3 == 0) + { + Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 8, 1.7f * Projectile.ai[0], Effects.ArsenalEffects.ArsenalLaserColor); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft % 2 == 0) + { + SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 3, 0.7f * Projectile.ai[0], Color.White); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + time++; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserDust, (Projectile.velocity * 4).RotatedByRandom(0.1f) * Main.rand.NextFloat(0.3f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 1.3f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + dust.fadeIn = -3; + } + } + public override bool PreDraw(ref Color lightColor) + { + + if (time < 1) + return false; + Texture2D pointTexture = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; + float fade = Utils.GetLerpValue(0, 15, Projectile.timeLeft, true); + + for (int i = 0; i < 4; i++) + { + Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fade * 0.4f, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.7f - i * 0.1f, 1 + i * 0.15f) * 0.018f * Projectile.ai[0], SpriteEffects.None); + Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fade * 0.2f, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.7f - i * 0.1f, 1 + i * 0.15f) * 0.013f * Projectile.ai[0], SpriteEffects.None); + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 4594581636..f864cef1ff 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -6,6 +6,7 @@ using CalamityMod.Graphics.Primitives; using CalamityMod.Items; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { + [PierceResistException] public class PhaseslayerProjectile : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeNoPin.png b/Projectiles/DraedonsArsenal/PulseGrenadeNoPin.png new file mode 100644 index 0000000000..f1ae57288f Binary files /dev/null and b/Projectiles/DraedonsArsenal/PulseGrenadeNoPin.png differ diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs b/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs new file mode 100644 index 0000000000..2bebbdd2fb --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs @@ -0,0 +1,146 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static Terraria.Player; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PulseGrenadeOrb : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public ref float time => ref Projectile.ai[0]; + public bool onSpawn = true; + public Vector2 lastPos; + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 15; + } + public override bool ShouldUpdatePosition() => (time < 120); + public override void AI() + { + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseColor.ToVector3() * 0.5f); + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (onSpawn) + { + lastPos = Projectile.Center; + Projectile.scale = (Projectile.Calamity().stealthStrike ? 1 : 0.7f); + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.5f) * Main.rand.NextFloat(5f, 7f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 1; + } + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(7f, 9f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.3f; + } + + onSpawn = false; + } + + if (time < 120) + Projectile.velocity = Projectile.velocity.RotatedBy(0.023f * Projectile.ai[1] * (time > 25 ? 1 : 0)) * 0.997f * (time > 25 ? 1 : 0.98f); + else + { + Vector2 goal = Vector2.Lerp(Owner.GetFrontHandPosition(CompositeArmStretchAmount.None, Owner.compositeFrontArm.rotation), Projectile.Center, 0.5f); + Projectile.Center = Vector2.Lerp(Projectile.Center, goal, (float)Math.Pow(Utils.GetLerpValue(120, 250, time, true), 5)); + + Vector2 direction = Utils.DirectionTo(Projectile.Center, Owner.Center); + float power = Utils.Distance(Projectile.Center, lastPos); + Projectile.velocity = direction * power; + + if (time == 250 || Utils.Distance(Projectile.Center, Owner.Center) < 10) + { + if (Projectile.ai[2] == 0 && Owner.HeldItem.type == ModContent.ItemType()) + { + Projectile reformGrenade = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), goal, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0); + reformGrenade.ai[1] = 5; + reformGrenade.ai[0] = Owner.HeldItem.useTime * 0.7f; + reformGrenade.Opacity = 0; + + SoundStyle grab = new("CalamityMod/Sounds/Item/LightCatch"); + SoundEngine.PlaySound(grab with { Volume = 1f, Pitch = 0 }, Projectile.Center); + SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSound"); + SoundEngine.PlaySound(pulse with { Volume = 0.1f, Pitch = 0.4f }, Projectile.Center); + + Particle restock = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPulseColor, "CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenade", Vector2.One, Main.rand.NextFloat(-0.2f, 0.2f), 1.5f, 0.9f, 45, true); + GeneralParticleHandler.SpawnParticle(restock); + Particle restock2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPulseColor, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-0.2f, 0.2f), 0.55f, 0.05f, 30, true); + GeneralParticleHandler.SpawnParticle(restock2); + + Projectile.Kill(); + return; + } + else + { + Projectile.Kill(); + return; + } + } + } + + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + if (targetDist < 1400f && squash > 0.2f && time > 5) // The trail + { + Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/DualTrail", false, 13, 0.075f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor * 0.6f * squash, new Vector2(1 - 0.15f * squash, 1.3f + Utils.GetLerpValue(11, 15, Projectile.velocity.Length(), true) * 1.5f), true, false, shrinkSpeed: 0.2f * squash); + GeneralParticleHandler.SpawnParticle(trail); + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + time++; + lastPos = Projectile.Center; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.23f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (Projectile.Calamity().stealthStrike ? 0.57f : 0.33f) * damageMult; + } + public override bool? CanHitNPC(NPC target) => null; + public override bool PreDraw(ref Color lightColor) + { + Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 2f)); + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, 40 * Projectile.extraUpdates, Projectile.timeLeft, true), 5); + + for (int i = 0; i < 6; i++) + { + Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalPulseColor, Color.White, i * 0.07f) with { A = 0 } * 0.5f; + Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f + i * 0.01f) * 3; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); + } + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/PulseGrenadePin.png b/Projectiles/DraedonsArsenal/PulseGrenadePin.png new file mode 100644 index 0000000000..9b251b5081 Binary files /dev/null and b/Projectiles/DraedonsArsenal/PulseGrenadePin.png differ diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs new file mode 100644 index 0000000000..0c3fcb4a86 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs @@ -0,0 +1,351 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static Terraria.Player; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PulseGrenadeProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenade"; + + public ref float time => ref Projectile.ai[0]; + public bool catching => Projectile.ai[1] == 5; + public bool caught = false; + public Player Owner => Main.player[Projectile.owner]; + public int tileHits = 0; // Keeps track of how many times the projectile has hit a tile. + public bool flung = false; // If the projectile has entered the thrown state. + public float UseTimer => Owner.HeldItem.useTime; + public float fxScale = 0; // A scaling value for the effects + public NPC targeted; + + public bool hasStoppedHolding = false; // If the player has let go of m1, thereby throwing the projectile. + + public Color col = Effects.ArsenalEffects.ArsenalPulseColor; + public bool pullPin = true; + public bool onSpawn = true; + public int beepTimer = 0; + public int beepRate = 1; + + public NPC lastHitTarget; + public override void SetDefaults() + { + Projectile.width = 5; + Projectile.height = 5; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + + Projectile.timeLeft = 180; + Projectile.DamageType = RogueDamageClass.Instance; + } + public override bool ShouldUpdatePosition() => flung; + public override bool? CanDamage() => (flung ? null : false); + public override void AI() + { + if (Owner.HeldItem.type != ModContent.ItemType()) + { + Projectile.Kill(); + return; + } + if (onSpawn) + { + if (catching) + caught = true; + if (Owner.Calamity().StealthStrikeAvailable()) + { + Projectile.Calamity().stealthStrike = true; + time = 0; + } + Owner.Calamity().ConsumeStealthByAttacking(); + onSpawn = false; + } + + if (flung) + FlungState(); + else + HeldState(); + + if (catching) + time--; + else + time++; + + if (Projectile.Opacity < 1) + Projectile.Opacity += 0.03f; + + Lighting.AddLight(Projectile.Center, col.ToVector3() * 0.3f); + } + public void HeldState() + { + if (Projectile.Calamity().stealthStrike) + { + if (beepTimer < 40) + { + if (Projectile.Opacity < 1) + Projectile.Opacity += 0.2f; + beepTimer += beepRate; + } + else + { + SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSound"); + SoundEngine.PlaySound(pulse with { Volume = 0.3f, Pitch = 0.1f + beepRate * 0.04f }, Projectile.Center); + Projectile.Opacity = 0; + beepTimer = 0; + beepRate += 2; + } + + } + + Projectile.velocity = Owner.velocity; + float completion = time / (UseTimer * 0.7f * (Projectile.Calamity().stealthStrike ? 2 : 1)); // The completion of the throw animation. + if (completion >= 1 && !catching) // The moment of being thrown. + { + time = -1; + Projectile.Center = Owner.Center; + Projectile.extraUpdates = (Projectile.Calamity().stealthStrike ? 22 : 5); + Projectile.rotation += Main.rand.NextFloat(-4, 4); + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 9; + Projectile.velocity = velocity; + + if (Projectile.Calamity().stealthStrike) + { + SoundStyle hardThrow = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(hardThrow with { Volume = 0.9f, Pitch = 0.5f }, Projectile.Center); + + Projectile.timeLeft = 240; + Particle pulse3 = new CustomSpark(Projectile.Center, Projectile.velocity * 1.5f, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 13, 0.08f, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(1.2f, 0.7f), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(pulse3); + + for (int i = 0; i <= 12; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f); + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.5f) * Main.rand.NextFloat(7f, 13f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 1; + } + for (int i = 0; i <= 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f); + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(9f, 18f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.3f; + } + } + + SoundStyle toss = new("CalamityMod/Sounds/Item/LightThrow"); + SoundEngine.PlaySound(toss with { Volume = 1f, Pitch = 0 }, Projectile.Center); + + Projectile.tileCollide = true; + flung = true; + } + else + { + fxScale = (float)Math.Pow(completion, 2); + + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float grenadeRot = 0; + float pinTime = 0.75f; + Vector2 aimDirection = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float dir = (Owner.direction == -1 ? MathHelper.ToRadians(180) : 0); + // All the annoying to make rotation and placement code for the throw animation. + if (completion >= 0.7f) + { + if (pullPin && completion >= pinTime && !catching) + { + Vector2 vel = aimDirection * -6 - Vector2.UnitY * 3 + Owner.velocity; + Particle thePin = new CustomSpark(Projectile.Center, vel, "CalamityMod/Projectiles/DraedonsArsenal/PulseGrenadePin", true, 43, 1f, Color.White, Vector2.One, false, false, 0, false, true, noShrink: true, spin: 0.1f * Math.Sign(vel.X)); + GeneralParticleHandler.SpawnParticle(thePin); + SoundStyle pin = new("CalamityMod/Sounds/Item/LightMetal"); + SoundEngine.PlaySound(pin with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + pullPin = false; + } + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), catching ? 2 : 7); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction); + } + else + { + if (catching && !Main.mouseLeft) + { + Projectile.Kill(); + return; + } + Projectile.ai[1] = 0; + + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction); + } + grenadeRot += aimDirection.ToRotation(); + Vector2 grenadePos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.None, Owner.compositeFrontArm.rotation) + new Vector2(0, -18 * Owner.direction).RotatedBy(grenadeRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * dir); + + Projectile.Center = grenadePos; + Projectile.rotation = (-aimDirection).ToRotation() + MathHelper.PiOver2 * Owner.direction + dir; + + float frontArmRot = aimDirection.ToRotation() - MathHelper.ToRadians(90); + float backArmRot = grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0)); + if (completion >= 0.4f && completion <= pinTime && !catching) + { + float goalRot = MathHelper.Lerp(frontArmRot, backArmRot, (float)Math.Pow(Utils.GetLerpValue(caught ? 0.6f : 0.4f, pinTime, completion, true), (Projectile.Calamity().stealthStrike ? 2 : 1) * (caught ? 5 : 3))); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, goalRot); + } + else + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, (completion > pinTime && !catching) ? MathHelper.Lerp(Owner.compositeFrontArm.rotation, frontArmRot, 0.07f) : frontArmRot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, backArmRot); + } + } + public void FlungState() + { + if ((time / Projectile.extraUpdates) > Owner.HeldItem.useAnimation * 0.45f) + Projectile.localAI[1] = 5; // Make sure you can throw another grenade, if any genade has this value at zero you cant throw another one. + + + if (Projectile.Calamity().stealthStrike) + { + Particle fadeInfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 23, 0.4f, col * 0.6f, new Vector2(0.8f, 1f), true, true, shrinkSpeed: 0.3f, glowOpacity: 0.35f); + GeneralParticleHandler.SpawnParticle(fadeInfx); + } + else + { + if (targeted != null && time >= 30) + { + Projectile.timeLeft++; + float homeSpeed = Utils.GetLerpValue(30, 180, time, true); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.8f * homeSpeed, 8, 1f - 0.15f * homeSpeed, 0.99f, true); + if (targeted.life <= 0) + targeted = null; + } + else + { + targeted = (Projectile.Center).ClosestNPCAt(500, false, true); + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + bool squash = Main.rand.NextBool(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, squash ? ModContent.DustType() : ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(0.1f, 1f), 0, default, Main.rand.NextFloat(0.6f, 1.05f)); + dust.noGravity = true; + dust.color = col; + dust.noLightEmittence = true; + if (squash) + { + dust.fadeIn = 1f; + dust.scale *= 2; + } + else + dust.velocity = dust.velocity.RotatedByRandom(0.2f); + if (Projectile.Calamity().stealthStrike) + dust.velocity = dust.velocity.RotatedByRandom(0.7f) * 12.5f; + if (Projectile.timeLeft == 1) + Explode(); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3); + SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = -0.25f - 0.1f * tileHits, MaxInstances = 6 }, Projectile.Center); + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + + tileHits++; + if (tileHits > 2) + Explode(); + return false; + } + public void Explode() + { + Owner.Calamity().GeneralScreenShakePower = 3.5f * (Projectile.Calamity().stealthStrike ? 2 : 1); + + int spin = Main.rand.NextBool() ? -1 : 1; + for (int i = 0; i < 8; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 8f).ToRotationVector2(); + Dust c = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + c.velocity = vel * 15f * (i % 2 == 0 ? 0.6f : 1f); + c.scale = (i % 2 == 0 ? 2.2f : 1.9f); + c.noGravity = true; + c.color = col; + c.noLightEmittence = true; + c.fadeIn = 0.3f; + + + // Do NOT change the damage of these here, do it on the on hit + Projectile orb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (vel * 7f).RotatedBy(MathHelper.PiOver4 / 2), ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0, spin, i); + orb.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; + if (Projectile.Calamity().stealthStrike) + { + Projectile orb2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (vel * 10f), ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0, -spin, i + 1); + orb2.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; + } + } + + if (Projectile.Calamity().stealthStrike) + { + SoundStyle pulseHard = new("CalamityMod/Sounds/Item/PulseSoundHeavy"); + SoundEngine.PlaySound(pulseHard with { Volume = 0.8f, Pitch = -0.6f, MaxInstances = 2 }, Projectile.Center); + } + SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSoundHeavy"); + SoundEngine.PlaySound(pulse with { Volume = 0.9f, Pitch = 0, MaxInstances = 2 }, Projectile.Center); + + + Projectile.Kill(); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.2f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + Explode(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 15, targetHitbox); + public override bool PreDraw(ref Color lightColor) + { + float fade = 1; + float reformMult = Utils.GetLerpValue(1, 0, Projectile.Opacity) * 3.5f; + Texture2D tex = pullPin ? ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenade").Value : ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseGrenadeNoPin").Value; + for (int i = 0; i < 15; i++) + { + Color auraColor = col with { A = 0 } * 0.25f * fade * fxScale; + Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 2 * Math.Max(fxScale, reformMult); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fade * Projectile.Opacity, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White * fade * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCs.Add(index); + } + } +} diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs index 55ad51e8d3..cb2d3a8c00 100644 --- a/Projectiles/DraedonsArsenal/PulsePistolShot.cs +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -1,7 +1,11 @@ using System; -using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,120 +15,202 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public NPC Target - { - get => Main.npc[(int)Projectile.ai[0]]; - set => Projectile.ai[0] = value.whoAmI; - } - public float Time - { - get => Projectile.ai[1]; - set => Projectile.ai[1] = value; - } - public List NPCsAlreadyHit = new List(); - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = 12; - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - } - + public ref float time => ref Projectile.ai[0]; + public bool onSpawn = true; + private NPC targeted = null; + private NPC lastHitTarget = null; + private int timesItCanHit = 1; + public bool startAttackEffects = true; + public int attackTime = 160; // The amount of time an orb spends slowing before it attacks public override void SetDefaults() { Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 10; - Projectile.timeLeft = 120 * (1 + Projectile.extraUpdates); + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { - Time++; - if (Time >= 10f || NPCsAlreadyHit.Count > 0) + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseColor.ToVector3() * 0.5f); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (onSpawn) { - if (NPCsAlreadyHit.Count > 0) + if (Projectile.ai[1] == 0) + SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = 1.7f, Pitch = 0.3f }, Projectile.Center); + + for (int i = 0; i <= 8; i++) { - float angleOffset = MathHelper.WrapAngle(Projectile.AngleTo(Target.Center) - Projectile.velocity.ToRotation()); - angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); - Projectile.velocity = Projectile.velocity.RotatedBy(angleOffset); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.5f) * Main.rand.NextFloat(5f, 7f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 1; } - float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(10f, 50f, Time, true)); - - Dust dust = Dust.NewDustPerfect(Projectile.Center, 234); - dust.noGravity = true; - dust.velocity = Vector2.Zero; - dust.scale = 1.6f; - - // Only the initial shot should have a circle of dust, to prevent potential dust overload. - if (NPCsAlreadyHit.Count == 0) + for (int i = 0; i <= 6; i++) { - for (int i = 0; i < 5; i++) + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(7f, 9f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.3f; + } + + onSpawn = false; + } + + if (time >= attackTime) // home in on enemy + { + // Find a target + if (targeted == null) + { + Projectile.velocity *= 0.9f; + + startAttackEffects = true; + NPC chosenTarget = null; + float distance = 2500; + for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit in the last two hits. { - float offsetRotationAngle = Projectile.velocity.ToRotation() + Time / 20f; - float radius = (14f + (float)Math.Cos(Time / 13f) * 6f) * radiusFactor; - Vector2 dustPosition = Projectile.Center; - dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; - dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(3) ? 234 : 173); - dust.noGravity = true; - dust.velocity = -Projectile.velocity; - dust.scale = 0.8f; + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false)) + { + if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && (lastHitTarget != null ? searchedTarget != lastHitTarget : true) && searchedTarget.active && searchedTarget.life > 0) + { + distance = Vector2.Distance(Projectile.Center, searchedTarget.Center); + chosenTarget = searchedTarget; + } + } } + if (chosenTarget == null) // If no target was found, check again but accept last hit targets as viable. + { + if (lastHitTarget != null) + Projectile.localNPCImmunity[lastHitTarget.whoAmI] = 0; + + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false)) + { + if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && searchedTarget.active && searchedTarget.life > 0) + { + distance = Vector2.Distance(Projectile.Center, searchedTarget.Center); + chosenTarget = searchedTarget; + } + } + } + } + + targeted = chosenTarget; + } + else // Home in on selected target + { + // Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects + Projectile.extraUpdates = 5 + (int)(Projectile.numHits * 0.6f); + + if (Projectile.timeLeft < 110 * Projectile.extraUpdates) + Projectile.timeLeft = 110 * Projectile.extraUpdates; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.5f, 15, 0.97f); + if (startAttackEffects) + { + Projectile.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center) * 10; + SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSound"); + SoundEngine.PlaySound(pulse with { Volume = 0.25f, Pitch = Math.Max(0.6f, Main.rand.NextFloat(0.3f, 0.4f) + Projectile.numHits * 0.1f), MaxInstances = 5 }, Projectile.Center); + for (int k = 0; k < 6; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center).RotatedByRandom(0.5f) * Main.rand.NextFloat(5f, 9f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 1; + } + startAttackEffects = false; + } + if (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy()) + targeted = null; } } + else + { + Projectile.velocity *= Projectile.numHits > 0 ? 0.955f : 0.97f; + } + + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + if (targetDist < 1400f && squash > 0.2f && (Projectile.ai[1] == 0 || time > 5)) // The trail + { + Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/DualTrail", false, 13, 0.075f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor * 0.6f * squash, new Vector2(1 - 0.15f * squash, 1.5f), true, false, shrinkSpeed: 0.2f * squash); + GeneralParticleHandler.SpawnParticle(trail); + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; } - public override bool? CanDamage() => Time > Projectile.MaxUpdates; + + public override bool? CanHitNPC(NPC target) => (target == targeted) ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!NPCsAlreadyHit.Contains(target)) - NPCsAlreadyHit.Add(target); + bool onKill = (target.life <= 0 && target.realLife == -1); + + // Set some values to get ready for it to home again for its next hit + lastHitTarget = target; + targeted = null; + time = 0; + timesItCanHit--; + Projectile.velocity *= 0.8f; - // If the maximum amount of targets have already been hit, die early. - if (Projectile.frameCounter >= 4) + for (int i = 0; i <= 5; i++) { - Projectile.Kill(); - return; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(1.7f, 2.4f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(4f, 9f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.3f; } - float minDistance = 600f; - List potentialTargets = new List(); - foreach (NPC n in Main.ActiveNPCs) + if (onKill) + timesItCanHit += 1; + + // If it's hit targeted enemies enough, kill it + if (timesItCanHit <= 0) { - bool legalTarget = n != target && n.CanBeChasedBy(null); - float distanceToTarget = Projectile.Distance(n.Center); - if (legalTarget && distanceToTarget < minDistance && !NPCsAlreadyHit.Contains(n)) + if (Projectile.ai[1] == 0 && Main.myPlayer == Projectile.owner) { - minDistance = distanceToTarget; - // The NPCs at the bottom will always be at the bottom of the list because it works via a minimum distance. - potentialTargets.Add(n); + Projectile pulseOrb1 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10).RotatedBy(0.3f) * 0.5f, Projectile.type, Projectile.damage / 4, Projectile.knockBack / 2, Projectile.owner, 0, 1); + Projectile pulseOrb2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10).RotatedBy(-0.3f) * 0.5f, Projectile.type, Projectile.damage / 4, Projectile.knockBack / 2, Projectile.owner, 0, -1); + pulseOrb1.penetrate = 1; + pulseOrb1.scale = 0.7f; + pulseOrb2.penetrate = 1; + pulseOrb2.scale = 0.7f; } - } - - if (potentialTargets.Count == 0) - { Projectile.Kill(); - return; + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 2f)); + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, 40 * Projectile.extraUpdates, Projectile.timeLeft, true), 5); + + for (int i = 0; i < 6; i++) + { + Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalPulseColor, Color.White, i * 0.07f) with { A = 0 } * 0.5f; + Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f + i * 0.01f) * 3; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); } - potentialTargets.Reverse(); // Move the closest NPCs to the top for convenience when indexing. - int maxIndex = Math.Min(potentialTargets.Count, 2); // Pick 1 out of the 2 closest NPCs. - NPC toHit = potentialTargets[Main.rand.Next(0, maxIndex)]; - - // A netcode block such as Main.myPlayer == projectile.owner is not required. OnHitNPC is only run client-side. - Projectile splitShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, - Projectile.velocity, - Projectile.type, - Projectile.damage, - Projectile.knockBack, - Projectile.owner, - toHit.whoAmI); - splitShot.frameCounter = Projectile.frameCounter + 1; - ((PulsePistolShot)splitShot.ModProjectile).NPCsAlreadyHit.AddRange(NPCsAlreadyHit); - ((PulsePistolShot)splitShot.ModProjectile).NPCsAlreadyHit.Add(toHit); - Projectile.Kill(); + return false; } } } diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index 9c88cdbd0e..6c97bc7b22 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -1,7 +1,9 @@ -using CalamityMod.Particles; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,13 +17,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private Color mainColor = Color.Orchid; - private bool notSplit; - private bool doDamage = false; - private NPC closestTarget = null; - private NPC lastTarget = null; - private float distance; + public ref float time => ref Projectile.ai[0]; + public bool isBeam => Projectile.ai[1] == 0; + public bool onSpawn = true; + private NPC targeted = null; + private NPC lastHitTarget = null; private int timesItCanHit = 3; + public bool startAttackEffects = true; + public bool dead = false; + public int attackTime => (int)(180 + Projectile.ai[1]); // The amount of time an orb spends slowing before it attacks public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() @@ -31,6 +35,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; + Projectile.extraUpdates = 7; Projectile.timeLeft = 900; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; @@ -39,252 +44,228 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - // If it's hit targeted enemies enough, kill it - if (timesItCanHit <= 0) - Projectile.Kill(); - - notSplit = Projectile.ai[1] == 0f; - - Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - Projectile.rotation = Projectile.velocity.ToRotation(); - float createDustVar = 10f; + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseColor.ToVector3() * 0.5f); - // Set split projectile stats - if (Projectile.localAI[0] == 0 && !notSplit) + if (onSpawn) { - Projectile.extraUpdates = 1; - Projectile.timeLeft = 1240; - if (Projectile.ai[1] == 1) - SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = 1.7f, Pitch = 0.3f }, Projectile.Center); - } - if (notSplit) - { - doDamage = true; - Projectile.extraUpdates = 100; - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > createDustVar && notSplit) - { - // Main projectile visual - float sizeBonus = MathHelper.Clamp(Projectile.localAI[0] * 0.009f, 0, 3.5f); - if (targetDist < 1400f) + float fxPower = isBeam ? 2 : 0.5f; + if (isBeam) { - GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 30, 1.1f - Projectile.ai[1] + sizeBonus, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); - GeneralParticleHandler.SpawnParticle(spark); + Projectile.Center += Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(-0.05f * Math.Sign(Projectile.velocity.X)) * 60; + Projectile.extraUpdates = 100; + timesItCanHit = 1; + Owner.Calamity().GeneralScreenShakePower = 4f; } - if (targetDist < 1400f && Main.rand.NextBool()) + for (int i = 0; i <= 8 * fxPower; i++) { - GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 30, 1.1f - Projectile.ai[1] + sizeBonus, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); - GeneralParticleHandler.SpawnParticle(spark); - } - - // A lingering trail of dust you can see after the particle trail disipates - if (Projectile.localAI[0] > 20 && Main.rand.NextBool()) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66); - dust.scale = Main.rand.NextFloat(0.7f, 1.5f); - dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.5f) * Main.rand.NextFloat(2f, 9f) * fxPower; dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; - dust.noLight = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 1; + } + for (int i = 0; i <= 6 * fxPower; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(4f, 15f) * fxPower; + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.3f; + } + + onSpawn = false; + } + if (isBeam) + { + if (targetDist < 1400f && time > 0) // The main beam + { + Particle mainBeam = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 35, 0.55f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor * 0.5f, new Vector2(0.6f, 1f), true, true, shrinkSpeed: 0.2f, glowCenterScale: 0.7f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(mainBeam); + Projectile.scale += 0.007f; + + if (time % 3 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3 * Projectile.scale, 3 * Projectile.scale), Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(0.7f, 1.2f) * Projectile.scale; + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(7f, 25f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.6f; + } } } - - #region Split Projectile AI - if (!notSplit) + else { - // Split projectile visuals - if (targetDist < 1400f) + if (time >= attackTime) // home in on enemy { - GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); - GeneralParticleHandler.SpawnParticle(spark); - } - if (targetDist < 1400f && Main.rand.NextBool()) - { - GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor); - GeneralParticleHandler.SpawnParticle(spark); - } - - if (Projectile.localAI[0] > 90) - { - // Velocity must look like it has stoped, but can't actually be zero otherwise homing code doesn't work - if (Projectile.localAI[0] == 91) - Projectile.velocity *= 0.001f; - - // When they begin the homing after a hit of spawning, do a few visuals - if (Projectile.localAI[0] == 120) + // Find a target + if (targeted == null) { - distance = 3000; + Projectile.velocity *= 0.9f; - SoundStyle fire = new("CalamityMod/Sounds/Item/PulseSound"); - SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); - - - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, mainColor, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0f, 0.5f, 15); - GeneralParticleHandler.SpawnParticle(pulse); - - for (int k = 0; k < 6; k++) + startAttackEffects = true; + NPC chosenTarget = null; + float distance = 2500; + for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit in the last two hits. { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); - dust.scale = Main.rand.NextFloat(0.6f, 1.1f); - dust.velocity = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; - dust.noLight = true; + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false)) + { + if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && (lastHitTarget != null ? searchedTarget != lastHitTarget : true) && searchedTarget.active && searchedTarget.life > 0) + { + distance = Vector2.Distance(Projectile.Center, searchedTarget.Center); + chosenTarget = searchedTarget; + } + } } - } - // Homing code - if (Projectile.localAI[0] > 120) - { - // Do damage if it's near its target otherwise don't, this is to prevent excessive hits as orbs rail through worm bosses and such - if (closestTarget is not null) - doDamage = Vector2.Distance(Projectile.Center, closestTarget.Center) < 10; - else - doDamage = false; + if (chosenTarget == null) // If no target was found, check again but accept last hit targets as viable. + { + if (lastHitTarget != null) + Projectile.localNPCImmunity[lastHitTarget.whoAmI] = 0; - // Tracking code, originally was going to try only tracking the closest target not including the last target you hit, but I couldn't make it work - // Eventually I settled on how it works now and it seems to home consistently so I'm happy enough there - float projectileSpeed = 9.5f; - if (closestTarget is not null && closestTarget.active) - { - float targetDirectionRotation = Projectile.SafeDirectionTo(closestTarget.Center).ToRotation(); - float turningRate = 10f + Projectile.localAI[0] * 0.00008f; - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirectionRotation, turningRate).ToRotationVector2() * projectileSpeed; - } - else - { - Projectile.velocity = Projectile.rotation.ToRotationVector2() * projectileSpeed; - Projectile.velocity *= 0.999f; - } - if (closestTarget is not null && Vector2.Distance(Projectile.Center, closestTarget.Center) < 10) - { - closestTarget = null; - distance = 3000; - } - - // Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects - Projectile.extraUpdates = 5 + (int)(Projectile.numHits * 0.3f); - { - // Actual homing movement for (int index = 0; index < Main.npc.Length; index++) { - if (Main.npc[index].CanBeChasedBy(null, false) || Main.npc[index] == lastTarget) + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false)) { - float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); - - if (Vector2.Distance(Projectile.Center, Main.npc[index].Center) < (distance + extraDistance)) + if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && searchedTarget.active && searchedTarget.life > 0) { - closestTarget = Main.npc[index]; - distance = Vector2.Distance(Projectile.Center, Main.npc[index].Center); + distance = Vector2.Distance(Projectile.Center, searchedTarget.Center); + chosenTarget = searchedTarget; } } } } + + targeted = chosenTarget; + } + else // Home in on selected target + { + // Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects + Projectile.extraUpdates = 7 + (int)(Projectile.numHits * 0.6f); + + if (Projectile.timeLeft < 110 * Projectile.extraUpdates) + Projectile.timeLeft = 110 * Projectile.extraUpdates; + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.4f, 15, 0.97f); + if (startAttackEffects) + { + Projectile.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center) * 10; + SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSound"); + SoundEngine.PlaySound(pulse with { Volume = 0.35f, Pitch = Math.Max(0.5f, Main.rand.NextFloat(0.1f, 0.3f) + Projectile.numHits * 0.2f), MaxInstances = 5 }, Projectile.Center); + + Particle pulse3 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.5f, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 13, 0.05f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(1.2f, 0.7f), shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(pulse3); + + for (int k = 0; k < 6; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale; + dust.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center).RotatedByRandom(0.5f) * Main.rand.NextFloat(5f, 9f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 1; + } + startAttackEffects = false; + } + if (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy()) + targeted = null; } } else { - // Minor dust trail for when they first spawn - if (Main.rand.NextBool(5)) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66); - dust.scale = Main.rand.NextFloat(0.8f, 1.4f); - dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; - dust.noLight = true; - } - Projectile.velocity *= 0.98f; + Projectile.velocity *= 0.985f; + } + + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + if (targetDist < 1400f && squash > 0.1f && time > 5) // The trail + { + Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/DualTrail", false, 13, 0.075f, Effects.ArsenalEffects.ArsenalPulseColor * 0.6f * squash, new Vector2(1 - 0.15f * squash, 1.5f), true, false, shrinkSpeed: 0.2f * squash); + GeneralParticleHandler.SpawnParticle(trail); } } - #endregion - // Visuals for the shot as it exits the tip of the rifle - if (Projectile.localAI[0] == createDustVar && notSplit) - PulseBurst(4f, 5f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; } - public override bool? CanDamage() => (doDamage ? null : false); + public override bool? CanHitNPC(NPC target) => ((target == targeted) || isBeam) ? null : false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { bool onKill = (target.life <= 0 && target.realLife == -1); - if (notSplit) + + timesItCanHit--; + + float fxVel = isBeam ? 3f : 1f; + for (int i = 0; i <= 5 * fxVel; i++) { - for (int i = 0; i <= 9; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); - dust.scale = Main.rand.NextFloat(0.4f, 1.1f); - dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; - dust.noLight = true; - } - - // Since the beam looks wider as it travels, these hit particles scale a bit to fit that - float sizeBonus = MathHelper.Clamp(Projectile.localAI[0] * 0.01f, 0, 3.5f); - for (int k = 0; k < 9; k++) - { - SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(8, 8) - Projectile.velocity * 7, Projectile.velocity * Main.rand.NextFloat(0.7f, 3.1f), false, 30, 0.9f * Main.rand.NextFloat(0.9f, 1.1f) + sizeBonus, mainColor); - GeneralParticleHandler.SpawnParticle(spark); - } - - // Spawn the 4 energy orbs - // These should do a large fraction of the beam's damage so they will easily kill even some decently bulky enemies regular enemies in one hit - // This is so it can better proc its on kill effect - int numProj = 4; - int projectileDamage = (int)(Projectile.damage * 0.5f); - for (int i = 0; i < numProj; i++) - { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.Zero) * (14f - i * 0.7f)) * ((i + 1) * 0.25f), Projectile.type, projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 1f + i); - } - Projectile.Kill(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.scale = Main.rand.NextFloat(1.7f, 2.4f) * Projectile.scale; + dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(4f, 9f) * fxVel; + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPulseColor; + dust.fadeIn = 0.3f * fxVel; } - // Split projectile on hit effects - else + + // Set some values to get ready for it to home again for its next hit + if (!isBeam) { - // Set some values to get ready for it to home again for its next hit - lastTarget = target; - distance = 3000; - Projectile.localAI[0] = 60; - Projectile.velocity *= MathHelper.Clamp(1.5f - Projectile.numHits * 0.5f, 1f, 1.5f); - - for (int i = 0; i <= 2; i++) - { - SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(20, 30 + 1), 0.25f, 2f); - GeneralParticleHandler.SpawnParticle(energy); - } - - if (hit.Damage > 2 && target == closestTarget) - timesItCanHit--; + Projectile.ai[1] = -50; + lastHitTarget = target; + targeted = null; + time = 0; + Projectile.velocity *= 0.9f; if (onKill) + timesItCanHit += 3; + } + else + { + if (Main.myPlayer == Projectile.owner) { - timesItCanHit += 1; - Projectile.timeLeft += 90; + // Spawn the 4 energy orbs + // These should do a large fraction of the beam's damage so they will easily kill even some decently bulky enemies regular enemies in one hit + // This is so it can better proc its on kill effect + int numProj = 4; + int projectileDamage = (int)(Projectile.damage * 0.5f); + for (int i = 1; i < numProj + 1; i++) + { + Projectile orb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.Zero) * (10 / numProj * i), Projectile.type, projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 28 * i); + orb.scale = 1.4f - i * 0.2f; + } } + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Particle pulse3 = new CustomSpark(Projectile.Center, vel * 7, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 16, 0.065f, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(pulse3); + Particle pulse4 = new CustomSpark(Projectile.Center, vel * 13, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 12, 0.04f, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(pulse4); } + // If it's hit targeted enemies enough, kill it + if (timesItCanHit <= 0) + Projectile.Kill(); + } - private void PulseBurst(float speed1, float speed2) + public override bool PreDraw(ref Color lightColor) { - for (int i = 0; i <= 15; i++) + if (isBeam) + return false; + Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 2f)); + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, 40 * Projectile.extraUpdates, Projectile.timeLeft, true), 5); + + for (int i = 0; i < 7; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 66); - dust.scale = Main.rand.NextFloat(0.4f, 1.4f); - dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor; - dust.noLight = true; - } - for (int i = 0; i <= 15; i++) - { - SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.2f, 0.6f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(30, 40 + 1), 0.25f, 2f); - GeneralParticleHandler.SpawnParticle(energy); + Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalPulseColor, Color.White, i * 0.07f) with { A = 0 } * 0.5f; + Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f + i * 0.01f) * 3; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); } + + return false; } } } diff --git a/Projectiles/DraedonsArsenal/ShortCircuitExplosion.cs b/Projectiles/DraedonsArsenal/ShortCircuitExplosion.cs new file mode 100644 index 0000000000..e931f7966f --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShortCircuitExplosion.cs @@ -0,0 +1,51 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ShortCircuitExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float radius = 200; + public override void SetDefaults() + { + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 10; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 300); + + float minMult = 0.2f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + Player Owner = Main.player[Projectile.owner]; + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center); + target.MoveNPC(launchVel, 12, true); + } + + public override void AI() + { + + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + } +} diff --git a/Projectiles/DraedonsArsenal/ShortCircuitHook.cs b/Projectiles/DraedonsArsenal/ShortCircuitHook.cs new file mode 100644 index 0000000000..deb10e2df6 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShortCircuitHook.cs @@ -0,0 +1,248 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + [PierceResistException] + public class ShortCircuitHook : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public static readonly SoundStyle Explode = new("CalamityMod/Sounds/Item/ElectricBurst") { Volume = 0.8f }; + public bool giveCooldown = false; + public bool onSpawn = true; + public enum TaserAIState + { + Firing, + Electrocuting, + ReelingBack + } + + public TaserAIState AIState + { + get => (TaserAIState)(int)Projectile.ai[0]; + set => Projectile.ai[0] = (int)value; + } + + public float Time + { + get => Projectile.ai[1]; + set => Projectile.ai[1] = value; + } + + public int ElectrocutionTarget + { + get => (int)Projectile.localAI[0]; + set => Projectile.localAI[0] = value; + } + + public const float ReelbackSpeed = 40f; + public Color hookColor = Color.SlateGray; + public SlotId Hum { get; set; } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = 2; + Projectile.extraUpdates = 8; + Projectile.tileCollide = false; + Projectile.ownerHitCheck = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.ArmorPenetration = 10; + } + + public override void AI() + { + if (onSpawn) + { + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, Effects.ArsenalEffects.ArsenalElectricDust); + dust.scale = Main.rand.NextBool(7) ? 1.5f : 0.9f; + dust.noGravity = true; + dust.fadeIn = 2; + dust.color = Effects.ArsenalEffects.ArsenalElectricColor; + dust.velocity = Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.9f, 2.8f); + } + onSpawn = false; + } + if (AIState != TaserAIState.Firing) + Time++; + Player player = Main.player[Projectile.owner]; + hookColor = Color.Lerp(hookColor, Color.SlateGray, 0.25f); + + float distanceFromPlayer = Projectile.Distance(player.Center); + switch (AIState) + { + case TaserAIState.Firing: + if (distanceFromPlayer > 800f || Time >= 90f) + GoToAIState(TaserAIState.ReelingBack); + break; + case TaserAIState.Electrocuting: + if (distanceFromPlayer > 2000f) + GoToAIState(TaserAIState.ReelingBack); + + if (SoundEngine.TryGetActiveSound(Hum, out var hum) && hum.IsPlaying) + { + hum.Position = player.Center; + hum.Pitch = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(0f, 150, Time, true)); + } + // electric explosion; + if (Time == 150 || !Main.npc[ElectrocutionTarget].active) + { + if (!Main.npc[ElectrocutionTarget].active) + giveCooldown = false; + SoundEngine.PlaySound(Explode, Projectile.Center); + Projectile.localNPCHitCooldown = 15; + + for (int i = 0; i < 25; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); + dust.scale = Main.rand.NextFloat(0.9f, 1.4f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalElectricColor; + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.75f, 1f)); + dust2.scale = Main.rand.NextFloat(1.7f, 2.1f); + dust2.noGravity = true; + dust2.color = Effects.ArsenalEffects.ArsenalElectricColor; + } + + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalElectricColor * 0.5f, new Vector2(1f, 1), 0, 0.5f, 3f, 18); + GeneralParticleHandler.SpawnParticle(pulse); + Particle bloom = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 10, 1.3f, Effects.ArsenalEffects.ArsenalElectricColor, Vector2.One, true, true); + GeneralParticleHandler.SpawnParticle(bloom); + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 8, 0, Projectile.owner, 0); + Time = 0; + Projectile.velocity = Projectile.SafeDirectionTo(player.Center); + + GoToAIState(TaserAIState.ReelingBack); + return; + } + if (Main.npc[ElectrocutionTarget].active) + Projectile.Center = Main.npc[ElectrocutionTarget].Center; + break; + case TaserAIState.ReelingBack: + // Kill the gun and the hook if the hook has returned to the gun. + if (SoundEngine.TryGetActiveSound(Hum, out var hum2) && hum2.IsPlaying) + { + hum2?.Stop(); + } + if (Projectile.Hitbox.Intersects(player.Hitbox)) + { + if (giveCooldown) + { + player.Calamity().arsenalCooldown = 300; + player.AddCooldown(ArsenalPower.ID, 300); + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); + Projectile.Kill(); + return; + } + Projectile.tileCollide = false; + Projectile.extraUpdates = 8; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(player.Center) * (ReelbackSpeed / Projectile.extraUpdates), 0.02f); + break; + } + + Projectile.rotation = Projectile.AngleFrom(player.Center); + + ManipulatePlayerItemValues(player); + } + + + public void ManipulatePlayerItemValues(Player player) + { + player.ChangeDir((player.Center.X - Projectile.Center.X < 0).ToDirectionInt()); + player.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation); + player.itemTime = 4; + player.itemAnimation = 4; + } + + public void GoToAIState(TaserAIState newAIState) + { + // Don't waste the resources changing the AI state if the projectile is already in said state. + if (AIState == newAIState) + return; + + Projectile.penetrate = -1; + AIState = newAIState; + Projectile.netUpdate = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Player player = Main.player[Projectile.owner]; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D lineTex = ModContent.Request("CalamityMod/Particles/BloomLineSoftEdge").Value; + Vector2 altPos = player.Center - Vector2.UnitY * 3; + float distance = Utils.Distance(altPos, Projectile.Center); + int drawSeperation = 10; + int startSeperation = drawSeperation; + Vector2 toPoint = Utils.DirectionTo(altPos, Projectile.Center); + for (int i = startSeperation; i < distance; i += drawSeperation) + { + Main.EntitySpriteDraw(lineTex, Projectile.Center - Main.screenPosition - toPoint * i, null, hookColor with { A = 0 }, toPoint.ToRotation() + MathHelper.PiOver2, lineTex.Size() * 0.5f, new Vector2(1, 1.3f) * Projectile.scale * 0.01f, SpriteEffects.None); + } + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.tileCollide = false; + if (Projectile.localNPCHitCooldown > 7 && target == Main.npc[ElectrocutionTarget]) + Projectile.localNPCHitCooldown -= 1; + hookColor = Color.Cyan; + target.AddBuff(ModContent.BuffType(), 120); + + if (AIState == TaserAIState.Firing) + { + giveCooldown = true; + Projectile.Center = target.Center; + Projectile.extraUpdates = 1; + if (!Main.dedServ) + { + for (int i = 0; i < 30; i++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 0.9f)); + dust2.scale = Main.rand.NextFloat(0.9f, 1.2f); + dust2.noGravity = true; + dust2.color = Effects.ArsenalEffects.ArsenalElectricColor; + } + } + ElectrocutionTarget = target.whoAmI; + Time = 0f; + + SoundStyle charge = new("CalamityMod/Sounds/Item/LowHum"); + Hum = SoundEngine.PlaySound(charge with { Volume = 1.6f, IsLooped = true }, Projectile.Center); + + GoToAIState(TaserAIState.Electrocuting); + } + + // If it kills an enemy, don't give cooldown + if (giveCooldown && (target.life <= 0 && target.realLife == -1)) + giveCooldown = false; + } + public override bool? CanHitNPC(NPC target) => (Projectile.numHits == 0 || target == Main.npc[ElectrocutionTarget]) ? null : false; + public override bool OnTileCollide(Vector2 oldVelocity) + { + GoToAIState(TaserAIState.ReelingBack); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShortCircuitHook.png b/Projectiles/DraedonsArsenal/ShortCircuitHook.png new file mode 100644 index 0000000000..9dd6e3ffc9 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShortCircuitHook.png differ diff --git a/Projectiles/DraedonsArsenal/ShortCircuitShot.cs b/Projectiles/DraedonsArsenal/ShortCircuitShot.cs new file mode 100644 index 0000000000..95c1b5dc0d --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShortCircuitShot.cs @@ -0,0 +1,89 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ShortCircuitShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public Vector2 position; + public Vector2 oldPos; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.timeLeft = 180; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 2; + Projectile.extraUpdates = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 10; + } + public override void AI() + { + if (time == 0) + { + for (int i = 0; i < 7; i++) + { + bool is278 = Main.rand.NextBool(4); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, is278 ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalElectricDust); + dust.scale = is278 ? 0.7f : Main.rand.NextBool(7) ? 1.2f : 0.8f; + dust.noGravity = true; + if (!is278) + dust.fadeIn = 2; + dust.color = Effects.ArsenalEffects.ArsenalElectricColor; + dust.velocity = Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.6f, 2.3f) * (is278 ? 0.3f : 1); + } + } + if (time > 4) + { + if (Projectile.timeLeft % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust); + dust.scale = Main.rand.NextBool(7) ? 1f : 0.55f; + dust.noGravity = true; + dust.fadeIn = 2; + dust.color = Effects.ArsenalEffects.ArsenalElectricColor; + dust.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 1.5f); + } + + if (Projectile.timeLeft % 2 == 0) + { + SparkParticle tip = new SparkParticle(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5, Projectile.velocity, false, (Projectile.timeLeft < 50 ? 20 : 6), 0.6f, Effects.ArsenalEffects.ArsenalElectricColor); + GeneralParticleHandler.SpawnParticle(tip); + } + if (Projectile.timeLeft % 3 == 0) + { + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + Particle trail = new BoltParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, Projectile.velocity * 0.01f, false, 7, 0.2f, Effects.ArsenalEffects.ArsenalElectricColor * 0.8f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.5f * squash); + GeneralParticleHandler.SpawnParticle(trail); + } + } + + Projectile.velocity *= 0.987f; + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + target.AddBuff(ModContent.BuffType(), 40); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center); + target.MoveNPC(launchVel, 8, false); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.7f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } +} diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs deleted file mode 100644 index fc876533ee..0000000000 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class TaserHook : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public enum TaserAIState - { - Firing, - Electrocuting, - ReelingBack - } - - public TaserAIState AIState - { - get => (TaserAIState)(int)Projectile.ai[0]; - set => Projectile.ai[0] = (int)value; - } - - public float Time - { - get => Projectile.ai[1]; - set => Projectile.ai[1] = value; - } - - public int ElectrocutionTarget - { - get => (int)Projectile.localAI[0]; - set => Projectile.localAI[0] = value; - } - - public const float ReelbackSpeed = 25f; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.tileCollide = true; - Projectile.ownerHitCheck = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - } - - public override void AI() - { - Time++; - Player player = Main.player[Projectile.owner]; - switch (AIState) - { - case TaserAIState.Firing: - float distanceFromPlayer = Projectile.Distance(player.Center); - if (distanceFromPlayer > 600f || Time >= 90f) - GoToAIState(TaserAIState.ReelingBack); - break; - case TaserAIState.Electrocuting: - // Reel back to the player if the target has been killed or a second has passed. - if (!Main.npc[ElectrocutionTarget].active || Time >= 60f) - { - GoToAIState(TaserAIState.ReelingBack); - return; - } - - Projectile.Center = Main.npc[ElectrocutionTarget].Center; - break; - case TaserAIState.ReelingBack: - // Kill the gun and the hook if the hook has returned to the gun. - if (Projectile.Hitbox.Intersects(player.Hitbox)) - { - Projectile.Kill(); - return; - } - Projectile.tileCollide = false; - Projectile.velocity = Projectile.SafeDirectionTo(player.Center) * ReelbackSpeed; - break; - } - - Projectile.rotation = Projectile.AngleFrom(player.Center); - - ManipulatePlayerItemValues(player); - } - - - public void ManipulatePlayerItemValues(Player player) - { - player.ChangeDir((player.Center.X - Projectile.Center.X < 0).ToDirectionInt()); - player.itemRotation = CalamityUtils.WrapAngle90Degrees(Projectile.rotation); - player.itemTime = 4; - player.itemAnimation = 4; - } - - public void GoToAIState(TaserAIState newAIState) - { - // Don't waste the resources changing the AI state if the projectile is already in said state. - if (AIState == newAIState) - return; - - Projectile.penetrate = -1; - AIState = newAIState; - Projectile.netUpdate = true; - } - - public override bool PreDraw(ref Color lightColor) - { - Player player = Main.player[Projectile.owner]; - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Utils.DrawLine(Main.spriteBatch, player.MountedCenter, Projectile.Center, Color.Cyan, Color.White, 4f); - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - - if (AIState == TaserAIState.Firing) - { - if (!Main.dedServ) - { - for (int i = 0; i < 50; i++) - { - float angle = MathHelper.TwoPi / 50f * i + Utils.GetLerpValue(90f, 150f, Time, true) * MathHelper.ToRadians(1080f); - Dust dust = Dust.NewDustPerfect(target.Center + angle.ToRotationVector2() * 10f, 226); - dust.velocity = Vector2.Zero; - if (Main.rand.NextBool(6)) - dust.velocity = target.SafeDirectionTo(dust.position) * 4.5f; - - dust.noGravity = true; - } - } - ElectrocutionTarget = target.whoAmI; - Time = 0f; - GoToAIState(TaserAIState.Electrocuting); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - GoToAIState(TaserAIState.ReelingBack); - return false; - } - } -} diff --git a/Projectiles/DraedonsArsenal/TaserHook.png b/Projectiles/DraedonsArsenal/TaserHook.png deleted file mode 100644 index 1efdfb0ad7..0000000000 Binary files a/Projectiles/DraedonsArsenal/TaserHook.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs deleted file mode 100644 index 7e42868aea..0000000000 --- a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class TrackingDiskLaser : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public float Time - { - get => Projectile.localAI[0]; - set => Projectile.localAI[0] = value; - } - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - 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; - Projectile.ArmorPenetration = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); - - Time++; - if (Time >= 10f) - { - for (int i = 0; i < 2; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 160, default, 2f); - dust.position = Projectile.Center; - dust.velocity = Projectile.velocity; - dust.scale = Projectile.scale; - dust.noGravity = true; - } - } - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(60); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - } -} diff --git a/Projectiles/DraedonsArsenal/UnstableMatter.cs b/Projectiles/DraedonsArsenal/UnstableMatter.cs deleted file mode 100644 index 34f8e8b7b6..0000000000 --- a/Projectiles/DraedonsArsenal/UnstableMatter.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class UnstableMatter : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public bool HasCollidedWithATile - { - get => Projectile.ai[0] == 1f; - set => Projectile.ai[0] = value.ToInt(); - } - - public float Time - { - get => Projectile.ai[1]; - set => Projectile.ai[1] = value; - } - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 480; - } - - public override void AI() - { - // Cast some lime light at the projectile's position. - Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3()); - Time++; - if (Time >= 10f) - GenerateIdleDust(); - } - - public void GenerateIdleDust() - { - if (Main.dedServ) - return; - - // Release some dust outward. - // The faster the projectile itself is, the slower the dust, and the longer it lasts. - // This is done to give the projectile a "streak" movement the faster it is versus a expansion. - int dustCount = HasCollidedWithATile ? 5 : 12; - float baseSpeedRatio = Utils.GetLerpValue(6f, 14f, Projectile.velocity.Length(), true); - float speed = MathHelper.Lerp(6f, 1.8f, (float)Math.Pow(baseSpeedRatio, 3f)); - if (!HasCollidedWithATile) - speed += MathHelper.Lerp(-6f, 4f, Utils.GetLerpValue(10f, 150f, Time, true)); - float persistence = MathHelper.Lerp(0f, 0.8f, baseSpeedRatio); - for (int i = 0; i < dustCount; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 107); - dust.velocity = Main.rand.NextVector2CircularEdge(speed, speed) - Projectile.velocity; - dust.fadeIn = persistence; - dust.scale = 0.9f; - dust.noGravity = true; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (!HasCollidedWithATile) - modifiers.SourceDamage /= 3; - else if (Projectile.penetrate == -1) - Projectile.penetrate = 1; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - // Register the tile collision, if one has not happened yet. - if (!HasCollidedWithATile) - { - HasCollidedWithATile = true; - - // And bounce off the tile. Or towards a nearby enemy, if there is one. - NPC potentialTarget = Projectile.Center.ClosestNPCAt(700f, false); - if (potentialTarget != null) - Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center); - else - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y; - } - - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 14f; - - Projectile.netUpdate = true; - return false; - } - return true; - } - } -} diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index fa67dcad89..f5ba29a1d1 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Enemy Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.alpha = 120; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs index a7ce7ed980..3659aadfad 100644 --- a/Projectiles/Healing/GladiatorHealOrb.cs +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Healing public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int target = -1; + public ref float heal => ref Projectile.ai[0]; public override void SetStaticDefaults() { @@ -39,6 +40,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { + Projectile.scale = MathHelper.Lerp((heal / 8), 1, 0.65f); float maxDistance = 150f; if (target < 0) { @@ -76,8 +78,7 @@ namespace CalamityMod.Projectiles.Healing float playerDist = playerVector.Length(); if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) { - int heal = 10; - player.HealPlayer(heal, HealTextType.Local); + player.HealPlayer((int)heal, HealTextType.Local); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/OrbHeal", 5) { Volume = 0.15f }, Projectile.Center); @@ -108,8 +109,8 @@ namespace CalamityMod.Projectiles.Healing intensity *= Projectile.timeLeft / 60f; } // Become smaller the futher along the old positions we are. - Vector2 outerScale = new Vector2(1f) * intensity; - Vector2 innerScale = new Vector2(1f) * intensity * 0.7f; + Vector2 outerScale = new Vector2(1f) * Projectile.scale * intensity; + Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; outerColor *= intensity; innerColor *= intensity; Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.25f, SpriteEffects.None, 0); diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 7b1c806410..96d90b3332 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index 740ff708e4..ffb9068575 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class AcidicSaxBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; @@ -31,6 +33,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; Projectile.alpha = 255; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 3aa60a7fb8..2c779ac44d 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Magic; +using CalamityMod.NPCs; using CalamityMod.Systems; using Microsoft.Xna.Framework; using System; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException(onlyForSingleHitbox: true)] public class AnahitasArpeggioNote : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/ApoctosisArrayHoldout.cs b/Projectiles/Magic/ApoctosisArrayHoldout.cs new file mode 100644 index 0000000000..e3fdf3942c --- /dev/null +++ b/Projectiles/Magic/ApoctosisArrayHoldout.cs @@ -0,0 +1,353 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ApoctosisArrayHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 1.5f * Projectile.spriteDirection; + public override float MaxOffsetLengthFromArm => 47f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -13f; + public override float OffsetYDownwards => 5f; + public override float WeaponTurnSpeed => 0.35f; + public override float RecoilResolveSpeed => shootingTimer >= 0 ? 0.3f : 0.05f; + + public bool firing => Projectile.ai[2] == 0; + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float manaPower => ref Projectile.ai[1]; + public Color effectsColor { get; set; } = Color.Crimson; + public int fireRate => Owner.HeldItem.useAnimation; + public bool fullyCharged = false; + public int time = 0; + public int shotNum = 0; + public SlotId ionHum { get; set; } + + public override void KillHoldoutLogic() + { + if (Owner.dead) + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + } + } + + public override void HoldoutAI() + { + bool isAtMaxMana = ((float)Owner.statMana / (float)Owner.statManaMax2) >= 1; + Projectile.timeLeft++; + + if (time == 0) + shootingTimer = fireRate; + + if (shootingTimer < 0) + { + OnCooldown(); + shootingTimer++; + if (shootingTimer == 0) + { + shootingTimer = fireRate; + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + } + return; + } + + if (HeldItem.type != Owner.ActiveItem().type) + { + if (manaPower > 0) + shootingTimer = -75; + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + } + + if (shootingTimer == 0) + { + if (firing) + { + if (Owner.Calamity().mouseRight) + { + Projectile.ai[2] = 5; + return; + } + if (Owner.CheckMana(HeldItem, -1, true, false)) + { + Shoot(false); + shootingTimer = fireRate; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + shootingTimer = -40; + } + } + else // Charging mode + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum.Position = Projectile.Center; + hum.Pitch = MathHelper.Lerp(-0.5f, 0.1f, manaPower); + } + else + { + SoundStyle charge = new("CalamityMod/Sounds/Item/IonChargeLoop"); + ionHum = SoundEngine.PlaySound(charge with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } + + if (Owner.Calamity().mouseRight) + { + if (!isAtMaxMana) + { + // This gives mana recharge a consistent rate rather than being variable by a frame + // Without it the mana recharge rate would change if you started charging on an even value rather than an odd one + if (manaPower == 0) + time = 100; + + if (time % 2 == 0) + { + Owner.statMana += (int)(Owner.statManaMax2 * 0.025f); // 80 frames to reach max mana + manaPower += 0.0275f; // 72 frames to reach max power + // Mana power reaches max at 90% mana regained + + if (Owner.statMana > Owner.statManaMax2) + Owner.statMana = Owner.statManaMax2; + } + if (manaPower > 1) + manaPower = 1; + + Vector2 vel = Projectile.velocity.RotateRandom(0.7f) * Main.rand.NextFloat(7, 14); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + vel * 10, ModContent.DustType(), -vel); + dust2.scale = Main.rand.NextFloat(0.35f, 0.55f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.5f) : effectsColor; + } + + if (isAtMaxMana && !fullyCharged && manaPower >= 0.25f) + { + SoundStyle fullCharge = new("CalamityMod/Sounds/Item/DudFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(fullCharge with { Volume = .6f, Pitch = -0.7f + i * 1.5f, MaxInstances = 2 }, Projectile.Center); + fullyCharged = true; + OffsetLengthFromArm -= 7f * manaPower; + } + + OffsetLengthFromArm += 1.3f * manaPower; + } + else + { + if (fullyCharged) + { + Shoot(true); + fullyCharged = false; + } + else // Failure to full charge + { + SoundEngine.PlaySound(SoundID.Item109 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 10; i++) + { + Vector2 vel = Projectile.velocity.RotateRandom(Math.PI); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), -vel); + dust2.scale = Main.rand.NextFloat(0.95f, 1.35f) * (manaPower + 0.3f); + dust2.noGravity = false; + dust2.color = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.5f) : effectsColor; + } + } + manaPower = 0; + shootingTimer = -75; + Projectile.ai[2] = 0; // Return to regular firing mode + } + } + } + else + { + if (!Owner.Calamity().mouseRight && !Main.mouseLeft) + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + } + } + + if (shootingTimer > 0) + shootingTimer--; + + time++; + } + public void OnCooldown() + { + Projectile.timeLeft++; + + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + float lerp = Utils.GetLerpValue(-60, 0, shootingTimer, true); + hum.Position = Projectile.Center; + hum.Pitch = MathHelper.Lerp(0f, -0.6f, lerp); + hum.Volume = 1 - lerp; + } + + Vector2 smokeVel = new Vector2(0, -6) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, Color.SlateGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool()); + GeneralParticleHandler.SpawnParticle(smoke); + } + public void Shoot(bool big) + { + float manaPercent = ((float)Owner.statMana / (float)Owner.statManaMax2); + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Vector2 firingVelocity = (shootDirection * 4); + float damageBoost = Math.Max((manaPower * 60) * (manaPower >= 1 ? 1.5f : 1f), 1); + + if (big) + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/ImpalerLaunch"); + for (int i = 0; i < (manaPower >= 1 ? 2 : 1); i++) + SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = -0.7f, MaxInstances = 2 }, Projectile.Center); + + SoundStyle fire2 = new("CalamityMod/Sounds/Item/PulseRifleFire"); + SoundEngine.PlaySound(fire2 with { Volume = 0.75f, Pitch = (manaPower >= 1 ? 0.7f : 0.5f) }, Projectile.Center); + + Owner.Calamity().GeneralScreenShakePower = 12f * manaPower; + float projSpeedMult = (manaPower + 0.4f) * (manaPower >= 1 ? 3f : 2f); + + float variance = Main.rand.NextFloat(-0.8f, 0.8f); + Vector2 vel = firingVelocity * projSpeedMult; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, vel, ModContent.ProjectileType(), (int)(Projectile.damage * damageBoost), Projectile.knockBack * 4, Projectile.owner, 0, 0, 5); + + OffsetLengthFromArm -= 24f * manaPower; + Owner.velocity -= Projectile.velocity * 14f * manaPower; + Projectile.rotation += 0.5f * Projectile.direction; + + for (int i = 0; i < Math.Max(3, 30 * manaPower); i++) + { + Particle sparks = new SparkParticle(GunTipPosition, Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(7, 25), false, 35, Main.rand.NextFloat(0.5f, 0.9f), Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.5f) : effectsColor); + GeneralParticleHandler.SpawnParticle(sparks); + } + Particle pulse3 = new CustomSpark(GunTipPosition, shootDirection * 7, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 23, 0.085f * manaPower, effectsColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(pulse3); + Particle pulse4 = new CustomSpark(GunTipPosition, shootDirection * 13, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 18, 0.06f * manaPower, effectsColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(pulse4); + } + else + { + SoundStyle shoot = new("CalamityMod/Sounds/Item/ApoctosisShoot"); + SoundEngine.PlaySound(shoot with { Volume = 0.25f, Pitch = 0.5f - 1.1f * manaPercent, MaxInstances = -1 }, Projectile.Center); + if (shotNum % 2 == 0) + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0); + for (int k = 1; k <= 10; k++) + { + Color useColor = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.3f) : effectsColor; + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.85f, 1f); + dust2.noGravity = true; + dust2.color = useColor; + + if (k % 2 == 0) + { + Particle blast = new CustomSpark(GunTipPosition, Projectile.velocity * 3 * k, "CalamityMod/Particles/BloomLineSoftEdge", false, 11, 0.04f, useColor, new Vector2(1f, 0.8f), shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(blast); + } + } + } + else + { + for (int i = -1; i <= 1; i += 2) + { + Vector2 vel = firingVelocity.RotatedBy(0.23f * i); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, vel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, i); + + shootDirection = shootDirection.RotatedBy(0.23f * i); + for (int k = 1; k <= 10; k++) + { + Color useColor = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.3f) : effectsColor; + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.85f, 1f); + dust2.noGravity = true; + dust2.color = useColor; + + if (k % 2 == 0) + { + Particle blast = new CustomSpark(GunTipPosition, vel.SafeNormalize(Vector2.UnitX) * 3 * k, "CalamityMod/Particles/BloomLineSoftEdge", false, 11, 0.04f, useColor, new Vector2(1f, 0.8f), shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(blast); + } + } + } + } + OffsetLengthFromArm -= 5f; + + shotNum++; + } + } + public override bool PreDraw(ref Color lightColor) + { + float manaPercent = ((float)Owner.statMana / (float)Owner.statManaMax2); + if (time < 2) + return false; + Texture2D tex = TextureAssets.Projectile[Type].Value; + Texture2D texGlow = ModContent.Request("CalamityMod/Items/Weapons/Magic/ApoctosisArrayGlow").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D sparkle = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 shake = Main.rand.NextVector2Circular(2, 2) * manaPower; + + Main.EntitySpriteDraw(tex, drawPosition + shake, null, Projectile.GetAlpha(lightColor), drawRotation, tex.Size() * 0.5f, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(texGlow, drawPosition + shake, null, Color.White, drawRotation, texGlow.Size() * 0.5f, Projectile.scale, flipSprite); + + if (shootingTimer >= 0) + { + float reverseManaPower = MathHelper.Lerp(0.7f, 0.1f, manaPower > 0 ? (1 - manaPower) : manaPercent); + for (int i = 0; i < 5; i++) + { + float iMult = (1 - 0.1f * i); + if (manaPower > 0) + Main.EntitySpriteDraw(tex2, GunTipPosition - Main.screenPosition + shake, null, Color.Lerp(effectsColor, Color.White, i * 0.1f) with { A = 0 }, Main.rand.NextFloat(-5f, 5f), tex2.Size() * 0.5f, new Vector2(1f, 0.35f) * 0.75f * manaPower * Main.rand.NextFloat(0.7f, 1.3f) * iMult, flipSprite); + + for (int b = -1; b <= 1; b += 2) + { + float sine = MathHelper.Lerp(((float)Math.Sin(Main.GlobalTimeWrappedHourly * (firing ? 20f : 35f) / MathHelper.Pi)), reverseManaPower * b, 0.75f); + Vector2 scale = new Vector2(0.3f, 1f * sine * b) * (Main.rand.NextFloat(3f, 4.5f) * iMult + manaPower * 1.2f); + float rotation = Projectile.rotation + (time * manaPower * Math.Max(i - 2, 0) * 0.2f) + MathHelper.PiOver4 * b; + Main.EntitySpriteDraw(sparkle, Projectile.Center - Main.screenPosition + Projectile.velocity.RotatedBy(0.44f * Projectile.direction) * 11.7f, null, Color.Lerp(effectsColor, Color.White, i * 0.1f) with { A = 0 }, rotation, sparkle.Size() * 0.5f, scale, flipSprite); + } + } + } + return false; + } + } +} diff --git a/Projectiles/Magic/ApoctosisBlast.cs b/Projectiles/Magic/ApoctosisBlast.cs new file mode 100644 index 0000000000..5abf274f8b --- /dev/null +++ b/Projectiles/Magic/ApoctosisBlast.cs @@ -0,0 +1,108 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class ApoctosisBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public bool chargeShot => Projectile.ai[2] == 5; + public bool onSpawn = true; + public float sine = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 7; + Projectile.ignoreWater = false; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 40 / MathHelper.Pi); + if (onSpawn) + { + Projectile.penetrate = -1; + Projectile.extraUpdates = 20; + Projectile.tileCollide = false; + onSpawn = false; + } + Projectile.velocity *= 0.98f; + + if (Projectile.velocity.Length() > 1 && time > 3) + { + Vector2 placement = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 60; + Particle spark = new GlowSparkParticle(placement, -Projectile.velocity * 0.1f, false, 35, 0.08f, Color.Crimson, new Vector2(0.4f, 1.3f), true, false, 0); + GeneralParticleHandler.SpawnParticle(spark); + + Vector2 vel = -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(3.5f, 14f); + if (time % 2 == 0) + { + Particle trail = new CustomSpark(placement + Main.rand.NextVector2Circular(9, 9), vel, "CalamityMod/Particles/GlowSquareParticle", false, Main.rand.Next(17, 42), Main.rand.NextFloat(1.4f, 3.5f), Main.rand.NextBool() ? Color.Lerp(Color.Crimson, Color.White, 0.5f) : Color.Crimson, new Vector2(1f, 1f), extraRotation: MathHelper.PiOver4); + GeneralParticleHandler.SpawnParticle(trail); + } + } + + + Lighting.AddLight(Projectile.Center, Color.Crimson.ToVector3() * 0.8f); + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.35f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + for (int i = 0; i < 15; i++) + { + Particle sparks = new SparkParticle(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.7f) * Main.rand.NextFloat(7, 25), false, 35, Main.rand.NextFloat(0.5f, 0.9f), Main.rand.NextBool() ? Color.Lerp(Color.Crimson, Color.White, 0.5f) : Color.Crimson); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (time <= 1) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, Projectile.width, ref _); + } + else + return base.Colliding(projHitbox, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation - MathHelper.PiOver2; + float timeleftFade = Utils.GetLerpValue(0, 190, Projectile.timeLeft, true); + + for (int i = 0; i < 10; i++) + { + float iMult = (1 - 0.06f * i); + Vector2 scale = new Vector2((1.2f - 0.8f * iMult) * timeleftFade, 0.2f + 3 * iMult) * iMult * 0.04f; + Vector2 bodyScale = new Vector2((1.2f - 0.8f * iMult) * timeleftFade, 0.2f + 5 * iMult) * iMult * 0.04f; + for (int b = -1; b <= 1; b += 2) + Main.EntitySpriteDraw(tex2, drawPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(0.35f * b * (15 - i) * 0.06f * sine) * 65, null, Color.Lerp(Color.Crimson, Color.White, i * 0.05f) with { A = 0 } * iMult * timeleftFade, drawRotation + 0.2f * b * sine, tex2.Size() * 0.5f, scale, SpriteEffects.None); + + Main.EntitySpriteDraw(tex2, drawPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 125, null, Color.Lerp(Color.Crimson, Color.White, i * 0.05f) with { A = 0 } * iMult * timeleftFade, drawRotation, tex2.Size() * 0.5f, bodyScale, SpriteEffects.None); + } + + return false; + } + } +} diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 7aa7bea46c..d78e533df4 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -1,11 +1,13 @@ using System; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class ApotheosisEnergy : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index 43f9c166df..3ca467c977 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class ApotheosisWorm : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; @@ -200,7 +202,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(10)) - SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center); } float idealFlyAcceleration = 0.18f; diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 296fb9b03d..188e0b38ce 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = 2; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs index a958dd9dc9..3fbe159a25 100644 --- a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs +++ b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 09533fe2b7..25ea685675 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,14 +9,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException(onlyForSingleHitbox: true)] public class AtlantisSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public bool devourer = DownedBossSystem.downedDoG; - public static int TotalSegments = 16; - public float damageMultiplier = 1f; - public int time = 0; - public float fade = 1; + private static int TotalSegments = 16; + private float damageMultiplier = 1f; + private int time = 0; + private float fade = 1; public override void SetDefaults() { @@ -29,6 +31,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = (Main.zenithWorld && devourer) ? 1 : 0; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = (Main.zenithWorld && devourer) ? 2 : 8; + Projectile.appliesImmunityTimeOnSingleHits = true; } public override void AI() diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index 04b524b607..76cc9a31f0 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 10; Projectile.extraUpdates = 100; Projectile.timeLeft = Lifetime; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 98e2af8c09..6275230bf5 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using rail; using Terraria; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class BlushieStaffProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 242551db4a..fe351407b1 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class DarkSparkBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index a512651328..bf2299ddcd 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Magic/DeathValleyDusterProjectile.cs b/Projectiles/Magic/DeathValleyDusterProjectile.cs index d7602bf560..0fd107a6bf 100644 --- a/Projectiles/Magic/DeathValleyDusterProjectile.cs +++ b/Projectiles/Magic/DeathValleyDusterProjectile.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 240); + player.AddBuff(ModContent.BuffType(), 600); int Dusts = 12; float radians = MathHelper.TwoPi / Dusts; diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index 23316f5c74..a4795ab8e4 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -1,11 +1,13 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class EidolicWailSoundwave : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index 40d362af69..4ce8847842 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs index 46cac4412a..c945d0333f 100644 --- a/Projectiles/Magic/IncineratingFireball.cs +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic bool canUseMana = Owner.CheckMana(Owner.ActiveItem()); // Use different behavior depending on if the player is channeling or not. - if (Owner.CantUseHoldout() || !canUseMana || Projectile.timeLeft <= 40) + if (Owner.CantUseHoldout() || !canUseMana || Projectile.timeLeft <= (int)BurningSea.FizzleOutTime) { Released = true; @@ -103,17 +103,26 @@ namespace CalamityMod.Projectiles.Magic if (Timer % 15 == 0f) Owner.CheckMana(Owner.ActiveItem(), -1, true); - // If channeled for a while, turns red (handled in PreDraw) and starts emitting smoke as a warning. - // The smoke only starts once the fireball is completely red. - if (Timer > BurningSea.BurnOutTime - 60f) + // Spawn little spark effects around the fireball when fully charged. + if (Timer > BurningSea.ChargeTime && Timer < BurningSea.BurnOutTime) { - for (int s = 0; s < 2; s++) + for (int s = 0; s < 6; s++) { - Vector2 smokeLocation = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 237f; - Vector2 smokeVel = smokeLocation - Projectile.Center; - smokeVel.Normalize(); - smokeVel *= 5f; - HeavySmokeParticle burningUp = new(smokeLocation, smokeVel, new Color(192, 192, 192), 10, 1f, 0.6f); + float sparkRotation = Main.GlobalTimeWrappedHourly * -5.75f + (MathHelper.TwoPi / 6f * s); + Vector2 sparkLocation = Projectile.Center + Vector2.UnitX.RotatedBy(sparkRotation) * 220f; + Vector2 sparkVelocity = Vector2.Normalize(sparkLocation - Projectile.Center).RotatedBy(MathHelper.ToRadians(70)) * 2f; + AltLineParticle spark = new(sparkLocation, sparkVelocity, false, 8, 0.8f, Color.Lerp(Color.Red, Color.Orange, Main.rand.NextFloat(0.3f))); + GeneralParticleHandler.SpawnParticle(spark); + } + } + // If channeled for a while, turns red (handled in PreDraw) and starts emitting smoke as a warning. + if (Timer > BurningSea.BurnOutTime - 90f) + { + for (int s = 0; s < 3; s++) + { + Vector2 smokeLocation = Projectile.Center + Main.rand.NextVector2Circular(220f, 220f); + Vector2 smokeVel = -Vector2.UnitY * Main.rand.NextFloat(7f, 13f); + HeavySmokeParticle burningUp = new(smokeLocation, smokeVel, new Color(192, 192, 192), 10, 0.7f, 0.6f); GeneralParticleHandler.SpawnParticle(burningUp); } } @@ -178,12 +187,16 @@ namespace CalamityMod.Projectiles.Magic // Big fucking fireball for (int i = 0; i < 6; i++) { - float direction = (i % 2f == 0f).ToDirectionInt(); + float direction = (i % 2 == 0).ToDirectionInt(); + float offsetDist = 0f; Color fireballColor = Color.Lerp(new Color(255, 200, 200), new Color(255, 30, 30), MathHelper.Clamp(Timer / BurningSea.ChargeTime, 0f, 1f)); if (Timer > BurningSea.BurnOutTime - 120f) + { fireballColor = Color.Lerp(new Color(255, 30, 30), Color.Red, MathHelper.Clamp((Timer - BurningSea.BurnOutTime + 120f) / 60f, 0f, 1f)); + offsetDist = MathHelper.Lerp(5f, 40f, (Timer - BurningSea.BurnOutTime + 120f) / 120f); + } - Main.spriteBatch.Draw(TheodoreJNoise, Projectile.Center - Main.screenPosition, null, fireballColor, direction * rotation, TheodoreJNoise.Size() / 2f, drawScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(TheodoreJNoise, Projectile.Center - Main.screenPosition + Main.rand.NextVector2Circular(offsetDist, offsetDist), null, fireballColor, direction * rotation, TheodoreJNoise.Size() / 2f, drawScale, SpriteEffects.None, 0f); } Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 972d4d5541..f460e9ee48 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -1,8 +1,13 @@ using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using rail; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -10,81 +15,131 @@ namespace CalamityMod.Projectiles.Magic public class IonBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 4; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - + public ref float time => ref Projectile.ai[0]; + public bool chargeShot => Projectile.ai[2] == 5; + public bool onSpawn = true; public override void SetDefaults() { - Projectile.width = Projectile.height = 14; + Projectile.width = Projectile.height = 30; Projectile.friendly = true; - Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 7; Projectile.ignoreWater = false; - Projectile.timeLeft = 120; + Projectile.timeLeft = 280; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 40; } public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation(); - Projectile.velocity *= 1.015f; - if (Projectile.alpha > 0) + if (chargeShot) { - Projectile.alpha -= 3; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f, 0f, 0.2f); - float projTimer = 100f; - float timerIncr = 3f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += timerIncr; - if (Projectile.localAI[0] > projTimer) + if (onSpawn) { - Projectile.localAI[0] = projTimer; + Projectile.penetrate = -1; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 190; + Projectile.tileCollide = false; + onSpawn = false; + } + Projectile.velocity *= 0.975f; + + if (Projectile.timeLeft > 45 && time > 3) + { + Particle trail = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.01f, false, 15, 1f, Color.Crimson * 0.6f); + GeneralParticleHandler.SpawnParticle(trail); } } else { - Projectile.localAI[0] -= timerIncr; - if (Projectile.localAI[0] <= 0f) + if (Projectile.ai[1] != 0 && time > 18) + Projectile.velocity = Projectile.velocity.RotatedBy(0.003f * -Projectile.ai[1]); + + if (Projectile.velocity.Length() < 17) + Projectile.velocity *= 1.005f; + + Vector2 vel = -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(0.5f, 4.5f); + + if (time % 3 == 0) { - Projectile.Kill(); + Particle trail = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(6, 6), vel, "CalamityMod/Particles/GlowSquareParticle", false, Main.rand.Next(7, 12), Main.rand.NextFloat(0.5f, 0.8f), Main.rand.NextBool() ? Color.Lerp(Color.Crimson, Color.White, 0.5f) : Color.Crimson, new Vector2(1f, 1f), extraRotation: MathHelper.PiOver4); + GeneralParticleHandler.SpawnParticle(trail); } } - } + Lighting.AddLight(Projectile.Center, Color.Crimson.ToVector3() * 0.5f); + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 32; - 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.Item92, Projectile.Center); - int randDustAmt = Main.rand.Next(15, 30); - for (int i = 0; i < randDustAmt; i++) + if (!chargeShot) { - int reddish = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.Firework_Red, 0f, 0f, 100, default, 1f); - Main.dust[reddish].velocity *= 2f; - Main.dust[reddish].noGravity = true; + SoundEngine.PlaySound(SoundID.Item92 with { Volume = 0.4f }, Projectile.Center); + + Particle blastfx = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Crimson, "CalamityMod/Particles/BloomRingThinLarge", Vector2.One, 0, 0.02f, 0.053f, 17); + GeneralParticleHandler.SpawnParticle(blastfx); + Particle blastfx2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Crimson, Color.White, 0.5f), "CalamityMod/Particles/BloomRingThinLarge", Vector2.One, 0, 0.02f, 0.06f, 15); + GeneralParticleHandler.SpawnParticle(blastfx2); + + for (int i = 0; i < 15; i++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(Math.PI) * Main.rand.NextFloat(3, 7)); + dust2.scale = Main.rand.NextFloat(0.85f, 1f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(Color.Crimson, Color.White, 0.5f) : Color.Crimson; + } + + // Create Blast + float blastSize = 60; + float minMultiplier = 0.3f; + int hitsToMinMult = 7; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 10; + blast.DamageType = DamageClass.Magic; + blast.ArmorPenetration = 40; } } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (time <= 1) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, Projectile.width, ref _); + } + else + return base.Colliding(projHitbox, targetHitbox); + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + float timeleftFade = Utils.GetLerpValue(0, 60, Projectile.timeLeft, true); + if (chargeShot) + { + for (int i = 0; i < 5; i++) + { + float iMult = (1 - 0.1f * i); + Main.EntitySpriteDraw(tex2, drawPosition, null, Color.Lerp(Color.Crimson, Color.White, i * 0.1f) with { A = 0 } * iMult * timeleftFade, drawRotation, tex2.Size() * 0.5f, new Vector2(0.2f + 2 * iMult, (1.2f - 1f * iMult) * timeleftFade) * iMult * 0.03f, SpriteEffects.None); + } + } + else + { + for (int i = 0; i < 5; i++) + Main.EntitySpriteDraw(tex, drawPosition, null, Color.Lerp(Color.Crimson, Color.White, i * 0.1f) with { A = 0 } * (1 - 0.1f * i), drawRotation, tex.Size() * 0.5f, (1 - 0.1f * i), SpriteEffects.None); + } return false; } } diff --git a/Projectiles/Magic/IonBlasterHoldout.cs b/Projectiles/Magic/IonBlasterHoldout.cs new file mode 100644 index 0000000000..068a366505 --- /dev/null +++ b/Projectiles/Magic/IonBlasterHoldout.cs @@ -0,0 +1,309 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class IonBlasterHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 1.5f * Projectile.spriteDirection; + public override float MaxOffsetLengthFromArm => 30f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -9f; + public override float OffsetYDownwards => 5f; + public override float WeaponTurnSpeed => 0.35f; + public override float RecoilResolveSpeed => shootingTimer >= 0 ? 0.3f : 0.05f; + + public bool firing => Projectile.ai[2] == 0; + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float manaPower => ref Projectile.ai[1]; + public Color effectsColor { get; set; } = Color.Crimson; + public int fireRate => Owner.HeldItem.useAnimation; + public bool fullyCharged = false; + public int time = 0; + public int shotNum = 0; + public SlotId ionHum { get; set; } + + public override void KillHoldoutLogic() + { + if (Owner.dead) + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + } + } + + public override void HoldoutAI() + { + bool isAtMaxMana = ((float)Owner.statMana / (float)Owner.statManaMax2) >= 1; + Projectile.timeLeft++; + + if (time == 0) + shootingTimer = fireRate; + + if (shootingTimer < 0) + { + OnCooldown(); + shootingTimer++; + if (shootingTimer == 0) + { + shootingTimer = fireRate; + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + } + return; + } + + if (HeldItem.type != Owner.ActiveItem().type) + { + if (manaPower > 0) + shootingTimer = -75; + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + } + + if (shootingTimer == 0) + { + if (firing) + { + if (Owner.Calamity().mouseRight) + { + Projectile.ai[2] = 5; + return; + } + if (Owner.CheckMana(HeldItem, -1, true, false)) + { + Shoot(false); + shootingTimer = fireRate; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + shootingTimer = -40; + } + } + else // Charging mode + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum.Position = Projectile.Center; + hum.Pitch = MathHelper.Lerp(-0.5f, 0.1f, manaPower); + } + else + { + SoundStyle charge = new("CalamityMod/Sounds/Item/IonChargeLoop"); + ionHum = SoundEngine.PlaySound(charge with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } + + if (Owner.Calamity().mouseRight) + { + if (!isAtMaxMana) + { + // This gives mana recharge a consistent rate rather than being variable by a frame + // Without it the mana recharge rate would change if you started charging on an even value rather than an odd one + if (manaPower == 0) + time = 100; + + if (time % 2 == 0) + { + Owner.statMana += (int)(Owner.statManaMax2 * 0.025f); // 80 frames to reach max mana + manaPower += 0.0275f; // 72 frames to reach max power + // Mana power reaches max at 90% mana regained + + if (Owner.statMana > Owner.statManaMax2) + Owner.statMana = Owner.statManaMax2; + } + if (manaPower > 1) + manaPower = 1; + + Vector2 vel = Projectile.velocity.RotateRandom(0.7f) * Main.rand.NextFloat(7, 14); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + vel * 10, ModContent.DustType(), -vel); + dust2.scale = Main.rand.NextFloat(0.35f, 0.55f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.5f) : effectsColor; + } + + if (isAtMaxMana && !fullyCharged && manaPower >= 0.25f) + { + SoundStyle fullCharge = new("CalamityMod/Sounds/Item/DudFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(fullCharge with { Volume = .6f, Pitch = -0.7f + i * 1.5f, MaxInstances = 2 }, Projectile.Center); + fullyCharged = true; + OffsetLengthFromArm -= 7f * manaPower; + } + + OffsetLengthFromArm += 1.3f * manaPower; + } + else + { + if (fullyCharged) + { + Shoot(true); + fullyCharged = false; + } + else // Failure to full charge + { + SoundEngine.PlaySound(SoundID.Item109 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 10; i++) + { + Vector2 vel = Projectile.velocity.RotateRandom(Math.PI); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), -vel); + dust2.scale = Main.rand.NextFloat(0.95f, 1.35f) * (manaPower + 0.3f); + dust2.noGravity = false; + dust2.color = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.5f) : effectsColor; + } + } + manaPower = 0; + shootingTimer = -75; + Projectile.ai[2] = 0; // Return to regular firing mode + } + } + } + else + { + if (!Owner.Calamity().mouseRight && !Main.mouseLeft) + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + Projectile.Kill(); + } + } + + if (shootingTimer > 0) + shootingTimer--; + + time++; + } + public void OnCooldown() + { + Projectile.timeLeft++; + + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + float lerp = Utils.GetLerpValue(-60, 0, shootingTimer, true); + hum.Position = Projectile.Center; + hum.Pitch = MathHelper.Lerp(0f, -0.6f, lerp); + hum.Volume = 1 - lerp; + } + + Vector2 smokeVel = new Vector2(0, -6) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, Color.SlateGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool()); + GeneralParticleHandler.SpawnParticle(smoke); + } + public void Shoot(bool big) + { + float manaPercent = ((float)Owner.statMana / (float)Owner.statManaMax2); + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Vector2 firingVelocity = (shootDirection * 4); + float damageBoost = (manaPower >= 1 ? 1.9f : 1.6f); + + if (big) + { + if (SoundEngine.TryGetActiveSound(ionHum, out var hum) && hum.IsPlaying) + { + hum?.Stop(); + } + if (manaPower >= 1) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ImpalerLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = -0.6f }, Projectile.Center); + } + SoundStyle fire2 = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); + SoundEngine.PlaySound(fire2 with { Volume = 0.4f, Pitch = (manaPower >= 1 ? 0.8f : 0.6f) }, Projectile.Center); + + Owner.Calamity().GeneralScreenShakePower = 6f * manaPower; + int maxProj = (int)(manaPower * 24 * (manaPower >= 1 ? 1 : 0.5f)); + for (int i = 0; i < maxProj; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + Vector2 vel = firingVelocity.RotatedBy(variance * 0.3f) * (1 - Math.Abs(variance)) * (i % 2 == 0 ? 0.7f : 1) * Main.rand.NextFloat(5f, 5.5f); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, vel, ModContent.ProjectileType(), (int)(Projectile.damage * damageBoost), Projectile.knockBack * 2, Projectile.owner, 0, 0, 5); + } + OffsetLengthFromArm -= 24f * manaPower; + Owner.velocity -= Projectile.velocity * 12f * manaPower; + + for (int i = 0; i < Math.Max(3, 30 * manaPower); i++) + { + Particle sparks = new SparkParticle(GunTipPosition, Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(7, 25), false, 35, Main.rand.NextFloat(0.5f, 0.9f), Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.5f) : effectsColor); + GeneralParticleHandler.SpawnParticle(sparks); + } + Particle pulse3 = new CustomSpark(GunTipPosition, shootDirection * 9, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 17, 0.06f, effectsColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(pulse3); + } + else + { + SoundEngine.PlaySound(SoundID.Item91 with { Volume = 0.5f, Pitch = 0.8f - 1.3f * manaPercent }, Projectile.Center); + + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + OffsetLengthFromArm -= 5f; + + for (int k = 1; k <= 10; k++) + { + Color useColor = Main.rand.NextBool() ? Color.Lerp(effectsColor, Color.White, 0.3f) : effectsColor; + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.85f, 1f); + dust2.noGravity = true; + dust2.color = useColor; + + if (k % 2 == 0) + { + Particle blast = new CustomSpark(GunTipPosition, Projectile.velocity * 3 * k, "CalamityMod/Particles/BloomLineSoftEdge", false, 11, 0.04f, useColor, new Vector2(1f, 0.8f), shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(blast); + } + } + shotNum++; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + Texture2D tex = TextureAssets.Projectile[Type].Value; + Texture2D texGlow = ModContent.Request("CalamityMod/Items/Weapons/Magic/IonBlasterGlow").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 shake = Main.rand.NextVector2Circular(2, 2) * manaPower; + + Main.EntitySpriteDraw(tex, drawPosition + shake, null, Projectile.GetAlpha(lightColor), drawRotation, tex.Size() * 0.5f, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(texGlow, drawPosition + shake, null, Color.White, drawRotation, texGlow.Size() * 0.5f, Projectile.scale, flipSprite); + + if (manaPower > 0 && shootingTimer >= 0) + { + for (int i = 0; i < 4; i++) + { + float iMult = (1 - 0.1f * i); + Main.EntitySpriteDraw(tex2, GunTipPosition - Main.screenPosition + shake, null, Color.Lerp(effectsColor, Color.White, i * 0.1f) with { A = 0 }, Main.rand.NextFloat(-5f, 5f), tex2.Size() * 0.5f, new Vector2(1f, 0.55f) * 0.5f * manaPower * Main.rand.NextFloat(0.7f, 1.3f) * iMult, flipSprite); + } + } + return false; + } + } +} diff --git a/Projectiles/Magic/LazharSolarBeam.cs b/Projectiles/Magic/LazharSolarBeam.cs deleted file mode 100644 index 41cd01de7b..0000000000 --- a/Projectiles/Magic/LazharSolarBeam.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class LazharSolarBeam : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - for (int i = 0; i < 4; i++) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * ((float)i * 0.25f); - Projectile.alpha = 255; - int heatGold = Dust.NewDust(projPos, 1, 1, DustID.GoldCoin, 0f, 0f, 0, default, 1f); - Main.dust[heatGold].position = projPos; - Main.dust[heatGold].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[heatGold].velocity *= 0.2f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Daybreak, 180); - if (Projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Magic; - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Daybreak, 180); - } -} diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index 441739fc9c..8f43f46666 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 20; Projectile.penetrate = 5; Projectile.tileCollide = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index c5373229e3..0bfd8ae7cc 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 30; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/NightsRayBeam.cs b/Projectiles/Magic/NightsRayBeam.cs index 0e38e73656..f004db67aa 100644 --- a/Projectiles/Magic/NightsRayBeam.cs +++ b/Projectiles/Magic/NightsRayBeam.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 10; Projectile.extraUpdates = 100; Projectile.timeLeft = 150; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 8eb1c426c2..f6908e97fb 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Magic public int time = 0; public float dustRotation = 0; public bool launched = false; + public NPC targeted; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; @@ -64,10 +65,10 @@ namespace CalamityMod.Projectiles.Magic launched = true; } - NPC target = Projectile.Center.ClosestNPCAt(700); - CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.15f, 6, 0.98f, accelerate: true); + targeted = Projectile.Center.ClosestNPCAt(950); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.15f, 6, 0.98f, accelerate: true); - if (time < 550 && target == null) + if (time < 550 && targeted == null) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction if (Projectile.velocity.Length() < 6) @@ -106,7 +107,13 @@ namespace CalamityMod.Projectiles.Magic Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 1); target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true); } - + public override bool? CanHitNPC(NPC target) + { + if (targeted != null) + return (target == targeted ? null : false); + else + return null; + } public override void OnKill(int timeLeft) { for (int i = 0; i <= 3; i++) diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 34b9525e3e..423f549cdd 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Magic public int spinDir = 100; public int waveOften = 40; public float scaleVariance = 1; + public NPC targeted; public bool launched = false; public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -71,10 +72,10 @@ namespace CalamityMod.Projectiles.Magic time = 600; } - NPC target = Projectile.Center.ClosestNPCAt(550); - CalamityUtils.HomeInOnSelectedNPC(Projectile, target, true, 0.15f, 6, 0.98f, accelerate: true); + targeted = Projectile.Center.ClosestNPCAt(950); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.15f, 6, 0.98f, accelerate: true); - if (time < 550 && target == null) + if (time < 550 && targeted == null) { if (Projectile.velocity.Length() < 6) Projectile.velocity += (mouse - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; @@ -109,6 +110,13 @@ namespace CalamityMod.Projectiles.Magic target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true); } + public override bool? CanHitNPC(NPC target) + { + if (targeted != null) + return (target == targeted ? null : false); + else + return null; + } public override void OnKill(int timeLeft) { for (int i = 0; i <= 2; i++) diff --git a/Projectiles/Magic/PrimordialAncientProjectile.cs b/Projectiles/Magic/PrimordialAncientProjectile.cs index 42821ea279..6eac8df489 100644 --- a/Projectiles/Magic/PrimordialAncientProjectile.cs +++ b/Projectiles/Magic/PrimordialAncientProjectile.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 540); + player.AddBuff(ModContent.BuffType(), 840); int Dusts = 8; float radians = MathHelper.TwoPi / Dusts; diff --git a/Projectiles/Magic/PrimordialEarthProjectile.cs b/Projectiles/Magic/PrimordialEarthProjectile.cs index e7d99309b2..6a5a77c9ef 100644 --- a/Projectiles/Magic/PrimordialEarthProjectile.cs +++ b/Projectiles/Magic/PrimordialEarthProjectile.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 360); + player.AddBuff(ModContent.BuffType(), 720); int Dusts = 12; float radians = MathHelper.TwoPi / Dusts; diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index a27ef75db1..ac874b32c1 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.timeLeft = 300; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index b857ad36cf..d0e09f1117 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -4,6 +4,7 @@ using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -13,6 +14,7 @@ using Terraria.WorldBuilding; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class RancorLaserbeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index f024feb401..edcd3fe031 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class Snowflake : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index 4a6cbb038c..54a4b578af 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class SparklingLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index ba7385356e..312b9f501c 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Graphics.Metaballs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class SpiritCongregation : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 96822f36ce..d33a69bb29 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 1; } public override void AI() @@ -35,10 +37,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 1; - } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index c01869a4b3..71f6acda5e 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class Teslabeam : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 3bd8f7fb9c..36f9ad6e48 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.timeLeft = 30; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index c1f057a06d..3dbd357902 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Magic public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int time = 0; public int direction = 0; + public Vector2 lastPos; public override void SetDefaults() { Projectile.width = 16; @@ -44,6 +45,7 @@ namespace CalamityMod.Projectiles.Magic if (time == 0) { direction = Main.rand.NextBool() ? 1 : -1; + lastPos = Projectile.Center; } if (time > 3) @@ -51,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic if (time > 3 && targetDist < 1400) { - Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 0.7f), false, true); + Particle spark = new GlowSparkParticle(Projectile.Center, Utils.DirectionTo(Projectile.Center, lastPos), false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 1.4f), false, true); GeneralParticleHandler.SpawnParticle(spark); if (Main.rand.NextBool((int)(MathHelper.Clamp((1 - Projectile.ai[2]) * 5, 1, 15)))) @@ -64,6 +66,7 @@ namespace CalamityMod.Projectiles.Magic } } time++; + lastPos = Projectile.Center; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index cc1d8ddeb6..277a9241a8 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class WaterLeechProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; @@ -25,6 +27,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.timeLeft = 540; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 74c6d6ee5f..809db702cf 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index c336051740..c4ae4715b3 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index fbc4db8a6d..c80d9b0306 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 105a0a852e..d9a8f4bb10 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class YharimsCrystalBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index cb5eb85d89..7f071091f0 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index c9e6cc4e7a..cf2aace6b5 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -39,6 +39,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index 6c3de2de20..65c40923ae 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -39,6 +39,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/BalefulHarvesterHoldout.cs b/Projectiles/Melee/BalefulHarvesterHoldout.cs index bcb77bd920..3363445afd 100644 --- a/Projectiles/Melee/BalefulHarvesterHoldout.cs +++ b/Projectiles/Melee/BalefulHarvesterHoldout.cs @@ -42,12 +42,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index 1e2b9dd04c..be8d7e1f2c 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class BasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -42,12 +44,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -196,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee { Owner.Calamity().GeneralScreenShakePower = 1.2f; - SoundStyle fire3 = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion"); + SoundStyle fire3 = new("CalamityMod/Sounds/Item/DampExplosion"); SoundEngine.PlaySound(fire3 with { Volume = 0.35f, Pitch = 0.7f }, Projectile.Center); for (int i = 0; i < MathHelper.Clamp(15 - Projectile.numHits * 3, 2, 15); i++) { diff --git a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs index 377e46ab08..d629cef3db 100644 --- a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs +++ b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs @@ -103,11 +103,13 @@ namespace CalamityMod.Projectiles.Melee ejectedBlade = projectile; } } - ejectedBlade.localAI[0] = 5; - ejectedBlade.ai[1] += 1000; - ejectedBlade.velocity = Projectile.velocity.RotatedByRandom(0.2f); - ejectedBlade.netUpdate = true; - ejectedBlade.netSpam = 0; + if (ejectedBlade != null) + { + ejectedBlade.localAI[0] = 5; + ejectedBlade.ai[1] += 1000; + ejectedBlade.velocity = Projectile.velocity.RotatedByRandom(0.2f); + ejectedBlade.ForceNetUpdate(); + } for (int i = 0; i < 8; i++) { diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index f9ad15cf39..6cce44387c 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 200; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 765c4831b3..41c5b560a3 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class BonebreakerProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 3fbd52fcf1..0957b0a141 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 5; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index e36d1e29dd..f8d4d6935c 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -70,6 +70,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 0022918305..8c7e3ac1c3 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -37,6 +37,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index 2b5428f25b..2f5da2023e 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -37,10 +37,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { SwingDir = 1f; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnimation = Owner.itemAnimationMax; diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index 3ce47bbf54..6d1015e6c7 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index c06fb4e466..8a5e54dcfd 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class CometQuasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -41,12 +43,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index fd9454da63..9e308d1d6f 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 10; Projectile.height = 10; - Projectile.scale = 1.5f; + Projectile.scale = 7f; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -67,33 +67,32 @@ namespace CalamityMod.Projectiles.Melee Vector2 maxLength = owner.ClampedMouseWorld() - owner.Center; DrawLaser(Terraria.GameContent.TextureAssets.Projectile[Type].Value, owner.Center, - Projectile.velocity, 15f, Projectile.damage, -MathHelper.PiOver2, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); + Projectile.velocity, 15f, -MathHelper.PiOver2, Projectile.scale, maxLength.Length(), new Color(Main.DiscoR, 0, 255), (int)MOVE_DISTANCE); } return false; } // The core function of drawing a laser - public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default(Color), int transDist = 50) + public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default, int transDist = 50) { float r = unit.ToRotation() + rotation; // Draws the laser 'body' for (float i = transDist; i <= Distance; i += step) { - Color c = new Color(Main.DiscoR, 0, 255); var origin = start + i * unit; Main.EntitySpriteDraw(texture, origin - Main.screenPosition, - new Rectangle(0, 26, 28, 26), i < transDist ? Color.Transparent : c, r, - new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); + new Rectangle(0, 26, 28, 26), i < transDist ? Color.Transparent : color, r, + new Vector2(28 * .5f, 26 * .5f), MathHelper.Lerp(1f, scale, i / Distance), 0, 0); } // Draws the laser 'tail' Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, - new Rectangle(0, 0, 28, 26), new Color(Main.DiscoR, 0, 255), r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); + new Rectangle(0, 0, 28, 26), color, r, new Vector2(28 * .5f, 26 * .5f), 1f, 0, 0); // Draws the laser 'head' Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, - new Rectangle(0, 52, 28, 26), new Color(Main.DiscoR, 0, 255), r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); + new Rectangle(0, 52, 28, 26), color, r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); } // Change the way of collision check of the projectile @@ -119,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft == 300) SoundEngine.PlaySound(CrystylCrusher.ChargeSound, player.Center); - Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE; + Projectile.Center = player.Center + Projectile.velocity * MOVE_DISTANCE; Projectile.timeLeft = 2; // By separating large AI into methods it becomes very easy to see the flow of the AI in a broader sense @@ -232,6 +231,7 @@ namespace CalamityMod.Projectiles.Melee /* * Update CutTiles so the laser will cut tiles (like grass) */ + public override bool? CanCutTiles() => IsAtMaxCharge ? null : false; public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; @@ -244,11 +244,11 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { Vector2 destroyVector = Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE); - int threeMod = 3; - int mineXLeft = (int)(destroyVector.X / 16f - threeMod); - int mineXRight = (int)(destroyVector.X / 16f + threeMod); - int mineXUp = (int)(destroyVector.Y / 16f - threeMod); - int mineXDown = (int)(destroyVector.Y / 16f + threeMod); + int radius = 7; + int mineXLeft = (int)(destroyVector.X / 16f - radius); + int mineXRight = (int)(destroyVector.X / 16f + radius); + int mineXUp = (int)(destroyVector.Y / 16f - radius); + int mineXDown = (int)(destroyVector.Y / 16f + radius); if (mineXLeft < 0) { mineXLeft = 0; @@ -273,7 +273,7 @@ namespace CalamityMod.Projectiles.Melee float destroyTileX = Math.Abs(i - destroyVector.X / 16f); float destroyTileY = Math.Abs(j - destroyVector.Y / 16f); double destroyTileArea = Math.Sqrt(destroyTileX * destroyTileX + destroyTileY * destroyTileY); - if (destroyTileArea < threeMod) + if (destroyTileArea < radius) { if (Main.tile[i, j] != null && Main.tile[i, j].HasTile) { diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index 93c4930826..e0c9b5272e 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 200; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index aa594d8fff..16d5f599b0 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -23,6 +24,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DevilsDevastationHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -62,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { IgnoreActiveAnimation = true; DrawUnconditionally = true; @@ -70,7 +72,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -95,11 +96,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 2; Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, vel.RotatedBy(MathHelper.ToRadians(45)), ModContent.ProjectileType(), 0, 0f, Owner.whoAmI, 1, 0); } - Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.5f), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); SoundStyle dieSound = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); SoundEngine.PlaySound(dieSound with { Volume = 0.9f, Pitch = 0.3f }, lastHitTarget.Center); - int bonusDamage = 4500; + int bonusDamage = 4000; if (lastHitTarget.Calamity().demonicFlamesBonusDamage <= bonusDamage) { lastHitTarget.Calamity().demonicFlamesBonusDamage = bonusDamage; @@ -303,7 +304,7 @@ namespace CalamityMod.Projectiles.Melee bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); - int bonusDamage = 4500; + int bonusDamage = 4000; if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) { target.Calamity().demonicFlamesBonusDamage = bonusDamage; @@ -388,7 +389,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.35f; int hitsToMinMult = 8; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs index 4fc376974d..95d76aeb8a 100644 --- a/Projectiles/Melee/DevilsDevastationThrownBlade.cs +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; public int ChargeupTime => (int)Projectile.localAI[2]; - public int Lifetime = 180; + public int Lifetime = 300; public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); public Color usedColor = Color.White; public bool thrown = false; - public int fadeOutTime = 120; + public int fadeOutTime = 240; public bool stuckInTarget = false; public int stuckTimer = 0; public bool exitedTarget = false; diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index 959f4b8f4d..cab7c87dbf 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DevilsSunriseCyclone : ModProjectile, ILocalizedModType { public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 1.25f, PitchVariance = 0.15f }; diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 5a440b6883..3f72eacbf0 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DevilsSunriseProj : ModProjectile { public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 0.8f }; diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 01ec734e1f..29a8413530 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DragonRageStaff : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/DragoonBigBolt.cs b/Projectiles/Melee/DragoonBigBolt.cs index 5ed32691a3..af712cfd53 100644 --- a/Projectiles/Melee/DragoonBigBolt.cs +++ b/Projectiles/Melee/DragoonBigBolt.cs @@ -131,7 +131,18 @@ namespace CalamityMod.Projectiles.Melee target.MoveNPC(launchVel, 20, true); } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1), targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1); + Player Owner = Main.player[Projectile.owner]; + if (time <= 1 && Projectile.ai[1] != 0.5f) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, size, ref _); + } + else + return CalamityUtils.CircularHitboxCollision(Projectile.Center, size, targetHitbox); + } public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Melee/DragoonSmallBolt.cs b/Projectiles/Melee/DragoonSmallBolt.cs index 50f9cd897e..fa312e20a0 100644 --- a/Projectiles/Melee/DragoonSmallBolt.cs +++ b/Projectiles/Melee/DragoonSmallBolt.cs @@ -75,9 +75,19 @@ namespace CalamityMod.Projectiles.Melee Particle spark2 = new BoltParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 13, Main.rand.NextFloat(0.3f, 0.35f), Main.rand.NextBool() ? Color.Orchid : Color.Cyan, new Vector2(1.8f, 0.8f), true, true, false, 0.9f); GeneralParticleHandler.SpawnParticle(spark2); } - + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (time <= 1) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25, ref _); + } + else + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 5c2c17864d..62e7694000 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Runtime.ConstrainedExecution; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class EarthHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -26,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee public override Vector2 HitboxSize => new Vector2(288, 288) * (1 + bladeFade * 1.2f); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(-3, 186f); + public override Vector2 SpriteOrigin => new(0, 186f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -48,12 +50,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning mousePos = Owner.Calamity().mouseWorld; @@ -101,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) fadeIn = MathHelper.Lerp(fadeIn, 1, 0.2f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.28f); if (Projectile.ai[1] == -1) bladeFade = MathHelper.Lerp(bladeFade, 1, 0.15f); @@ -297,7 +298,7 @@ namespace CalamityMod.Projectiles.Melee spawnBoom = false; } - int healPower = (Projectile.ai[1] == -1 ? 100 : 85); + int healPower = Projectile.ai[1] == -1 ? 90 : 80; int heal = (int)(MathHelper.Clamp(healPower - Projectile.numHits * 75, 1, healPower)); if (Projectile.numHits < 10) { @@ -379,11 +380,14 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < draws; i++) { + bool swordTip = i > draws * 0.73f; + float swordTipScale = swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1; Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); - Color auraColor = Color.Lerp(mainColor, Color.Lerp(mainColor, Color.White, 0.7f), Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * bladeFade; + Color bladeColor = Color.Lerp(Color.MediumTurquoise, Color.Lerp(Color.LimeGreen, Color.OrangeRed, (i * 0.8f) / draws), i / (draws * 0.6f)); + Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.4f * bladeFade; Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.03f) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale, 1f) * (0.75f * swordTipScale) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index 11d5b2620c..e0151b3c6e 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee if (time > 65) { - if (!Main.dedServ) + if (Main.myPlayer == Projectile.owner) { Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.4f, "CalamityMod/Particles/GlowSpark2", false, (int)MathHelper.Clamp(9 * sizeVariance, 3, 9), MathHelper.Clamp(0.03f * sizeVariance, 0.01f, 0.03f), Color.Black * 0.6f, new Vector2(1.2f, 0.5f), false, shrinkSpeed: 1.1f); GeneralParticleHandler.SpawnParticle(spark2); diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 23ca636df8..e69e5f6157 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -19,6 +20,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class ExaltedOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { IgnoreActiveAnimation = true; DrawUnconditionally = true; @@ -62,7 +64,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -317,7 +318,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.35f; int hitsToMinMult = 8; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs index 17b17ede5c..ae5c9d7cd6 100644 --- a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int bonusDamage = 120; + int bonusDamage = 100; if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) { target.Calamity().demonicFlamesBonusDamage = bonusDamage; diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index b42a40d9ca..fe3d3bdd40 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -19,6 +20,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class ForbiddenOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { IgnoreActiveAnimation = true; DrawUnconditionally = true; @@ -62,7 +64,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -306,7 +307,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.3f; int hitsToMinMult = 7; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 22ee0898d6..12efa56e57 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -3,6 +3,7 @@ using System.IO; using System.Runtime.CompilerServices; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -17,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class GrandDadHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -40,9 +42,6 @@ namespace CalamityMod.Projectiles.Melee public bool swingSound = true; private NPC target => Main.npc[(int)Projectile.ai[0]]; - private bool hasSpawned; - private bool hasHit; - private int damageDone; public override void SetDefaults() { @@ -52,120 +51,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { - base.OnSpawn(source); + Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1; } public override void UseStyle() { - /* - * OnSpawn() method implemented inside AI(). - * This is done for MP syncing. - */ - if (!hasSpawned) - { - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; - Projectile.knockBack = 0; - Projectile.scale = 1; - Projectile.ai[1] = -1; - - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; - useAnim = Owner.itemAnimationMax; - - if (mousePos.X < Owner.Center.X) Owner.direction = -1; - else Owner.direction = 1; - - FlipAsSword = Owner.direction == -1; - hasSpawned = true; - } - - /* - * OnHitNPC() method implemented inside AI(). - * This is done for MP syncing. - */ - if (hasHit) - { - int numHits = 0; - foreach (var target in Main.ActiveNPCs) - { - Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset); - Rectangle hitbox = new((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); - if (!hitbox.Intersects(target.getRect())) - continue; - - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && numHits > 0) - numHits -= 1; - - SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); - SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center); - SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); - SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); - if (Main.zenithWorld && numHits == 0 && target.type != ModContent.NPCType() && Main.rand.NextBool(5)) - { - SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8); - SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center); - } - if (numHits == 0) - { - Owner.Calamity().GeneralScreenShakePower = 6.5f; - } - - int heal = (int)MathHelper.Clamp(20 - numHits * 12, 1, 20); - if (numHits < 10) - { - Owner.HealPlayer(heal); - } - - if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) - { - if (target.type == ModContent.NPCType()) - { - CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop")); - SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped"); - SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center); - } - - bool rightClicked = Owner.Calamity().mouseRight; - - // Make all hit enemies able to hit tiles, so you can dunk them - target.noTileCollide = false; - - // Launch the suckers - Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); - float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1); - target.MoveNPC(launchVel, launchPower * 0.5f, true); - - // Remove knockback resist, just like it used to - target.knockBackResist = 1; - - // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) - target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true); - } - - if (numHits < 3) - { - Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + numHits * 5), false, (int)(16 - numHits * 3), 0.6f - numHits * 0.15f, Color.DodgerBlue, 0.45f); - GeneralParticleHandler.SpawnParticle(spark); - } - - for (int i = 0; i < MathHelper.Clamp(10 - numHits * 2, 2, 10); i++) - { - Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue); - GeneralParticleHandler.SpawnParticle(spark2); - Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f)); - dust.noGravity = true; - dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue; - } - - numHits++; - } - - hasHit = false; - } - AnimationProgress = Animation % useAnim; DrawUnconditionally = false; @@ -305,10 +210,69 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.ai[0] = target.whoAmI; - this.damageDone = damageDone; - hasHit = true; - Projectile.ForceNetUpdate(); + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType() && Main.rand.NextBool(5)) + { + SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8); + SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center); + } + if (Projectile.numHits == 0) + { + Owner.Calamity().GeneralScreenShakePower = 6.5f; + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); + } + + int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20)); + if (Projectile.numHits < 10) + { + Owner.HealPlayer(heal); + } + + if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) + { + if (target.type == ModContent.NPCType()) + { + CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop")); + SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped"); + SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center); + } + + bool rightClicked = Owner.Calamity().mouseRight; + + // Make all hit enemies able to hit tiles, so you can dunk them + target.noTileCollide = false; + + // Launch the suckers + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1); + target.MoveNPC(launchVel, launchPower * 0.5f, true); + + // Remove knockback resist, just like it used to + target.knockBackResist = 1; + + // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) + target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true); + } + + if (Projectile.numHits < 3) + { + Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + Projectile.numHits * 5), false, (int)(16 - Projectile.numHits * 3), 0.6f - Projectile.numHits * 0.15f, Color.DodgerBlue, 0.45f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) + { + Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue; + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -352,17 +316,5 @@ namespace CalamityMod.Projectiles.Melee } return false; } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasHit); - writer.Write(damageDone); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasHit = reader.ReadBoolean(); - damageDone = reader.ReadInt32(); - } } } diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 485229f91a..2dc1197cbc 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -17,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class GrandGuardianHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -46,12 +48,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Guardian has no projectiles mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 84549b7c86..87e4127d6d 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -1,6 +1,6 @@ using System; -using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -9,11 +9,13 @@ using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class HellkiteHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -45,13 +47,6 @@ namespace CalamityMod.Projectiles.Melee public bool playSwingSound = true; public SlotId AudSlot; - - private bool hasSpawned; - private bool hasHit; - private int damageDone; - private int targetId; - private NPC target => Main.npc[targetId]; - public override void SetDefaults() { base.SetDefaults(); @@ -59,115 +54,28 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } + public override void WhenSpawned() + { + CanHit = false; + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + storedUseAnim = useAnim; + + chargeTimerMax = useAnim * 5; // Max charge time is set here + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } public override void UseStyle() { - if (!hasSpawned) - { - CanHit = false; - Projectile.knockBack = 0; - Projectile.scale = 1; - Projectile.ai[1] = -1; - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; - - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; - useAnim = Owner.itemAnimationMax; - storedUseAnim = useAnim; - - chargeTimerMax = useAnim * 5; // Max charge time is set here - - if (mousePos.X < Owner.Center.X) Owner.direction = -1; - else Owner.direction = 1; - - FlipAsSword = Owner.direction == -1 ? true : false; - hasSpawned = true; - } - - if (hasHit) - { - int numHits = 0; - foreach (var target in Main.ActiveNPCs) - { - Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset); - Rectangle hitbox = new((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); - if (!hitbox.Intersects(target.getRect())) - continue; - - // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits) - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0) - { - pierceReduction -= 1; - } - - if (!chargedSwing) - { - if (numHits == 0) - { - SoundEngine.PlaySound(Hellkite.HitSoundSmall with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center); - Owner.Calamity().GeneralScreenShakePower = 4.5f; - } - for (int i = 0; i < MathHelper.Clamp(8 - numHits * 2, 2, 8); i++) - { - Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed); - GeneralParticleHandler.SpawnParticle(spark2); - if (Main.rand.NextBool()) - { - Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.DarkRed); - GeneralParticleHandler.SpawnParticle(spark3); - } - } - } - else - { - if (numHits == 0) - { - SoundEngine.PlaySound(Hellkite.HitSoundBig with { Volume = 1f }, Projectile.Center); - Owner.Calamity().GeneralScreenShakePower = 8.5f * GFBMulti; - bool photos = CalamityClientConfig.Instance.Photosensitivity; - - if (!photos) - { - for (int i = 0; i < 3; i++) - { - Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - } - } - - for (int i = 0; i < 2; i++) - { - Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * (photos ? 1f : GFBMulti), Color.OrangeRed, new Vector2(3, 0.8f), true); - GeneralParticleHandler.SpawnParticle(spark); - } - for (int i = 0; i < 15; i++) - { - Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed); - GeneralParticleHandler.SpawnParticle(spark2); - if (Main.rand.NextBool()) - { - Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Color.DarkRed); - GeneralParticleHandler.SpawnParticle(spark3); - } - Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1)); - dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * GFBMulti; - dust2.noGravity = true; - dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; - } - } - } - - Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); - target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true); - numHits++; - } - - hasHit = false; - } - AnimationProgress = Animation % (chargedSwing ? (int)(storedUseAnim * 0.7f) : storedUseAnim); if (Owner.Calamity().mouseRight) @@ -311,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; } - + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); if (AnimationProgress < (useAnim / 1.5f)) @@ -425,7 +333,7 @@ namespace CalamityMod.Projectiles.Melee dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; } } - } + } } } @@ -439,16 +347,84 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - targetId = target.whoAmI; - this.damageDone = damageDone; - Projectile.ForceNetUpdate(); + // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0) + { + pierceReduction -= 1; + } + + if (!chargedSwing) + { + if (Projectile.numHits == 0) + { + SoundEngine.PlaySound(Hellkite.HitSoundSmall with { Volume = 0.85f, PitchVariance = 0.25f }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 4.5f; + } + for (int i = 0; i < MathHelper.Clamp(8 - Projectile.numHits * 2, 2, 8); i++) + { + Particle spark2 = new LineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + if (Main.rand.NextBool()) + { + Particle spark3 = new AltLineParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 40, Main.rand.NextFloat(0.3f, 1f), Color.DarkRed); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + } + else + { + if (Projectile.numHits == 0) + { + SoundEngine.PlaySound(Hellkite.HitSoundBig with { Volume = 1f }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 8.5f * GFBMulti; + bool photos = CalamityClientConfig.Instance.Photosensitivity; + + if (!photos) + { + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * (i + 1) * GFBMulti, 1f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * (i + 1) * GFBMulti, 0.5f, (GFBFlashWarning && !photos) ? (int)(18 * GFBMulti) : 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + } + + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -25 * (i == 0 ? -1 : 1), false, 12, 0.08f * (photos ? 1f : GFBMulti), Color.OrangeRed, new Vector2(3, 0.8f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 15; i++) + { + Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + if (Main.rand.NextBool()) + { + Particle spark3 = new AltSparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -40).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), true, 40, Main.rand.NextFloat(0.5f, 1.2f) * GFBMulti, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(spark3); + } + Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f) * GFBMulti; + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + } + } + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (chargedSwing) + modifiers.SetCrit(); + + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); float minMult = 0.25f; int hitsToMinMult = 10; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 4.5f * (GFBMulti) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? (3f * (GFBMulti) + critDamage) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { @@ -491,19 +467,8 @@ namespace CalamityMod.Projectiles.Melee } return false; } - - public override void SendExtraAI(BinaryWriter writer) + public override void ResetStyle() { - writer.Write7BitEncodedInt(targetId); - writer.Write(damageDone); - writer.Write(hasHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - targetId = reader.Read7BitEncodedInt(); - damageDone = reader.ReadInt32(); - hasHit = reader.ReadBoolean(); } } } diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index 483b0807d4..ae4988b83b 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class HolyColliderHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -55,12 +57,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Holy Collider's projectile spawning mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 19356cd8b4..2fb89841b5 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class InsidiousHarpoon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 2bcf99ec00..1df4e4245f 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 60; Projectile.DamageType = DamageClass.Melee; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 17eb3bd5ad..43b21f426c 100644 --- a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Melee; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.MaceFlails { + [PierceResistException] public class UrchinMaceProj : BaseMaceFlailProjectile { // The entire chain is on the mace sprite, in which the player swings diff --git a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs index 1073486d6b..9972b1baee 100644 --- a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs +++ b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Projectiles.BaseProjectiles; using Terraria; using Terraria.ID; @@ -6,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.MaceFlails { + [PierceResistException] public class YateveoBloomMace : BaseMaceFlailProjectile { public override int AssociatedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 3fbac724c3..b480b723bc 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class MajesticGuardHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -41,12 +43,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index 15eeb01f2f..190f752a77 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -270,6 +270,6 @@ namespace CalamityMod.Projectiles.Melee // The holdout cannot deal damage. public override bool? CanDamage() => false; - public override void OnSpawn(IEntitySource source) => Projectile.scale = 0f; + public override void WhenSpawned() => Projectile.scale = 0f; } } diff --git a/Projectiles/Melee/MarniteDeconstructorProj.cs b/Projectiles/Melee/MarniteDeconstructorProj.cs index 1d006e1ea9..86d7dff494 100644 --- a/Projectiles/Melee/MarniteDeconstructorProj.cs +++ b/Projectiles/Melee/MarniteDeconstructorProj.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index d110a46fa3..f79b3244d9 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -36,6 +36,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index 56c512c9e4..fb19dc0660 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; Projectile.timeLeft = 20; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 5b12d990e1..b05763bebb 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -70,6 +70,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 1ae29e68d9..56033def56 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -42,6 +42,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index 921c229c71..644d52dd2e 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -48,10 +48,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { SwingDir = 1f; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnimation = Owner.itemAnimationMax; diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 8cf521594d..62c4e42c16 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class MurasamaSlash : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index e7daa112c0..de9eff766d 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class OldLordClaymoreHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -46,13 +48,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { CanHit = false; Projectile.knockBack = 0; Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index d7bb4b4043..8e9ef1d4ae 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class OmnibladeSwing : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index d587a822c6..749fb11172 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class PhotonRipperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/PrismaticRay.cs b/Projectiles/Melee/PrismaticRay.cs index c10c472e13..28d99875b9 100644 --- a/Projectiles/Melee/PrismaticRay.cs +++ b/Projectiles/Melee/PrismaticRay.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class PrismaticRay : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 6c4ad50df0..89d7090ef5 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs index 5e691dfb7b..d999e088e3 100644 --- a/Projectiles/Melee/RespiteblockHoldout.cs +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -1,7 +1,8 @@ using System; -using CalamityMod.Enums; -using CalamityMod.Particles; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class RespiteblockHoldout : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/RiptideWave.cs b/Projectiles/Melee/RiptideWave.cs index 6c7f6f9f13..6128a5b06d 100644 --- a/Projectiles/Melee/RiptideWave.cs +++ b/Projectiles/Melee/RiptideWave.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public const int Lifetime = 30; - public const int MaxSize = 176; + + public float RotationDirection = 1f; public override void SetDefaults() { @@ -25,13 +26,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.aiStyle = -1; } public override void AI() { - // Constantly stay on top of the yoyo. + Projectile.rotation += MathHelper.Lerp(0.3f, 0f, Projectile.timeLeft / (float)Lifetime) * RotationDirection; + + float MaxSize = 135f * Projectile.ai[1]; + + // Stay on top of the yoyo. if (Main.projectile[(int)Projectile.ai[0]].active) - Projectile.Center = Main.projectile[(int)Projectile.ai[0]].Center + Main.projectile[(int)Projectile.ai[0]].velocity; + Projectile.Center = Vector2.Lerp(Projectile.Center, Main.projectile[(int)Projectile.ai[0]].Center + Main.projectile[(int)Projectile.ai[0]].velocity, 0.2f); // Expand the hitbox as lifespan goes on. int waveSize = (int)MathHelper.Lerp(MaxSize, 16, Projectile.timeLeft / (float)Lifetime); @@ -39,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee // Fade out. if (Projectile.timeLeft <= 20) - Projectile.alpha += 12; + Projectile.alpha += (int)(12 * Projectile.ai[1]); } // Ensure knockback is always applied away from the player. @@ -47,19 +53,18 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.SetBlendState(BlendState.Additive); - Texture2D waveTex = ModContent.Request("CalamityMod/Particles/SeaFoam").Value; Rectangle frame = waveTex.Frame(1, 3, 0, (int)Projectile.ai[2]); - Color waveColor = new Color(61, 119, 148) * Projectile.Opacity; + Color Col = Color.Lerp(Color.DarkSlateBlue, Color.DeepSkyBlue, Projectile.ai[1]); + Color waveColor = Lighting.GetColor((Projectile.Center / 16).ToPoint()).MultiplyRGBA(Color.Lerp(Color.Transparent, Col, Projectile.Opacity).MultiplyRGBA(new Color(1f, 1f, 1f, 0f))); float waveScale = Projectile.width / (float)waveTex.Width; - Main.EntitySpriteDraw(waveTex, Projectile.Center - Main.screenPosition, frame, waveColor, Projectile.ai[1], frame.Size() / 2f, waveScale, SpriteEffects.None); + Main.EntitySpriteDraw(waveTex, Projectile.Center - Main.screenPosition, frame, waveColor, Projectile.rotation, frame.Size() / 2f, waveScale, SpriteEffects.None); + Color ringColor = Lighting.GetColor((Projectile.Center / 16).ToPoint()).MultiplyRGBA(Color.Lerp(Color.Transparent, Col.MultiplyRGBA(new Color(0.6f, 0.8f, 1f, 0f)), Projectile.Opacity)); Texture2D ringTex = ModContent.Request("CalamityMod/Particles/HollowCircleSoftEdge").Value; float ringScale = Projectile.width / (float)ringTex.Width; - Main.EntitySpriteDraw(ringTex, Projectile.Center - Main.screenPosition, null, waveColor, 0f, ringTex.Size() / 2f, ringScale, SpriteEffects.None); + Main.EntitySpriteDraw(ringTex, Projectile.Center - Main.screenPosition, null, ringColor, Projectile.rotation, ringTex.Size() / 2f, ringScale, SpriteEffects.None); - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; } } diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs deleted file mode 100644 index 00272dd585..0000000000 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SeashineSwordProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - private const int TimeLeft = 600; - - private const int MaxAlpha = 255; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = TimeLeft; - Projectile.alpha = MaxAlpha; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue); - - if (Projectile.localAI[1] < 7f) - { - Projectile.localAI[1] += 1f; - } - else - { - float dustScale = 1.8f * Projectile.scale; - int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= -0.25f; - - dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= -0.25f; - Main.dust[dust].position -= Projectile.velocity * 0.5f; - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 10; - if (Projectile.alpha >= MaxAlpha - 5) - { - Projectile.alpha = MaxAlpha; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 10; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - } - - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); - } - - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > TimeLeft - 5) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); - return false; - } - public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - - for (int i = 4; i < 31; i++) - { - float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); - float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); - - float dustScale = 3.6f * Projectile.scale; - int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - - dustScale = 3f * Projectile.scale; - dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index 9d0c626cb5..e362c1c7f4 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class SkytideDragoonHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -52,12 +54,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = DamageClass.Melee; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -221,7 +222,7 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().GeneralScreenShakePower = 3f; SoundStyle sound = new("CalamityMod/Sounds/Item/SkytiedBolt"); SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 5), Projectile.knockBack, Projectile.owner, 0, 0.5f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 0.5f); proj.timeLeft = 45; swingCount = 0; attackPower = 6; diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 1581375c55..de63e02e4b 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.hide = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index c46d1c22cd..0bb3d152c0 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 5acc6d3ecc..3fcda3e30c 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index e6bf1b5aeb..715ba348bc 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -14,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class StellarStrikerHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -42,12 +44,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 172fff2d28..0f208bdc5b 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 851b4a2cd1..17cf90d7a2 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class TyphonsGreedStaff : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 2da1fa70aa..0bd714b8fa 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class ViolenceThrownProjectile : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs index 71c49e4116..738d7d071c 100644 --- a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs +++ b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs @@ -18,14 +18,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; - public int timer = 0; public bool canDamage = true; public bool firing = false; public NPC targeted; public float fade = 0; public int hitCooldown = 0; - public ref float yoyoPower => ref Projectile.ai[2]; + public int timer = 0; + public int yoyoPower = 0; public int yoyoPowerMax = 1000; public bool cloneYoyo = false; @@ -90,19 +90,19 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (firing) { if (targeted == null || targeted.life <= 0) - targeted = Projectile.Center.ClosestNPCAt(600); + targeted = Projectile.Center.ClosestNPCAt(800f); if (timer % (cloneYoyo ? 20 : 10) == 0) // Fire Holy Stars { - int stardamage = (int)(Projectile.damage * 0.12f); + int stardamage = (int)(Projectile.damage * 0.24f); Vector2 vel = new Vector2(0, 10).RotatedBy(timer * 0.025f * (cloneYoyo ? -1 : 1)); - Projectile damageStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), stardamage, Projectile.knockBack, Projectile.owner, 0, 5, (targeted == null ? -1 : targeted.whoAmI)); + Projectile damageStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), stardamage, Projectile.knockBack, Projectile.owner, 0, 5, targeted == null ? -1 : targeted.whoAmI); damageStar.extraUpdates = 1; - damageStar.scale = 0.6f; - Projectile damageStar2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 0, 5, (targeted == null ? -1 : targeted.whoAmI)); + damageStar.scale = 0.5f; + Projectile damageStar2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -vel, ModContent.ProjectileType(), stardamage, Projectile.knockBack, Projectile.owner, 0, 5, targeted == null ? -1 : targeted.whoAmI); damageStar2.extraUpdates = 1; - damageStar2.scale = 0.6f; + damageStar2.scale = 0.5f; SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); SoundEngine.PlaySound(fire with { Volume = 0.6f, PitchVariance = 0.2f }, Projectile.Center); @@ -120,14 +120,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } */ - if (timer <= 0) + if (timer > 0) { - firing = false; - canDamage = true; - yoyoPower = 0; - } - else timer--; + if (timer <= 0) + { + firing = false; + canDamage = true; + yoyoPower = 0; + } + } } else { diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index 1f151bb14f..fb0ec5f5df 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -1,8 +1,12 @@ using System.IO; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -26,20 +30,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.width = Projectile.height = 22; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.alpha = 150; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.localAI[2]); } public override void ReceiveExtraAI(BinaryReader reader) { Projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); } public override void AI() @@ -47,14 +52,34 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) // 200 blocks Projectile.Kill(); - Projectile.localAI[1]++; - if (Projectile.localAI[1] % 32f == 0f) + Projectile.localAI[2]++; + if (Projectile.localAI[2] % 10 == 0) { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - - // ai[0] is the yoyo's index, ai[1] is the rotation, ai[2] is the texture - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, Projectile.whoAmI, Main.rand.NextFloat(MathHelper.TwoPi), Main.rand.Next(3)); + Projectile proj = Projectile.NewProjectileDirect(new EntitySource_ItemUse(Main.player[Projectile.owner], Main.player[Projectile.owner].HeldItem), + Projectile.Center, + Vector2.Zero, + ModContent.ProjectileType(), + Projectile.damage, + 0f, + Projectile.owner, + Projectile.whoAmI, + Projectile.localAI[1]); + (proj.ModProjectile as RiptideWave).RotationDirection = Projectile.localAI[2] % 20 == 0 ? -1 : 1; } } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], 2f, 0.09f); + } + + public override bool PreDraw(ref Color lightColor) + { + Asset glowTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + Main.EntitySpriteDraw(glowTexture.Value, Projectile.Center - Main.screenPosition, glowTexture.Frame(), new Color(0.05f, 0.1f, 0.25f, 0f), 0f, glowTexture.Frame().Size() / 2, 0.3f * Projectile.localAI[1], SpriteEffects.None); + + return true; + } } } diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 4d38d44c8c..268d86c952 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -219,7 +219,7 @@ IL_6899: } else { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ChibiiDoggo").Format(player.name)), 500, 0); + player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ChibiiDoggo").ToNetworkText(player.name)), 500, 0); } player.RemoveAllIFrames(); } diff --git a/Projectiles/Ranged/AcidRocket.cs b/Projectiles/Ranged/AcidRocket.cs index 982bd2cb2c..8b4eb5f127 100644 --- a/Projectiles/Ranged/AcidRocket.cs +++ b/Projectiles/Ranged/AcidRocket.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] public class AcidRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; @@ -103,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged if (stuckTimer == 40) { SoundStyle Primed = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort"); - SoundEngine.PlaySound(Primed with { Volume = 0.5f }, Projectile.Center); + SoundEngine.PlaySound(Primed with { Volume = 0.4f , PitchVariance = 0.2f }, Projectile.Center); } } Projectile.Opacity = 1f; diff --git a/Projectiles/Ranged/AstralSandgun.cs b/Projectiles/Ranged/AstralSandgun.cs index dd09fb1abf..fca008bd42 100644 --- a/Projectiles/Ranged/AstralSandgun.cs +++ b/Projectiles/Ranged/AstralSandgun.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/AuricBullet.cs b/Projectiles/Ranged/AuricBullet.cs index 9a2f524c55..61d6186699 100644 --- a/Projectiles/Ranged/AuricBullet.cs +++ b/Projectiles/Ranged/AuricBullet.cs @@ -103,5 +103,6 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(0.3f, 0.9f); } } + public override bool? CanHitNPC(NPC target) => target.CanBeChasedBy() ? null : false; } } diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index 42d6af0c6d..cef1f3c346 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException(onlyForSingleHitbox: true)] public class AuroraFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; diff --git a/Projectiles/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs index 8304e5168a..a8834a219f 100644 --- a/Projectiles/Ranged/BlissfulBombardierHoldout.cs +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -87,6 +87,7 @@ namespace CalamityMod.Projectiles.Ranged if (Owner.CantUseHoldout() && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) { Projectile.Kill(); + return; } if (!hasFired) @@ -152,10 +153,12 @@ namespace CalamityMod.Projectiles.Ranged } // Spawns the projectile. - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); - PostFireCooldown = Owner.itemAnimationMax; - Owner.Calamity().GeneralScreenShakePower = 5f; - + if (Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); + PostFireCooldown = Owner.itemAnimationMax; + Owner.Calamity().GeneralScreenShakePower = 5f; + } // Inside here go all the things that dedicated servers shouldn't spend resources on. // Like visuals and sounds. diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 985287bd5b..5c271827d0 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 9; Projectile.timeLeft = 1200; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -46,13 +47,14 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.localAI[0] == 0) { + Projectile.damage = (int)(Projectile.damage * 1.3f); // damage boost player.statLife -= 1; if (player.statLife <= 0) { - PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).Format(player.name)); + PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BloodFireArrow" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)); player.KillMe(pdr, 1000.0, 0, false); } - Projectile.velocity *= 0.4f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9; } Player Owner = Main.player[Projectile.owner]; @@ -73,22 +75,27 @@ namespace CalamityMod.Projectiles.Ranged if (dust.type == 130) dust.scale = Main.rand.NextFloat(0.25f, 0.45f); } - PointParticle spark = new PointParticle(Projectile.Center - Projectile.velocity, -Projectile.velocity * 0.01f, false, 2, 1.2f, Color.Firebrick); - GeneralParticleHandler.SpawnParticle(spark); + if (Projectile.localAI[0] % 2 == 0) + { + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomLineFade", false, 6, 0.025f, Color.Firebrick, new Vector2(1, 1), true, true, shrinkSpeed: 1.4f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + } } } public override void OnKill(int timeLeft) { - for (int b = 0; b < 9; b++) + for (int b = 0; b < 6; b++) { - int dustType = Main.rand.NextBool() ? 303 : 90; + int dustType = ModContent.DustType(); float velMulti = Main.rand.NextFloat(0.1f, 0.75f); - Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, new Vector2(4, 4).RotatedByRandom(100) * velMulti); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, (Projectile.velocity * 2).RotatedByRandom(0.3) * velMulti); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.75f, 1.35f); - if (dust.type == 303) - dust.color = Color.Firebrick; + dust.scale = Main.rand.NextFloat(0.75f, 0.95f); + dust.color = Color.Firebrick; + dust.noLightEmittence = true; + dust.noLight = true; + dust.fadeIn = 15; } } @@ -119,7 +126,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 2); return false; } } diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index cdf8888264..5fddf998a1 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -1,4 +1,6 @@ -using CalamityMod.Particles; +using CalamityMod.Balancing; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -76,36 +78,35 @@ namespace CalamityMod.Projectiles.Ranged return true; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += OnHitEffect(Main.player[Projectile.owner]); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= OnHitEffect(Main.player[Projectile.owner], target); // Returns the amount of bonus damage that should be dealt. Boosts life regeneration appropriately as a side effect. - private int OnHitEffect(Player owner) + private float OnHitEffect(Player owner, NPC target) { - // Adds 3 frames to lifeRegenTime on every hit. This increased value is used for the damage calculation. - owner.lifeRegenTime += 3; + // The bonus scales based on a rough estimate of how strong the hit is + // Caps at min 12 and max 720 + float lifeRegenTimeBonus = 3600 * MathHelper.Clamp((Projectile.damage / target.lifeMax), 0.0035f, 0.2f); + owner.lifeRegenTime += (int)lifeRegenTimeBonus; + // Provides up to 10% damage boost based on life regen time, caps at 3600 + float lifeRegenTimeContribution = Utils.GetLerpValue(0, 3600, owner.lifeRegenTime, true) * 0.1f; + float finalDamageBoost = 1 + lifeRegenTimeContribution; - // Deals (1.00 + (0.1 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit. - // For example, at 0 life regen, you get 1% of lifeRegenTime as bonus damage. - // At 10 life regen, you get 2%. At 20 life regen, you get 3%. - // Negative life regen does not decrease damage. - int regenForCalc = owner.lifeRegen > 0 ? owner.lifeRegen : 0; - float regenDamageRatio = (1f + 0.1f * regenForCalc) / 100f; - - // For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla. 75% of this is taken for computing the final damage. - int regenTimeForCalc = (int)(MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f) * 0.75f); - - int finalDamageBoost = (int)(regenDamageRatio * regenTimeForCalc); - // Damage boost has a cap of 35 to prevent it from getting too crazy. - int damageCap = 35; - if (finalDamageBoost > damageCap) - finalDamageBoost = damageCap; - - if (finalDamageBoost == damageCap) // Special hit visual if the bonus damage is at the cap. + if (lifeRegenTimeContribution == 0.1f) // Special hit visual if the bonus damage is at the cap. { for (int k = 0; k < 3; k++) { BloodParticle blood = new BloodParticle(Projectile.Center, new Vector2(6.5f, 6.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.Next(8, 10 + 1), Main.rand.NextFloat(0.7f, 0.9f), Color.Red); GeneralParticleHandler.SpawnParticle(blood); + + int dustType = ModContent.DustType(); + float velMulti = Main.rand.NextFloat(0.1f, 0.75f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, (-Projectile.velocity * 4).RotatedByRandom(0.4) * velMulti); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.55f, 0.65f); + dust.color = Color.Firebrick; + dust.noLightEmittence = true; + dust.noLight = true; + dust.fadeIn = 15; } } return finalDamageBoost; diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 34900bde02..4726639c39 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index e6f934e331..79d2f8c695 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index 2d02ef5959..368d219ab7 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index b0addec51c..f8b82c043d 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Ranged/ChromaticFire.cs b/Projectiles/Ranged/ChromaticFire.cs index a97a221ad5..3c33792693 100644 --- a/Projectiles/Ranged/ChromaticFire.cs +++ b/Projectiles/Ranged/ChromaticFire.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = Projectile.height = 12; + Projectile.width = Projectile.height = 52; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index 23d7c8f793..b0a56381e5 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 90; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.extraUpdates = 2; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index a2756431ff..1adf47bc8f 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -2,8 +2,10 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -23,6 +25,7 @@ namespace CalamityMod.Projectiles.Ranged private float storedVelocity = 1f; public const float velocityMultiplier = 1.2f; public bool homing = false; + public bool playShootSound = true; public override void KillHoldoutLogic() { @@ -35,6 +38,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Kill(); return; } + if (homing && playShootSound) + { + SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot with { Pitch = 0.2f, MaxInstances = 2 }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot with { Pitch = -0.4f, MaxInstances = 2 }, Projectile.Center); + playShootSound = false; + } // Fire one charged arrow every frame until you're out of arrows. ShootProjectiles(homing); @@ -84,11 +93,13 @@ namespace CalamityMod.Projectiles.Ranged FramesToLoadNextArrow = MathHelper.Clamp(FramesToLoadNextArrow--, 1f, HeldItem.useAnimation); // Play a sound for additional notification that an arrow has been loaded. - var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.3f }); + var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.4f, Pitch = -0.3f + ArrowsLoaded * 0.1f }); if (ArrowsLoaded >= Condemnation.MaxLoadedArrows) { - SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameRecharge")); + SoundStyle fire = new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameRecharge"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = i * 0.25f, MaxInstances = 3 }); homing = true; } } @@ -154,9 +165,32 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * storedVelocity; int ArrowType = homing ? ModContent.ProjectileType() : ModContent.ProjectileType(); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ArrowType, Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ArrowType, (int)(Projectile.damage * 1.35f), Projectile.knockBack, Projectile.owner); } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3); + float randSize = Main.rand.NextFloat(0.9f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (homing) + { + for (int i = 0; i < 22; i++) + { + Color auraColor = Color.Lerp(Color.Red, Color.White, i * 0.01f) with { A = 0 } * 0.6f; + Vector2 drawOffset = ((MathHelper.TwoPi * i / 22f).ToRotationVector2() * 5) + Main.rand.NextVector2Circular(7, 7); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale * Main.rand.NextFloat(0.7f, 1.1f), flipSprite); + } + } + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } public override void SendExtraAIHoldout(BinaryWriter writer) { writer.Write(FramesToLoadNextArrow); diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index 97ec9ede47..26f7ad0d44 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() @@ -62,8 +64,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 0; - target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 0e457db337..6cf4dfc842 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged } } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner, 0f, 0f); SoundStyle onKill = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); SoundEngine.PlaySound(onKill with { Volume = 0.4f, Pitch = 0.4f }, Projectile.position); diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs index 2963288945..8e9eefa522 100644 --- a/Projectiles/Ranged/ElysianArrowRain.cs +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 15; } public override bool? CanDamage() => Projectile.numHits >= 1 ? false : null; diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index f8fd95b5d8..a607bb74fa 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] // Photoviscerator right click main projectile (invisible flare cluster bomb) public class ExoFlareCluster : ModProjectile, ILocalizedModType { diff --git a/Projectiles/Ranged/FetidEmesisHoldout.cs b/Projectiles/Ranged/FetidEmesisHoldout.cs index 36081c683c..6a4d3e1a42 100644 --- a/Projectiles/Ranged/FetidEmesisHoldout.cs +++ b/Projectiles/Ranged/FetidEmesisHoldout.cs @@ -1,17 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.GameContent; using Terraria.ModLoader; -using Terraria.ID; -using System; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Ranged { @@ -28,8 +24,6 @@ namespace CalamityMod.Projectiles.Ranged public ref float shootingTimer => ref Projectile.ai[2]; // Dual functions for rapid fire shooting cooldown and recoil public bool isTired => cooldownTimer > 0; public float revSpeed = 1; - public bool isHoldingIn = false; - public bool holdingInBonus = false; public bool secondShot = true; public int maxFrames = 420; public int initialFireTime = 45; @@ -37,14 +31,12 @@ namespace CalamityMod.Projectiles.Ranged public override void KillHoldoutLogic() { - if ( !isTired && (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)) + if (!isTired && (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)) Projectile.Kill(); } public override void HoldoutAI() { - isHoldingIn = Owner.Calamity().mouseRight; - if (!isTired && (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type)) cooldownTimer = (int)(Utils.Remap(revFrames, 0, 350, 40, 180, true)); if (isTired) @@ -92,81 +84,43 @@ namespace CalamityMod.Projectiles.Ranged revFrames++; shineScale *= 0.77f; - if (revFrames >= maxFrames && !isTired) + if (revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) { - if (isHoldingIn) - { - if (revFrames == maxFrames + 120) - { - holdingInBonus = true; - SoundEngine.PlaySound(SoundID.NPCHit14 with { Volume = 1f, Pitch = 0.3f }, Projectile.Center); - for (int i = 0; i < 25; i++) - { - Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 8); - Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); - dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); - dust2.noGravity = true; - dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Chartreuse : Color.Green, 0.7f); - } - Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); - GeneralParticleHandler.SpawnParticle(pulse); - } + Owner.Calamity().GeneralScreenShakePower = 6.5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = (int)MathHelper.Lerp((int)(Utils.Remap(revFrames, 0, 350, 40, 180, true)), 180, 0.7f); + SoundStyle bigShot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); + SoundStyle bigShotGun = new("CalamityMod/Sounds/Item/FlakKrakenShoot"); + SoundEngine.PlaySound(bigShot with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(bigShotGun with { Volume = 0.6f }, Projectile.Center); - Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(5) ? 28 : 215, (Projectile.velocity * 2).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); - dust.noGravity = true; - if (revFrames % 20 == 0) - { - SoundStyle tired = new("CalamityMod/Sounds/Custom/OldDukeHuff"); - SoundEngine.PlaySound(tired with { Volume = 0.3f, Pitch = 0.3f }, Projectile.Center); - for (int i = 0; i <= 3; i++) - { - Dust dust5 = Dust.NewDustPerfect(GunTipPosition, 267, (Projectile.velocity * 5f).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.9f, 1.2f)); - dust5.noGravity = true; - dust5.color = Color.Chartreuse; - } - } + int chunkDamage = (int)(Projectile.damage * 2.5f); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 13; + + Particle pulse3 = new GlowSparkParticle(GunTipPosition - shootVelocity, shootVelocity, false, 12, 0.035f, Color.Chartreuse, new Vector2(2.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + + Particle pulse2 = new CustomPulse(GunTipPosition, Projectile.velocity * 14.5f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.13f, 0, 34); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(GunTipPosition, Projectile.velocity * 9f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.25f, 0, 34); + GeneralParticleHandler.SpawnParticle(pulse); + + float velBonus = 1.1f; + for (int i = 0; i <= 5; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(-0.03f * i * velBonus) * (1 - i * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, -i, 0, velBonus); } - else + for (int j = 0; j <= 5; j++) { - Owner.Calamity().GeneralScreenShakePower = 6.5f; - OffsetLengthFromArm -= 35f; - cooldownTimer = holdingInBonus ? 230 : 180; - SoundStyle bigShot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); - SoundStyle bigShotGun = new("CalamityMod/Sounds/Item/FlakKrakenShoot"); - SoundEngine.PlaySound(bigShot with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); - SoundEngine.PlaySound(bigShotGun with { Volume = 0.6f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(0.03f * j * velBonus) * (1 - j * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, j, 0, velBonus); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, 20, 0, velBonus); - int chunkDamage = (int)(Projectile.damage * (2f + (holdingInBonus ? 1 : 0))); - Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 13; - if (holdingInBonus) - { - Particle pulse2 = new CustomPulse(GunTipPosition, Projectile.velocity * 14.5f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.13f, 0, 34); - GeneralParticleHandler.SpawnParticle(pulse2); - Particle pulse = new CustomPulse(GunTipPosition, Projectile.velocity * 9f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.25f, 0, 34); - GeneralParticleHandler.SpawnParticle(pulse); - } - for (int y = 0; y < (holdingInBonus ? 3 : 1); y++) - { - float velBonus = 1 - y * 0.2f; - for (int i = 0; i <= 5; i++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(-0.03f * i * velBonus) * (1 - i * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, -i, 0, velBonus); - } - for (int j = 0; j <= 5; j++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(0.03f * j * velBonus) * (1 - j * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, j, 0, velBonus); - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, 20, 0, velBonus); - - for (int i = 0; i <= 18; i++) - { - Dust dust = Dust.NewDustPerfect(GunTipPosition, 66, shootVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); - dust.noGravity = true; - dust.color = Color.Chartreuse; - } - Particle pulse = new GlowSparkParticle(GunTipPosition - shootVelocity, shootVelocity * velBonus, false, 12, 0.035f, Color.Chartreuse, new Vector2(2.5f, 0.9f), true); - GeneralParticleHandler.SpawnParticle(pulse); - } + for (int i = 0; i <= 18; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 66, shootVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; } } } diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 1c2fca754b..a5eb54f88e 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/FlashRoundFlash.cs b/Projectiles/Ranged/FlashRoundFlash.cs new file mode 100644 index 0000000000..ecd6d8841e --- /dev/null +++ b/Projectiles/Ranged/FlashRoundFlash.cs @@ -0,0 +1,51 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FlashRoundFlash : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetDefaults() + { + Projectile.width = 95; + Projectile.height = 95; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.5f); + } + public override bool? CanHitNPC(NPC target) + { + if (Utils.Distance(target.Center, Projectile.Center) <= Projectile.width) + { + Player Owner = Main.player[Projectile.owner]; + target.AddBuff(BuffID.Confused, 180); + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Projectile.Center); + target.MoveNPC(launchVel, 5, false); + + Vector2 dustVel = Utils.DirectionTo(Projectile.Center, target.Center); + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), dustVel.RotatedByRandom(0.7f) * Main.rand.NextFloat(9f, 14f)); + dust.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust.noGravity = true; + dust.color = Color.White; + dust.noLightEmittence = true; + } + } + return false; + } + } +} diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 6eb86ba08f..1ba053ff56 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,8 +14,10 @@ namespace CalamityMod.Projectiles.Ranged public class FlashRoundProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public bool Exploding = false; - public float ExplosionPower = 1.5f; + public int bounces = 2; + public float shineRot = 0; + public bool onSpawn = true; + public ref float time => ref Projectile.ai[2]; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 15; @@ -19,15 +26,15 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 8; + Projectile.height = 8; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.timeLeft = 600; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; @@ -37,81 +44,130 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.spriteDirection = Projectile.direction; - Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * (Exploding ? 1.5f : 0.2f)); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); - Projectile.localAI[0] += 1f; - - if (Exploding) + if (bounces < 2 || Projectile.numHits > 0) { - if (Projectile.timeLeft == 59) - { - SoundEngine.PlaySound(SoundID.Item93 with { Pitch = 0.55f, Volume = 0.4f }, Projectile.Center); - } - Projectile.velocity = Vector2.Zero; + int falloffTime = 7; + if (time > falloffTime) + Projectile.velocity.X *= 0.983f; + if (Projectile.velocity.Y < 15 && time > falloffTime) + Projectile.velocity.Y += 0.16f; + if (Projectile.velocity.Y < 5) + Projectile.velocity.Y *= 0.98f; + } + if (onSpawn) + { + Projectile.knockBack = 0; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10; + shineRot = Main.rand.NextFloat(-5, 5); + onSpawn = false; + } + shineRot += Math.Sign(shineRot) * 0.05f; - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 91 : 264, (new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.2f)) * ExplosionPower); - dust.scale = Main.rand.NextFloat(0.75f, 0.9f) * ExplosionPower; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time > 2 && time % 2 == 0 && targetDist < 1400) + { + float trailSize = Utils.GetLerpValue(2, 5, Projectile.velocity.Length(), true); + Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 0.5f, "CalamityMod/Particles/BloomCircle", false, 5, 0.13f, Color.White * 0.6f, new Vector2(1f - 0.2f * trailSize, 1 + 2f * trailSize), true, false, shrinkSpeed: 0.8f * trailSize); + GeneralParticleHandler.SpawnParticle(trail); + } + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 91 : 264, -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.5f, 0.9f)); + dust.scale = Main.rand.NextFloat(0.55f, 0.7f); dust.noGravity = true; - - if (Projectile.timeLeft <= 50 && ExplosionPower > 0.5f) - ExplosionPower -= 0.015f; - } - else - { - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 63, -Projectile.velocity * Main.rand.NextFloat(0.9f, 1.1f)); - dust.scale = Main.rand.NextFloat(0.7f, 0.85f); - dust.noGravity = true; - } - } } + time++; } public override bool PreDraw(ref Color lightColor) { - if (Projectile.localAI[0] > 6f && !Exploding) - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, Color.White); + float sine = (float)Math.Sin(Projectile.timeLeft * 0.175f / MathHelper.Pi); + float trueSine = MathHelper.Lerp(sine, Math.Sign(sine) * 0.5f, 0.6f); + Asset trail = ModContent.Request("CalamityMod/Particles/BloomLineSoftEdge"); + Asset shine = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + Main.EntitySpriteDraw(shine.Value, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * 0.6f, Projectile.rotation + shineRot, shine.Size() / 2f, new Vector2(1 + 0.9f * trueSine, 1 + 0.9f * -trueSine) * Projectile.scale * 0.13f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shine.Value, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * 0.6f, Projectile.rotation + shineRot, shine.Size() / 2f, new Vector2(1 + 0.9f * -trueSine, 1 + 0.9f * trueSine) * Projectile.scale * 0.13f, SpriteEffects.None, 0); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (!Exploding) + time = 0; + Projectile.velocity = Vector2.Lerp(Utils.DirectionFrom(Projectile.Center, target.Center) * 12, Vector2.UnitY * -7, 0.75f).RotatedByRandom(0.25f); + makeDust(false); + } + public void makeDust(bool onlyFlash) // This is basically the tile/hit effects + { + if (!onlyFlash) { - Projectile.timeLeft = 60; - Exploding = true; - Projectile.damage = (int)(Projectile.damage * 0.15f); - Projectile.ExpandHitboxBy(100); - Projectile.alpha = 255; + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 91 : 264, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(8.5f, 12f)); + dust.scale = Main.rand.NextFloat(0.75f, 1.1f); + dust.noGravity = true; + } + //SoundEngine.PlaySound(SoundID.Shatter with { Volume = 0.4f, Pitch = 0.1f + 0.1f * bounces }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item50 with { Volume = 0.3f, Pitch = -0.2f + 0.4f * bounces, MaxInstances = 15 }, Projectile.Center); } - target.AddBuff(BuffID.Confused, 300); + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f * (i), 0.45f * (i), 9, true); + GeneralParticleHandler.SpawnParticle(blastRing); + } + float rot = Main.rand.NextFloat(-5, 5); + for (int i = 0; i < 5; i++) + { + Vector2 dustVel = ((MathHelper.TwoPi * i / 5f) + rot).ToRotationVector2() * 5; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel); + dust.scale = 1.1f; + dust.fadeIn = 1.5f; + dust.noGravity = true; + dust.color = Color.White; + } + // Doesn't actually do damage, just an aoe for confustion infliction and knockback + Projectile flash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 5, 0f, Projectile.owner); } public override bool OnTileCollide(Vector2 oldVelocity) { - if (!Exploding) + time = 0; + if (Projectile.velocity.X != oldVelocity.X) { - Projectile.timeLeft = 60; - Exploding = true; - Projectile.damage = (int)(Projectile.damage * 0.15f); - Projectile.ExpandHitboxBy(100); - Projectile.alpha = 255; - Projectile.tileCollide = false; + Projectile.velocity.X = -oldVelocity.X; } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + if (Projectile.velocity.X < 2 && Projectile.velocity.X > 0) + Projectile.velocity.X = 2; + if (Projectile.velocity.X > -2 && Projectile.velocity.X < 0) + Projectile.velocity.X = -2; + if (Projectile.velocity.Y < 2 && Projectile.velocity.Y > 0) + Projectile.velocity.Y = 2; + if (Projectile.velocity.Y > -2 && Projectile.velocity.Y < 0) + Projectile.velocity.Y = -2; + + Projectile.velocity *= 0.97f; + + int expectedDamage = Math.Max((int)(Projectile.damage * 1.13f), Projectile.damage + 2); + Projectile.damage = expectedDamage; + + makeDust(false); + if (bounces <= 0) + { + Projectile.Kill(); + return false; + } + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + bounces--; return false; } public override void OnKill(int timeLeft) { - if (!Exploding) - { - for (int k = 0; k < 9; k++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 63, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.1f)); - dust.scale = Main.rand.NextFloat(0.6f, 0.75f); - dust.noGravity = true; - } - } } } } diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 45dd067be9..5f40a1c0fc 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; // Reduce damage, but remove piercing. Reset local iframes so the bullet, turned blue, may always strike again. Reset the point blank timer. - Projectile.damage = (int)(0.28f * Projectile.damage); + Projectile.damage = (int)(0.23f * Projectile.damage); Projectile.penetrate = 1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; for (int i = 0; i < Main.maxNPCs; i++) diff --git a/Projectiles/Ranged/HailstormBulletProj.cs b/Projectiles/Ranged/HailstormBulletProj.cs index 3ab6b52907..17620c79fa 100644 --- a/Projectiles/Ranged/HailstormBulletProj.cs +++ b/Projectiles/Ranged/HailstormBulletProj.cs @@ -44,6 +44,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.localAI[0] == 0f) { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10.5f; startVelocity = Projectile.velocity; rotDirection = Main.rand.NextBool(); Projectile.velocity *= Main.rand.NextFloat(0.97f, 1.03f); @@ -90,17 +91,18 @@ namespace CalamityMod.Projectiles.Ranged for (int k = 0; k < points; k++) { Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); - WaterFlavoredParticle subTrail = new WaterFlavoredParticle(Projectile.Center + velocity * 4.5f + addedPlacement, velocity * 7, false, 6, 0.65f, Color.SkyBlue); - GeneralParticleHandler.SpawnParticle(subTrail); + Particle ice = new CustomSpark(Projectile.Center + velocity * 4.5f + addedPlacement, velocity * 7, "CalamityMod/Particles/GlowBlade", false, 6, 0.025f, Color.SkyBlue * 0.9f, new Vector2(1.5f, 0.6f), true, true, shrinkSpeed: 0.9f, glowCenterScale: 0.8f, glowOpacity: 0.3f); + GeneralParticleHandler.SpawnParticle(ice); } - int onHitDamage = (int)(Projectile.damage * 0.5f); - Projectile flash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Projectile.owner, target.whoAmI); - flash.DamageType = Projectile.DamageType; } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + // This is about equivalent to the previous direct strike extra damage but can't also crit itself obviously + // Also it's not as impacted by defense, which is why it's a bit weaker, rather than being a full 1f + modifiers.CritDamage += 0.85f; + if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.5f); if (Projectile.damage < 1) diff --git a/Projectiles/Ranged/HellbornHoldout.cs b/Projectiles/Ranged/HellbornHoldout.cs index a4a486cd78..8896cebac8 100644 --- a/Projectiles/Ranged/HellbornHoldout.cs +++ b/Projectiles/Ranged/HellbornHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] public class HellbornHoldout : BaseGunHoldoutProjectile { public override int AssociatedItemID => ModContent.ItemType(); @@ -32,6 +34,7 @@ namespace CalamityMod.Projectiles.Ranged public bool hasPlayedSound = false; public bool hasPlayedReloadSound = false; public float fade = 0; + public int hitTimer = 0; public override void SetStaticDefaults() { @@ -52,6 +55,9 @@ namespace CalamityMod.Projectiles.Ranged } public override void HoldoutAI() { + if (hitTimer > 0) + hitTimer--; + fade = Utils.GetLerpValue(0, 40, time, true); if (SoundEngine.TryGetActiveSound(SoundSlot, out var sSound) && sSound.IsPlaying) { @@ -87,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged drawRot += 0.75f * Projectile.direction * MathHelper.Clamp(fade, 0.3f, 1f); Lighting.AddLight(Projectile.Center, Color.Lerp(Color.OrangeRed, Color.White, 0.6f).ToVector3() * fade * 0.7f); - if (!hasPlayedSound && !Main.dedServ) + if (!hasPlayedSound && Main.myPlayer == Projectile.owner) { SoundStyle spin = new("CalamityMod/Sounds/Item/SpinningWoosh"); SoundSlot = SoundEngine.PlaySound(spin with { Volume = 0.01f, Pitch = -0.1f, IsLooped = true }, Projectile.Center); @@ -201,10 +207,18 @@ namespace CalamityMod.Projectiles.Ranged } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= 0.1f; - if (Owner.Calamity().hellbornShots < 8) + if (hitTimer == 0) { - Owner.Calamity().hellbornShots++; + modifiers.SourceDamage *= 0.08f; + if (Owner.Calamity().hellbornShots < 12) + { + Owner.Calamity().hellbornShots++; + } + hitTimer = Projectile.localNPCHitCooldown; + } + else + { + modifiers.SourceDamage *= 0.02f; } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/HellbornProj.cs b/Projectiles/Ranged/HellbornProj.cs index 357bbad717..132e147bf5 100644 --- a/Projectiles/Ranged/HellbornProj.cs +++ b/Projectiles/Ranged/HellbornProj.cs @@ -1,9 +1,12 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -27,6 +30,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -64,20 +69,34 @@ namespace CalamityMod.Projectiles.Ranged Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; if (Main.rand.NextBool(2)) { - Particle orb = new GlowOrbParticle(Projectile.Center + offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); - GeneralParticleHandler.SpawnParticle(orb); + //Particle orb = new GlowOrbParticle(Projectile.Center + offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + //GeneralParticleHandler.SpawnParticle(orb); + + Dust dust5 = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(3f, 5f)); + dust5.noGravity = true; + dust5.scale = Main.rand.NextFloat(2.3f, 2.7f); + dust5.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + dust5.fadeIn = 2.5f; } if (Main.rand.NextBool(2)) { - Particle orb2 = new GlowOrbParticle(Projectile.Center - offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); - GeneralParticleHandler.SpawnParticle(orb2); + //Particle orb2 = new GlowOrbParticle(Projectile.Center - offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + //GeneralParticleHandler.SpawnParticle(orb2); + + Dust dust5 = Dust.NewDustPerfect(Projectile.Center - offset, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(3f, 5f)); + dust5.noGravity = true; + dust5.scale = Main.rand.NextFloat(2.3f, 2.7f); + dust5.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + dust5.fadeIn = 2.5f; } } Vector2 dustPos = Projectile.Center + Main.rand.NextVector2Circular(30, 30); - Dust dust = Dust.NewDustPerfect(dustPos, 267, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f)); + Dust dust = Dust.NewDustPerfect(dustPos, ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.72f, 1.12f); + dust.scale = Main.rand.NextFloat(0.62f, 0.82f); dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + dust.fadeIn = 1; + dust.noLight = true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -86,6 +105,8 @@ namespace CalamityMod.Projectiles.Ranged // Launch Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); target.MoveNPC(launchVel, 6, true); + + MakeBlast(target.whoAmI, true); } public override void OnKill(int timeLeft) { @@ -95,6 +116,12 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = false; dust.scale = Main.rand.NextFloat(0.62f, 0.82f); dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + + Dust dust5 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f)); + dust5.noGravity = true; + dust5.scale = Main.rand.NextFloat(2.1f, 2.4f); + dust5.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + dust5.fadeIn = 1.7f; } Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.2f, 1.7f, 16, true); @@ -104,6 +131,30 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle bigShot = new("CalamityMod/Sounds/Item/HellbornImpact"); SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.8f }, Projectile.Center); + if (Projectile.numHits == 0) + { + MakeBlast(0, false); + } + } + public void MakeBlast(int target, bool hitTarget) + { + float blastSize = 70; + float minMultiplier = 0.25f; + int hitsToMinMult = 5; + int blastDamage = (int)(Projectile.damage * 0.33f); + if (hitTarget) + { + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 2; + blast.DamageType = DamageClass.Ranged; + blast.localAI[0] = target; + } + else + { + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 2; + blast.DamageType = DamageClass.Ranged; + } } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index 1a126bde6b..3c3fdd2a79 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -1,132 +1,184 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Diagnostics; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.InverseKinematics; using CalamityMod.Items.Ammo; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; 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 System.Net.Mime.MediaTypeNames; namespace CalamityMod.Projectiles.Ranged { public class HolyFireBulletProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - private const int Lifetime = 600; - private static readonly Color Alpha = new Color(1f, 1f, 1f, 0f); - private bool ColorStyle = false; + public Color col = Color.White; private float SizeVariance; - private float SizeBonus = 2; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 5; - ProjectileID.Sets.TrailingMode[Type] = 2; - } + public ref float time => ref Projectile.ai[2]; + public ref float sizeBonus => ref Projectile.ai[1]; public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 8; + Projectile.height = 8; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.MaxUpdates = 5; - Projectile.timeLeft = Lifetime; + Projectile.penetrate = 1; + Projectile.extraUpdates = 7; + Projectile.timeLeft = 600; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.localAI[0] == 0) + if (time == 0) { + Projectile.damage = (int)(Projectile.damage * 1.15f); + col = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; SizeVariance = Main.rand.NextFloat(0.95f, 1.05f); - ColorStyle = Main.rand.NextBool(); - Projectile.velocity *= 0.7f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 14; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); Projectile.spriteDirection = Projectile.direction; - if (Projectile.localAI[0] >= 30 && SizeBonus > 1) - { - SizeBonus -= 0.02f; - } - // Flaking dust - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) + + sizeBonus = MathHelper.Lerp(1, 2, (float)Math.Pow(Utils.GetLerpValue(50, 15, time, true), 2)); + if (time > 4) { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 15f / MathHelper.Pi); if (Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), Main.rand.NextBool() ? 262 : 87, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.01f, 0.1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), ModContent.DustType(), -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.15f, 0.3f) * (Main.rand.NextBool() ? -1 : 1)) * Main.rand.NextFloat(0.2f, 1f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.5f, 0.85f); - dust.alpha = 235; + dust.noLightEmittence = true; + dust.color = col; } - if (Main.rand.NextBool(15)) + + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time > 2 && targetDist < 1400) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, -Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.4f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.4f, 0.7f); - dust.color = ColorStyle ? Color.Orange : Color.Khaki; + Particle trail = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 0.5f, "CalamityMod/Particles/DualTrail", false, 4, 0.03f, col * 0.9f, new Vector2(1f, 3), true, true, shrinkSpeed: 0.8f, glowOpacity: 0.6f); + GeneralParticleHandler.SpawnParticle(trail); } } + time++; } - - public override Color? GetAlpha(Color lightColor) => Alpha; - public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, ColorStyle ? Color.OrangeRed * 8 : Color.Khaki * 8); - return true; + if (time <= 0) + return false; + Asset tip = ModContent.Request("CalamityMod/Particles/SquareRotated"); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tip.Value, Projectile.Center - Main.screenPosition, null, Color.Lerp(col, Color.White, i) with { A = 0 } * 0.7f, Projectile.rotation, tip.Size() / 2f, new Vector2(0.2f, 1.4f) * Projectile.scale * (0.28f - 0.1f * i), SpriteEffects.None, 0); + return false; } public override void OnKill(int timeLeft) { - // Spawn an on-hit explosion which deals 30% of the projectile's damage. - if (Projectile.owner == Main.myPlayer) + // Spawn an on-hit explosion which deals part of the projectile's damage to enemies around the target + if (Projectile.numHits == 0) { - Projectile.damage = (int)(Projectile.damage * HolyFireBullet.ExplosionMultiplier); - Projectile.penetrate = -1; - Projectile.ExpandHitboxBy((25 * SizeVariance) * SizeBonus); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - SoundEngine.PlaySound(HolyFireBullet.Explosion with { Pitch = -0.15f, Volume = 0.3f }, Projectile.Center); - - Vector2 Offset = Main.rand.NextVector2Circular(15, 15); - - Particle explosion = new DetailedExplosion(Projectile.Center + Offset, Vector2.Zero, (ColorStyle ? Color.Orange : Color.Khaki) * 0.9f, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, (0.28f * SizeVariance) * SizeBonus, 10); - GeneralParticleHandler.SpawnParticle(explosion); - - SparkleParticle impactParticle = new SparkleParticle(Projectile.Center + Offset, Vector2.Zero, Color.White, ColorStyle ? Color.Orange : Color.OrangeRed, 2.5f * (SizeBonus * 0.3f), 7, 0f, 2f); - GeneralParticleHandler.SpawnParticle(impactParticle); - - for (int k = 0; k < 9; k++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 262 : 87, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.7f, 1.25f); - dust.alpha = 235; - if (Main.rand.NextBool()) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); - dust2.noGravity = true; - dust2.scale = Main.rand.NextFloat(0.8f, 1.5f); - dust2.alpha = 70; - } - } - for (int k = 0; k < 3; k++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) + new Vector2(0, -3)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.85f, 1f); - dust.color = ColorStyle ? Color.Orange : Color.Khaki; + MakeBlast(0, false); } } + public void MakeBlast(int target, bool hitTarget) + { + float blastSize = 50 * sizeBonus; + float minMultiplier = 0.35f; + int hitsToMinMult = 8; + int blastDamage = (int)(Projectile.damage * 0.33f); + int knockback = -10; + int debuff = ModContent.BuffType(); + int debuffTime = 180; + if (hitTarget) + { + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, knockback, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 3; + blast.DamageType = Projectile.DamageType; + blast.localAI[0] = target; + blast.localAI[1] = debuff; + blast.localAI[2] = debuffTime; + } + else + { + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, knockback, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 3; + blast.DamageType = Projectile.DamageType; + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + SoundEngine.PlaySound(HolyFireBullet.Explosion with { Pitch = -0.2f + 0.3f * sizeBonus, Volume = 0.3f + 0.1f * sizeBonus, MaxInstances = 10 }, Projectile.Center); + + float fxScale = MathHelper.Lerp(sizeBonus, 1, 0.25f); + Vector2 Offset = Main.rand.NextVector2Circular(15, 15); + + Particle blastvfx = new CustomPulse(Projectile.Center + Offset, Vector2.Zero, Color.Lerp(Color.SlateGray, col, 0.8f) * 0.9f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f * fxScale, 0.1f * fxScale, Main.rand.Next(8, 10 + 1), true); + GeneralParticleHandler.SpawnParticle(blastvfx); + + float rot = Main.rand.NextFloat(-5, 5); + for (int i = -1; i <= 1; i += 2) + { + Particle centerShine = new CustomSpark(Projectile.Center + Offset, Vector2.UnitY.RotatedBy(rot + MathHelper.PiOver4 * i) * 0.01f, "CalamityMod/Particles/BloomCircle", false, 5, 0.3f * fxScale, Color.White, new Vector2(1f, 1f), true, false, shrinkSpeed: 2f); + GeneralParticleHandler.SpawnParticle(centerShine); + } + + for (int k = 0; k < 7; k++) + { + if (Main.rand.NextBool()) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Offset, ModContent.DustType(), new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) * fxScale); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.4f, 0.6f) * fxScale; + dust2.alpha = Main.rand.Next(90, 180 + 1); + dust2.color = col; + dust2.fadeIn = 10f; + dust2.noLight = true; + dust2.noLightEmittence = true; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Offset, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) * fxScale); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1f) * fxScale; + dust.alpha = Main.rand.Next(160, 230 + 1); ; + dust.color = Color.White; + dust.noLight = true; + dust.noLightEmittence = true; + } + } + for (int k = 0; k < 2; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Offset, ModContent.DustType(), new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f) * fxScale + new Vector2(0, -5)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.75f, 0.95f) * fxScale; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + dust.fadeIn = 1; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { target.AddBuff(ModContent.BuffType(), 300); + MakeBlast(target.whoAmI, true); + if (sizeBonus == 2) // If you're at max damage get extra damage + { + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = 0.3f, Volume = 0.4f, MaxInstances = 10 }, Projectile.Center); + } + // This used to be 25% was I fucking insane??? + modifiers.SourceDamage *= MathHelper.Lerp(1, 1.15f, sizeBonus - 1); // Up to 15% damage bonus } } } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 5bf58ceb15..084f5a7ab9 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -18,36 +22,38 @@ namespace CalamityMod.Projectiles.Ranged public bool dustWave = false; public float variance = 0.8f; public Vector2 lastPos; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - + public int slowdownTime = 7; + public bool tileTouched = false; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = 15; + Projectile.height = 15; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.timeLeft = 1200; - Projectile.extraUpdates = 7; + Projectile.extraUpdates = 25; + Projectile.tileCollide = false; AIType = ProjectileID.Bullet; Projectile.ignoreWater = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, slowdownTime * Projectile.extraUpdates, Projectile.timeLeft, true), 1); if (currentColor == Color.Black) { + slowdownTime = Main.rand.Next(6, 9 + 1); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 20; variance = Main.rand.NextFloat(0.7f, 1f); - dustWave = Main.rand.NextBool(); + dustAngle = Main.rand.NextFloat(-0.43f, 0.43f); + dustWave = Math.Sign(dustAngle) == 1; Projectile.scale = 1.5f; Projectile.velocity *= 0.3f; lastPos = Projectile.velocity; @@ -80,85 +86,86 @@ namespace CalamityMod.Projectiles.Ranged } dustAngle += (growing ? 0.07f * variance : -0.07f * variance); - Projectile.localAI[0] += 1f; - Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); - if (Projectile.localAI[0] > 12f && targetDist < 1200f) + if (Collision.SolidCollision(Projectile.Center, 4, 4) && !tileTouched && Projectile.numHits == 0) { - CustomSpark orb = new CustomSpark(orbPos, Utils.DirectionTo(lastPos, orbPos), "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.2f, currentColor, new Vector2(1 + MathF.Abs(dustAngle * 0.6f), 1), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.7f), 0.7f, 0.8f); + tileTouched = true; + OnHitEffects(null); + } + if (Projectile.numHits > 0 || tileTouched) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5 * Math.Max(timeleftFade, 0.01f); + if (Projectile.timeLeft > slowdownTime * Projectile.extraUpdates) + Projectile.timeLeft = slowdownTime * Projectile.extraUpdates; + } + + Projectile.ai[2]++; + Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); + if (Projectile.ai[2] > 15 && targetDist < 1200f) + { + CustomSpark orb = new CustomSpark(orbPos - Utils.DirectionTo(lastPos, orbPos) * timeleftFade, Utils.DirectionTo(lastPos, orbPos) * 0.1f, "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.15f * timeleftFade, currentColor, new Vector2(1 - MathF.Abs(dustAngle * 0.2f), 2 - (1 - MathF.Abs(dustAngle))), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.6f), 0.7f, 0.8f); GeneralParticleHandler.SpawnParticle(orb); - if (Main.rand.NextBool(7)) + if (Main.rand.NextBool(8)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 1.3f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.8f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * timeleftFade; dust.color = currentColor; dust.noLightEmittence = true; + dust.fadeIn = 1.4f; } } lastPos = orbPos; } - - // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) + public override bool? CanHitNPC(NPC target) { - return currentColor; + return (Projectile.numHits > 0 ? false : null); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + CalamityGlobalNPC modNPC = target.Calamity(); + if (!modNPC.hyperiusMarked) + modNPC.hyperiusMarked = true; + + Player Owner = Main.player[Projectile.owner]; + // Hits can crit and the collapse damage will take that into account + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); + modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); + + modifiers.DisableCrit(); + Projectile.damage = 1; + modifiers.HideCombatText(); + + OnHitEffects(target); + } + private void OnHitEffects(NPC target) + { + if (Projectile.owner == Main.myPlayer) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); + for (int b = 0; b < 2; b++) + { + Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7 * (tileTouched ? -1 : 1)).RotatedByRandom(0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)Math.Max(Projectile.originalDamage * 0.05f, 1), 0, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + } + } + } public override bool PreDraw(ref Color lightColor) { - if (Projectile.localAI[0] > 25f) + Asset orb = ModContent.Request("CalamityMod/Particles/GlowSpark"); + int startTime = 9; + int endTime = 35; + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, slowdownTime * Projectile.extraUpdates, Projectile.timeLeft, true), 1); + + for (int i = 0; i < 4; i++) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + Vector2 squash = new Vector2(Utils.Remap(Projectile.ai[2], startTime, endTime, 0.2f, 0.6f + i * 0.2f), Utils.Remap(Projectile.ai[2], startTime, endTime, 1f, 3f - i * 0.4f)); + Color orbColor = Color.Lerp(currentColor, Color.White, i * 0.2f) with { A = 0 } * 0.9f; + Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f - i * 0.008f) * 0.3f; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition + Projectile.velocity * i * 1.3f, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); } return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.owner == Main.myPlayer) - { - for (int b = 0; b < 3; b++) - { - Vector2 vel = (-oldVelocity.SafeNormalize(Vector2.UnitX) * 5); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); - } - } - return true; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - OnHitEffects(target.Center); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - OnHitEffects(target.Center); - } - - private void OnHitEffects(Vector2 targetPos) - { - if (Projectile.owner == Main.myPlayer) - { - for (int b = 0; b < 3; b++) - { - Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5).RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); - for (int b = 0; b < 4; b++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.7f, 1.4f); - dust.color = currentColor; - dust.noLightEmittence = true; - } - } } } diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index a6605021e9..97dd241aa7 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items.Ammo; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Ammo; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,11 +19,7 @@ namespace CalamityMod.Projectiles.Ranged private int rotDirection = 1; private float rotIntensity; private bool rotPhase2 = false; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 2; - } + public bool photosen = CalamityClientConfig.Instance.Photosensitivity; public override void SetDefaults() { Projectile.width = 12; @@ -29,11 +28,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; - Projectile.penetrate = 2; + Projectile.penetrate = 4; Projectile.timeLeft = 500; Projectile.extraUpdates = 4; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.extraUpdates; + Projectile.localNPCHitCooldown = -1; Projectile.alpha = 255; Projectile.ignoreWater = true; AIType = ProjectileID.Bullet; @@ -42,65 +41,82 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.localAI[0]++; + int trailLifetime = 8; if (currentColor == Color.Black) { + Player Owner = Main.player[Projectile.owner]; + Projectile.scale = 0.015f; Projectile.alpha = 255; rotDirection = Main.rand.NextBool() ? 1 : -1; - rotIntensity = Main.rand.NextFloat(0.5f, 1.5f); + rotIntensity = Main.rand.NextFloat(0.3f, 1.1f); Projectile.timeLeft = Main.rand.Next(250, 300 + 1); switch (Projectile.ai[2]) { case 4: // Yellow shot - currentColor = Color.Yellow * 0.65f; + currentColor = Color.Yellow; break; case 3: // Magenta shot - currentColor = Color.Magenta * 0.65f; + currentColor = Color.Magenta; break; case 2: // Red shot - currentColor = Color.Red * 0.65f; + currentColor = Color.Red; break; case 1: // Blue shot - currentColor = Color.Cyan * 0.65f; + currentColor = Color.Cyan; break; default: // Green shot - currentColor = Color.Lime * 0.65f; + currentColor = Color.Lime; break; } } + if (Projectile.localAI[0] > 4 && Projectile.localAI[0] % 2 == 0 && !photosen) + { + Particle trail = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, trailLifetime, 0.15f, currentColor, new Vector2(0.8f, 1.3f), true, true, shrinkSpeed: 0.6f / rotIntensity, glowCenterScale: 0.8f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (Projectile.timeLeft == 180) rotPhase2 = true; if (rotPhase2) { - rotIntensity *= 1.001f; - Projectile.velocity *= 0.997f; - Projectile.velocity = Projectile.velocity.RotatedBy(-0.025f * rotIntensity * rotDirection); + rotIntensity *= 1.003f; + Projectile.velocity *= 0.995f; + Projectile.velocity = Projectile.velocity.RotatedBy(-0.04f * rotIntensity * rotDirection); } else { - Projectile.velocity = Projectile.velocity.RotatedBy(0.015f * rotIntensity * rotDirection); + Projectile.velocity = Projectile.velocity.RotatedBy(0.02f * rotIntensity * rotDirection); } } public override void OnKill(int timeLeft) { - for (int b = 0; b < 2; b++) - { - GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), false, 5, Main.rand.NextFloat(0.35f, 0.45f), currentColor, true, true); - GeneralParticleHandler.SpawnParticle(orb); - } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12, targetHitbox); public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Lerp(currentColor, Color.White, 0.15f) with { A = 0 }, 1, texture, true, true); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, currentColor with { A = 0 } * (photosen ? 0.4f : 1), Projectile.rotation, texture.Size() * 0.5f, new Vector2(0.9f, 1.5f) * Projectile.scale, SpriteEffects.None); return false; } - public override bool? CanDamage() => Projectile.localAI[0] < 20 ? false : null; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + CalamityGlobalNPC modNPC = target.Calamity(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += HyperiusBullet.SplitBulletBonusDamage; + if (!modNPC.hyperiusMarked) + modNPC.hyperiusMarked = true; + + Player Owner = Main.player[Projectile.owner]; + // Hits can crit and the collapse damage will take that into account + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); + modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); + + modifiers.DisableCrit(); + Projectile.damage = 1; + modifiers.HideCombatText(); + } } } diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index c51582d6cc..be93d8c4ff 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -98,10 +98,10 @@ namespace CalamityMod.Projectiles.Ranged Owner.Calamity().GeneralScreenShakePower = 1.85f; //recoil Owner.velocity += -Projectile.velocity * fullRevShots * (Main.zenithWorld ? 0.028f : 0.013f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall"); if (fullRevShots % 2 == 0) - SoundEngine.PlaySound(fire with { Volume = 0.8f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.7f }, Projectile.Center); //SoundEngine.PlaySound(SoundID.Item40 with { PitchVariance = 0.4f }, Projectile.Center); Owner.channel = true; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotMid"); - SoundEngine.PlaySound(fire with { Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.4f }, Projectile.Center); framesBetweenShots = 3; } if (framesBetweenShots > 0) @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Ranged float interpolant = Utils.GetLerpValue(0f, 55f, Owner.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), 0.185f).SafeNormalize(Vector2.UnitY); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), (discharging ? 0.2f : 0.45f)).SafeNormalize(Vector2.UnitY); if (Projectile.velocity != oldVelocity) Projectile.ForceNetUpdate(); } diff --git a/Projectiles/Ranged/NukeOfBliss.cs b/Projectiles/Ranged/NukeOfBliss.cs index a8ff6adc94..70729aa744 100644 --- a/Projectiles/Ranged/NukeOfBliss.cs +++ b/Projectiles/Ranged/NukeOfBliss.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged if (rainDownTimer >= 80) { bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); - if (rainDownTimer % 15 == 0) + if (rainDownTimer % 15 == 0 && Main.myPlayer == Projectile.owner) { SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); SoundEngine.PlaySound(fire with { Volume = 0.45f, Pitch = (0 - 0.3f * Utils.GetLerpValue(0, 300, rainDownTimer, true)) }, Projectile.Center); diff --git a/Projectiles/Ranged/OntologicalDespoilerBeam.cs b/Projectiles/Ranged/OntologicalDespoilerBeam.cs index 5aecd11315..181d634eea 100644 --- a/Projectiles/Ranged/OntologicalDespoilerBeam.cs +++ b/Projectiles/Ranged/OntologicalDespoilerBeam.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 80; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs index ea3b79ba0d..fec35012f6 100644 --- a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs +++ b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle fire2 = new("CalamityMod/Sounds/Item/ShadowboltReflect"); SoundEngine.PlaySound(fire2 with { Volume = 0.9f, Pitch = -0.4f}, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 12f), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 14f), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0); } else { diff --git a/Projectiles/Ranged/OntologicalDespoilerHoldout.cs b/Projectiles/Ranged/OntologicalDespoilerHoldout.cs index 05b655bfd8..cf66a738c5 100644 --- a/Projectiles/Ranged/OntologicalDespoilerHoldout.cs +++ b/Projectiles/Ranged/OntologicalDespoilerHoldout.cs @@ -208,7 +208,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; int charge2DamagePos = Projectile.damage; // Most of the damage comes from the explosion - int charge2DamageNeg = Projectile.damage * 40; // Big charge time? Check. No pierce? Check. 40x damage? Yes! + int charge2DamageNeg = Projectile.damage * 32; // Big charge time? Check. No pierce? Check. 32x damage? Yes! if (Positive) { diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index 51358b057d..2e5e780578 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs index e7f29f76f0..2d51675e1c 100644 --- a/Projectiles/Ranged/PrismaticEnergyBlast.cs +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 100; Projectile.extraUpdates = 1; Projectile.timeLeft = 450; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool PreAI() diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index 38a8616c6e..a55d9e67ec 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (Vector2.Distance(Projectile.Center, projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.Opacity > 0.5f) + if (Vector2.Distance(Projectile.Center, projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.Opacity > 0.7f) { if (projectile.ai[2] == 0) { diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index da8d891e33..f8b4aeb2c1 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -50,7 +50,8 @@ namespace CalamityMod.Projectiles.Ranged { // Xyk: "This is probably too much lol" // Yeah I'd say 7x base damage is a bit much - Projectile.damage *= 4; + // Xyk: Follow up, the inital damage is nerfed AND it has a "cooldown" 7x should now be fine... + Projectile.damage *= (int)7; FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 10ffcec20c..b34f8aae17 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -7,6 +7,7 @@ using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -267,8 +268,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, ((closestTarget.Center - Owner.Center + closestTarget.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 18), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1] + 1); } - int heal = 25; - Owner.HealPlayer(heal); + if (!chosenTarget.SpawnedFromStatue) + { + int heal = Math.Max(25 - (int)Projectile.ai[1], 10); + Owner.HealPlayer(heal); + } spawnPullBlood = false; } @@ -339,7 +343,8 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (!stuckInTarget && canStick) + + if (!stuckInTarget && canStick && !target.Calamity().pacified) { for (int i = 0; i <= 8; i++) { @@ -404,7 +409,6 @@ namespace CalamityMod.Projectiles.Ranged } public override bool? CanDamage() => canDamage ? null : false; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * (!spawnPullBlood ? 4 : 1), targetHitbox); - public override bool PreDraw(ref Color lightColor) { Player Owner = Main.player[Projectile.owner]; diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 7f227bbb77..85150cc826 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -68,9 +68,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item93, Projectile.position); if (Projectile.owner == Main.myPlayer) { - int flash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); - Main.projectile[flash].usesLocalNPCImmunity = true; - Main.projectile[flash].localNPCHitCooldown = 10; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); } for (int k = 0; k < 5; k++) { diff --git a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs index 30c4c325b1..c5ab4cae17 100644 --- a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs +++ b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.NPCs.CalClone; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] public class StarmageddonBinaryStarCenter : ModProjectile, ILocalizedModType { private const float TimeBeforeHoming = 30f; diff --git a/Projectiles/Ranged/SulphuricDrop.cs b/Projectiles/Ranged/SulphuricDrop.cs index f987c5725a..200a38aea2 100644 --- a/Projectiles/Ranged/SulphuricDrop.cs +++ b/Projectiles/Ranged/SulphuricDrop.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = false; Projectile.penetrate = 3; Projectile.timeLeft = 840; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15; Projectile.DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index 7044b1bbb1..73df5f9278 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -31,15 +31,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = Projectile.velocity.ToRotation(); CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 15f); Projectile.frameCounter++; - if (Projectile.frameCounter > 3) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/ThePackMinissile.png b/Projectiles/Ranged/ThePackMinissile.png index 343769d211..1323197fa3 100644 Binary files a/Projectiles/Ranged/ThePackMinissile.png and b/Projectiles/Ranged/ThePackMinissile.png differ diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 6d16b07aaf..bd88446c91 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() { - Main.projFrames[Type] = 4; + Main.projFrames[Type] = 9; ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 6; ProjectileID.Sets.TrailingMode[Type] = 0; @@ -71,15 +71,7 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.frameCounter++; - if (Projectile.frameCounter > 3) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } + Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Type]; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/ThePackMissile.png b/Projectiles/Ranged/ThePackMissile.png index 76f97a6237..61fbc7519e 100644 Binary files a/Projectiles/Ranged/ThePackMissile.png and b/Projectiles/Ranged/ThePackMissile.png differ diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 08be6cba30..719bedb2bc 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs index b0c39fb9b8..30c1d474cd 100644 --- a/Projectiles/Ranged/VanquisherArrowProj.cs +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -1,15 +1,19 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Ammo; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Humanizer; 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 Terraria.GameContent.Animations.IL_Actions.Sprites; namespace CalamityMod.Projectiles.Ranged { public class VanquisherArrowProj : ModProjectile, ILocalizedModType @@ -30,14 +34,14 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetDefaults() { - Projectile.width = 22; - Projectile.height = 22; + Projectile.width = 35; + Projectile.height = 35; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; Projectile.arrow = true; Projectile.penetrate = 2; - Projectile.timeLeft = 300; + Projectile.timeLeft = 600; Projectile.extraUpdates = 7; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; @@ -46,11 +50,23 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.Cyan, + Color.Magenta + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + MainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + if (Time == 0) { - Projectile.velocity *= 0.4f; + Projectile.scale = 0.014f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f; ProjectileSpeed = 30; - MainColor = Main.rand.NextBool() ? Color.Cyan : Color.Magenta; } Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; @@ -62,19 +78,32 @@ namespace CalamityMod.Projectiles.Ranged dust.noLightEmittence = true; } - if (Phase2 == false) - targeted = Projectile.Center.ClosestNPCAt(165); - - if (targeted != null) + if (Time > 45) { - Phase2 = true; - HomingTime = 1; + if (targeted != null) + { + Phase2 = true; + if (HomingTime == 0) + HomingTime = 1; + if (targeted.life <= 0) + targeted = null; + } + else + targeted = Projectile.Center.ClosestNPCAt(450); } - if (HomingTime == 1) + if (HomingTime > 0 && HomingTime < 2 && targeted != null) { Projectile.timeLeft++; - CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.65f, 7, 0.98f, 0.95f, true); + //CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); + } + else if (Projectile.velocity.Length() < 7) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f, 0.04f); + if (HomingTime > 1) + { + HomingTime--; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.09f); } Time++; @@ -82,9 +111,9 @@ namespace CalamityMod.Projectiles.Ranged public override void PostDraw(Color lightColor) { - Color color = Color.White; - Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); + //Color color = Color.White; + //Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height); + //Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); } public override Color? GetAlpha(Color lightColor) @@ -94,17 +123,14 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + HomingTime = Main.rand.Next(10, 20 + 1) * Projectile.extraUpdates; target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - // First hit is 0.85% damage - if (Projectile.numHits < 1) - Projectile.damage = (int)(Projectile.damage * .85f); + // First hit is 30% damage // Second hit is 100% base damage, it is the "Slash Hit" - else - Projectile.damage = (int)(Projectile.damage * (1f / 0.85f)); - + modifiers.SourceDamage *= (Projectile.numHits == 0 ? 0.3f : 1f); if (Projectile.damage < 1) Projectile.damage = 1; } @@ -112,9 +138,23 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.numHits > 0) { - VoidSparkParticle spark2 = new VoidSparkParticle(Projectile.Center, new Vector2(0.1f, 0.1f).RotatedByRandom(100), false, 9, Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool() ? Color.Magenta : Color.Cyan); + Vector2 vel = new Vector2(0.1f, 0.1f).RotatedByRandom(100); + VoidSparkParticle spark2 = new VoidSparkParticle(Projectile.Center, vel, false, 9, Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool() ? Color.Magenta : Color.Cyan); GeneralParticleHandler.SpawnParticle(spark2); + for (int j = -1; j <= 1; j += 2) + { + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), vel.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(2f, 12.5f) * j); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.7f); + dust.color = Main.rand.NextBool() ? Color.Magenta : Color.Cyan; + dust.noLightEmittence = true; + dust.fadeIn = 1; + } + } + SoundStyle onKill = new("CalamityMod/Sounds/Item/ScorpioHit"); SoundEngine.PlaySound(onKill with { Volume = 0.25f, Pitch = 0.1f, PitchVariance = 0.3f }, Projectile.Center); SoundEngine.PlaySound(SoundID.DD2_FlameburstTowerShot with { Volume = 0.8f, Pitch = -0.5f, PitchVariance = 0.3f }, Projectile.Center); @@ -122,10 +162,19 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; - if (Time > 6) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], MainColor * 0.3f, 1, texture); - return true; + if (Time == 0) + return false; + Asset arrow = ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrow"); + Asset glow = ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow"); + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomLineSoftEdge").Value; + + if (Time > 6) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], MainColor with { A = 0 } * 0.6f, 1, texture); + } + Main.EntitySpriteDraw(arrow.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, arrow.Size() / 2f, 1, SpriteEffects.None, 0); + Main.EntitySpriteDraw(glow.Value, Projectile.Center - Main.screenPosition, null, Color.Lerp(MainColor, Color.White, 0.6f), Projectile.rotation, glow.Size() / 2f, 1, SpriteEffects.None, 0); + return false; } } } diff --git a/Projectiles/Rogue/AshenStalactiteDebris.cs b/Projectiles/Rogue/AshenStalactiteDebris.cs index 45e2583878..00bd07fc53 100644 --- a/Projectiles/Rogue/AshenStalactiteDebris.cs +++ b/Projectiles/Rogue/AshenStalactiteDebris.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 50; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 828e638019..f4d204e888 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/BallisticPoisonCloud.cs b/Projectiles/Rogue/BallisticPoisonCloud.cs index efd74924e6..51cb7e8104 100644 --- a/Projectiles/Rogue/BallisticPoisonCloud.cs +++ b/Projectiles/Rogue/BallisticPoisonCloud.cs @@ -1,10 +1,12 @@ using System; +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException(onlyForSingleHitbox: true)] public class BallisticPoisonCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 79ce3bb0d0..a7270c0862 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 5; Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/BrimbladeProj.cs b/Projectiles/Rogue/BrimbladeProj.cs index e12364e225..17c0a27023 100644 --- a/Projectiles/Rogue/BrimbladeProj.cs +++ b/Projectiles/Rogue/BrimbladeProj.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 180; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index 99f36ef71e..57b5178d67 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -37,6 +37,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.MaxUpdates = 4; Projectile.timeLeft = 300; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 61cb9505f0..a47d434f18 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.localNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/DestructionExplosion.cs b/Projectiles/Rogue/DestructionExplosion.cs index d20d58abca..aeb01ad6f6 100644 --- a/Projectiles/Rogue/DestructionExplosion.cs +++ b/Projectiles/Rogue/DestructionExplosion.cs @@ -27,8 +27,16 @@ namespace CalamityMod.Projectiles.Rogue } public override void AI() { + if (Main.zenithWorld) + { + Projectile.hostile = true; + Projectile.friendly = true; + } + if (Projectile.ai[0] == 1) - ExplosionRadius = 800; + { + ExplosionRadius = 800; + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 2f70791b27..23b83e6887 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -44,6 +44,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void AI() { + if (setRot) { rotDirection = Main.rand.NextBool() ? 1 : -1; @@ -151,24 +152,41 @@ namespace CalamityMod.Projectiles.Rogue internal void Explode(bool big) { - float sizeBonus = big ? 2 : 1; - float bigExplosionDamage = 1f; + + + float sizeBonus = big ? Main.zenithWorld ? 6 : 2 : 1; + float bigExplosionDamage = 3f; Player Owner = Main.player[Projectile.owner]; Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb); Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); - SoundStyle explo = new("CalamityMod/Sounds/Item/MeldExplosion"); - SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? Main.zenithWorld ? bigExplosionDamage * 4f : bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); + + if (!Main.zenithWorld || !big) + { + SoundStyle explo = new("CalamityMod/Sounds/Item/MeldExplosion"); + SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); + } + else + { + SoundStyle gfbExplosion = new("CalamityMod/Sounds/Custom/ExoMechs/AresGaussNukeExplosion"); + SoundEngine.PlaySound(gfbExplosion with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + } + if (big) { - SoundStyle explo2 = new("CalamityMod/Sounds/Item/EarthMeteor"); - SoundEngine.PlaySound(explo2 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center); + if (!Main.zenithWorld) + { + SoundStyle explo2 = new("CalamityMod/Sounds/Item/EarthMeteor"); + SoundEngine.PlaySound(explo2 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center); + + SoundStyle explo3 = new("CalamityMod/Sounds/Item/ExobladeDashImpact"); + SoundEngine.PlaySound(explo3 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center); + } - SoundStyle explo3 = new("CalamityMod/Sounds/Item/ExobladeDashImpact"); - SoundEngine.PlaySound(explo3 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center); } Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18); diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index cd6fc21372..d845c88fe8 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class DoomsdayDeviceProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; @@ -235,7 +237,7 @@ namespace CalamityMod.Projectiles.Rogue { float finalHitMult = 1; // If it is the last hit of a stealth strike, this is increased. - if (Projectile.Calamity().stealthStrike && !doneHitting) // Stealth strike bounce code, TODO: port this over to Pulse Rifle/Pusle Pistol because this is just a more functional version of theirs. + if (Projectile.Calamity().stealthStrike && !doneHitting) // Stealth strike bounce code { NPC chosenTarget = null; float distance = 2500; diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index be9d2ec200..9c4201d233 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,7 +1,10 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { + [PierceResistException(onlyForSingleHitbox: true)] public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs index 9e44160aad..c8b26e7e8f 100644 --- a/Projectiles/Rogue/DynamicPursuerElectricity.cs +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -43,6 +43,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 10; Projectile.timeLeft = 60 * Projectile.extraUpdates; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 2ea50cc720..29d036ba82 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class EclipsesStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 6c32ebf15d..a81963a004 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class EradicatorProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index ae1c6226d1..0e373d855c 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); for (int i = 0; i < 20; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 2.5f), ModContent.ProjectileType(), Projectile.damage * 4, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 2.5f), ModContent.ProjectileType(), (int)(Projectile.damage * 2.4f), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 2ff632ba34..1dea82d896 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -55,6 +55,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool? CanDamage() => ((flung && !inSky && !hitTiles && impaleDist == Vector2.Zero) ? null : false); public override void AI() { + if (stealth && Projectile.ai[2] != 5) // Multiplayer Syncing? + { + Projectile.ai[2] = 5; + Projectile.ForceNetUpdate(); + } + if (Projectile.ai[2] == 5) + Projectile.Calamity().stealthStrike = true; + if (!flung && time == 0) randpitch = Main.rand.NextFloat(-0.1f, 0.1f); if (flung) @@ -98,6 +106,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft++; if (Projectile.Center.Y + 80 > Owner.Calamity().mouseWorld.Y && Collision.SolidCollision(Projectile.Center, 20, 20)) { + Projectile.netUpdate = true; Projectile.extraUpdates = 3; Projectile.ai[1] = -5; SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit2"); @@ -138,7 +147,16 @@ namespace CalamityMod.Projectiles.Rogue if (stealth) { if (Projectile.timeLeft > 240) + { + // Boomerang noises + if (Projectile.soundDelay == 0) + { + Projectile.soundDelay = 5 * Projectile.MaxUpdates; + SoundStyle sound = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(sound with { MaxInstances = -1, Volume = 0.5f, Pitch = -0.2f }, Projectile.Center); + } Projectile.rotation += 0.07f * Projectile.direction; + } if (time > 80) { @@ -279,19 +297,22 @@ namespace CalamityMod.Projectiles.Rogue } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if ((!falling || Projectile.numHits != 0) && !stealth) + if (stealth) + { + float minMult = 0.35f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + else if (!falling || Projectile.numHits != 0) modifiers.SourceDamage *= 0.1f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { bool onKill = ((target.life <= 0 && target.realLife == -1) || target.lifeMax == 1); - if (!onKill && (falling || stealth)) + if (!onKill && falling) { - if (stealth) - { - - } - else + if (!stealth) { time = 0; SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit4"); @@ -315,37 +336,53 @@ namespace CalamityMod.Projectiles.Rogue } if (stealth) { - SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); - for (int i = 0; i < 3; i++) - SoundEngine.PlaySound(soundBurst with { Volume = 0.8f, Pitch = 0.2f * i, MaxInstances = 3 }, Projectile.Center); - SoundStyle soundExplosion = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); - SoundEngine.PlaySound(soundExplosion with { Volume = 0.65f, Pitch = 0.6f}, Projectile.Center); - + if (Main.zenithWorld) + { + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + searchedTarget.active = false; + } + + SoundStyle gong = new("CalamityMod/Sounds/Custom/GFB/Jesus"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(gong with { Volume = 1f, MaxInstances = 2 }, Projectile.Center); + } + else + { + Owner.Calamity().GeneralScreenShakePower = 7f; + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(soundBurst with { Volume = 0.8f, Pitch = 0.2f * i, MaxInstances = 3 }, Projectile.Center); + SoundStyle soundExplosion = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(soundExplosion with { Volume = 0.65f, Pitch = 0.6f }, Projectile.Center); + + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 24; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 35; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 1.2f, y * 1.5f) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.7f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.4f : 1.2f) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 24, 0.065f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + Vector2 fxVel2 = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * (i == 0 ? 1.7f : 1); + Particle bigCross = new CustomSpark(crossCenter + fxVel2 * 145, fxVel2, "CalamityMod/Particles/BloomLineFade", false, 15, 0.15f, mainColor, new Vector2(1.8f, 1.2f), true, true, 0, false, false, 0.8f, 0.8f, 0.8f); + GeneralParticleHandler.SpawnParticle(bigCross); + } + } Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI); crossBurst.Calamity().stealthStrike = true; - for (int i = 0; i < 4; i++) - { - for (int y = 0; y < 24; y++) - { - bool red = Main.rand.NextBool(5); - float variance = Main.rand.NextFloat(0.7f, 1); - float placementVariance = 35; - Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 1.2f, y * 1.5f) * (i == 0 ? 1.7f : 1) * variance; - Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); - Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.7f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); - dust.noGravity = true; - dust.scale = (red ? 1.4f : 1.2f) * Main.rand.NextFloat(0.7f, 0.9f); - dust.color = red ? Color.Red : mainColor; - if (y % 2 == 0) - { - Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 24, 0.065f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.5f); - GeneralParticleHandler.SpawnParticle(spark); - } - } - Vector2 fxVel2 = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * (i == 0 ? 1.7f : 1); - Particle bigCross = new CustomSpark(crossCenter + fxVel2 * 145, fxVel2, "CalamityMod/Particles/BloomLineFade", false, 15, 0.15f, mainColor, new Vector2(1.8f, 1.2f), true, true, 0, false, false, 0.8f, 0.8f, 0.8f); - GeneralParticleHandler.SpawnParticle(bigCross); - } } else { @@ -376,8 +413,8 @@ namespace CalamityMod.Projectiles.Rogue } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Projectile.Calamity().stealthStrike) - return CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); + if (stealth) + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 120, targetHitbox); else return base.Colliding(projHitbox, targetHitbox); } @@ -387,7 +424,7 @@ namespace CalamityMod.Projectiles.Rogue float throwCompletion = flung ? 1 : (float)Math.Pow(Math.Min(time / (Owner.HeldItem.useAnimation * 0.7f), 1), 5); Color glowColor = Color.Lerp(mainColor, Color.Khaki, glowUp - 1); Texture2D tex = TextureAssets.Projectile[Type].Value; - Asset glowBlade = ModContent.Request("CalamityMod/Particles/BloomLineFade"); + Asset glowBlade = ModContent.Request("CalamityMod/Particles/GlowBlade"); Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); if (hitTiles || falling || stealth) @@ -404,17 +441,17 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 4; i++) { - Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i).RotatedBy(Projectile.rotation) * (i == 0 ? 1.2f : 1) * 50 * throwCompletion; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i).RotatedBy(Projectile.rotation) * (i == 0 ? 1.2f : 1) * 80 * throwCompletion; Vector2 fxPos = crossCenter + fxVel; if (i == 0 && Projectile.timeLeft > 240) { - Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.37f * throwCompletion, SpriteEffects.None, 0); - Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.32f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); } for (int y = 0; y < 2; y++) - Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 }, fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.3f, 1.3f * throwCompletion * glowUp) * Projectile.scale * (y != 0 ? 0.015f : 0.04f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 55dc3c14b8..40234674e5 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,7 +1,13 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs.Yharon; +using CalamityMod.UI; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; +using System.Text.RegularExpressions; namespace CalamityMod.Projectiles.Rogue { @@ -42,5 +48,17 @@ namespace CalamityMod.Projectiles.Rogue bool verticalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitY * crossSize, Projectile.Center + Vector2.UnitY * crossSize * 1.7f, crosThickness, ref _); return (horizontalHit || verticalHit); } + public override bool PreDraw(ref Color lightColor) + { + Player Owner = Main.player[Projectile.owner]; + float fade = Utils.GetLerpValue(0, 9, Projectile.timeLeft, true); + Asset him = ModContent.Request("CalamityMod/ExtraTextures/Jesus"); + + if (Projectile.Calamity().stealthStrike && Main.zenithWorld) + { + Main.EntitySpriteDraw(him.Value, Owner.Center - Main.screenPosition, null, Color.White * 0.45f * fade, 0, him.Size() / 2f, 10, SpriteEffects.None, 0); + } + return false; + } } } diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index ccbb12405c..378c484662 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -1,10 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class FantasyTalismanProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index c15729eb34..9be29c003d 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -1,10 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class FantasyTalismanStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index f101b2cb23..a405ddaa85 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index e485108463..33bc7eb8a3 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index bafb14937a..9a13c9403b 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index 2adb2139bb..1546b0b997 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index d0834ef778..e397a9457c 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -1,12 +1,14 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class GodsParanoiaProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 60d4e259a8..ecc722a3bd 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index ab0c7314d9..d7f2386bdb 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 25b55a5c37..ccb092aea0 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class JawsProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 8ecefdb0c6..507789ee06 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -78,8 +78,6 @@ namespace CalamityMod.Projectiles.Rogue if (flash.WithinBounds(Main.maxProjectiles)) { Main.projectile[flash].DamageType = RogueDamageClass.Instance; - Main.projectile[flash].usesLocalNPCImmunity = true; - Main.projectile[flash].localNPCHitCooldown = 10; } Vector2 pos = new Vector2(Projectile.Center.X + Projectile.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 85a6f13add..2851230620 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class LeviathanTooth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 6d6bd45d06..7d5cb2ecae 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class LionfishProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; @@ -24,6 +26,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = CalamityUtils.SecondsToFrames(20f); + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index 4992f835b2..be8ef36f5a 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Y > 0) Projectile.velocity.X *= 0.99f; - if (Projectile.timeLeft > 60) + if (Projectile.timeLeft > 60 && Projectile.timeLeft % 2 == 0) { Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.3f); - Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, dustVel); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.4f, 0.5f); dust.color = Color.Magenta; diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index 0310ef4f94..83d25aece6 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -1,4 +1,4 @@ - +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class MetalShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 492b0a54db..68580e9028 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class NastyChollaBol : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index a33e54ff06..0ec456a0ee 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.localAI[0] = 10f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index 69829d8f21..5efba5e5e6 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.localAI[0] = 10f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/PlaguedFuelPackCloud.cs b/Projectiles/Rogue/PlaguedFuelPackCloud.cs index a543c97c8b..24e2dfa9d1 100644 --- a/Projectiles/Rogue/PlaguedFuelPackCloud.cs +++ b/Projectiles/Rogue/PlaguedFuelPackCloud.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class PlaguedFuelPackCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 836b7d10e8..f926019b56 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class ReaperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; @@ -243,7 +245,7 @@ namespace CalamityMod.Projectiles.Rogue } Particle Smear = new CustomPulse(rainSpot, Vector2.Zero, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-5, 5), 0, 0.35f, 12); GeneralParticleHandler.SpawnParticle(Smear); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), rainSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0, 0, 100); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), rainSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.13), 0f, Projectile.owner, 0, 0, 100); } else // Radiation Burst { diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 8da92c9fc3..2942d3ed40 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -6,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SacrificeProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs index dac74b5b0d..14b31a2c20 100644 --- a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs +++ b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs @@ -105,11 +105,6 @@ namespace CalamityMod.Projectiles.Rogue Parent = Main.projectile[(int)Projectile.ai[0]]; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.immune[Projectile.owner] = 0; - } - public override bool PreDraw(ref Color lightColor) { for (int i = 1; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index d6a3686639..85e86a89df 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.Bananarang; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 8afb260719..ea6787c932 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -70,16 +70,20 @@ namespace CalamityMod.Projectiles.Rogue } float throwCount = Projectile.localAI[0]; - for (int i = 0; i < (Main.zenithWorld ? 38 : 8); i++) + if (Main.myPlayer == Projectile.owner) { - throwCount++; - Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); - int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].localAI[0] = throwCount; - Main.projectile[stealth].ai[0] = 1; - Main.projectile[stealth].extraUpdates = 3; + for (int i = 0; i < (Main.zenithWorld ? 38 : 8); i++) + { + throwCount++; + Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); + int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].localAI[0] = throwCount; + Main.projectile[stealth].ai[0] = 1; + Main.projectile[stealth].extraUpdates = 3; + } } + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = -0.3f, Volume = 0.8f }, Projectile.Center); } else // Normal bubble spawn diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index bf96565d51..5cd7cf61a0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Rogue int hitsToMinMult = 5; int debuff1 = ModContent.BuffType(); int debuffTime = 180; - if (Projectile.localAI[0] >= 0) // On kill but exclude small bubbles and bubbled that died in a fuse + if (Projectile.localAI[0] >= 0 && Main.myPlayer == Projectile.owner) // On kill but exclude small bubbles and bubbled that died in a fuse { Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.localAI[0] = debuff1; diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index f84567151f..2aff8e2686 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -1,11 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SnapClamProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index a7dd3b8d1c..12ddd3ee4b 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -1,11 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SnapClamStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index 7d2c53512d..cde5d6edc4 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index cfa9694d3b..fd4022c0cc 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index dda87de504..3aa6c9ac5d 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; } diff --git a/Projectiles/Rogue/ToxicantTwisterProj.cs b/Projectiles/Rogue/ToxicantTwisterProj.cs index 8099348e8e..59641da7ba 100644 --- a/Projectiles/Rogue/ToxicantTwisterProj.cs +++ b/Projectiles/Rogue/ToxicantTwisterProj.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.timeLeft % 50 == 0) { - Projectile dustProjectile = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33f), 0f, Projectile.owner, 0, 0, Projectile.ai[2]); + Projectile dustProjectile = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, 0, 0, Projectile.ai[2]); dustProjectile.timeLeft = 240; } } diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index d874b1ee34..e2e73954eb 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class UrchinStingerProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index 14840d8a11..278ffb7121 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/WhitewaterAura.cs b/Projectiles/Rogue/WhitewaterAura.cs index 954ae22133..cc86ca7ba0 100644 --- a/Projectiles/Rogue/WhitewaterAura.cs +++ b/Projectiles/Rogue/WhitewaterAura.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; } public override void AI() @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[playerIndex]; float targetDist = Vector2.Distance(player.Center, Projectile.Center); - if (targetDist < 200f * areaScale && time % 15 == 0) + if (targetDist < 200f * areaScale && player.Calamity().whitewaterHeal == 0) { - player.HealPlayer(1); + player.Calamity().whitewaterHeal = (player.whoAmI == Projectile.owner ? 300 : 600); } } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 300); Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); - target.MoveNPC(launchVel, 6, true); + target.MoveNPC(launchVel, 9, true); } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Rogue/WhitewaterProj.cs b/Projectiles/Rogue/WhitewaterProj.cs index 58ff0fc987..cd84b2652d 100644 --- a/Projectiles/Rogue/WhitewaterProj.cs +++ b/Projectiles/Rogue/WhitewaterProj.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; } public override void AI() { @@ -167,26 +167,22 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); if (Projectile.Calamity().stealthStrike) { - for (int x = 0; x < Main.maxProjectiles; x++) + foreach (Projectile p in Main.ActiveProjectiles) { - Projectile projectile = Main.projectile[x]; - if (projectile.active) + if (p.type == ModContent.ProjectileType() && p.owner == Projectile.owner) { - if (projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 30) - projectile.timeLeft = 30; - } + if (p.timeLeft > 30) + p.timeLeft = 30; } } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), Projectile.knockBack, Projectile.owner, 0f, 0f); } } } } time++; } - public override bool? CanDamage() => (shattered && !returning) ? false : null; + public override bool? CanDamage() => (shattered || returning) ? false : null; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (damageModifier > 0.05f) @@ -197,7 +193,7 @@ namespace CalamityMod.Projectiles.Rogue SoundStyle sound = new("CalamityMod/Sounds/Item/BreakAndReform"); SoundEngine.PlaySound(sound with { Volume = 0.4f }, Projectile.Center); - int points = Projectile.Calamity().stealthStrike ? 8 : 4; + int points = Projectile.Calamity().stealthStrike ? 6 : 4; float radians = MathHelper.TwoPi / points; Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); for (int k = 0; k < points; k++) diff --git a/Projectiles/Rogue/WhitewaterSpear.cs b/Projectiles/Rogue/WhitewaterSpear.cs index dedcc42106..c16a59f091 100644 --- a/Projectiles/Rogue/WhitewaterSpear.cs +++ b/Projectiles/Rogue/WhitewaterSpear.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 5; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 25; + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; } public override void AI() diff --git a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs index a2094971eb..54e29e8b73 100644 --- a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs +++ b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs @@ -369,7 +369,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI dust.noGravity = true; } } - SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center); } } } diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index 9d79d29582..c03465dcfd 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Summon AIType = ProjectileID.RainFriendly; Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 3f0975c5ca..e627103010 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -9,11 +11,12 @@ namespace CalamityMod.Projectiles.Summon public class CorruptionSlimeGodMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/Summon/CorroslimeMinion"; public float dust = 0f; public override void SetStaticDefaults() { - Main.projFrames[Type] = 2; + Main.projFrames[Type] = 6; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -84,5 +87,13 @@ namespace CalamityMod.Projectiles.Summon } public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D slom = TextureAssets.Projectile[Type].Value; + Rectangle frame = slom.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(slom, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index fa6f533cff..3199f82bbc 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -9,11 +11,12 @@ namespace CalamityMod.Projectiles.Summon public class CrimsonSlimeGodMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/Summon/CrimslimeMinion"; public float dust = 0f; public override void SetStaticDefaults() { - Main.projFrames[Type] = 2; + Main.projFrames[Type] = 6; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -84,5 +87,13 @@ namespace CalamityMod.Projectiles.Summon } public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D slom = TextureAssets.Projectile[Type].Value; + Rectangle frame = slom.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(slom, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs index 23d7b00dda..ee5d8a1c2d 100644 --- a/Projectiles/Summon/DaedalusLightning.cs +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.extraUpdates = 20; Projectile.timeLeft = 45 * Projectile.extraUpdates; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs index 4c8b737425..19279ec247 100644 --- a/Projectiles/Summon/DeathstareBeam.cs +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.timeLeft = 10; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index ccc2102d01..20465c93fe 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -330,7 +330,7 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.owner == Main.myPlayer) { - SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center); int damage = (int)player.GetTotalDamage().ApplyTo(LaserBaseDamage); // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -353,7 +353,7 @@ namespace CalamityMod.Projectiles.Summon public void ExitChargeModeEarly(Player player) { RightIconCooldown = RightIconAttackTime; - SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center); SpecialAttackExplosionDust(player); } public void SpecialAttackExplosionDust(Player player) diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 050a280eea..5821c667dc 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.minion = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Summon/SeashineSwordProj.cs b/Projectiles/Summon/SeashineSwordProj.cs new file mode 100644 index 0000000000..61917656be --- /dev/null +++ b/Projectiles/Summon/SeashineSwordProj.cs @@ -0,0 +1,321 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SeashineSwordProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public Player Owner => Main.player[Projectile.owner]; + public float attackTimer = 0; + public float time = 0; + public bool isSpawning => time < 180; + + public float bladeCharge = 0; // The charge level of the blade, ranges from 0 to 1 + + public Vector2 tipPosition; + public Vector2 savedTipPos = Vector2.Zero; + public bool attackMode => Owner.HeldItem.type == ModContent.ItemType(); // If not holding the weapon, the blades won't charge (no whips for you) + + // Values stored to create blade swing arc + public Vector2 startPos; + public Vector2 endPos; + public bool setPos = true; + + public bool isAttacking = false; // If the blade is in the swinging animation to attack + public bool readySound = true; + public static int baseReturnSpeed = 18; + public int returnSpeed = baseReturnSpeed; // How fast blades retun to you + public float bladeValue = 0; // The delay between each sword swing + public Color mainColor; + + public float bladeChargeSpeed = 0.0015f; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + // Minion targeting feature is not active here since this isn't a normal summon weapon + } + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 34; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 70 * Projectile.MaxUpdates; + Projectile.DamageType = DamageClass.Summon; + Projectile.extraUpdates = 2; + } + + public override void AI() + { + // Color shifting + float rate = (Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 6; + List eColors = new List() + { + Color.RoyalBlue, + Color.Turquoise + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // This is the delay between each sword swing, the time bewteen gets shorter as you get more swords + // This is so it doesn't take forever for swords to come out when you have a lot of them + bladeValue = (Projectile.ai[1] * (6 / MathHelper.Clamp(Owner.ownedProjectileCounts[Projectile.type] * 0.1f, 1, 1000))) + 10; + + // This checks when the blade is told to attacking to see if it can attack + if (Projectile.ai[0] == 5 && bladeCharge >= 1) + isAttacking = true; + else if (attackTimer == 0) + Projectile.ai[0] = 0; + + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.6f); + ApplyPlayerBuffs(); + + tipPosition = Projectile.Center + (Vector2.UnitX * MathHelper.Clamp(bladeCharge * 103, 0, 2000)).RotatedBy(Projectile.rotation) * Projectile.scale; + Vector2 tipVel = (savedTipPos - tipPosition); + savedTipPos = tipPosition; + + if (isSpawning) // The effects when you first throw out a summon + { + if (time >= 110) // Shine effect when spawning + { + if (time == 110) + { + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 14f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.3f); + dust.color = mainColor; + dust.noLightEmittence = true; + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ExobladeBeamSlash") with { Volume = 0.45f, Pitch = 0.9f }, Projectile.Center); + for (int i = 0; i < 2; i++) + { + Particle fx = new CustomSpark(tipPosition, (i == 0 ? Vector2.UnitY : Vector2.UnitX).RotatedBy(MathHelper.ToRadians(45)) * 0.01f, "CalamityMod/Particles/ThinEndedLine", false, 18, 1, mainColor, new Vector2(3.3f, 0.6f), extraRotation: 0, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.1f); + Projectile.velocity *= 0.95f; + } + else // Spinning + { + Projectile.velocity *= 0.96f; + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.2f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.55f, 0.7f); + dust.color = mainColor; + dust.noLightEmittence = true; + if (time >= 80) + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.09f); + else + Projectile.rotation += 0.15f; + } + bladeCharge = 0.4f; + } + else // The actual active ai for the summon + { + if (isAttacking) // When commanded to attack and is fully charged + { + attackTimer++; + if (attackTimer >= 120 + bladeValue) // Reset values after a swing + { + Projectile.netUpdate = true; + attackTimer = 80; + Projectile.ai[0] = 0; + setPos = true; + isAttacking = false; + readySound = true; + bladeCharge = 0.9f; + Projectile.numHits = 0; + Projectile.scale = 1; + returnSpeed = 460; + } + + if (attackTimer > bladeValue && Projectile.ai[0] != 0) // The actual swing + { + Vector2 toMouse = Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld()); + float lerp = Utils.GetLerpValue(30 + bladeValue, 100 + bladeValue, attackTimer, true); + if (setPos) + { + Projectile.netUpdate = true; + startPos = Projectile.Center; + endPos = Owner.Calamity().mouseWorld + toMouse * 480; + Projectile.numHits = 0; + setPos = false; + } + + Projectile.velocity = (Vector2.Lerp(startPos, endPos, lerp) - Projectile.Center) / returnSpeed; + float angles = 180 * (Projectile.ai[1] % 2 == 0 ? -1 : 1); + float rot = Utils.DirectionTo(startPos, endPos).RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-angles), MathHelper.ToRadians(angles) / 5, (float)Math.Pow(lerp, 1.5f))).ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, rot, 0.1f); + + } + else // An altered version of the on back code to get them into position to swing + { + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); + Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center, Projectile.Center).ToRotation(), 0.05f); + + float destLerp = Utils.GetLerpValue(0, bladeValue, attackTimer, true); + Vector2 destination = Owner.Center + bonusPos + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 2) * (-20 - 330 * (float)Math.Pow(destLerp, 2)); + Projectile.velocity = (destination - Projectile.Center) / (returnSpeed * 0.6f); + } + } + else // Chill on the players back while charging the blade + { + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); + Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); + + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center + Vector2.UnitY * -60, Projectile.Center).ToRotation(), Utils.Remap(returnSpeed, baseReturnSpeed, 460, 0.05f, 0.005f, true)); + + Vector2 destination = Owner.Center + bonusPos - Vector2.UnitY * 40 + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 3) * (-15 - Projectile.ai[1] * 18); + Projectile.velocity = (destination - Projectile.Center) / returnSpeed; + if (bladeCharge < 1f) + bladeCharge += bladeChargeSpeed; + + // The weapon theoretically works with projectile scale, though I ended up not using it + //if (Projectile.scale < 3) + //Projectile.scale += 0.01f; + } + if (readySound && bladeCharge >= 1) // Effect when the blade is fully charged + { + Projectile.netUpdate = true; + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = mainColor; + dust.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) + Projectile.ai[1] * 0.05f }, Projectile.Center); + readySound = false; + } + } + // This is the tip trail for the blades, it is a very consistently good looking trail, however it creates a LOT of particles + // I do not recommend reusing this effect unless you're using it carefully + if ((returnSpeed == baseReturnSpeed && bladeCharge >= 1 || (isAttacking && attackTimer > bladeValue + 5)) || isSpawning) + { + Particle orb = new CustomSpark(tipPosition, tipVel.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/BloomCircle", false, isAttacking ? 30 : 12, Utils.Remap(tipVel.Length(), 2, 15, 0.15f, 0.3f, true) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, isAttacking ? 1.3f : 1), true, true, shrinkSpeed: Utils.Remap(tipVel.Length(), 1, 8, 0f, 0.4f, true), glowOpacity: 0.5f, glowCenterScale: 0.8f); + GeneralParticleHandler.SpawnParticle(orb); + } + // The uncharge of the blades when you're not holding the item or after they slash + if (!isAttacking && (attackTimer > 0 || !attackMode)) + { + bladeCharge = MathHelper.Clamp(MathHelper.Lerp(bladeCharge, 0, 0.025f), 0.4f, 1); + if (attackTimer > 0) + attackTimer--; + readySound = true; + } + // How fast the blades try to reach their goal position when not activley slashing + // Tries to get back to the base value when possible + if (returnSpeed > baseReturnSpeed) + { + returnSpeed = (int)(returnSpeed * 0.99f); + } + else + returnSpeed = baseReturnSpeed; + + time++; + } + public void ApplyPlayerBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().seashineSwordBuff = false; + if (Owner.Calamity().seashineSwordBuff) + Projectile.timeLeft = 2; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Summon/SeashineHilt").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; + Texture2D tex3 = ModContent.Request("CalamityMod/Particles/FullStar").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + float extremeLerp = (float)Math.Pow(bladeCharge, 10); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2, drawPos - (Vector2.UnitY.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * 59 * bladeCharge * Projectile.scale), null, Color.Lerp(mainColor, Color.White, i * 0.3f) with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(90), tex2.Size() * 0.5f, new Vector2(0.33f - i * 0.05f, (0.75f + i * 0.03f) * bladeCharge) * 0.05f * Projectile.scale, SpriteEffects.None); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex, drawPos, null, Color.Lerp(lightColor, (i == 0 ? Color.White : mainColor) with { A = 0 }, extremeLerp), Projectile.rotation + MathHelper.ToRadians(45), tex.Size() * 0.5f, (i == 0 ? 0.8f : 1) * Projectile.scale, SpriteEffects.None); + + if (!isAttacking && bladeCharge < 1) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex3, drawPos, null, mainColor with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45), tex3.Size() * 0.5f, new Vector2(i == 0 ? 1 : 3, i == 0 ? 3 : 1) * Main.rand.NextFloat(0.8f, 1.1f) * extremeLerp, SpriteEffects.None); + } + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + if (isAttacking) + { + for (int i = 0; i < 6; i++) + { + if (i % 2 == 0) + { + Particle spark = new SeaPrismParticle(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 30f), true, 40, Main.rand.NextFloat(0.85f, 1.3f), Color.White, Vector2.One, false, Main.rand.NextFloat(-0.3f, 0.3f), affectedByLight: false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle e = new CustomSpark(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.1f, 0.2f) * 2.5f, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(e); + } + for (int i = 0; i < 3; i++) + { + //Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 15f)); + //dust.noGravity = false; + //dust.scale = Main.rand.NextFloat(0.95f, 1.4f); + //dust.color = mainColor; + //dust.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, PitchVariance = 0.3f }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Blades should do big damage on the inital hit due to the large delay between attacks + // However, it's pierce reduction is quite severe (at least right now) + float minMult = 0.1f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear + { + // Perform an AABB line collision check to check the whole spear. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, tipPosition, 30 * Projectile.scale, ref _); + } + public override bool? CanDamage() => (isAttacking && attackTimer > bladeValue && Projectile.ai[0] != 0) ? null : false; + } +} diff --git a/Projectiles/Melee/SeashineSwordProj.png b/Projectiles/Summon/SeashineSwordProj.png similarity index 100% rename from Projectiles/Melee/SeashineSwordProj.png rename to Projectiles/Summon/SeashineSwordProj.png diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index ad59ba6a1f..5b9c20254a 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -69,6 +69,8 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Projectile.timeLeft = 900000; Projectile.scale = 1f; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 37970e73a4..91487ce95c 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index b79ca5a550..efed72d73c 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -45,6 +45,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.scale = 0.01f; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } private void ApplySucc(NPC npc) diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 7e75dadd3c..119154d277 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class ArtifactOfResilienceShards : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/AuricLandMineExplosion.cs b/Projectiles/Typeless/AuricLandMineExplosion.cs index e5b4d7d935..74dbe2c605 100644 --- a/Projectiles/Typeless/AuricLandMineExplosion.cs +++ b/Projectiles/Typeless/AuricLandMineExplosion.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.tileCollide = false; Projectile.hostile = true; Projectile.friendly = true; + Projectile.trap = true; } public override void AI() diff --git a/Projectiles/Typeless/BasicBurstExclusive.cs b/Projectiles/Typeless/BasicBurstExclusive.cs new file mode 100644 index 0000000000..b5297f95f8 --- /dev/null +++ b/Projectiles/Typeless/BasicBurstExclusive.cs @@ -0,0 +1,100 @@ +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BasicBurstExclusive : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Vector2 pushVelocity; + public float customKnockback = 0; + + public bool hasStongDisplacement = false; // If you set Knockback to anything below zero, the custom knockback will be able to effect enemies that normally ignore knockback. + + // Projectile.ai[0] is the size of the circular hitbox. + // Projectile.ai[1] is the minimum multiplier on pierce damage. + // Projectile.ai[2] is the number of hits to reach minimum pierce damage. + + // local ai 0 is an excluded enemy that can not be hit. This is usually the enemy hit by the projectile that spawned this explosion + + // You can use the local ai variables 1 and 2 to inflict a debuff. If you need more than that, just make your own projectile + // 1 is the debuff being inflicted + // 2 is the debuff duration + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + // Get custom knockback strength. + // Takes the knockback applied to the projectile to determine strength, then sets regular knockback to zero + // Negative knockback is Abs'd and turns on strong knockback that effects more kinds of enemies + if (customKnockback == 0) + { + if (Projectile.knockBack < 0) + hasStongDisplacement = true; + customKnockback = Math.Abs(Projectile.knockBack); + Projectile.knockBack = 0; + } + if (Projectile.ai[0] == 0) + Projectile.ai[0] = 50; // The base size for explosions is 50. + if (Projectile.ai[1] == 0) + Projectile.ai[1] = 0.1f; // The base minimum damage multiplier is 0.1f. + if (Projectile.ai[2] == 0) + Projectile.ai[2] = 5; // The base number of hit to reach minimum damage is 5. + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.localAI[1] != 0) // Debuff 1 + { + target.AddBuff((int)(Projectile.localAI[1]), (int)(Projectile.localAI[2])); + } + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; + float minMult = Projectile.ai[1]; + int hitsToMinMult = (int)Projectile.ai[2]; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + if (customKnockback != 0 && target.CanBeMoved(hasStongDisplacement)) + { + target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1)); + } + } + public override bool? CanHitNPC(NPC target) + { + if (target.whoAmI == Projectile.localAI[0]) + return false; + else + return null; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[0], targetHitbox); + } + public override void SendExtraAI(BinaryWriter writer) // Sending extra ai for the debuff infliction + { + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + writer.Write(Projectile.localAI[2]); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + Projectile.localAI[2] = reader.ReadSingle(); + } + } +} diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 4a534b93c1..440c655f07 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class BlunderBoosterAura : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index 9d4cd5e92e..8162bb748b 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -63,7 +64,16 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { + Vector3 lightCol = new(85f / 255f, 151f / 255f, 196f / 255f); + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + lightCol *= brightness; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Lighting.AddLight(Projectile.position, lightCol); return false; } diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index d6bc051dae..ec264285ad 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -66,7 +67,16 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { + Vector3 lightCol = new(85f / 255f, 151f / 255f, 196f / 255f); + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + lightCol *= brightness; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Lighting.AddLight(Projectile.position, lightCol); return false; } diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index d32a00d7f5..e3e6320565 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class CryonicShield : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index bc65e2df07..b601c92938 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.extraUpdates = 1; Projectile.coldDamage = true; Projectile.npcProj = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 49f7b51a74..5094d26e31 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Balancing; using CalamityMod.CalPlayer; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class FungalClumpMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/HolyStarDamage.cs b/Projectiles/Typeless/HolyStarDamage.cs index 455d337210..55c7dcbd09 100644 --- a/Projectiles/Typeless/HolyStarDamage.cs +++ b/Projectiles/Typeless/HolyStarDamage.cs @@ -66,17 +66,17 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.ai[2] != -1 && time > 20) { NPC targeted = Projectile.ai[2] == -1 ? null : Main.npc[(int)Projectile.ai[2]]; - if (targeted != null && targeted.life <= 0) + if (targeted != null && (targeted.life <= 0 || !targeted.CanBeChasedBy(Projectile))) targeted = null; else Projectile.timeLeft++; - CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.5f, 12, 0.975f); + CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted ?? Projectile.Center.ClosestNPCAt(800f), true, 0.5f, 12, 0.975f); } - if (Projectile.scale < 1) - Projectile.scale += 0.0035f; - if (Projectile.scale >= 1 && !reachedMaxDamage) + if (Projectile.scale < 1.15) + Projectile.scale += 0.004f; + if (Projectile.scale >= 1.15 && !reachedMaxDamage) { - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.5f, 8); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.3f, 8); GeneralParticleHandler.SpawnParticle(orb2); reachedMaxDamage = true; } @@ -89,8 +89,6 @@ namespace CalamityMod.Projectiles.Typeless Color col = Projectile.ai[1] == 5 ? (Color.Lerp(Color.Goldenrod, Color.Orchid, Utils.GetLerpValue(0.85f, 1f, Projectile.scale))) : Color.Goldenrod; - float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); - Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f * Projectile.scale, col * 0.7f, new Vector2(1, 0.3f), true, false, 1.5f); GeneralParticleHandler.SpawnParticle(spark); @@ -111,9 +109,8 @@ namespace CalamityMod.Projectiles.Typeless Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = Color.Goldenrod with { A = 0 }; - Color baseColor2 = Color.Khaki with { A = 0 }; - baseColor.A = 0; + Color baseColor = Color.Goldenrod with { A = 150 }; + Color baseColor2 = Color.Khaki with { A = 150 }; baseColor *= lerpMult; baseColor2 *= lerpMult; Vector2 origin = texture.Size() / 2f; @@ -158,8 +155,6 @@ namespace CalamityMod.Projectiles.Typeless Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.5f, 10); GeneralParticleHandler.SpawnParticle(orb2); - Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.65f, 15, true); - GeneralParticleHandler.SpawnParticle(orb3); for (int i = 0; i < 4; i++) { @@ -167,9 +162,12 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(spark); } - // Sub projectiles spawning sub explosions... yea it needs armor pen - Projectile explo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0.75f); - explo.ArmorPenetration = 30; + if (Main.myPlayer == Projectile.owner) + { + // Sub projectiles spawning sub explosions... yea it needs armor pen + Projectile explo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0.75f); + explo.ArmorPenetration = 30; + } } } public override bool? CanDamage() => time > 15 ? null : false; diff --git a/Projectiles/Typeless/HyperiusBleed.cs b/Projectiles/Typeless/HyperiusBleed.cs new file mode 100644 index 0000000000..173f4a5787 --- /dev/null +++ b/Projectiles/Typeless/HyperiusBleed.cs @@ -0,0 +1,20 @@ +using CalamityMod.Items.Ammo; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HyperiusBleed : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + + modifiers.HideCombatText(); // Has special combat text + + SoundEngine.PlaySound(HyperiusBullet.hit with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f), MaxInstances = 10 }, Projectile.Center); + } + } +} diff --git a/Projectiles/Typeless/HyperiusDamage.cs b/Projectiles/Typeless/HyperiusDamage.cs new file mode 100644 index 0000000000..bb700a296e --- /dev/null +++ b/Projectiles/Typeless/HyperiusDamage.cs @@ -0,0 +1,22 @@ +using CalamityMod.Items.Ammo; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HyperiusDamage : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + + modifiers.HideCombatText(); // Has special combat text + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = Projectile.damage; // Always does the exact damage of the hit so that it doesn't double scale with defense and dr + + SoundEngine.PlaySound(HyperiusBullet.hit with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f), MaxInstances = 10 }, Projectile.Center); + } + } +} diff --git a/Projectiles/Typeless/LeviAmberDash.cs b/Projectiles/Typeless/LeviAmberDash.cs index ce78561a5f..0ac512a5bc 100644 --- a/Projectiles/Typeless/LeviAmberDash.cs +++ b/Projectiles/Typeless/LeviAmberDash.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,56 +17,147 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; + public Color effectsColor = Color.White; + public float fxFade = 0; + public bool isAlive = true; + public bool onSpawn = true; + public Vector2 aimVel; + public bool visuals => Owner.Calamity().lAmbergrisVisual; private static float ExplosionRadius = 85f; public static readonly SoundStyle Slap = new("CalamityMod/Sounds/Custom/WetSlap", 4) { Volume = 0.8f, PitchVariance = 0.3f }; - public override void SetDefaults() { - //These shouldn't matter because its circular - Projectile.width = 85; - Projectile.height = 85; + Projectile.width = (int)ExplosionRadius; + Projectile.height = (int)ExplosionRadius; Projectile.friendly = true; Projectile.DamageType = AverageDamageClass.Instance; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 4; + Projectile.timeLeft = 15; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; + Projectile.localNPCHitCooldown = 18; } + public override void AI() + { + if (onSpawn && visuals) + { + Particle pulse = new CustomSpark(Owner.Center, Owner.velocity.SafeNormalize(Vector2.UnitX) * 9, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 23, 0.095f, Color.MediumTurquoise, new Vector2(1f, 1.7f), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomSpark(Owner.Center, Owner.velocity.SafeNormalize(Vector2.UnitX) * 12, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 20, 0.065f, Color.DeepSkyBlue, new Vector2(1f, 1.7f), shrinkSpeed: -0.23f); + GeneralParticleHandler.SpawnParticle(pulse2); + onSpawn = false; + } + if (Owner.dashDelay != -1) + isAlive = false; + if (isAlive) + Projectile.timeLeft++; + Projectile.Center = Owner.Center; + + if (effectsColor == Color.White) + aimVel = Owner.velocity; + else + { + aimVel = Vector2.Lerp(aimVel, Owner.velocity, 0.2f); + } + + if (isAlive) + { + float goalSize = Utils.GetLerpValue(5, 15, Math.Abs(aimVel.X), true); + if (goalSize < fxFade) + fxFade = MathHelper.Lerp(fxFade, goalSize, 0.03f); + else + fxFade = goalSize; + } + else + { + fxFade = MathHelper.Lerp(fxFade, 0, 0.13f); + } + + + float rate = Main.GlobalTimeWrappedHourly * 22; + List eColors = new List() + { + Color.DarkTurquoise, + Color.DeepSkyBlue, + Color.MediumTurquoise + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + effectsColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (visuals) + { + int dir = MathF.Sign(aimVel.X); + Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX); + float sparkscale2 = 0.35f * Math.Max(fxFade, 0.5f); + for (int i = -1; i <= 1; i += 2) + { + Vector2 sparkVelocity = safeVel.RotatedBy(dir * 1.5f * i) - safeVel * 3; + Vector2 sparkPlace = Owner.Center + (((safeVel * 15).RotatedBy(2f * dir * i) * 1.5f) + safeVel.RotatedBy(0.5f * i * dir) * 30) * fxFade; + Particle spark = new CustomSpark(sparkPlace, sparkVelocity.RotatedByRandom(0.1f), "CalamityMod/Particles/BloomCircle", false, 6, sparkscale2, effectsColor * fxFade, new Vector2(0.8f, 2f), shrinkSpeed: 1.1f); + GeneralParticleHandler.SpawnParticle(spark); + + if (isAlive) + { + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(sparkPlace, dustStyle, sparkVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(3, 5)); + dust2.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust2.color = effectsColor; + dust2.noGravity = true; + dust2.fadeIn = Main.rand.NextFloat(0f, 0.7f); + } + } + } + + if (Owner.dead || (!isAlive && fxFade < 0.1f) || Owner.velocity == Vector2.Zero) + Projectile.Kill(); + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); - target.MoveNPC(launchVel, 16, true); + SoundStyle sound = new("CalamityMod/Sounds/Item/WaterSplash", 2); + SoundEngine.PlaySound(sound with { Volume = 0.2f, Pitch = Main.rand.NextFloat(0.35f, 0.5f), MaxInstances = -1 }, Projectile.Center); target.AddBuff(BuffID.Wet, 300); target.AddBuff(ModContent.BuffType(), 180); - SoundEngine.PlaySound(SoundID.Item85 with { Volume = 0.4f, PitchVariance = 0.4f }, Projectile.Center); - for (int i = 0; i < 3; ++i) + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + target.MoveNPC(launchVel, 20, true); + + for (int i = 0; i <= 17; i++) { - int bloodLifetime = Main.rand.Next(20, 26); - float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); - Color bloodColor = Color.Lerp(Color.DodgerBlue, Color.DarkTurquoise, Main.rand.NextFloat()); - - if (Main.rand.NextBool(20)) - bloodScale *= 2f; - - float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); - Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 5 * randomSpeedMultiplier; - bloodVelocity.Y -= 5f; - BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); - GeneralParticleHandler.SpawnParticle(blood); + float variance = Main.rand.NextFloat(-0.4f, 0.4f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle); + dust2.scale = (Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance)) * 1.5f; + dust2.velocity = (aimVel.SafeNormalize(Vector2.UnitX).RotatedBy(variance) - Vector2.UnitY * 0.3f) * Main.rand.NextFloat(15, 35f) * (1 - Math.Abs(variance) * 1.3f); + dust2.color = Main.rand.NextBool() ? Color.MediumTurquoise : Color.DeepSkyBlue; + dust2.noGravity = false; + dust2.fadeIn = Main.rand.NextFloat(0f, 1.2f); } - } + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - public override bool? CanDamage() => base.CanDamage(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + public override bool? CanDamage() => (isAlive ? null : false); + public override bool PreDraw(ref Color lightColor) { - modifiers.HitDirectionOverride = Math.Sign(Owner.direction); - } + if (effectsColor == Color.White || !visuals) + return false; + float sine = MathHelper.Lerp(Math.Abs((float)Math.Sin(Main.GlobalTimeWrappedHourly * 50f / MathHelper.Pi)), 0.8f, 0.7f); + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged").Value; + + for (int i = 0; i < 10; i++) + { + float bScale2 = 0.75f; + Vector2 scale = new Vector2((1 - i * 0.13f) * sine, (1 + i * 0.012f) + fxFade * 0.2f) * (bScale2 + i * 0.08f) * fxFade * 0.27f; + Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition + aimVel.SafeNormalize(Vector2.UnitX) * -15, null, Color.Lerp(Color.Aquamarine, effectsColor, i * 0.15f) with { A = 0 } * fxFade * 1f, aimVel.ToRotation() + MathHelper.PiOver2, bTexture.Size() * 0.5f, scale, i % 2 == 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + return false; + } public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Typeless/Luxor.cs b/Projectiles/Typeless/Luxor.cs index ca5210dd07..bc170f8aa9 100644 --- a/Projectiles/Typeless/Luxor.cs +++ b/Projectiles/Typeless/Luxor.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld).ToRotation() + MathHelper.PiOver2; - fxFade = (float)Math.Pow(Utils.GetLerpValue(30, 0, attackTimer, true), 3) + postFireBoost; + fxFade = moddedOwner.luxorsGiftVanity ? 1 : (float)Math.Pow(Utils.GetLerpValue(30, 0, attackTimer, true), 3) + postFireBoost; if (idleTimer >= 280) { @@ -121,81 +121,84 @@ namespace CalamityMod.Projectiles.Typeless } - if (attackTimer == 0 && moddedOwner.luxorHit) + if (!moddedOwner.luxorsGiftVanity) { - int attackSpeed = 0; - int attackDamage = 0; - int projType = 0; - switch (classType) + if (attackTimer == 0 && moddedOwner.luxorHit) { - case 0: attackSpeed = LuxorsGift.classlessAttackSpeed; attackDamage = LuxorsGift.classlessDamage; projType = ModContent.ProjectileType(); break; - case 1: attackSpeed = LuxorsGift.meleeAttackSpeed; attackDamage = LuxorsGift.meleeDamage; projType = ModContent.ProjectileType(); break; - case 2: attackSpeed = LuxorsGift.rangedAttackSpeed; attackDamage = LuxorsGift.rangedDamage; projType = ModContent.ProjectileType(); break; - case 3: attackSpeed = LuxorsGift.magicAttackSpeed; attackDamage = LuxorsGift.magicDamage; projType = ModContent.ProjectileType(); break; - case 4: attackSpeed = LuxorsGift.summonerAttackSpeed; attackDamage = LuxorsGift.summonerDamage; projType = ModContent.ProjectileType(); break; - case 5: attackSpeed = LuxorsGift.rogueAttackSpeed; attackDamage = LuxorsGift.rogueDamage; projType = ModContent.ProjectileType(); break; - } - float powerMult = Utils.GetLerpValue(-120, 140, attackSpeed, true); // An intensity multiplier based on the fire rate of the mode - if (Main.zenithWorld) // Just like old times - { - attackSpeed = 0; - attackDamage = Math.Max(1, (int)(Owner.HeldItem.damage * Utils.Remap(Owner.HeldItem.useAnimation, 3, 120, 0.025f, 1f, false))); - } - - for (int i = 0; i < (int)(20 * powerMult); i++) // Firing dust - { - Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 12 * powerMult; - Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); - dust.noGravity = !Main.rand.NextBool(3); - dust.scale = Main.rand.NextFloat(0.75f, 1.4f) * powerMult; - dust.color = usedColor; - dust.noLightEmittence = true; - } - if (classType == 1) // Melee shotgun - { - for (int i = -1; i <= 1; i++) + int attackSpeed = 0; + int attackDamage = 0; + int projType = 0; + switch (classType) { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedBy(-0.12f * i * Main.rand.NextFloat(0.7f, 1f)) * (12 - Main.rand.NextFloat(0f, 0.6f) - Math.Abs(i)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI); + case 0: attackSpeed = LuxorsGift.classlessAttackSpeed; attackDamage = LuxorsGift.classlessDamage; projType = ModContent.ProjectileType(); break; + case 1: attackSpeed = LuxorsGift.meleeAttackSpeed; attackDamage = LuxorsGift.meleeDamage; projType = ModContent.ProjectileType(); break; + case 2: attackSpeed = LuxorsGift.rangedAttackSpeed; attackDamage = LuxorsGift.rangedDamage; projType = ModContent.ProjectileType(); break; + case 3: attackSpeed = LuxorsGift.magicAttackSpeed; attackDamage = LuxorsGift.magicDamage; projType = ModContent.ProjectileType(); break; + case 4: attackSpeed = LuxorsGift.summonerAttackSpeed; attackDamage = LuxorsGift.summonerDamage; projType = ModContent.ProjectileType(); break; + case 5: attackSpeed = LuxorsGift.rogueAttackSpeed; attackDamage = LuxorsGift.rogueDamage; projType = ModContent.ProjectileType(); break; + } + float powerMult = Utils.GetLerpValue(-120, 140, attackSpeed, true); // An intensity multiplier based on the fire rate of the mode + if (Main.zenithWorld) // Just like old times + { + attackSpeed = 0; + attackDamage = Math.Max(1, (int)(Owner.HeldItem.damage * Utils.Remap(Owner.HeldItem.useAnimation, 3, 120, 0.025f, 1f, false))); + } + + for (int i = 0; i < (int)(20 * powerMult); i++) // Firing dust + { + Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 12 * powerMult; + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + dust.noGravity = !Main.rand.NextBool(3); + dust.scale = Main.rand.NextFloat(0.75f, 1.4f) * powerMult; + dust.color = usedColor; + dust.noLightEmittence = true; + } + if (classType == 1) // Melee shotgun + { + for (int i = -1; i <= 1; i++) + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedBy(-0.12f * i * Main.rand.NextFloat(0.7f, 1f)) * (12 - Main.rand.NextFloat(0f, 0.6f) - Math.Abs(i)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI); + proj.ArmorPenetration = LuxorsGift.luxArmorPen; + } + for (int i = 0; i < 5; i++) // These are visual + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedByRandom(0.4f) * (12 - Main.rand.NextFloat(2f, 5f)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI, 5); + proj.timeLeft = 95; + } + } + else // Everything else + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld) * 12, projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI); proj.ArmorPenetration = LuxorsGift.luxArmorPen; + if (classType == 5) // Rogue has gravity so velocity is adjusted a bit + proj.velocity.Y -= 1.5f; } - for (int i = 0; i < 5; i++) // These are visual + + SoundStyle blam = new("CalamityMod/Sounds/Item/GunShotSmall"); + SoundEngine.PlaySound(blam with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.6f, 0.8f) }, tipPosition); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, Pitch = 0.2f }, tipPosition); + + if (classType == 5 && rogueChain) { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld).RotatedByRandom(0.4f) * (12 - Main.rand.NextFloat(2f, 5f)), projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI, 5); - proj.timeLeft = 95; + rogueChain = false; + attackTimer = attackSpeed / 3; } + else + { + attackTimer = attackSpeed; + moddedOwner.luxorHit = false; + if (!CalamityClientConfig.Instance.Photosensitivity) + postFireBoost = 1.7f; + idleTimer = 0; + rogueChain = true; + } + Projectile.netUpdate = true; } - else // Everything else - { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), tipPosition, Utils.DirectionTo(tipPosition, Owner.Calamity().mouseWorld) * 12, projType, (int)(Owner.GetDamage(itemClass).ApplyTo(attackDamage)), 0f, Owner.whoAmI); - proj.ArmorPenetration = LuxorsGift.luxArmorPen; - if (classType == 5) // Rogue has gravity so velocity is adjusted a bit - proj.velocity.Y -= 1.5f; - } - - SoundStyle blam = new("CalamityMod/Sounds/Item/GunShotSmall"); - SoundEngine.PlaySound(blam with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.6f, 0.8f) }, tipPosition); - SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, Pitch = 0.2f }, tipPosition); - - if (classType == 5 && rogueChain) - { - rogueChain = false; - attackTimer = attackSpeed / 3; - } - else - { - attackTimer = attackSpeed; - moddedOwner.luxorHit = false; - if (!CalamityClientConfig.Instance.Photosensitivity) - postFireBoost = 1.7f; - idleTimer = 0; - rogueChain = true; - } - Projectile.netUpdate = true; + if (attackTimer > 0) + attackTimer--; + if (postFireBoost > 0) // Quickly fade out the increased poost fire visuals + postFireBoost -= 0.2f; } - if (attackTimer > 0) - attackTimer--; - if (postFireBoost > 0) // Quickly fade out the increased poost fire visuals - postFireBoost -= 0.2f; if (time % 2 == 0 && false) { @@ -210,7 +213,7 @@ namespace CalamityMod.Projectiles.Typeless float idleFade = Utils.GetLerpValue(280, 300, idleTimer, true); Lighting.AddLight(tipPosition, Color.Lerp(usedColor, Color.Lerp(usedColor, Color.White, 0.5f), idleFade).ToVector3() * (0.5f * MathHelper.Lerp(fxFade, 1, 0.55f) + 0.35f * idleFade)); - if (moddedOwner.luxorsGift) + if (moddedOwner.luxorsGift || moddedOwner.luxorsGiftVanity) Projectile.timeLeft++; else Projectile.Kill(); @@ -218,15 +221,17 @@ namespace CalamityMod.Projectiles.Typeless Projectile.Kill(); time++; - if (!moddedOwner.luxorHit) + if (!moddedOwner.luxorHit && !moddedOwner.luxorsGiftVanity) idleTimer++; + else if (moddedOwner.luxorsGiftVanity) + idleTimer = 0; } public override bool PreDraw(ref Color lightColor) { Asset tex = ModContent.Request(Texture); Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Texture2D cTexture = ModContent.Request("CalamityMod/Particles/Light").Value; - float idleFade = (float)Math.Pow(Utils.GetLerpValue(280, 300, idleTimer, true), 5); + float idleFade = moddedOwner.luxorsGiftVanity ? 0 : (float)Math.Pow(Utils.GetLerpValue(280, 300, idleTimer, true), 5); Color drawColor = usedColor; Color bodyColor = Color.Lerp(lightColor, Color.Gold with { A = 0 }, idleFade); float drawMult = Math.Max(idleFade, fxFade); diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 3bb6f28ae9..6a575b5809 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -1,4 +1,5 @@ using CalamityMod.Balancing; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,11 +10,13 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class OmegaBlueTentacle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public bool initSegments = false; public Vector2[] segment = new Vector2[6]; + private Player Owner => Main.player[Projectile.owner]; public override void SetDefaults() { @@ -43,18 +46,17 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - Player player = Main.player[Projectile.owner]; - bool hentai = player.Calamity().omegaBlueHentai; - if (player.active && player.Calamity().omegaBlueSet) + bool madness = Owner.Calamity().omegaBlueAbyssalMadness; + if (Owner.active && Owner.Calamity().omegaBlueSet) Projectile.timeLeft = 8; - //tentacle head movement (homing) - Vector2 playerVel = player.position - player.oldPosition; + // Tentacle head movement (homing) + Vector2 playerVel = Owner.position - Owner.oldPosition; Projectile.position += playerVel; Projectile.ai[0]++; if (Projectile.ai[0] >= 0f) { - Vector2 home = player.Center + new Vector2(50, 0).RotatedBy(MathHelper.ToRadians(60) * Projectile.ai[1]); + Vector2 home = Owner.Center + new Vector2(50, 0).RotatedBy(MathHelper.ToRadians(60) * Projectile.ai[1]); Vector2 distance = home - Projectile.Center; float range = distance.Length(); distance.Normalize(); @@ -62,7 +64,7 @@ namespace CalamityMod.Projectiles.Typeless { if (range > 13f) { - Projectile.ai[0] = -1f; //if in fast mode, stay fast until back in range + Projectile.ai[0] = -1f; // If in fast mode, stay fast until back in range if (range > 1300f) { Projectile.Kill(); @@ -71,8 +73,8 @@ namespace CalamityMod.Projectiles.Typeless } else { - if (hentai) - Projectile.ai[0] = 120f;//45f + Main.rand.Next(45); + if (madness) + Projectile.ai[0] = 120f; Projectile.velocity.Normalize(); Projectile.velocity *= 3f + Main.rand.NextFloat(3f); Projectile.netUpdate = true; @@ -82,6 +84,7 @@ namespace CalamityMod.Projectiles.Typeless { distance /= 8f; } + if (range > 120f) //switch to fast return mode { Projectile.ai[0] = -1f; @@ -94,7 +97,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.ai[0] > 120f) //attack nearby enemy { Projectile.ai[0] = 10 + Main.rand.Next(10); - float maxDistance = hentai ? 900f : 600f; + float maxDistance = madness ? 900f : 600f; int target = -1; foreach (NPC npc in Main.ActiveNPCs) { @@ -110,11 +113,7 @@ namespace CalamityMod.Projectiles.Typeless } if (target != -1) { - Projectile.velocity = Main.npc[target].Center - Projectile.Center; - Projectile.velocity.Normalize(); - Projectile.velocity *= 13f; - Projectile.velocity += Main.npc[target].velocity / 2f; - Projectile.velocity -= playerVel / 2f; + Projectile.velocity = Vector2.Normalize(Main.npc[target].Center - Projectile.Center) * 13f + (Main.npc[target].velocity / 2f) - (playerVel / 2f); Projectile.ai[0] *= -1f; } Projectile.netUpdate = true; @@ -122,14 +121,14 @@ namespace CalamityMod.Projectiles.Typeless } //tentacle segment updates - segment[0] = player.Center; + segment[0] = Owner.Center; for (int i = 1; i < 5; i++) { MoveSegment(segment[i - 1], ref segment[i], segment[i + 1]); } MoveSegment(segment[4], ref segment[5], Projectile.Center + Projectile.velocity); - if (hentai) + if (madness) { if (Projectile.ai[0] != -1f) Projectile.ai[0]++; @@ -138,19 +137,15 @@ namespace CalamityMod.Projectiles.Typeless Vector2 dustPos = Projectile.position + Projectile.velocity; Vector2 tickVel = dustPos - Projectile.oldPosition; //playerVel + projectile.velocity * 2f; dustPos += new Vector2(Projectile.width / 2, 0).RotatedBy(Projectile.rotation); - dustPos.X -= 4; - dustPos.X += Projectile.width / 2; - dustPos.Y -= 4; - dustPos.Y += Projectile.height / 2; + dustPos += new Vector2(Projectile.width / 2 - 4, Projectile.height / 2 - 4); const float factor = 3f; int limit = (int)(tickVel.Length() / factor); if (limit == 0) { - int d = Dust.NewDust(dustPos, 0, 0, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 0.9f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity = Vector2.Zero; + Dust d = Dust.NewDustPerfect(dustPos, DustID.PurificationPowder, Vector2.Zero, 100, Color.Transparent, 0.9f); + d.noGravity = true; + d.noLight = true; + d.fadeIn = 1f; } else { @@ -158,12 +153,11 @@ namespace CalamityMod.Projectiles.Typeless tickVel *= factor; for (int i = 0; i <= limit; i++) { - int d = Dust.NewDust(dustPos, 0, 0, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 0.9f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].position -= tickVel * i; - Main.dust[d].velocity = Vector2.Zero; + Dust d = Dust.NewDustPerfect(dustPos, DustID.PurificationPowder, Vector2.Zero, 100, Color.Transparent, 0.9f); + d.noGravity = true; + d.noLight = true; + d.fadeIn = 1f; + d.position -= tickVel * i; } } } @@ -177,13 +171,13 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Main.player[Projectile.owner].Calamity().omegaBlueHentai) + if (Owner.Calamity().omegaBlueAbyssalMadness) modifiers.SetCrit(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].lifeSteal > 0f && !Main.player[Projectile.owner].moonLeech && target.lifeMax > 5) + if (Projectile.owner == Main.myPlayer && Owner.lifeSteal > 0f && !Owner.moonLeech && target.lifeMax > 5) { int healAmount = 10 * damageDone / Projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > BalancingConstants.LifeStealCap) @@ -191,9 +185,9 @@ namespace CalamityMod.Projectiles.Typeless if (healAmount > 0) { - Main.player[Projectile.owner].lifeSteal -= healAmount; - if (Main.player[Projectile.owner].Calamity().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay - Main.player[Projectile.owner].lifeSteal += healAmount / 2; + Owner.lifeSteal -= healAmount; + if (Owner.Calamity().omegaBlueAbyssalMadness) // Always crits during Abyssal Madness, this makes it have same lifesteal delay + Owner.lifeSteal += healAmount / 2; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, Projectile.owner, Projectile.owner, healAmount); } @@ -205,7 +199,7 @@ namespace CalamityMod.Projectiles.Typeless Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - GameShaders.Armor.ApplySecondary(Main.player[Projectile.owner].cBody, Main.player[Projectile.owner], new DrawData?()); + GameShaders.Armor.ApplySecondary(Owner.cBody, Owner, new DrawData?()); Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D segmentSprite = ModContent.Request("CalamityMod/Projectiles/Typeless/OmegaBlueTentacleSegment1").Value; for (int i = 0; i < 5; i++) diff --git a/Projectiles/Typeless/PauldronDash.cs b/Projectiles/Typeless/PauldronDash.cs index 31a4099d5a..efc5b8021d 100644 --- a/Projectiles/Typeless/PauldronDash.cs +++ b/Projectiles/Typeless/PauldronDash.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -16,22 +17,92 @@ namespace CalamityMod.Projectiles.Typeless public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; private static float ExplosionRadius = 75f; - + public Color effectsColor = Color.White; + public float fxFade = 0; + public bool isAlive = true; + public bool visuals => Owner.Calamity().sPauldronVisual; + public Vector2 aimVel; public override void SetDefaults() { - //These shouldn't matter because its circular - Projectile.width = 75; - Projectile.height = 75; + Projectile.width = (int)ExplosionRadius; + Projectile.height = (int)ExplosionRadius; Projectile.friendly = true; Projectile.DamageType = AverageDamageClass.Instance; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 4; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 22; + Projectile.penetrate = -1; + Projectile.timeLeft = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 18; } + public override void AI() + { + if (Owner.dashDelay != -1) + isAlive = false; + if (isAlive) + Projectile.timeLeft++; + Projectile.Center = Owner.Center; + if (effectsColor == Color.White) + aimVel = Owner.velocity; + else + { + aimVel = Vector2.Lerp(aimVel, Owner.velocity, 0.2f); + } + + if (isAlive) + { + float goalSize = Utils.GetLerpValue(5, 15, Math.Abs(aimVel.X), true); + if (goalSize < fxFade) + fxFade = MathHelper.Lerp(fxFade, goalSize, 0.03f); + else + fxFade = goalSize; + } + else + { + fxFade = MathHelper.Lerp(fxFade, 0, 0.08f); + } + + + float rate = Main.GlobalTimeWrappedHourly * 22; + List eColors = new List() + { + Color.OrangeRed, + Color.Orange, + Color.DarkOrange + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + effectsColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (visuals) + { + int dir = MathF.Sign(aimVel.X); + Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX); + float sparkscale2 = 0.35f * Math.Max(fxFade, 0.5f); + for (int i = -1; i <= 1; i += 2) + { + Vector2 sparkVelocity = safeVel.RotatedBy(dir * 4.3f * i) - safeVel * 3; + Vector2 sparkPlace = Owner.Center + (safeVel * 15).RotatedBy(2f * dir * i) * 1.5f; + Particle spark = new VelChangingSpark(sparkPlace, sparkVelocity, -safeVel * 5, "CalamityMod/Particles/BloomCircle", 10, sparkscale2, effectsColor * fxFade, new Vector2(0.8f, 2f), shrinkSpeed: 0.4f, lerpRate: 0.1f); + GeneralParticleHandler.SpawnParticle(spark); + + if (isAlive) + { + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(sparkPlace + safeVel * 30, dustStyle, sparkVelocity.RotatedBy(-0.6f * i * dir).RotatedByRandom(0.3f) * Main.rand.NextFloat(3, 5)); + dust2.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust2.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed; + dust2.noGravity = true; + } + } + } + + if (Owner.dead || (!isAlive && fxFade < 0.1f) || Owner.velocity == Vector2.Zero) + Projectile.Kill(); + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 240); @@ -45,43 +116,61 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i <= 12; i++) { float variance = Main.rand.NextFloat(-0.7f, 0.7f); - int dustStyle = ModContent.DustType(); + int dustStyle = ModContent.DustType(); Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity); - dust2.scale = (Main.rand.NextFloat(1.1f, 1.3f) - Math.Abs(variance)) * 2.5f; - dust2.velocity = (Vector2.UnitY * -18).RotatedBy(variance) * Main.rand.NextFloat(0.7f, 1f) * (1 - Math.Abs(variance) * 1.3f); + dust2.scale = (Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance)) * 2.5f; + dust2.velocity = (Vector2.UnitY * -25).RotatedBy(variance) * Main.rand.NextFloat(0.7f, 1f) * (1 - Math.Abs(variance) * 1.3f); dust2.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed; dust2.noGravity = false; + dust2.fadeIn = 0.35f; Particle spark = new SparkParticle(Projectile.Center, new Vector2(17, 17).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark); } - float baseRot = Main.rand.NextFloat(-9f, 9f); + if (visuals) + { + float baseRot = Main.rand.NextFloat(-9f, 9f); + for (int i = 0; i < 5; i++) + { + float rot = Main.rand.NextFloat(-0.3f, 0.3f); + for (int b = 0; b < 2; b++) + { + Vector2 pulseVel = new Vector2(0, Main.rand.NextFloat(-7, -9)).RotatedBy(i * (MathHelper.ToRadians(360f) / 5)).RotatedBy(rot + baseRot + 0.9f); + Particle orb = new CustomPulse(target.Center, pulseVel, (Main.rand.NextBool() ? Color.Orange : Color.OrangeRed) * 0.9f, "CalamityMod/Projectiles/Summon/RustyBeaconPulse", Vector2.One, pulseVel.ToRotation(), 0.2f, Main.rand.NextFloat(0.55f, 0.85f) * 3f, Main.rand.Next(14, 19 + 1)); + GeneralParticleHandler.SpawnParticle(orb); + } + Particle orb2 = new CustomSpark(target.Center, new Vector2(0, -7).RotatedBy(i * (MathHelper.ToRadians(360f) / 5)).RotatedBy(rot + baseRot), "CalamityMod/Particles/BloomLineFade", false, 13, 0.095f, Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, new Vector2(2.9f, 0.5f), shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(orb2); + } + + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomSpark(target.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 20, 1.2f, Color.OrangeRed, new Vector2(1, 1), true, true, glowCenterScale: 0.7f, glowOpacity: 0.8f); + GeneralParticleHandler.SpawnParticle(bloom); + } + } + + Owner.Calamity().GeneralScreenShakePower = 4f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 5, 0, Projectile.owner); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + public override bool? CanDamage() => (isAlive ? null : false); + public override bool PreDraw(ref Color lightColor) + { + if (effectsColor == Color.White || !visuals) + return false; + + float sine = MathHelper.Lerp(Math.Abs((float)Math.Sin(Main.GlobalTimeWrappedHourly * 50f / MathHelper.Pi)), 0.8f, 0.7f); + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge").Value; + for (int i = 0; i < 5; i++) { - float rot = Main.rand.NextFloat(-0.3f, 0.3f); - for (int b = 0; b < 2; b++) - { - Vector2 pulseVel = new Vector2(0, Main.rand.NextFloat(-7, -9)).RotatedBy(i * (MathHelper.ToRadians(360f) / 5)).RotatedBy(rot + baseRot + 0.9f); - Particle orb = new CustomPulse(target.Center, pulseVel, (Main.rand.NextBool() ? Color.Orange : Color.OrangeRed) * 0.9f, "CalamityMod/Projectiles/Summon/RustyBeaconPulse", Vector2.One, pulseVel.ToRotation(), 0.2f, Main.rand.NextFloat(0.55f, 0.85f) * 3f, Main.rand.Next(14, 19 + 1)); - GeneralParticleHandler.SpawnParticle(orb); - } - Particle orb2 = new CustomSpark(target.Center, new Vector2(0, -7).RotatedBy(i * (MathHelper.ToRadians(360f) / 5)).RotatedBy(rot + baseRot), "CalamityMod/Particles/BloomLineFade", false, 13, 0.095f, Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, new Vector2(2.9f, 0.5f), shrinkSpeed: 0.9f); - GeneralParticleHandler.SpawnParticle(orb2); - } - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0, Projectile.owner); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - public override bool? CanDamage() => base.CanDamage(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - Owner.Calamity().GeneralScreenShakePower = 4f; - for (int i = 0; i < 2; i++) - { - Particle bloom = new CustomSpark(target.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 20, 1.2f, Color.OrangeRed, new Vector2(1, 1), true, true, glowCenterScale: 0.7f, glowOpacity: 0.8f); - GeneralParticleHandler.SpawnParticle(bloom); + float bScale2 = 0.75f; + Vector2 scale = new Vector2((1 - i * 0.15f) * sine, (1 + i * 0.22f) + fxFade * 0.2f) * (bScale2 - i * 0.08f) * fxFade * 0.23f; + Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition + aimVel.SafeNormalize(Vector2.UnitX) * -15, null, Color.Lerp(effectsColor, Color.White, i * 0.15f) with { A = 0 } * fxFade, aimVel.ToRotation() + MathHelper.PiOver2, bTexture.Size() * 0.5f, scale, SpriteEffects.None, 0); } + return false; } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Typeless/PauldronExplosion.cs b/Projectiles/Typeless/PauldronExplosion.cs index ee02ad48c7..db6a871702 100644 --- a/Projectiles/Typeless/PauldronExplosion.cs +++ b/Projectiles/Typeless/PauldronExplosion.cs @@ -31,21 +31,19 @@ namespace CalamityMod.Projectiles.Typeless Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 240); - - //Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.8f, 1.1f), 20); - //GeneralParticleHandler.SpawnParticle(pulse); - //Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.6f, 0.9f), 20); - //GeneralParticleHandler.SpawnParticle(pulse2); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); public override bool? CanDamage() => base.CanDamage(); public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + float minMult = 0.3f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); target.MoveNPC(launchVel, 15, true); } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index cc5b122fa2..831a4ae3f5 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -4,6 +4,7 @@ using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -17,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class RelicOfDeliveranceSpear : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Typeless/SCalAltarArenaVisual.cs b/Projectiles/Typeless/SCalAltarArenaVisual.cs new file mode 100644 index 0000000000..6ed98e6c53 --- /dev/null +++ b/Projectiles/Typeless/SCalAltarArenaVisual.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; +using CalamityMod.NPCs.SupremeCalamitas; + +namespace CalamityMod.Projectiles.Typeless +{ + public class SCalAltarArenaVisual : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private const int VisualDuration = 900; + private Particle topLine; + private Particle bottomLine; + private Particle leftLine; + private Particle rightLine; + public override void SetStaticDefaults() => ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = VisualDuration; + } + + public override void AI() + { + // Spawn in the border lines + if (topLine == null) + { + // Arena is smaller in Death Mode + float arenaHalfLength = Projectile.ai[0] == 1f ? 1000f : 1250f; + Vector2 topLeft = Projectile.Center + new Vector2(-arenaHalfLength, -arenaHalfLength); + Vector2 topRight = Projectile.Center + new Vector2(arenaHalfLength, -arenaHalfLength); + Vector2 bottomLeft = Projectile.Center + new Vector2(-arenaHalfLength, arenaHalfLength); + Vector2 bottomRight = Projectile.Center + new Vector2(arenaHalfLength, arenaHalfLength); + + topLine = new BloomLineVFX(topLeft, topRight - topLeft, 1f, Color.Red, VisualDuration, true, true); + bottomLine = new BloomLineVFX(bottomLeft, bottomRight - bottomLeft, 1f, Color.Red, VisualDuration, true, true); + leftLine = new BloomLineVFX(topLeft, bottomLeft - topLeft, 1f, Color.Red, VisualDuration, true, true); + rightLine = new BloomLineVFX(topRight, bottomRight - topRight, 1f, Color.Red, VisualDuration, true, true); + GeneralParticleHandler.SpawnParticle(topLine); + GeneralParticleHandler.SpawnParticle(bottomLine); + GeneralParticleHandler.SpawnParticle(leftLine); + GeneralParticleHandler.SpawnParticle(rightLine); + } + + if (NPC.AnyNPCs(ModContent.NPCType())) + Projectile.Kill(); + } + + public override void OnKill(int timeLeft) + { + topLine.Time = VisualDuration - 30; + bottomLine.Time = VisualDuration - 30; + leftLine.Time = VisualDuration - 30; + rightLine.Time = VisualDuration - 30; + } + } +} diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index c5f95893e9..6a43186f50 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -65,6 +65,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; if (Fired) { diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 6da5082c5c..89e9e698c0 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.alpha = 255; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 26e2976644..9984be55a6 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class TeslaAura : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/TransformerBlob.cs b/Projectiles/Typeless/TransformerBlob.cs index 3184708412..b012f5def2 100644 --- a/Projectiles/Typeless/TransformerBlob.cs +++ b/Projectiles/Typeless/TransformerBlob.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using Terraria.ModLoader.IO; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class TransformerBlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs index 0bc98e5c28..e40f380574 100644 --- a/Projectiles/Typeless/WulfrumDrillProj.cs +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Projectile.scale = 0.93f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index 687ac2c0ca..493644d923 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -3,15 +3,10 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; -using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +32,7 @@ namespace CalamityMod.Projectiles.Typeless 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 float MaxReach => Owner.GetModPlayer().ActualMaxLength; public override void SetStaticDefaults() { @@ -104,7 +99,7 @@ namespace CalamityMod.Projectiles.Typeless else if (State == HookState.Retracting) { - Projectile.velocity = BetweenOwner.SafeNormalize(Vector2.One) * WulfrumPackPlayer.ReturnVelocity; + Projectile.velocity = BetweenOwner.SafeNormalize(Vector2.One) * Owner.GetModPlayer().ActualReturnVelocity; Projectile.Center += Vector2.UnitY * 0.5f; if (BetweenOwner.Length() < 25f) @@ -164,7 +159,7 @@ namespace CalamityMod.Projectiles.Typeless continue; OnGrapple(worldPos, x, y); - + break; } @@ -177,7 +172,7 @@ namespace CalamityMod.Projectiles.Typeless { 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) + if (mp.Grapple > -1 && 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 @@ -231,7 +226,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Vector2[] segmentPositions = new Vector2[] {Projectile.Center, Owner.Center }; + Vector2[] segmentPositions = new Vector2[] { Projectile.Center, Owner.Center }; if (State == HookState.Grappling) segmentPositions = Owner.GetModPlayer().Segments.Select(x => x.position).ToArray(); diff --git a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs index 77398c4c76..e5597c0d2e 100644 --- a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs +++ b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs @@ -9,6 +9,6 @@ namespace CalamityMod.Systems { public override int Music => MusicID.Boss3; // I spent 20 minutes trying to get this music to play while forgetting to actually override this in the first place _ YuH public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; - public override bool IsSceneEffectActive(Player player) => Main.masterMode && CalamityWorld.revenge && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; + public override bool IsSceneEffectActive(Player player) => CalamityWorld.death && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; } } diff --git a/Skies/BossRushSky.cs b/Skies/BossRushSky.cs index c5c2d7c66c..7cc3f753df 100644 --- a/Skies/BossRushSky.cs +++ b/Skies/BossRushSky.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Skies private float GetIntensity() { if (ShouldDrawRegularly || Main.LocalPlayer?.Calamity().monolithBossRushShader > 0) - return 1f; + return 0.57f; float fadeRatio = BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime; return Utils.GetLerpValue(0.57f, 1f, fadeRatio, true); diff --git a/Sounds/Custom/BubbleCracklePop.ogg b/Sounds/Custom/BubbleCracklePop.ogg new file mode 100644 index 0000000000..f1f0f2deca Binary files /dev/null and b/Sounds/Custom/BubbleCracklePop.ogg differ diff --git a/Sounds/Custom/GFB/Jesus.ogg b/Sounds/Custom/GFB/Jesus.ogg new file mode 100644 index 0000000000..4cc26fb6f7 Binary files /dev/null and b/Sounds/Custom/GFB/Jesus.ogg differ diff --git a/Sounds/Custom/GFB/OceanShieldParryGFB.ogg b/Sounds/Custom/GFB/OceanShieldParryGFB.ogg new file mode 100644 index 0000000000..89985cebee Binary files /dev/null and b/Sounds/Custom/GFB/OceanShieldParryGFB.ogg differ diff --git a/Sounds/Custom/GungeonCreditMusic.mp3 b/Sounds/Custom/GungeonCreditMusic.mp3 deleted file mode 100644 index 801bdb972e..0000000000 Binary files a/Sounds/Custom/GungeonCreditMusic.mp3 and /dev/null differ diff --git a/Sounds/Custom/GungeonCreditMusic.ogg b/Sounds/Custom/GungeonCreditMusic.ogg new file mode 100644 index 0000000000..4a6a455070 Binary files /dev/null and b/Sounds/Custom/GungeonCreditMusic.ogg differ diff --git a/Sounds/Item/ApoctosisShoot.ogg b/Sounds/Item/ApoctosisShoot.ogg new file mode 100644 index 0000000000..bb04453a04 Binary files /dev/null and b/Sounds/Item/ApoctosisShoot.ogg differ diff --git a/Sounds/Item/DampExplosion.ogg b/Sounds/Item/DampExplosion.ogg new file mode 100644 index 0000000000..b153edeeaa Binary files /dev/null and b/Sounds/Item/DampExplosion.ogg differ diff --git a/Sounds/Item/ElectricBurst.ogg b/Sounds/Item/ElectricBurst.ogg new file mode 100644 index 0000000000..69a477afd8 Binary files /dev/null and b/Sounds/Item/ElectricBurst.ogg differ diff --git a/Sounds/Item/HolyFireBulletExplosion.ogg b/Sounds/Item/HolyFireBulletExplosion.ogg index b153edeeaa..a802c20625 100644 Binary files a/Sounds/Item/HolyFireBulletExplosion.ogg and b/Sounds/Item/HolyFireBulletExplosion.ogg differ diff --git a/Sounds/Item/HyperiusOverflow.ogg b/Sounds/Item/HyperiusOverflow.ogg new file mode 100644 index 0000000000..772d253f6a Binary files /dev/null and b/Sounds/Item/HyperiusOverflow.ogg differ diff --git a/Sounds/Item/ImmolatorCharge.ogg b/Sounds/Item/ImmolatorCharge.ogg new file mode 100644 index 0000000000..82f4e347ba Binary files /dev/null and b/Sounds/Item/ImmolatorCharge.ogg differ diff --git a/Sounds/Item/ImmolatorChargeLoop.ogg b/Sounds/Item/ImmolatorChargeLoop.ogg new file mode 100644 index 0000000000..c6af65b241 Binary files /dev/null and b/Sounds/Item/ImmolatorChargeLoop.ogg differ diff --git a/Sounds/Item/ImmolatorFire.ogg b/Sounds/Item/ImmolatorFire.ogg new file mode 100644 index 0000000000..9badc286dd Binary files /dev/null and b/Sounds/Item/ImmolatorFire.ogg differ diff --git a/Sounds/Item/ImmolatorPreExplode.ogg b/Sounds/Item/ImmolatorPreExplode.ogg new file mode 100644 index 0000000000..94818619ef Binary files /dev/null and b/Sounds/Item/ImmolatorPreExplode.ogg differ diff --git a/Sounds/Item/IonChargeLoop.ogg b/Sounds/Item/IonChargeLoop.ogg new file mode 100644 index 0000000000..be6a482886 Binary files /dev/null and b/Sounds/Item/IonChargeLoop.ogg differ diff --git a/Sounds/Item/LaserBurn.ogg b/Sounds/Item/LaserBurn.ogg new file mode 100644 index 0000000000..feea7d8cb8 Binary files /dev/null and b/Sounds/Item/LaserBurn.ogg differ diff --git a/Sounds/Item/LightCatch.ogg b/Sounds/Item/LightCatch.ogg new file mode 100644 index 0000000000..c76ef70c6f Binary files /dev/null and b/Sounds/Item/LightCatch.ogg differ diff --git a/Sounds/Item/LightMetal.ogg b/Sounds/Item/LightMetal.ogg new file mode 100644 index 0000000000..4b6ac95eb0 Binary files /dev/null and b/Sounds/Item/LightMetal.ogg differ diff --git a/Sounds/Item/LightThrow.ogg b/Sounds/Item/LightThrow.ogg new file mode 100644 index 0000000000..5bd9aa44f1 Binary files /dev/null and b/Sounds/Item/LightThrow.ogg differ diff --git a/Sounds/Item/MagicBlast.ogg b/Sounds/Item/MagicBlast.ogg new file mode 100644 index 0000000000..e8e088d672 Binary files /dev/null and b/Sounds/Item/MagicBlast.ogg differ diff --git a/Sounds/Item/NidhoggBigShot.ogg b/Sounds/Item/NidhoggBigShot.ogg new file mode 100644 index 0000000000..869809f522 Binary files /dev/null and b/Sounds/Item/NidhoggBigShot.ogg differ diff --git a/Sounds/Item/NidhoggCharge.ogg b/Sounds/Item/NidhoggCharge.ogg new file mode 100644 index 0000000000..25d09aa186 Binary files /dev/null and b/Sounds/Item/NidhoggCharge.ogg differ diff --git a/Sounds/Item/NidhoggFire.ogg b/Sounds/Item/NidhoggFire.ogg new file mode 100644 index 0000000000..00a153e283 Binary files /dev/null and b/Sounds/Item/NidhoggFire.ogg differ diff --git a/Sounds/Item/OracleHum.ogg b/Sounds/Item/OracleHum.ogg index d5cfe6cd1c..24cfa990b7 100644 Binary files a/Sounds/Item/OracleHum.ogg and b/Sounds/Item/OracleHum.ogg differ diff --git a/Sounds/Item/PhalanxSurgeCharge.ogg b/Sounds/Item/PhalanxSurgeCharge.ogg new file mode 100644 index 0000000000..dba7b23381 Binary files /dev/null and b/Sounds/Item/PhalanxSurgeCharge.ogg differ diff --git a/Sounds/Item/PhalanxSurgeChargeLoop.ogg b/Sounds/Item/PhalanxSurgeChargeLoop.ogg new file mode 100644 index 0000000000..873f8d3dce Binary files /dev/null and b/Sounds/Item/PhalanxSurgeChargeLoop.ogg differ diff --git a/Sounds/Item/PhalanxSurgeChargeMax.ogg b/Sounds/Item/PhalanxSurgeChargeMax.ogg new file mode 100644 index 0000000000..b04d83e262 Binary files /dev/null and b/Sounds/Item/PhalanxSurgeChargeMax.ogg differ diff --git a/Sounds/Item/PhalanxSurgeChargeShoot.ogg b/Sounds/Item/PhalanxSurgeChargeShoot.ogg new file mode 100644 index 0000000000..09e40f39d2 Binary files /dev/null and b/Sounds/Item/PhalanxSurgeChargeShoot.ogg differ diff --git a/Sounds/Item/PhalanxSurgeShoot.ogg b/Sounds/Item/PhalanxSurgeShoot.ogg new file mode 100644 index 0000000000..a827d96e41 Binary files /dev/null and b/Sounds/Item/PhalanxSurgeShoot.ogg differ diff --git a/Sounds/Item/PlasmaBig.ogg b/Sounds/Item/PlasmaBig.ogg new file mode 100644 index 0000000000..279a160f02 Binary files /dev/null and b/Sounds/Item/PlasmaBig.ogg differ diff --git a/Sounds/Item/PlasmaSmall.ogg b/Sounds/Item/PlasmaSmall.ogg new file mode 100644 index 0000000000..221d5ffe95 Binary files /dev/null and b/Sounds/Item/PlasmaSmall.ogg differ diff --git a/Sounds/Item/PulseSoundHeavy.ogg b/Sounds/Item/PulseSoundHeavy.ogg new file mode 100644 index 0000000000..e579bae7ef Binary files /dev/null and b/Sounds/Item/PulseSoundHeavy.ogg differ diff --git a/Sounds/Item/TaserLaunch.ogg b/Sounds/Item/TaserLaunch.ogg new file mode 100644 index 0000000000..1bf31cf9f5 Binary files /dev/null and b/Sounds/Item/TaserLaunch.ogg differ diff --git a/Sounds/Item/VoidDash.ogg b/Sounds/Item/VoidDash.ogg new file mode 100644 index 0000000000..52a3ab7ee5 Binary files /dev/null and b/Sounds/Item/VoidDash.ogg differ diff --git a/Systems/Collections/DonatorsNameList.cs b/Systems/Collections/DonatorsNameList.cs index ed851b871a..a339941ebd 100644 --- a/Systems/Collections/DonatorsNameList.cs +++ b/Systems/Collections/DonatorsNameList.cs @@ -297,7 +297,6 @@ namespace CalamityMod.Systems.Collections "Goblin", "NoOneElse", "Nicholas", - "Toasty", "oli saer", "Blobby6799", "Domrinth", diff --git a/Systems/Collections/MagicGunIDList.cs b/Systems/Collections/MagicGunIDList.cs index bc6544d228..9bce514ec6 100644 --- a/Systems/Collections/MagicGunIDList.cs +++ b/Systems/Collections/MagicGunIDList.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Systems.Collections ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), diff --git a/Systems/Collections/NPCs/EnemyImmunitiesList.cs b/Systems/Collections/NPCs/EnemyImmunitiesList.cs index 667c66cc2b..60d1d76aa7 100644 --- a/Systems/Collections/NPCs/EnemyImmunitiesList.cs +++ b/Systems/Collections/NPCs/EnemyImmunitiesList.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), diff --git a/Systems/Collections/NPCs/MinibossList.cs b/Systems/Collections/NPCs/MinibossList.cs index 97353eb626..f2e0ed4f62 100644 --- a/Systems/Collections/NPCs/MinibossList.cs +++ b/Systems/Collections/NPCs/MinibossList.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), - NPCType(), + NPCType(), NPCType(), NPCType(), NPCID.Pumpking, diff --git a/Systems/Collections/NPCs/PierceResistList.cs b/Systems/Collections/NPCs/PierceResistList.cs deleted file mode 100644 index efbe96843f..0000000000 --- a/Systems/Collections/NPCs/PierceResistList.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PierceResistList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/PierceResistExceptionLeviAureusList.cs b/Systems/Collections/PierceResistExceptionLeviAureusList.cs deleted file mode 100644 index 4c3f202da1..0000000000 --- a/Systems/Collections/PierceResistExceptionLeviAureusList.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PierceResistExceptionLeviAureusList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.NettleBurstEnd, - ProjectileID.NettleBurstLeft, - ProjectileID.NettleBurstRight, - ProjectileID.PrincessWeapon, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int projectileType) => List.Contains(projectileType); - } -} diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs deleted file mode 100644 index 95dc2ecceb..0000000000 --- a/Systems/Collections/PierceResistExceptionList.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.MaceFlails; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Typeless; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PierceResistExceptionList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.Arkhalis, - ProjectileID.ChargedBlasterLaser, - ProjectileID.ClingerStaff, - ProjectileID.FinalFractal, - ProjectileID.FlyingKnife, - ProjectileID.LastPrismLaser, - ProjectileID.MonkStaffT3, - ProjectileID.PiercingStarlight, - ProjectileID.Terragrim, - 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(), - 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(), - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int projectileType) => List.Contains(projectileType); - } -} diff --git a/Systems/Collections/SharedStaticIFramesIDSet.cs b/Systems/Collections/SharedStaticIFramesIDSet.cs new file mode 100644 index 0000000000..d01cc7bd6a --- /dev/null +++ b/Systems/Collections/SharedStaticIFramesIDSet.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A which contains an ProjectileID Set, created with the appropriate factory.
+ ///
+ /// This is populated from a much more human readable set of "shared iframe lists", contained in OnModLoad. + ///
+ public sealed class SharedStaticIFrames : ModSystem + { + public static IDictionary> SharedIFrameSets { get; private set; } + public static int[] SharedIFrameFactorySet { get; private set; } + + public override void PostSetupContent() + { + // This transient structure is used to make the setup of intended shared-iframe sets as easy as possible. + // + // If you want to add a new projectile to share iframes with any existing sets, just add it to that [ area ]. + // + // If you want to create a brand new shared iframe set, just add a new [ area ] at the bottom. + IList> setupLists = + [ + [ // Set 1: Vanilla bees (Hive Pack) + ProjectileID.Bee, + ProjectileID.GiantBee + ], + + [ // Set 2: Vilethorn + ProjectileID.VilethornBase, + ProjectileID.VilethornTip + ], + + [ // Set 3: Harp notes + ProjectileID.QuarterNote, + ProjectileID.EighthNote, + ProjectileID.TiedEighthNote + ], + + [ // Set 4: The North Pole + ProjectileID.NorthPoleWeapon, + ProjectileID.NorthPoleSpear, + ProjectileID.NorthPoleSnowflake, + ], + + [ // Set 5: All spore gas clouds + ProjectileID.SporeTrap, + ProjectileID.SporeTrap2, + ProjectileID.SporeGas, + ProjectileID.SporeGas2, + ProjectileID.SporeGas3 + ], + + [ // Set 6: Astral Staff and Asteroid Staff + ModContent.ProjectileType(), + ModContent.ProjectileType() + ], + + [ // Set 7: All toxic clouds + ProjectileID.ToxicCloud, + ProjectileID.ToxicCloud2, + ProjectileID.ToxicCloud3 + ] + ]; + + // Convert the above list-of-lists into a dictionary, where the key is the shared iframe projectile ID. + SharedIFrameSets = new SortedDictionary>(); + foreach (var innerList in setupLists) + { + int sharedIDForThisSet = innerList[0]; + SharedIFrameSets.Add(sharedIDForThisSet, innerList); + } + + // Now construct a vanilla Terraria Projectile ID Set using the appropriate factory. + + // Calculate the total length of the input buffer to the factory + int totalLength = 0; + foreach(var l in SharedIFrameSets.Values) + totalLength += l.Count; + + // Create the buffer and fill it + int[] buffer = new int[totalLength * 2]; + int idx = 0; + foreach (var sharedFrameList in setupLists) + { + int sharedIDForThisSet = sharedFrameList[0]; + + foreach (var projID in sharedFrameList) + { + buffer[idx++] = projID; + buffer[idx++] = sharedIDForThisSet; + } + } + + SharedIFrameFactorySet = ProjectileID.Sets.Factory.CreateIntSet(-1, buffer); + } + + public override void Unload() + { + SharedIFrameSets = null; + SharedIFrameFactorySet = null; + } + + /// + /// A shorthand method to check if this projectile shares static iframes in any way. + /// + public static bool Includes(int projType) => SharedIFrameFactorySet[projType] != -1; + + /// + /// The intended + /// + /// The projectile type to get the set of shared iframe projectile IDs for. + /// A list of projectile IDs that share static iframes with this projectile ID. This list may be empty. + public static IList GetSharedStaticIFrames(int projType) + { + int sharedSetID = SharedIFrameFactorySet[projType]; + bool setExists = SharedIFrameSets.TryGetValue(sharedSetID, out var ret); + + return setExists ? ret : []; + } + } +} diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index d2149df7c7..69b975993a 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Placeables.Astral; using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -336,7 +337,9 @@ namespace CalamityMod.Systems ItemID.EbonwoodSword, ItemID.ShadewoodSword, ItemID.PearlwoodSword, - ItemID.AshWoodSword + ItemID.AshWoodSword, + ItemType(), + ItemType() }); AnyWoodenSword = RecipeGroup.RegisterGroup("AnyWoodenSword", group); @@ -501,13 +504,6 @@ namespace CalamityMod.Systems Register() .DisableDecraft(); - // Black Lens - Recipe.Create(ItemID.BlackLens). - AddIngredient(ItemID.Lens). - AddIngredient(ItemID.BlackDye). - AddTile(TileID.DyeVat). - Register(); - // Stohne smelts into Lihzahrd Bricks Recipe.Create(ItemID.LihzahrdBrick). AddIngredient(ItemType()). @@ -576,13 +572,6 @@ namespace CalamityMod.Systems AddTile(TileID.Anvils). Register(); - // Lava Fishing Hook - Recipe.Create(ItemID.LavaFishingHook). - AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.Seashell). - AddTile(TileID.Hellforge). - Register(); - // Alternative Evil Biome items Recipe.Create(ItemID.CrimsonRod). AddIngredient(ItemID.Vilethorn). @@ -727,15 +716,13 @@ namespace CalamityMod.Systems AddAstralClayRecipes(); AddBloodOrbPotionRecipes(); AddCookedFood(); - AddEssentialToolRecipes(); - AddSummonAndProgressionRecipes(); + AddMiscItemRecipes(); AddTombstoneRecipes(); AddEarlyGameWeaponRecipes(); AddEarlyGameAccessoryRecipes(); AddHardmodeItemRecipes(); AddArmorRecipes(); AddAnkhShieldRecipes(); - AddLivingWoodRecipes(); } #endregion @@ -793,7 +780,6 @@ namespace CalamityMod.Systems var edits = new Dictionary, Action>(128) { - { Vanilla(ItemID.EnchantedBoomerang), Disable }, // Calamity adds its own recipe { Vanilla(ItemID.MiniNukeI), Disable }, { Vanilla(ItemID.MiniNukeII), Disable }, @@ -845,6 +831,9 @@ namespace CalamityMod.Systems { Vanilla(ItemID.PumpkinMoonMedallion), RemoveIngredient(ItemID.HallowedBar) }, { Vanilla(ItemID.NaughtyPresent), RemoveIngredient(ItemID.SoulofFright) }, + // Make Enchanted Boomerang slightly harder to obtain + { Vanilla(ItemID.EnchantedBoomerang), EnchantedBoomerangRecipeEdit }, + // Add 20 Souls of Flight to vanilla Luminite wings { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), LunarWingsRecipeEdits }, @@ -1011,6 +1000,24 @@ namespace CalamityMod.Systems r.requiredItem[2] = r.requiredItem[1]; r.requiredItem[1] = store; } + + private static void EnchantedBoomerangRecipeEdit(Recipe r) + { + // Add Any Gold Bar and make it crafted at an Anvil + r.AddRecipeGroup(AnyGoldBar, 8); + r.AddTile(TileID.Anvils); + + // Then move it to the proper spot + if (r.requiredItem.Count < 3) + return; + + var store = r.requiredItem[1]; + r.requiredItem[1] = r.requiredItem[2]; + r.requiredItem[2] = store; + + // Increase amount of Fallen Stars used + r.requiredItem[2].stack = 6; + } #endregion #region Shimmer Recipes @@ -1302,60 +1309,36 @@ namespace CalamityMod.Systems } #endregion - #region Essential Gameplay Tools - private static void AddEssentialToolRecipes() + #region Miscellaneous Items + private static void AddMiscItemRecipes() { - // Umbrella - Recipe r = Recipe.Create(ItemID.Umbrella); - r.AddIngredient(ItemID.Silk, 5); - r.AddRecipeGroup("AnyCopperBar", 2); - r.AddTile(TileID.Loom); - r.Register(); - r.DisableDecraft(); - - // Bug Net - r = Recipe.Create(ItemID.BugNet); - r.AddIngredient(ItemID.Cobweb, 30); - r.AddRecipeGroup("AnyCopperBar", 3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Bloody Tear - r = Recipe.Create(ItemID.BloodMoonStarter); + Recipe r = Recipe.Create(ItemID.BloodMoonStarter); r.AddIngredient(10); r.AddRecipeGroup("AnyCopperBar", 3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); - // Staff of Regrowth - r = Recipe.Create(ItemID.StaffofRegrowth); - r.AddIngredient(ItemID.RichMahogany, 10); - r.AddIngredient(ItemID.JungleSpores, 5); - r.AddIngredient(ItemID.JungleRose); - r.AddTile(TileID.WorkBenches); - r.Register(); - r.DisableDecraft(); - - // Sky Mill - r = Recipe.Create(ItemID.SkyMill); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 5); - r.AddIngredient(ItemID.RainCloud, 3); + // Snow Globe (Frost Legion) recipe for consistency + r = Recipe.Create(ItemID.SnowGlobe); + r.AddRecipeGroup(AnySnowBlock, 10); + r.AddIngredient(ItemID.Glass, 5); + r.AddIngredient(ItemID.SoulofLight, 3); + r.AddIngredient(ItemID.SoulofNight, 3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); - // Ice Machine - r = Recipe.Create(ItemID.IceMachine); - r.AddRecipeGroup("AnyIceBlock", 10); - r.AddRecipeGroup("AnySnowBlock", 5); - r.AddRecipeGroup("IronBar", 5); - r.AddTile(TileID.Anvils); + // Umbrella (for Temporal Umbrella) + r = Recipe.Create(ItemID.Umbrella); + r.AddIngredient(ItemID.Silk, 5); + r.AddRecipeGroup("AnyCopperBar", 2); + r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); + // Lower half Desert items (these are partially destroyed by Sunken Sea) // Bast Statue r = Recipe.Create(ItemID.CatBast); r.AddRecipeGroup("IronBar", 7); @@ -1371,70 +1354,15 @@ namespace CalamityMod.Systems r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); - - // Desert Minecart - r = Recipe.Create(ItemID.DesertMinecart); - r.AddIngredient(ItemID.SandstoneBrick, 20); - r.AddRecipeGroup("AnyGoldBar", 6); - r.AddRecipeGroup("IronBar", 3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - } - #endregion - - #region Boss Summon and Progression Items - private static void AddSummonAndProgressionRecipes() - { - // Guide Voodoo Doll - Recipe r = Recipe.Create(ItemID.GuideVoodooDoll); - r.AddIngredient(ItemID.Leather, 2); - r.AddRecipeGroup(AnyEvilPowder, 10); - r.AddTile(TileID.Hellforge); - r.Register(); - r.DisableDecraft(); - - // Frost Legion recipe for consistency - r = Recipe.Create(ItemID.SnowGlobe); - r.AddRecipeGroup(AnySnowBlock, 10); - r.AddIngredient(ItemID.Glass, 5); - r.AddIngredient(ItemID.SoulofLight, 3); - r.AddIngredient(ItemID.SoulofNight, 3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Temple Key - r = Recipe.Create(ItemID.TempleKey); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.RichMahogany, 10); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddIngredient(ItemID.SoulofNight, 5); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - r.DisableDecraft(); } #endregion #region Early Game Weapons private static void AddEarlyGameWeaponRecipes() { - // Shuriken - Recipe r = Recipe.Create(ItemID.Shuriken, 50); - r.AddRecipeGroup("IronBar"); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Throwing Knife - r = Recipe.Create(ItemID.ThrowingKnife, 50); - r.AddRecipeGroup("IronBar"); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - + // Wooden Chest weapons // Wooden Boomerang - r = Recipe.Create(ItemID.WoodenBoomerang); + Recipe r = Recipe.Create(ItemID.WoodenBoomerang); r.AddIngredient(ItemID.Wood, 7); r.AddTile(TileID.WorkBenches); r.Register(); @@ -1450,6 +1378,7 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); + // Early game minions // Finch Staff r = Recipe.Create(ItemID.BabyBirdStaff); r.AddIngredient(ItemID.Bird); @@ -1458,33 +1387,15 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Starfury w/ Gold Broadsword - r = Recipe.Create(ItemID.Starfury); - r.AddIngredient(ItemID.GoldBroadsword); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Starfury w/ Platinum Broadsword - r = Recipe.Create(ItemID.Starfury); - r.AddIngredient(ItemID.PlatinumBroadsword); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Enchanted Boomerang - r = Recipe.Create(ItemID.EnchantedBoomerang); - r.AddIngredient(ItemID.WoodenBoomerang); - r.AddIngredient(ItemID.FallenStar, 6); - r.AddRecipeGroup(AnyGoldBar, 8); + // Slime Staff + r = Recipe.Create(ItemID.SlimeStaff); + r.AddRecipeGroup("Wood", 6); + r.AddIngredient(ItemID.Gel, 40); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); + // Key sword components // Enchanted Sword r = Recipe.Create(ItemID.EnchantedSword); r.AddIngredient(10); @@ -1495,6 +1406,14 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); + // Starfury + r = Recipe.Create(ItemID.Starfury); + r.AddIngredient(7); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + // Muramasa r = Recipe.Create(ItemID.Muramasa); r.AddIngredient(7); @@ -1503,7 +1422,7 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Water Bolt w/ Hardmode Spell Tome + // Water Bolt r = Recipe.Create(ItemID.WaterBolt); r.AddIngredient(ItemID.SpellTome); r.AddIngredient(ItemID.Waterleaf, 3); @@ -1511,46 +1430,20 @@ namespace CalamityMod.Systems r.AddTile(TileID.Bookcases); r.Register(); r.DisableDecraft(); - - // Slime Staff - r = Recipe.Create(ItemID.SlimeStaff); - r.AddRecipeGroup("Wood", 6); - r.AddIngredient(ItemID.Gel, 40); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Ice Boomerang - r = Recipe.Create(ItemID.IceBoomerang); - r.AddIngredient(ItemID.WoodenBoomerang); - r.AddRecipeGroup(AnyIceBlock, 20); - r.AddRecipeGroup(AnySnowBlock, 10); - r.AddIngredient(ItemID.Shiverthorn); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); } #endregion #region Early Game Accessories private static void AddEarlyGameAccessoryRecipes() { - // Cloud in a Bottle - Recipe r = Recipe.Create(ItemID.CloudinaBottle); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.Cloud, 5); - r.AddIngredient(ItemID.Feather, 2); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Step Stool - r = Recipe.Create(ItemID.PortableStool); + // Step Stool (replaced Chest item) + Recipe r = Recipe.Create(ItemID.PortableStool); r.AddRecipeGroup("Wood", 10); r.AddTile(TileID.Sawmill); r.Register(); r.DisableDecraft(); + #region Terraspark Boots Line // Hermes Boots r = Recipe.Create(ItemID.HermesBoots); r.AddIngredient(ItemID.Silk, 10); @@ -1559,6 +1452,58 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); + // Aglet + r = Recipe.Create(ItemID.Aglet); + r.AddRecipeGroup(AnyCopperBar, 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + + // Anklet of the Wind + r = Recipe.Create(ItemID.AnkletoftheWind); + r.AddIngredient(ItemID.JungleSpores, 15); + r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.PinkGel, 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + + // Ice Skates + r = Recipe.Create(ItemID.IceSkates); + r.AddIngredient(ItemID.FlinxFur, 3); + r.AddRecipeGroup("IronBar", 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + + // Water Walking Boots + r = Recipe.Create(ItemID.WaterWalkingBoots); + r.AddIngredient(ItemID.Leather, 5); + r.AddIngredient(ItemID.WaterWalkingPotion, 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + + // Lava Charm + r = Recipe.Create(ItemID.LavaCharm); + r.AddIngredient(ItemID.LavaBucket, 3); + r.AddIngredient(ItemID.Obsidian, 5); + r.AddRecipeGroup(AnyGoldBar, 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + + // Obsidian Rose + r = Recipe.Create(ItemID.ObsidianRose); + r.AddIngredient(ItemID.JungleRose); + r.AddIngredient(ItemID.Obsidian, 5); + r.AddIngredient(ItemID.Hellstone, 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + #endregion + + #region Core Movement Accessories // Blizzard in a Bottle r = Recipe.Create(ItemID.BlizzardinaBottle); r.AddIngredient(ItemID.Bottle); @@ -1569,6 +1514,15 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); + // Cloud in a Bottle + r = Recipe.Create(ItemID.CloudinaBottle); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.Feather, 2); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); + // Sandstorm in a Bottle r = Recipe.Create(ItemID.SandstorminaBottle); r.AddIngredient(ItemID.Bottle); @@ -1580,13 +1534,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Frog Leg - r = Recipe.Create(ItemID.FrogLeg); - r.AddIngredient(ItemID.Frog, 6); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Fledgling Wings r = Recipe.Create(ItemID.CreativeWings); r.AddIngredient(ItemID.Cloud, 5); @@ -1604,43 +1551,9 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Aglet - r = Recipe.Create(ItemID.Aglet); - r.AddRecipeGroup(AnyCopperBar, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Anklet of the Wind - r = Recipe.Create(ItemID.AnkletoftheWind); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.Cloud, 5); - r.AddIngredient(ItemID.PinkGel, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Water Walking Boots - r = Recipe.Create(ItemID.WaterWalkingBoots); - r.AddIngredient(ItemID.Leather, 5); - r.AddIngredient(ItemID.WaterWalkingPotion, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Flame Waker Boots - r = Recipe.Create(ItemID.FlameWakerBoots); - r.AddIngredient(ItemID.Silk, 8); - r.AddIngredient(ItemID.HellstoneBar, 5); - r.AddIngredient(ItemID.Obsidian, 4); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Ice Skates - r = Recipe.Create(ItemID.IceSkates); - r.AddIngredient(ItemID.Leather, 5); - r.AddRecipeGroup("IronBar", 5); + // Frog Leg + r = Recipe.Create(ItemID.FrogLeg); + r.AddIngredient(ItemID.Frog, 6); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1655,60 +1568,21 @@ namespace CalamityMod.Systems // Shiny Red Balloon r = Recipe.Create(ItemID.ShinyRedBalloon); r.AddIngredient(ItemID.WhiteString); - r.AddIngredient(ItemID.Gel, 15); - r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.Cloud, 10); r.AddTile(TileID.Solidifier); r.Register(); r.DisableDecraft(); + #endregion - // Lava Charm - r = Recipe.Create(ItemID.LavaCharm); - r.AddIngredient(ItemID.LavaBucket, 3); - r.AddIngredient(ItemID.Obsidian, 5); - r.AddRecipeGroup(AnyGoldBar, 5); + // Flame Waker Boots + r = Recipe.Create(ItemID.FlameWakerBoots); + r.AddIngredient(ItemID.Silk, 8); + r.AddIngredient(ItemID.HellstoneBar, 5); + r.AddIngredient(ItemID.Obsidian, 4); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); - // Obsidian Rose - r = Recipe.Create(ItemID.ObsidianRose); - r.AddIngredient(ItemID.JungleRose); - r.AddIngredient(ItemID.Obsidian, 5); - r.AddIngredient(ItemID.Hellstone, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Feral Claws - r = Recipe.Create(ItemID.FeralClaws); - r.AddIngredient(ItemID.Leather, 10); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Radar - r = Recipe.Create(ItemID.Radar); - r.AddRecipeGroup("IronBar", 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Metal Detector - r = Recipe.Create(ItemID.MetalDetector); - r.AddIngredient(ItemID.Wire, 10); - r.AddIngredient(ItemID.SpelunkerGlowstick, 5); - r.AddRecipeGroup(AnyCopperBar, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Hand Warmer - r = Recipe.Create(ItemID.HandWarmer); - r.AddIngredient(ItemID.Silk, 10); - r.AddTile(TileID.Loom); - r.Register(); - r.DisableDecraft(); - // Flower Boots r = Recipe.Create(ItemID.FlowerBoots); r.AddIngredient(ItemID.Silk, 7); @@ -1717,35 +1591,49 @@ namespace CalamityMod.Systems r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); + + // Hand Warmer + r = Recipe.Create(ItemID.HandWarmer); + r.AddIngredient(ItemID.Silk, 10); + r.AddTile(TileID.Loom); + r.Register(); + r.DisableDecraft(); + + // Radar + r = Recipe.Create(ItemID.Radar); + r.AddRecipeGroup("IronBar", 5); + r.AddTile(TileID.Anvils); + r.Register(); + r.DisableDecraft(); } #endregion #region Armor private static void AddArmorRecipes() { - // Eskimo armor + // Snow armor Recipe r = Recipe.Create(ItemID.EskimoHood); r.AddIngredient(ItemID.Silk, 4); - r.AddIngredient(ItemID.Leather, 2); + r.AddIngredient(ItemID.FlinxFur, 1); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.EskimoCoat); r.AddIngredient(ItemID.Silk, 8); - r.AddIngredient(ItemID.Leather, 4); + r.AddIngredient(ItemID.FlinxFur, 2); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.EskimoPants); r.AddIngredient(ItemID.Silk, 6); - r.AddIngredient(ItemID.Leather, 3); + r.AddIngredient(ItemID.FlinxFur, 1); r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); - // Pharaoh set + // Pharaoh set (replaced Chest items) r = Recipe.Create(ItemID.PharaohsMask); r.AddIngredient(ItemID.AncientCloth, 3); r.AddTile(TileID.Loom); @@ -1770,50 +1658,41 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Armor Polish (broken armor) - r = Recipe.Create(ItemID.ArmorPolish); - r.AddIngredient(ItemID.Bone, 10); - r.AddIngredient(3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Adhesive Bandage (bleeding) - r = Recipe.Create(ItemID.AdhesiveBandage); + // The Plan: + // Trifold Map (confusion) + r = Recipe.Create(ItemID.TrifoldMap); r.AddIngredient(ItemID.Silk, 10); - r.AddIngredient(ItemID.Gel, 10); - r.AddIngredient(ItemID.HealingPotion); + r.AddIngredient(ItemID.SoulofLight, 10); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); - // Bezoar (poison) - r = Recipe.Create(ItemID.Bezoar); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.Stinger, 5); + // Fast Clock (slow) + r = Recipe.Create(ItemID.FastClock); + r.AddIngredient(ItemID.Timer1Second); + r.AddIngredient(ItemID.PixieDust, 25); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); + // Countercurse Mantra: // Nazar (curse) r = Recipe.Create(ItemID.Nazar); - r.AddIngredient(ItemID.SoulofNight, 5); + r.AddIngredient(ItemID.SoulofNight, 10); r.AddIngredient(ItemID.Lens, 3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); - // Vitamins (weakness) - r = Recipe.Create(ItemID.Vitamins); - r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ItemID.Waterleaf, 3); - r.AddIngredient(ItemID.Blinkroot, 3); - r.AddIngredient(ItemID.Daybloom, 3); - r.AddIngredient(5); - r.AddTile(TileID.AlchemyTable); + // Megaphone (silence) + r = Recipe.Create(ItemID.Megaphone); + r.AddRecipeGroup(AnyCobaltBar, 5); + r.AddIngredient(ItemID.Wire, 10); + r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); + // Reflective Shades: // Blindfold (darkness) r = Recipe.Create(ItemID.Blindfold); r.AddIngredient(ItemID.Silk, 10); @@ -1822,117 +1701,22 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Trifold Map (confusion) - r = Recipe.Create(ItemID.TrifoldMap); - r.AddIngredient(ItemID.Silk, 10); - r.AddIngredient(ItemID.SoulofLight, 3); - r.AddIngredient(ItemID.SoulofNight, 3); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Fast Clock (slow) - r = Recipe.Create(ItemID.FastClock); - r.AddIngredient(ItemID.Timer1Second); - r.AddIngredient(ItemID.PixieDust, 5); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Megaphone (silence) - r = Recipe.Create(ItemID.Megaphone); - r.AddIngredient(ItemID.Wire, 5); - r.AddRecipeGroup(AnyCobaltBar, 3); - r.AddIngredient(ItemID.Ruby); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Pocket Mirror (petrification) r = Recipe.Create(ItemID.PocketMirror); - r.AddIngredient(ItemID.Glass, 5); - r.AddRecipeGroup(AnyGoldBar, 3); - r.AddIngredient(ItemID.CrystalShard, 2); - r.AddIngredient(ItemID.SoulofNight, 2); + r.AddIngredient(ItemID.Glass, 10); + r.AddRecipeGroup(AnyGoldBar, 8); + r.AddIngredient(ItemID.CrystalShard, 8); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); } #endregion - #region Living Wood - private static void AddLivingWoodRecipes() - { - // Living Loom - Recipe r = Recipe.Create(ItemID.LivingLoom); - r.AddIngredient(ItemID.Loom); - r.AddIngredient(ItemID.Vine, 2); - r.AddTile(TileID.Sawmill); - r.Register(); - r.DisableDecraft(); - - // Living Wood Wand - r = Recipe.Create(ItemID.LivingWoodWand); - r.AddIngredient(ItemID.Wood, 10); - r.AddTile(TileID.LivingLoom); - r.Register(); - r.DisableDecraft(); - - // Living Leaf Wand - r = Recipe.Create(ItemID.LeafWand); - r.AddIngredient(ItemID.Wood, 10); - r.AddTile(TileID.LivingLoom); - r.Register(); - r.DisableDecraft(); - - // Living Mahogany Wand - r = Recipe.Create(ItemID.LivingMahoganyWand); - r.AddIngredient(ItemID.RichMahogany, 10); - r.AddTile(TileID.LivingLoom); - r.Register(); - r.DisableDecraft(); - - // Living Mahogany Leaf Wand - r = Recipe.Create(ItemID.LivingMahoganyLeafWand); - r.AddIngredient(ItemID.RichMahogany, 10); - r.AddTile(TileID.LivingLoom); - r.Register(); - r.DisableDecraft(); - } - #endregion - #region Hardmode Items and Accessories private static void AddHardmodeItemRecipes() { - // Celestial Magnet - Recipe r = Recipe.Create(ItemID.CelestialMagnet); - r.AddIngredient(ItemID.TreasureMagnet); - r.AddIngredient(ItemID.FallenStar, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Frozen Turtle Shell - r = Recipe.Create(ItemID.FrozenTurtleShell); - r.AddIngredient(ItemID.TurtleShell, 2); - r.AddIngredient(4); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Magic Quiver - r = Recipe.Create(ItemID.MagicQuiver); - r.AddIngredient(ItemID.EndlessQuiver); - r.AddIngredient(ItemID.PixieDust, 5); - r.AddIngredient(ItemID.Lens, 3); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddTile(TileID.CrystalBall); - r.Register(); - r.DisableDecraft(); - // Pulse Bow - r = Recipe.Create(ItemID.PulseBow); + Recipe r = Recipe.Create(ItemID.PulseBow); r.AddIngredient(ItemID.ShroomiteBar, 16); r.AddTile(TileID.MythrilAnvil); r.Register(); diff --git a/Systems/Mechanic/WorldSelectionDifficultySystem.cs b/Systems/Mechanic/WorldSelectionDifficultySystem.cs index 7193069b77..18d7107050 100644 --- a/Systems/Mechanic/WorldSelectionDifficultySystem.cs +++ b/Systems/Mechanic/WorldSelectionDifficultySystem.cs @@ -23,9 +23,6 @@ namespace CalamityMod.Systems { WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Revengeance"), GetRevengeance, new(211, 42, 42))); WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Death"), GetDeath, new(192, 64, 219))); - WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.RevMaster"), GetMasterRevengeance, new(124, 153, 242))); - WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.DeathMaster"), GetMasterDeath, new(255, 25, 255))); - WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.RevLegend"), GetLegendRevengeance, new(240, 128, 128))); // Malice color WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.DeathLegend"), GetLegendDeath, new(220, 255, 132))); // Defiled color } } @@ -64,72 +61,6 @@ namespace CalamityMod.Systems return false; } - public static bool GetMasterRevengeance(AWorldListItem item) - { - // Grab data from the listed world - FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); - WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); - - int trueGameMode = worldData.GameMode; - if (worldData.ForTheWorthy) - { - trueGameMode++; - } - - if (item.Data.TryGetHeaderData(out TagCompound tag)) - { - if (tag.ContainsKey("RevengeanceMode") && tag.GetBool("RevengeanceMode") && trueGameMode == 2) - { - return true; - } - } - return false; - } - - public static bool GetMasterDeath(AWorldListItem item) - { - // Grab data from the listed world - FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); - WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); - - int trueGameMode = worldData.GameMode; - if (worldData.ForTheWorthy) - { - trueGameMode++; - } - - if (item.Data.TryGetHeaderData(out TagCompound tag)) - { - if (tag.ContainsKey("DeathMode") && tag.GetBool("DeathMode") && trueGameMode == 2) - { - return true; - } - } - return false; - } - - public static bool GetLegendRevengeance(AWorldListItem item) - { - // Grab data from the listed world - FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); - WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); - - int trueGameMode = worldData.GameMode; - if (worldData.ForTheWorthy) - { - trueGameMode++; - } - - if (item.Data.TryGetHeaderData(out TagCompound tag)) - { - if (tag.ContainsKey("RevengeanceMode") && tag.GetBool("RevengeanceMode") && trueGameMode == 3) - { - return true; - } - } - return false; - } - public static bool GetLegendDeath(AWorldListItem item) { // Grab data from the listed world diff --git a/Systems/Tile/BiomeTileCounterSystem.cs b/Systems/Tile/BiomeTileCounterSystem.cs index e66ed5837c..bd77177433 100644 --- a/Systems/Tile/BiomeTileCounterSystem.cs +++ b/Systems/Tile/BiomeTileCounterSystem.cs @@ -55,8 +55,8 @@ namespace CalamityMod.Systems public override void TileCountsAvailable(ReadOnlySpan tileCounts) { BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/Tile/TileFramingSystem.cs b/Systems/Tile/TileFramingSystem.cs index e55bedb771..8294009f1b 100644 --- a/Systems/Tile/TileFramingSystem.cs +++ b/Systems/Tile/TileFramingSystem.cs @@ -92,6 +92,7 @@ namespace CalamityMod.Systems (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), ]; private static int[][] PlantValidGrounds; diff --git a/Systems/TileMerging/TileBlendMergeSystem.cs b/Systems/TileMerging/TileBlendMergeSystem.cs index 88658e9bc5..5da7dde7a6 100644 --- a/Systems/TileMerging/TileBlendMergeSystem.cs +++ b/Systems/TileMerging/TileBlendMergeSystem.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Systems static void SetupTileTypeToBlendTextureSlot() { + if (TileBlendTextureLoader.AllTextures == null) + return; foreach (var blendTexture in TileBlendTextureLoader.AllTextures) { _TileTypeToBlendTextureSlot[blendTexture.TileType] = (byte)blendTexture.Slot; diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 58ff723779..ef10be5563 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -36,6 +36,14 @@ namespace CalamityMod.Systems #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref double totalWeight) { + // Better Underworld (similar to Don't Dig Up seed but with some adjustments) + int UnderworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); + tasks[UnderworldIndex] = new PassLegacy("Underworld", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; + CustomUnderworld.NewUnderworld(); + }); + // Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); if (islandIndex != -1) @@ -71,7 +79,7 @@ namespace CalamityMod.Systems FloralParadiseMinibiome.GenerateInstances(); })); - // Improved Golem arena + // Improved Golem Arena int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => { @@ -82,7 +90,7 @@ namespace CalamityMod.Systems Main.tileSolid[232] = false; }); - // Better Lihzahrd altar (consistency?) + // Better Lihzahrd Altar (consistency?) int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => { @@ -90,7 +98,7 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTempleLihzahrdAltar(); }); - // Giant beehive + // Big Hive int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); if (giantHiveIndex != -1) { @@ -143,7 +151,7 @@ namespace CalamityMod.Systems })); } - // Vernal pass + // Vernal Pass int vernalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Muds Walls In Jungle")); if (vernalIndex != -1) { @@ -154,7 +162,7 @@ namespace CalamityMod.Systems })); } - // sunken sea + // Sunken Sea int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); if (SunkenSeaIndex != -1) { @@ -173,14 +181,14 @@ namespace CalamityMod.Systems }; // place each piece of the sunken sea based on the above positons - SunkenSea.PlaceRadiantReefs(sunkenSeaX - 100, sunkenSeaY + 75, true); - SunkenSea.PlaceRadiantReefs(sunkenSeaX + 100, sunkenSeaY + 75, false); - SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceRadiantReefs(sunkenSeaX, sunkenSeaY + 110); + SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - SunkenSea.PlaceSunkenSeaAmbience(); - SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); + SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceSunkenSeaAmbience(); })); } diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs index d23102c5d6..4aa4856eb8 100644 --- a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs +++ b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient // // Pirate Crate With Glow - public class PirateCrate1 : GlowMaskTile + public abstract class PirateCrateExplosive : GlowMaskTile { - public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow"; + public abstract string GoreKey { get; } public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; public override void SetupStatic() @@ -39,6 +39,13 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient // NOTE: The damage of ProjectileID.Explosives is reduced in CalamityPlayerHitHurt, this actually deals 52 / 67 / 101 damage. int blastDamage = (Main.getGoodWorld ? 99999 : 150) * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition.X, spawnPosition.Y, 0, 0, ProjectileID.Explosives, blastDamage, 0f); + + if (Main.dedServ) + return; + + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"{GoreKey}1").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"{GoreKey}2").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"{GoreKey}3").Type); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -52,21 +59,31 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient } } - public class PirateCrate2 : PirateCrate1 + public class PirateCrate1 : PirateCrateExplosive { - public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow"; + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow"; + public override string GoreKey => "PirateCrateL"; } - public class PirateCrate3 : PirateCrate1 + public class PirateCrate2 : PirateCrateExplosive + { + public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow"; + public override string GoreKey => "PirateCrateM"; + } + + public class PirateCrate3 : PirateCrateExplosive { public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow"; + public override string GoreKey => "PirateCrateR"; } // // Pirate Crate Without Glow - public class PirateCrate4 : ModTile + public abstract class PirateCrateGold : ModTile { + public abstract string GoreKey { get; } + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; public override void SetStaticDefaults() { @@ -90,6 +107,13 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.GoldCoin, Main.rand.Next(1, 2)); Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.SilverCoin, Main.rand.Next(45, 75)); + + if (Main.dedServ) + return; + + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"{GoreKey}1").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"{GoreKey}2").Type); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"{GoreKey}3").Type); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -98,11 +122,18 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient } } - public class PirateCrate5 : PirateCrate4 + public class PirateCrate4 : PirateCrateGold { + public override string GoreKey => "PirateCrateL"; } - public class PirateCrate6 : PirateCrate4 + public class PirateCrate5 : PirateCrateGold { + public override string GoreKey => "PirateCrateM"; + } + + public class PirateCrate6 : PirateCrateGold + { + public override string GoreKey => "PirateCrateR"; } } diff --git a/Tiles/Abyss/AbyssalPots.cs b/Tiles/Abyss/AbyssalPots.cs index 8e269c0357..ee32b3dae7 100644 --- a/Tiles/Abyss/AbyssalPots.cs +++ b/Tiles/Abyss/AbyssalPots.cs @@ -36,11 +36,10 @@ namespace CalamityMod.Tiles.Abyss { if (!Main.dedServ) { - int goreAmt = Main.rand.Next(1, 2 + 1); + int goreAmt = Main.rand.Next(2, 4 + 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); + Gore.NewGore(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), Mod.Find($"AbyssPot{WorldGen.genRand.Next(1, 6 + 1)}").Type); } } diff --git a/Tiles/Abyss/CausticTorch.cs b/Tiles/Abyss/CausticTorch.cs new file mode 100644 index 0000000000..53c7200e51 --- /dev/null +++ b/Tiles/Abyss/CausticTorch.cs @@ -0,0 +1,80 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class CausticTorch : ModTile + { + public override void SetStaticDefaults() => this.SetUpTorch(ModContent.ItemType(), true, true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(160, 210, 60), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + 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 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 = 1f; + g = 1.5f; + b = 0.4f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Abyss/CausticTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? DustID.GreenTorch : DustID.YellowTorch, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + 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/Abyss/CausticTorch.png b/Tiles/Abyss/CausticTorch.png new file mode 100644 index 0000000000..190d710030 Binary files /dev/null and b/Tiles/Abyss/CausticTorch.png differ diff --git a/Tiles/Abyss/CausticTorchFlame.png b/Tiles/Abyss/CausticTorchFlame.png new file mode 100644 index 0000000000..7ecd0df17f Binary files /dev/null and b/Tiles/Abyss/CausticTorchFlame.png differ diff --git a/Tiles/Abyss/KelpTorch.cs b/Tiles/Abyss/KelpTorch.cs new file mode 100644 index 0000000000..d5c35ccc56 --- /dev/null +++ b/Tiles/Abyss/KelpTorch.cs @@ -0,0 +1,80 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class KelpTorch : ModTile + { + public override void SetStaticDefaults() => this.SetUpTorch(ModContent.ItemType(), true, true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(160, 210, 60), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + 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 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 = 1.8f; + g = 1.5f; + b = 0.4f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Abyss/KelpTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(DustID.YellowTorch, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + 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/Abyss/KelpTorch.png b/Tiles/Abyss/KelpTorch.png new file mode 100644 index 0000000000..d9797b9bca Binary files /dev/null and b/Tiles/Abyss/KelpTorch.png differ diff --git a/Tiles/Abyss/KelpTorchFlame.png b/Tiles/Abyss/KelpTorchFlame.png new file mode 100644 index 0000000000..2ff9f17160 Binary files /dev/null and b/Tiles/Abyss/KelpTorchFlame.png differ diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index 48bfde5d53..a4670f5322 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.Abyss Tile up2 = Main.tile[i, j - 2]; // Place kelp - if (WorldGen.genRand.NextBool(5)&& !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(5) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index 698c1b4422..e34c381cb3 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.Abyss public class PyreMantle : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; diff --git a/Tiles/Abyss/SulphurousSand.png b/Tiles/Abyss/SulphurousSand.png index 200e715bfc..cbfcee2433 100644 Binary files a/Tiles/Abyss/SulphurousSand.png and b/Tiles/Abyss/SulphurousSand.png differ diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index 1ecdc028b3..d526aaff48 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Tiles.Abyss Tile up2 = Main.tile[i, j - 2]; // Place sulphur tentacle corals - if (WorldGen.genRand.NextBool(10)&& !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(10) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; diff --git a/Tiles/Abyss/SulphurousTorch.cs b/Tiles/Abyss/SulphurousTorch.cs index 3ddf59809c..ca89a1f6ae 100644 --- a/Tiles/Abyss/SulphurousTorch.cs +++ b/Tiles/Abyss/SulphurousTorch.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.Abyss public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 66) - CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? 61 : 64, 5, i, j); + CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? DustID.GreenTorch : DustID.YellowTorch, 5, i, j); } public override bool RightClick(int i, int j) diff --git a/Tiles/Abyss/ThermalTorch.cs b/Tiles/Abyss/ThermalTorch.cs new file mode 100644 index 0000000000..44b162d35d --- /dev/null +++ b/Tiles/Abyss/ThermalTorch.cs @@ -0,0 +1,80 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class ThermalTorch : ModTile + { + public override void SetStaticDefaults() => this.SetUpTorch(ModContent.ItemType(), true, true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(200, 0, 0), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + 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 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 = 2f; + g = 0.5f; + b = 0.5f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Abyss/ThermalTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(DustID.RedTorch, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + 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/Abyss/ThermalTorch.png b/Tiles/Abyss/ThermalTorch.png new file mode 100644 index 0000000000..8e3bf0608d Binary files /dev/null and b/Tiles/Abyss/ThermalTorch.png differ diff --git a/Tiles/Abyss/ThermalTorchFlame.png b/Tiles/Abyss/ThermalTorchFlame.png new file mode 100644 index 0000000000..1d4ddff980 Binary files /dev/null and b/Tiles/Abyss/ThermalTorchFlame.png differ diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index 232125a4e6..bd3732bb9c 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -69,39 +69,39 @@ namespace CalamityMod.Tiles.Abyss } public override void RandomUpdate(int i, int j) - { - Tile tileBelow = Framing.GetTileSafely(i, j + 1); - if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) { - bool PlaceVine = false; - int Test = j; - while (Test > j - 10) + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) { - Tile testTile = Framing.GetTileSafely(i, Test); - if (testTile.BottomSlope) + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) { - break; - } - else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) { - Test--; - continue; - } - PlaceVine = true; - break; - } - - if (PlaceVine) + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) { - tileBelow.TileType = Type; - tileBelow.HasTile = true; - WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.dedServ) + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) { - NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); - } - } - } - } + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/Abyss/VoidTorch.cs similarity index 87% rename from Tiles/FurnitureAbyss/AbyssTorch.cs rename to Tiles/Abyss/VoidTorch.cs index 7c0459014e..d3074ce982 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/Abyss/VoidTorch.cs @@ -5,11 +5,11 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureAbyss +namespace CalamityMod.Tiles.Abyss { - public class AbyssTorch : ModTile + public class VoidTorch : ModTile { - public override void SetStaticDefaults() => this.SetUpTorch(ModContent.ItemType(), true, true); + public override void SetStaticDefaults() => this.SetUpTorch(ModContent.ItemType(), true, true); public override bool CreateDust(int i, int j, ref int type) { @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss Player player = Main.LocalPlayer; player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); + player.cursorItemIconID = ModContent.ItemType(); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -56,13 +56,13 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAbyss/AbyssTorchFlame").Value, i, j, 2); + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Abyss/VoidTorchFlame").Value, i, j, 2); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 66) - CalamityUtils.DrawFlameSparks(187, 5, i, j); + CalamityUtils.DrawFlameSparks(DustID.BlueFlare, 5, i, j); } public override bool RightClick(int i, int j) diff --git a/Tiles/FurnitureAbyss/AbyssTorch.png b/Tiles/Abyss/VoidTorch.png similarity index 100% rename from Tiles/FurnitureAbyss/AbyssTorch.png rename to Tiles/Abyss/VoidTorch.png diff --git a/Tiles/FurnitureAbyss/AbyssTorchFlame.png b/Tiles/Abyss/VoidTorchFlame.png similarity index 100% rename from Tiles/FurnitureAbyss/AbyssTorchFlame.png rename to Tiles/Abyss/VoidTorchFlame.png diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index e9ce5af903..4c2f9f609c 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileBrick[Type] = true; + Main.tileBrick[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); diff --git a/Tiles/Astral/AstralDirt.png b/Tiles/Astral/AstralDirt.png index 47b54336de..0a6f5d2d23 100644 Binary files a/Tiles/Astral/AstralDirt.png and b/Tiles/Astral/AstralDirt.png differ diff --git a/Tiles/BaseTiles/BaseBossRelic.cs b/Tiles/BaseTiles/BaseBossRelic.cs index b7a6ccdd37..41318d476c 100644 --- a/Tiles/BaseTiles/BaseBossRelic.cs +++ b/Tiles/BaseTiles/BaseBossRelic.cs @@ -90,21 +90,16 @@ namespace CalamityMod.Tiles.BaseTiles // This allows us to draw things in SpecialDraw if (drawData.tileFrameX % FrameWidth == 0 && drawData.tileFrameY % FrameHeight == 0) { - Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + Main.instance.TilesRenderer.AddSpecialPoint(i, j, Terraria.GameContent.Drawing.TileDrawing.TileCounterType.CustomNonSolid); } } public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { - // This is lighting-mode specific, always include this if you draw tiles manually. - Vector2 offScreen = new Vector2(Main.offScreenRange); - if (Main.drawToScreen) - offScreen = Vector2.Zero; - // Take the tile, check if it actually exists. Point p = new Point(i, j); Tile tile = Main.tile[p.X, p.Y]; - if (tile == null || !tile.HasTile) + if (!tile.HasTile) return; // Get the initial draw parameters. @@ -124,7 +119,7 @@ namespace CalamityMod.Tiles.BaseTiles // Some math magic to make it smoothly move up and down over time. const float TwoPi = (float)Math.PI * 2f; float offset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * TwoPi / 5f); - Vector2 drawPos = worldPos + offScreen - Main.screenPosition + new Vector2(0f, -40f) + new Vector2(0f, offset * 4f); + Vector2 drawPos = worldPos - Main.screenPosition + new Vector2(0f, -40f) + new Vector2(0f, offset * 4f); // Draw the main texture. spriteBatch.Draw(texture, drawPos, frame, color, 0f, origin, 1f, effects, 0f); diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index a003841988..854b2e295e 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -17,6 +17,7 @@ using Terraria.Enums; using Terraria.GameContent.Achievements; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Tiles { @@ -25,11 +26,13 @@ namespace CalamityMod.Tiles public static List GrowthTiles = new List() { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType() + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType() }; public override void SetStaticDefaults() @@ -42,136 +45,118 @@ namespace CalamityMod.Tiles TileID.Sets.TileCutIgnore.IgnoreDontHurtNature[TileID.Larva] = true; } + public override void PreShakeTree(int x, int y, TreeTypes treeType) + { + // Add an additional 25% chance to drop vanilla fruits + if (WorldGen.genRand.NextBool(4)) + { + int treeDropItemType = 0; + switch (treeType) + { + case TreeTypes.Forest: + + switch (WorldGen.genRand.Next(5)) + { + case 0: + treeDropItemType = ItemID.Apple; + break; + case 1: + treeDropItemType = ItemID.Apricot; + break; + case 2: + treeDropItemType = ItemID.Peach; + break; + case 3: + treeDropItemType = ItemID.Grapefruit; + break; + default: + treeDropItemType = ItemID.Lemon; + break; + } + break; + + case TreeTypes.Snow: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Cherry : ItemID.Plum; + break; + + case TreeTypes.Jungle: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Mango : ItemID.Pineapple; + break; + + case TreeTypes.Palm: + if (WorldGen.IsPalmOasisTree(x)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + break; + + case TreeTypes.PalmCorrupt: + if (WorldGen.genRand.NextBool()) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; + else if (WorldGen.IsPalmOasisTree(x)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + else + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; + break; + + case TreeTypes.Corrupt: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; + break; + + case TreeTypes.PalmHallowed: + if (WorldGen.genRand.NextBool()) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; + else if (WorldGen.IsPalmOasisTree(x)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + else + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; + break; + + case TreeTypes.Hallowed: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; + break; + + case TreeTypes.PalmCrimson: + if (WorldGen.genRand.NextBool()) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; + else if (WorldGen.IsPalmOasisTree(x)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + else + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; + break; + + case TreeTypes.Crimson: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; + break; + + case TreeTypes.Ash: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Pomegranate : ItemID.SpicyPepper; + break; + + default: + break; + } + + if (treeDropItemType != 0) + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + } + + public override bool ShakeTree(int x, int y, TreeTypes treeType) + { + // Ha-pu Fruit @ 1% (6.67% during Valentines) + // This *will* work on modded trees as well + if (WorldGen.genRand.NextBool(100) || (DateTime.Now.Month == 2 && DateTime.Now.Day == 14 && WorldGen.genRand.NextBool(15))) + { + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemType()); + return true; + } + + return base.ShakeTree(x, y, treeType); + } + public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) { Tile tile = Main.tile[i, j]; - // Fruit from trees upon tree destruction - // 25% chance to drop 1 to 2 fruit - if (!effectOnly && !fail && Main.netMode != NetmodeID.MultiplayerClient && TileID.Sets.IsShakeable[type] && WorldGen.genRand.NextBool(4)) - { - GetTreeBottom(i, j, out int treeX, out int treeY); - TreeTypes treeType = WorldGen.GetTreeType(Main.tile[treeX, treeY].TileType); - if (treeType != TreeTypes.None) - { - treeY--; - while (treeY > 10 && Main.tile[treeX, treeY].HasTile && TileID.Sets.IsShakeable[Main.tile[treeX, treeY].TileType]) - treeY--; - - treeY++; - - if (WorldGen.IsTileALeafyTreeTop(treeX, treeY) && !Collision.SolidTiles(treeX - 2, treeX + 2, treeY - 2, treeY + 2)) - { - int randomAmt = WorldGen.genRand.Next(1, 3); - for (int z = 0; z < randomAmt; z++) - { - int treeDropItemType = 0; - switch (treeType) - { - case TreeTypes.Forest: - - switch (WorldGen.genRand.Next(5)) - { - case 0: - treeDropItemType = ItemID.Apple; - break; - case 1: - treeDropItemType = ItemID.Apricot; - break; - case 2: - treeDropItemType = ItemID.Peach; - break; - case 3: - treeDropItemType = ItemID.Grapefruit; - break; - default: - treeDropItemType = ItemID.Lemon; - break; - } - - break; - - case TreeTypes.Snow: - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Cherry : ItemID.Plum; - break; - - case TreeTypes.Jungle: - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Mango : ItemID.Pineapple; - break; - - case TreeTypes.Palm: - - if (WorldGen.IsPalmOasisTree(treeX)) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; - - break; - - case TreeTypes.PalmCorrupt: - - if (WorldGen.genRand.NextBool()) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; - else if (WorldGen.IsPalmOasisTree(treeX)) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; - else - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; - - break; - - case TreeTypes.Corrupt: - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; - break; - - case TreeTypes.PalmHallowed: - - if (WorldGen.genRand.NextBool()) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; - else if (WorldGen.IsPalmOasisTree(treeX)) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; - else - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; - - break; - - case TreeTypes.Hallowed: - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; - break; - - case TreeTypes.PalmCrimson: - - if (WorldGen.genRand.NextBool()) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; - else if (WorldGen.IsPalmOasisTree(treeX)) - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; - else - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; - - break; - - case TreeTypes.Crimson: - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; - break; - - case TreeTypes.Ash: - treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Pomegranate : ItemID.SpicyPepper; - break; - - default: - break; - } - - if (treeDropItemType != 0) - { - if (Main.rand.NextBool(100) || (DateTime.Now.Month == 2 && DateTime.Now.Day == 14 && Main.rand.NextBool(15))) - { - treeDropItemType = ModContent.ItemType(); - } - Item.NewItem(new EntitySource_TileBreak(treeX, treeY), treeX * 16, treeY * 16, 16, 16, treeDropItemType); - } - } - } - } - } - // Helper function to shatter crystals attached to neighboring solid tiles. void CheckShatterCrystal(int xPos, int yPos, bool dontShatter) { @@ -179,7 +164,7 @@ namespace CalamityMod.Tiles return; Tile t = Main.tile[xPos, yPos]; - if (t.HasTile && (t.TileType == ModContent.TileType() || t.TileType == ModContent.TileType())) + if (t.HasTile && (t.TileType == TileType() || t.TileType == TileType())) { WorldGen.KillTile(xPos, yPos, false, false, false); if (!Main.tile[xPos, yPos].HasTile && Main.netMode != NetmodeID.SinglePlayer) @@ -188,7 +173,7 @@ namespace CalamityMod.Tiles } // Check if crystals should be shattered, do not shatter crystals next to other crystals if a crystal is shattered. - if (Main.tileSolid[tile.TileType] && tile.TileType != ModContent.TileType() && tile.TileType != ModContent.TileType()) + if (Main.tileSolid[tile.TileType] && tile.TileType != TileType() && tile.TileType != TileType()) { bool dontShatter = fail || effectOnly; CheckShatterCrystal(i + 1, j, dontShatter); @@ -318,7 +303,7 @@ namespace CalamityMod.Tiles // Drop Evil Smasher on every 12 alter smashed if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) { - DropItem(i, j, ModContent.ItemType(), quantity: 1, asStack: true); + DropItem(i, j, ItemType(), quantity: 1, asStack: true); } } // Drop Golden Bombs at a 0.33% chance from Pots @@ -326,7 +311,7 @@ namespace CalamityMod.Tiles { if (Main.rand.NextBool(300)) { - DropItem(i, j, ModContent.ItemType(), quantity: 1, asStack: true); + DropItem(i, j, ItemType(), quantity: 1, asStack: true); } } } @@ -359,11 +344,11 @@ namespace CalamityMod.Tiles { int[] invincibleTiles = new int[] { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType() + TileType(), + TileType(), + TileType(), + TileType(), + TileType() }; Tile checkTile = CalamityUtils.ParanoidTileRetrieval(x, y); diff --git a/Tiles/Crags/GloomTorch.cs b/Tiles/Crags/GloomTorch.cs index 025bc99438..47a62f1346 100644 --- a/Tiles/Crags/GloomTorch.cs +++ b/Tiles/Crags/GloomTorch.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Crags public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 66) - CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? 61 : 64, 5, i, j); + CalamityUtils.DrawFlameSparks(DustID.BlueTorch, 5, i, j); } public override bool RightClick(int i, int j) diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs index 7ce3ad11d3..f473c94e94 100644 --- a/Tiles/Furniture/CraftingStations/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.SummonItems; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -13,7 +14,6 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); + AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); TileID.Sets.DisableSmartCursor[Type] = true; // This cannot be placed and only exists for backwards compatibility, so item has to be returned to the player manually if broken. @@ -63,36 +63,50 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations } public override bool RightClick(int i, int j) => AttemptToSummonSCal(i, j); - public override void MouseOver(int i, int j) => HoverItemIcon(); - public override void MouseOverFar(int i, int j) => HoverItemIcon(); + public override void MouseOver(int i, int j) => HoverItemIcon(i, j); + public override void MouseOverFar(int i, int j) => HoverItemIcon(i, j); + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType()) + { + p.Kill(); + break; + } + } + } - public static void HoverItemIcon() + public static void HoverItemIcon(int i, int j) { bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (vodka) - { Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); - } else if (Main.LocalPlayer.HasItem(ModContent.ItemType())) - { Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); - } else - { Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); - } Main.LocalPlayer.noThrow = 2; Main.LocalPlayer.cursorItemIconEnabled = true; + + // Checks if the player has the Ruler lines or Ruler grid toggled + if (Main.LocalPlayer.builderAccStatus[0] == 0 || Main.LocalPlayer.builderAccStatus[1] == 0) + { + // Don't spawn the arena visual if one already exists or if SCal is alive or spawning + if (CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) || + CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) || + NPC.AnyNPCs(ModContent.NPCType())) + return; + + Tile t = Main.tile[i, j]; + Vector2 arenaCenter = new Vector2(i - t.TileFrameX / 18 + Width / 2, j - t.TileFrameY / 18).ToWorldCoordinates() - Vector2.UnitY * 24f; + Projectile.NewProjectile(new EntitySource_WorldEvent(), arenaCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, CalamityWorld.death.ToInt()); + } } public static bool AttemptToSummonSCal(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()) && !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) { @@ -109,6 +123,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations bool usingSpecialItem = Main.LocalPlayer.HasItem(ModContent.ItemType()); + Tile tile = Main.tile[i, j]; + int left = i - tile.TileFrameX / 18; + int top = j - tile.TileFrameY / 18; Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); ritualSpawnPosition += new Vector2(0f, -24f); @@ -118,12 +135,10 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations if (vodka) { Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); - for (int f = 0; f < Main.maxNPCs; f++) + foreach (NPC n in Main.ActiveNPCs) { - if (Main.npc[f].type == ModContent.NPCType() && Main.npc[f].active) - { - Main.npc[f].active = false; - } + if (n.type == ModContent.NPCType()) + n.active = false; } } else if (!usingSpecialItem) @@ -159,7 +174,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); + AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName()); TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { ModContent.TileType() }; } @@ -174,7 +189,18 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations } public override bool RightClick(int i, int j) => SCalAltar.AttemptToSummonSCal(i, j); - public override void MouseOver(int i, int j) => SCalAltar.HoverItemIcon(); - public override void MouseOverFar(int i, int j) => SCalAltar.HoverItemIcon(); + public override void MouseOver(int i, int j) => SCalAltar.HoverItemIcon(i, j); + public override void MouseOverFar(int i, int j) => SCalAltar.HoverItemIcon(i, j); + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType()) + { + p.Kill(); + break; + } + } + } } } diff --git a/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs b/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs index 544b0fcab8..a196adc55a 100644 --- a/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs +++ b/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void SetStaticDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; Main.tileShine[Type] = 3500; diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs b/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs new file mode 100644 index 0000000000..8945a76fcb --- /dev/null +++ b/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs @@ -0,0 +1,39 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class AnodizedWulfrumPanels : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + + HitSound = MinePlatingSound; + AddMapEntry(new Color(89, 113, 91)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.png b/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.png new file mode 100644 index 0000000000..d21f8a56c8 Binary files /dev/null and b/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.png differ diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs new file mode 100644 index 0000000000..a5e47eb9a0 --- /dev/null +++ b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class AnodizedWulfrumPlatform : ModTile + { + internal static Texture2D GlowTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow", AssetRequestMode.ImmediateLoad).Value; + } + + this.SetUpPlatform(ModContent.ItemType(), true); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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; + } + 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); + if (tile.IsTileActuallyInvisible()) + return; + + int xPos = tile.TileFrameX; + int frameOffset = (i + j) % 6 * 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) + { + 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/FurnitureWulfrum/AnodizedWulfrumPlatform.png b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.png new file mode 100644 index 0000000000..4c097dcfac Binary files /dev/null and b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.png differ diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow.png b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow.png new file mode 100644 index 0000000000..9f3ad966ea Binary files /dev/null and b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs b/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs new file mode 100644 index 0000000000..619ac0c860 --- /dev/null +++ b/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs @@ -0,0 +1,52 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class AnodizedWulfrumTrim : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + private const short subsheetWidth = 216; + private const short subsheetHeight = 72; + public static int TypeCache; + public override void SetStaticDefaults() + { + TypeCache = Type; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileShine2[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + + HitSound = MinePlatingSound; + AddMapEntry(new Color(133, 13, 13)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 2; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + } + } +} diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.png b/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.png new file mode 100644 index 0000000000..8ca32f7c89 Binary files /dev/null and b/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.png differ diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs new file mode 100644 index 0000000000..2e65ffd89c --- /dev/null +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs @@ -0,0 +1,86 @@ +using System; +using CalamityMod.Systems; +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.FurnitureWulfrum +{ + + public class ChargedWulfrumEnergyBarrier : ModTile + { + public static int TypeCache; + public override void SetStaticDefaults() + { + TypeCache = Type; + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = false; + Main.tileBrick[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + + DustType = 108; + AddMapEntry(new Color(112, 244, 244)); + HitSound = SoundID.Shatter; + } + + 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) + { + float brightness = 0.9f; + Color cyan = new Color(112, 244, 244); + Color blue = new Color(54, 177, 221); + Color value = Color.Lerp(cyan, blue, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(cyan, blue, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + + r = (value.R + value1.R) / 800f; + g = (value.G + value1.G) / 800f; + b = (value.B + value1.B) / 800f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.094f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + float transparency = 0.05f + wave1angle; + + + // Must be set here + TileID.Sets.DrawsWalls[Type] = true; + Main.tileNoSunLight[Type] = false; + + Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrierReflect").Value; + + Tile tile = Main.tile[i, j]; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; + } + } +} diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.png b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.png new file mode 100644 index 0000000000..e9a2e8bdac Binary files /dev/null and b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.png differ diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrierReflect.png b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrierReflect.png new file mode 100644 index 0000000000..a937fddfbf Binary files /dev/null and b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrierReflect.png differ diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..41a4aeb59a --- /dev/null +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using CalamityMod.Systems; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class ChargedWulfrumWallMountedBulb : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + 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 = 84f / 255f; + g = 212f / 255f; + b = 233f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.094f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + float transparency = 0.05f + wave1angle; + + Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow").Value; + + Tile tile = Main.tile[i, j]; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + } + 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()); + } + } +} diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png new file mode 100644 index 0000000000..575501ad39 Binary files /dev/null and b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png differ diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow.png b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow.png new file mode 100644 index 0000000000..24567bc279 Binary files /dev/null and b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs b/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs new file mode 100644 index 0000000000..bb3feb86ec --- /dev/null +++ b/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs @@ -0,0 +1,52 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class RoundedAnodizedWulfrumPanels : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + private const short subsheetWidth = 216; + private const short subsheetHeight = 72; + public static int TypeCache; + public override void SetStaticDefaults() + { + TypeCache = Type; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileShine2[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + + HitSound = MinePlatingSound; + AddMapEntry(new Color(164, 150, 125)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 2; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + } + } +} diff --git a/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.png b/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.png new file mode 100644 index 0000000000..5f0bba3e44 Binary files /dev/null and b/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.cs b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.cs new file mode 100644 index 0000000000..cc6d71c610 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.cs @@ -0,0 +1,86 @@ +using System; +using CalamityMod.Systems; +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.FurnitureWulfrum +{ + + public class WulfrumEnergyBarrier : ModTile + { + public static int TypeCache; + public override void SetStaticDefaults() + { + TypeCache = Type; + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = false; + Main.tileBrick[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + + DustType = 108; + AddMapEntry(new Color(194, 255, 67)); + HitSound = SoundID.Shatter; + } + + 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) + { + float brightness = 0.9f; + Color lime = new Color(194, 255, 67); + Color green = new Color(110, 192, 93); + Color value = Color.Lerp(lime, green, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(lime, green, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + + r = (value.R + value1.R) / 800f; + g = (value.G + value1.G) / 800f; + b = (value.B + value1.B) / 800f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.064f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + float transparency = 0.05f + wave1angle; + + + // Must be set here + TileID.Sets.DrawsWalls[Type] = true; + Main.tileNoSunLight[Type] = false; + + Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumEnergyBarrierReflect").Value; + + Tile tile = Main.tile[i, j]; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.png b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.png new file mode 100644 index 0000000000..b7a61aeaf1 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumEnergyBarrierReflect.png b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrierReflect.png new file mode 100644 index 0000000000..76d130ee7b Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrierReflect.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPanels.cs b/Tiles/FurnitureWulfrum/WulfrumPanels.cs new file mode 100644 index 0000000000..da1bfab3e4 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumPanels.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumPanels : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + private const short subsheetWidth = 216; + private const short subsheetHeight = 72; + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + HitSound = MinePlatingSound; + AddMapEntry(new Color(89, 113, 91)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 2; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumPanels.png b/Tiles/FurnitureWulfrum/WulfrumPanels.png new file mode 100644 index 0000000000..9ad4d8635f Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPanels.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPlatform.cs b/Tiles/FurnitureWulfrum/WulfrumPlatform.cs new file mode 100644 index 0000000000..6eebeafb95 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumPlatform.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumPlatform : ModTile + { + internal static Texture2D GlowTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumPlatform_Glow", AssetRequestMode.ImmediateLoad).Value; + } + + this.SetUpPlatform(ModContent.ItemType(), true); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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; + } + 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); + if (tile.IsTileActuallyInvisible()) + return; + + int xPos = tile.TileFrameX; + int frameOffset = (i + j) % 6 * 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) + { + 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/FurnitureWulfrum/WulfrumPlatform.png b/Tiles/FurnitureWulfrum/WulfrumPlatform.png new file mode 100644 index 0000000000..a1b3cf4ee5 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPlatform.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPlatform_Glow.png b/Tiles/FurnitureWulfrum/WulfrumPlatform_Glow.png new file mode 100644 index 0000000000..c736697170 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPlatform_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.cs b/Tiles/FurnitureWulfrum/WulfrumPlating.cs index 6132c842d2..ef7187ab11 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPlating.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPlating.cs @@ -12,15 +12,17 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public class WulfrumPlating : ModTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - private const short subsheetWidth = 324; - private const short subsheetHeight = 90; + private const short subsheetWidth = 216; + private const short subsheetHeight = 72; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); HitSound = MinePlatingSound; AddMapEntry(new Color(155, 171, 117)); @@ -34,7 +36,8 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.png b/Tiles/FurnitureWulfrum/WulfrumPlating.png index 47559138c5..e08047297f 100644 Binary files a/Tiles/FurnitureWulfrum/WulfrumPlating.png and b/Tiles/FurnitureWulfrum/WulfrumPlating.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSheets.cs b/Tiles/FurnitureWulfrum/WulfrumSheets.cs new file mode 100644 index 0000000000..9b26f02b4d --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumSheets.cs @@ -0,0 +1,51 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumSheets : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + private const short subsheetWidth = 216; + private const short subsheetHeight = 72; + public static int TypeCache; + public override void SetStaticDefaults() + { + TypeCache = Type; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = false; + Main.tileShine2[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + HitSound = MinePlatingSound; + AddMapEntry(new Color(109, 132, 101)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFramingSystem.CompactFraming(i, j, resetFrame); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 2; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumSheets.png b/Tiles/FurnitureWulfrum/WulfrumSheets.png new file mode 100644 index 0000000000..509cff2949 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSheets.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSiding.cs b/Tiles/FurnitureWulfrum/WulfrumSiding.cs new file mode 100644 index 0000000000..8df1d946d3 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumSiding.cs @@ -0,0 +1,39 @@ +using CalamityMod.Dusts; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumSiding : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeDecorativeTiles(Type); + + HitSound = MinePlatingSound; + AddMapEntry(new Color(164, 150, 125)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumSiding.png b/Tiles/FurnitureWulfrum/WulfrumSiding.png new file mode 100644 index 0000000000..2a9b30f705 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSiding.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..17e276d470 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using CalamityMod.Systems; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumWallMountedBulb : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(92, 187, 99), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + 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 = 141f / 255f; + g = 219f / 255f; + b = 84f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.094f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + float transparency = 0.05f + wave1angle; + + Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow").Value; + + Tile tile = Main.tile[i, j]; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + } + 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()); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.png b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.png new file mode 100644 index 0000000000..3c4658b0ee Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow.png b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow.png new file mode 100644 index 0000000000..b46c72f818 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow.png differ diff --git a/Tiles/Merges/PolypSandMerge.cs b/Tiles/Merges/PolypSandMerge.cs new file mode 100644 index 0000000000..572ab6505e --- /dev/null +++ b/Tiles/Merges/PolypSandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class PolypSandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/PolypSandMerge.png b/Tiles/Merges/PolypSandMerge.png new file mode 100644 index 0000000000..9b36426426 Binary files /dev/null and b/Tiles/Merges/PolypSandMerge.png differ diff --git a/Tiles/Merges/RunestoneMerge.cs b/Tiles/Merges/RunestoneMerge.cs new file mode 100644 index 0000000000..08ef656bb0 --- /dev/null +++ b/Tiles/Merges/RunestoneMerge.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class RunestoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/RunestoneMerge.png b/Tiles/Merges/RunestoneMerge.png new file mode 100644 index 0000000000..084eb1d80a Binary files /dev/null and b/Tiles/Merges/RunestoneMerge.png differ diff --git a/Tiles/Merges/ScarletSeaGrassTileMerge.cs b/Tiles/Merges/ScarletSeaGrassTileMerge.cs new file mode 100644 index 0000000000..78e03fbe21 --- /dev/null +++ b/Tiles/Merges/ScarletSeaGrassTileMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class ScarletSeaGrassTileMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/ScarletSeaGrassTileMerge.png b/Tiles/Merges/ScarletSeaGrassTileMerge.png new file mode 100644 index 0000000000..9b36426426 Binary files /dev/null and b/Tiles/Merges/ScarletSeaGrassTileMerge.png differ diff --git a/Tiles/Merges/ShellstoneMerge.cs b/Tiles/Merges/ShellstoneMerge.cs new file mode 100644 index 0000000000..a01e3366e8 --- /dev/null +++ b/Tiles/Merges/ShellstoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class ShellstoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/ShellstoneMerge.png b/Tiles/Merges/ShellstoneMerge.png new file mode 100644 index 0000000000..30e9733f65 Binary files /dev/null and b/Tiles/Merges/ShellstoneMerge.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index db5c9265c8..a62018f05a 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Tiles Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); TileObjectData.newTile.Height = 3; @@ -43,21 +44,21 @@ namespace CalamityMod.Tiles TileObjectData.addAlternate(0); TileObjectData.addTile(Type); DustType = -1; - TileID.Sets.DisableSmartCursor[Type] = true; AddMapEntry(new Color(13, 88, 130), Language.GetText("MapObject.Banner")); } public override void NearbyEffects(int i, int j, bool closer) { - if (!closer) - return; - Player player = Main.LocalPlayer; - if (player is null || !player.active || player.dead) + if (closer) return; int style = Main.tile[i, j].TileFrameX / 18; int npc = GetBannerNPC(style); - if (npc != -1) + if (npc == -1) + return; + + int itemType = TileLoader.GetItemDropFromTypeAndStyle(Type, style); + if (ItemID.Sets.BannerStrength.IndexInRange(itemType) && ItemID.Sets.BannerStrength[itemType].Enabled) { Main.SceneMetrics.NPCBannerBuff[npc] = true; Main.SceneMetrics.hasBanner = true; @@ -66,6 +67,8 @@ namespace CalamityMod.Tiles public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY += 2; + public static int GetBannerNPC(int style) { int npc = -1; @@ -246,7 +249,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 58: - npc = NPCType(); + npc = NPCType(); break; case 59: npc = NPCType(); diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index d29d32726f..66f4d09ea4 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; DustType = 105; - AddMapEntry(new Color(210, 101, 28), CreateMapEntryName()); + AddMapEntry(new Color(167, 80, 22), CreateMapEntryName()); MineResist = 3f; MinPick = 210; HitSound = SoundID.Tink; diff --git a/Tiles/SunkenSea/AlgalPrismTorch.cs b/Tiles/SunkenSea/AlgalPrismTorch.cs index 10788826b7..dd388a3ed7 100644 --- a/Tiles/SunkenSea/AlgalPrismTorch.cs +++ b/Tiles/SunkenSea/AlgalPrismTorch.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.SunkenSea public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 66) - CalamityUtils.DrawFlameSparks(61, 5, i, j); + CalamityUtils.DrawFlameSparks(DustID.GreenTorch, 5, i, j); } public override bool RightClick(int i, int j) diff --git a/Tiles/SunkenSea/Ambient/BrainCoral.cs b/Tiles/SunkenSea/Ambient/BrainCoral.cs index f3f73b002f..c115b322ca 100644 --- a/Tiles/SunkenSea/Ambient/BrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/BrainCoral.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - DustType = 253; + DustType = DustID.SailfishBoots; AddMapEntry(new Color(36, 61, 111)); base.SetStaticDefaults(); @@ -44,8 +44,19 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { if (Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && Main.tile[i, tileLocationY - 2].LiquidAmount == 255) { + for (int t = 0; t < 5; t++) + { + Dust dust = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.BlueTorch, 0, 0, 1, default, 1.5f); + dust.velocity *= 0.2f; + dust.noGravity = true; + dust.noLight = true; + dust.noLightEmittence = true; + } + Dust dust2 = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.MagicMirror, 0, 0, 1, Color.LightSkyBlue, 0.5f); + dust2.velocity *= 0.2f; + if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 1f, Main.myPlayer); } } } diff --git a/Tiles/SunkenSea/Ambient/BranchCoral.cs b/Tiles/SunkenSea/Ambient/BranchCoral.cs new file mode 100644 index 0000000000..773d7d5f07 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/BranchCoral.cs @@ -0,0 +1,73 @@ +using System; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using CalamityMod.Items.Weapons.Melee; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class BranchCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileSpelunker[Type] = false; + + HitSound = SoundID.Dig; + DustType = DustID.CrimsonPlants; + + AddMapEntry(new Color(210, 66, 90)); + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 32; // total 32 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 8; // only 1 placement alternative per row + TileObjectData.newTile.RandomStyleRange = 8; // 8 different style will be selected upon placing + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(16); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(24); + TileObjectData.addTile(Type); + } + + 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 = 232 / 500f; + g = 122 / 500f; + b = 122 / 500f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/BranchCoral.png b/Tiles/SunkenSea/Ambient/BranchCoral.png new file mode 100644 index 0000000000..5661d35858 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BranchCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral.cs b/Tiles/SunkenSea/Ambient/DigitateCoral.cs new file mode 100644 index 0000000000..bd9961dd72 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DigitateCoral.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DigitateCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(48, 201, 214)); + DustType = DustID.IceGolem; + + base.SetStaticDefaults(); + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + + public class DigitateCoral2 : DigitateCoral + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + + public class DigitateCoral3 : DigitateCoral + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral.png b/Tiles/SunkenSea/Ambient/DigitateCoral.png new file mode 100644 index 0000000000..4af501b5ec Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DigitateCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral2.png b/Tiles/SunkenSea/Ambient/DigitateCoral2.png new file mode 100644 index 0000000000..7012604abd Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DigitateCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral3.png b/Tiles/SunkenSea/Ambient/DigitateCoral3.png new file mode 100644 index 0000000000..53d503eb5f Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DigitateCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs new file mode 100644 index 0000000000..9c278f7bc6 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs @@ -0,0 +1,138 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DriftwoodAmbient1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 4); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + + public class DriftwoodAmbient2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient5 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient6 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png new file mode 100644 index 0000000000..ed3ac19385 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png new file mode 100644 index 0000000000..4b1ae8d4cc Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png new file mode 100644 index 0000000000..b786e79bc1 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png new file mode 100644 index 0000000000..528c3ab92b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png new file mode 100644 index 0000000000..498e6e8bd4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png new file mode 100644 index 0000000000..a723c9116b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png differ diff --git a/Tiles/SunkenSea/Ambient/FryCoral.cs b/Tiles/SunkenSea/Ambient/FryCoral.cs new file mode 100644 index 0000000000..9002d177a9 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/FryCoral.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class FryCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(79, 196, 149)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 235f / 400f; + g = 146f / 400f; + b = 146f / 400f; + } + } + + public class FryCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(79, 196, 149)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 235f / 400f; + g = 146f / 400f; + b = 146f / 400f; + } + } + public class FryCoral3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(79, 196, 149)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 235f / 400f; + g = 146f / 400f; + b = 146f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/FryCoral.png b/Tiles/SunkenSea/Ambient/FryCoral.png new file mode 100644 index 0000000000..99e82a386d Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FryCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/FryCoral2.png b/Tiles/SunkenSea/Ambient/FryCoral2.png new file mode 100644 index 0000000000..82f4c7858a Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FryCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/FryCoral3.png b/Tiles/SunkenSea/Ambient/FryCoral3.png new file mode 100644 index 0000000000..830b4e0432 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FryCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs new file mode 100644 index 0000000000..827579e20d --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs @@ -0,0 +1,60 @@ +using System; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LongScarletSeagrass : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); + DustType = DustID.CrimsonPlants; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -30; + height = 48; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png new file mode 100644 index 0000000000..2cef1eb725 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs b/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs new file mode 100644 index 0000000000..169776c86a --- /dev/null +++ b/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class NavystoneAmbient : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(59, 136, 146)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } + + public class NavystoneAmbient2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(59, 136, 146)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } + public class NavystoneAmbient3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(59, 136, 146)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient.png new file mode 100644 index 0000000000..9b93ad7195 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystoneAmbient.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png new file mode 100644 index 0000000000..08f3a3845b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png new file mode 100644 index 0000000000..891b37d87d Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png differ diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs new file mode 100644 index 0000000000..eb442b6f1b --- /dev/null +++ b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs @@ -0,0 +1,127 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class RefractiveHangingCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoFail[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileNoSunLight[Type] = false; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.VineThreads[Type] = true; + AddMapEntry(new Color(96, 109, 154)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Framing.GetTileSafely(i, j + 1); + if (tile.HasTile && tile.TileType == Type) + { + WorldGen.KillTile(i, j + 1); + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + int type = -1; + if (tileAbove.HasTile && !tileAbove.BottomSlope) + { + type = tileAbove.TileType; + } + + if (type == ModContent.TileType() || type == Type) + { + return true; + } + + WorldGen.KillTile(i, j); + return true; + } + public override void NearbyEffects(int i, int j, bool closer) + { + // Light Cyan + if (closer && Main.rand.NextBool(600)) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(136, 206, 215), 1.7f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + //Lilac + if (closer && Main.rand.NextBool(600)) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(236, 194, 252), 1.6f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.9f; + brightness += 0.6f; + brightness = MathHelper.Clamp(brightness, 0.5f, 0.9f); + brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.01f + i); + Color lilac = new Color(236, 194, 252); + Color mint = new Color(163, 252, 195); + Color value = Color.Lerp(lilac, mint, (MathF.Sin(j / 30f + Main.GameUpdateCount * 0.017f + -i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(lilac, mint, (MathF.Sin((-j - 100) / 40f + Main.GameUpdateCount * 0.014f + i / 20f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + + public override void RandomUpdate(int i, int j) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + { + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) + { + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) + { + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + { + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) + { + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } + } +} diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.png b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.png new file mode 100644 index 0000000000..cd49838375 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/SeaAnemone.cs b/Tiles/SunkenSea/Ambient/SeaAnemone.cs index fe95a937cc..3986a6af4c 100644 --- a/Tiles/SunkenSea/Ambient/SeaAnemone.cs +++ b/Tiles/SunkenSea/Ambient/SeaAnemone.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -10,12 +12,13 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public override void SetStaticDefaults() { + Main.tileLighted[Type] = true; AnimationFrameHeight = 36; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - DustType = 253; + DustType = DustID.TsunamiInABottle; AddMapEntry(new Color(54, 69, 72)); base.SetStaticDefaults(); @@ -26,6 +29,21 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient num = fail ? 1 : 3; } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 85f / 255f; + b = 151f / 255f; + g = 196f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; diff --git a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs index 6013e6ac73..5b39be26bd 100644 --- a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - DustType = 253; + DustType = DustID.SailfishBoots; AddMapEntry(new Color(36, 61, 111)); base.SetStaticDefaults(); @@ -45,6 +45,17 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { if (Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && Main.tile[i, tileLocationY - 2].LiquidAmount == 255) { + for (int t = 0; t < 5; t++) + { + Dust dust = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.BlueTorch, 0, 0, 1, default, 1.5f); + dust.velocity *= 0.2f; + dust.noGravity = true; + dust.noLight = true; + dust.noLightEmittence = true; + } + Dust dust2 = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.MagicMirror, 0, 0, 1, Color.LightSkyBlue, 0.5f); + dust2.velocity *= 0.2f; + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 1f, Main.myPlayer); } diff --git a/Tiles/SunkenSea/Ambient/StalkCoral.cs b/Tiles/SunkenSea/Ambient/StalkCoral.cs new file mode 100644 index 0000000000..0ad633d405 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/StalkCoral.cs @@ -0,0 +1,113 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class StalkCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(156, 87, 57)); + DustType = DustID.t_PearlWood; + HitSound = SoundID.Dig; + + } + 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 = 192f / 450f; + g = 173f / 450f; + b = 166f / 450f; + } + } + + public class StalkCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(156, 87, 57)); + DustType = DustID.t_PearlWood; + HitSound = SoundID.Dig; + } + 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 = 192f / 450f; + g = 173f / 450f; + b = 166f / 450f; + } + } + public class StalkCoral3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(156, 87, 57)); + DustType = DustID.t_PearlWood; + HitSound = SoundID.Dig; + } + 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 = 192f / 450f; + g = 173f / 450f; + b = 166f / 450f; + } + } + +} diff --git a/Tiles/SunkenSea/Ambient/StalkCoral.png b/Tiles/SunkenSea/Ambient/StalkCoral.png new file mode 100644 index 0000000000..63624ae860 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/StalkCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/StalkCoral2.png b/Tiles/SunkenSea/Ambient/StalkCoral2.png new file mode 100644 index 0000000000..b252e86203 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/StalkCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/StalkCoral3.png b/Tiles/SunkenSea/Ambient/StalkCoral3.png new file mode 100644 index 0000000000..cab856dd66 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/StalkCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral.cs b/Tiles/SunkenSea/Ambient/TallDigitateCoral.cs new file mode 100644 index 0000000000..9f1a283578 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/TallDigitateCoral.cs @@ -0,0 +1,137 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class TallDigitateCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(48, 201, 214)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + 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 = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + + public class TallDigitateCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(48, 201, 214)); + DustType = 96; + HitSound = SoundID.Dig; + } + 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 = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + public class TallDigitateCoral3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(48, 201, 214)); + DustType = 96; + HitSound = SoundID.Dig; + } + 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 = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + public class TallDigitateCoral4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 6; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(48, 201, 214)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral.png new file mode 100644 index 0000000000..432a9bfed7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral2.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral2.png new file mode 100644 index 0000000000..2602cb0363 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral3.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral3.png new file mode 100644 index 0000000000..d7898fe9c4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral4.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral4.png new file mode 100644 index 0000000000..b1b1bca49a Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral4.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs new file mode 100644 index 0000000000..587ed2f77e --- /dev/null +++ b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs @@ -0,0 +1,161 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class WideScarletSeagrass : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public class WideScarletSeagrass2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + public class WideScarletSeagrass3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + public class WideScarletSeagrass4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png new file mode 100644 index 0000000000..6e040b11de Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png new file mode 100644 index 0000000000..ef6e26701f Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png new file mode 100644 index 0000000000..a3620da034 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png new file mode 100644 index 0000000000..ca8367022c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png differ diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs index 66801b9ce7..6e309e5123 100644 --- a/Tiles/SunkenSea/Basalt.cs +++ b/Tiles/SunkenSea/Basalt.cs @@ -1,5 +1,4 @@ -using CalamityMod.Systems; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,18 +26,24 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - DustType = 36; + DustType = DustID.Ash; HitSound = SoundID.Tink; AddMapEntry(new Color(58, 55, 70)); MinPick = 110; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,10 +58,5 @@ namespace CalamityMod.Tiles.SunkenSea frameYOffset = j % 4 * sheetHeight; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - // 02JUN2024: Ozzatron: unclear if this is the correct framing strategy for Basalt - return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); - } } } diff --git a/Tiles/SunkenSea/Basalt.png b/Tiles/SunkenSea/Basalt.png index 05a9bf9830..4341da810c 100644 Binary files a/Tiles/SunkenSea/Basalt.png and b/Tiles/SunkenSea/Basalt.png differ diff --git a/Tiles/SunkenSea/BlackPearlPile.cs b/Tiles/SunkenSea/BlackPearlPile.cs index 0dcf0cfa49..5bc5af6bb7 100644 --- a/Tiles/SunkenSea/BlackPearlPile.cs +++ b/Tiles/SunkenSea/BlackPearlPile.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,18 +22,23 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Shatter; - DustType = 82; + DustType = DustID.Lead; AddMapEntry(new Color(29, 33, 38)); TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/CyanCoral.cs b/Tiles/SunkenSea/CyanCoral.cs index 962a945c95..596a66cc9c 100644 --- a/Tiles/SunkenSea/CyanCoral.cs +++ b/Tiles/SunkenSea/CyanCoral.cs @@ -26,17 +26,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.HallowSpray; AddMapEntry(new Color(92, 168, 198)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/Driftwood.cs b/Tiles/SunkenSea/Driftwood.cs index d8b24dbb9d..2912e3a13a 100644 --- a/Tiles/SunkenSea/Driftwood.cs +++ b/Tiles/SunkenSea/Driftwood.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; HitSound = SoundID.Dig; - DustType = 121; + DustType = DustID.Shadewood_Tree; AddMapEntry(new Color(136, 129, 154)); - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Dunesand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); diff --git a/Tiles/SunkenSea/RuneSand.cs b/Tiles/SunkenSea/Dunesand.cs similarity index 93% rename from Tiles/SunkenSea/RuneSand.cs rename to Tiles/SunkenSea/Dunesand.cs index 41e23b8165..ddf287c5f5 100644 --- a/Tiles/SunkenSea/RuneSand.cs +++ b/Tiles/SunkenSea/Dunesand.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - public class RuneSand : ModTile + [LegacyName("RuneSand")] + public class Dunesand : ModTile { public override void SetStaticDefaults() { @@ -23,7 +24,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; Main.tileShine2[Type] = true; - DustType = 147; + DustType = DustID.Hive; AddMapEntry(new Color(210, 124, 45)); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/RuneSand.png b/Tiles/SunkenSea/Dunesand.png similarity index 100% rename from Tiles/SunkenSea/RuneSand.png rename to Tiles/SunkenSea/Dunesand.png diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 9638735706..586129ae10 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -27,14 +27,16 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here Main.tileShine[Type] = 1800; - Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - DustType = 108; - AddMapEntry(new Color(158, 203, 234)); + DustType = DustID.Titanium; + AddMapEntry(new Color(163, 194, 212)); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index ce710bc265..c85a907006 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - DustType = 108; + DustType = DustID.Titanium; AddMapEntry(new Color(61, 151, 194)); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); diff --git a/Tiles/SunkenSea/LimeCoral.cs b/Tiles/SunkenSea/LimeCoral.cs index b4536f301a..72fb3e4bfc 100644 --- a/Tiles/SunkenSea/LimeCoral.cs +++ b/Tiles/SunkenSea/LimeCoral.cs @@ -21,17 +21,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Terra; AddMapEntry(new Color(139, 206, 56)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/Limestone.cs b/Tiles/SunkenSea/Limestone.cs index 2b154ba374..6c05789b43 100644 --- a/Tiles/SunkenSea/Limestone.cs +++ b/Tiles/SunkenSea/Limestone.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Merges; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -19,14 +20,12 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; - DustType = 22; + DustType = DustID.Pot; AddMapEntry(new Color(154, 119, 119)); - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/MagentaCoral.cs b/Tiles/SunkenSea/MagentaCoral.cs index 85794d1b39..327b375883 100644 --- a/Tiles/SunkenSea/MagentaCoral.cs +++ b/Tiles/SunkenSea/MagentaCoral.cs @@ -26,17 +26,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Ice_Pink; AddMapEntry(new Color(206, 56, 123)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs new file mode 100644 index 0000000000..bb01d56583 --- /dev/null +++ b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using CalamityMod.Items.Weapons.Melee; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class MediumSeaPrismCrystal : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + HitSound = SoundID.Item27; + DustType = DustID.IceRod; + MinPick = 55; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 32; // total 32 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 8; // only 1 placement alternative per row + TileObjectData.newTile.RandomStyleRange = 8; // 8 different style will be selected upon placing + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(16); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(24); + TileObjectData.addTile(Type); + } + + 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) + { + var tile = Main.tile[i, j]; + bool lessLightDueToLowWater = tile.LiquidAmount > 50 && tile.LiquidType == LiquidID.Water; + + //Blue + Color blue = new Color(202, 236, 238); + Color darkviolet = new Color(18, 67, 116); + Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 10) / 50f + Main.GameUpdateCount * 0.064f + -i / 30f) + 1f) / 2f); + r = lessLightDueToLowWater ? 0.27f : 0.36f; + g = lessLightDueToLowWater ? 0.405f : 0.54f; + b = lessLightDueToLowWater ? 0.405f : 0.54f; + r *= (value.R + value1.R) / 300f; + g *= (value.G + value1.G) / 300f; + b *= (value.B + value1.B) / 300f; + } + 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(), 4); + } + } +} diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.png b/Tiles/SunkenSea/MediumSeaPrismCrystal.png new file mode 100644 index 0000000000..e087780707 Binary files /dev/null and b/Tiles/SunkenSea/MediumSeaPrismCrystal.png differ diff --git a/Tiles/SunkenSea/NavyPrismTorch.cs b/Tiles/SunkenSea/NavyPrismTorch.cs index db44eff724..2c6d422ac5 100644 --- a/Tiles/SunkenSea/NavyPrismTorch.cs +++ b/Tiles/SunkenSea/NavyPrismTorch.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.SunkenSea public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 66) - CalamityUtils.DrawFlameSparks(59, 5, i, j); + CalamityUtils.DrawFlameSparks(DustID.BlueTorch, 5, i, j); } public override bool RightClick(int i, int j) diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index d982d24e92..f599048eec 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -18,14 +18,13 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - DustType = 96; + DustType = DustID.BlueMoss; AddMapEntry(new Color(17, 53, 77)); HitSound = SoundID.Tink; - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/OrangeCoral.cs b/Tiles/SunkenSea/OrangeCoral.cs index d1b7a8e2e4..b9a4a0c5b5 100644 --- a/Tiles/SunkenSea/OrangeCoral.cs +++ b/Tiles/SunkenSea/OrangeCoral.cs @@ -21,17 +21,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Pixie; AddMapEntry(Color.Orange); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/PinkPearlPile.cs b/Tiles/SunkenSea/PinkPearlPile.cs index 3bafcf5afb..2e6b07a060 100644 --- a/Tiles/SunkenSea/PinkPearlPile.cs +++ b/Tiles/SunkenSea/PinkPearlPile.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -19,20 +20,25 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Shatter; - DustType = 119; + DustType = DustID.Ice_Pink; AddMapEntry(new Color(204, 143, 174)); Main.tileShine[Type] = 3500; Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/PolypSand.cs b/Tiles/SunkenSea/PolypSand.cs index 8f819b128d..4910ac35f5 100644 --- a/Tiles/SunkenSea/PolypSand.cs +++ b/Tiles/SunkenSea/PolypSand.cs @@ -1,9 +1,15 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; + + namespace CalamityMod.Tiles.SunkenSea { public class PolypSand : ModTile @@ -13,7 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.GeneralPlacementTiles[Type] = false; Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = false; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); @@ -21,11 +27,11 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - Main.tileShine2[Type] = true; - DustType = 147; + DustType = DustID.Ice_Red; AddMapEntry(new Color(221, 180, 182)); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/RefractivePrismTorch.cs b/Tiles/SunkenSea/RefractivePrismTorch.cs index e0e3d784e4..8d1f2f4b36 100644 --- a/Tiles/SunkenSea/RefractivePrismTorch.cs +++ b/Tiles/SunkenSea/RefractivePrismTorch.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.SunkenSea public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 66) - CalamityUtils.DrawFlameSparks(62, 5, i, j); + CalamityUtils.DrawFlameSparks(DustID.PurpleTorch, 5, i, j); } public override bool RightClick(int i, int j) diff --git a/Tiles/SunkenSea/Runestone.cs b/Tiles/SunkenSea/Runestone.cs index dc2d5cbcb6..7108f7d9ed 100644 --- a/Tiles/SunkenSea/Runestone.cs +++ b/Tiles/SunkenSea/Runestone.cs @@ -21,17 +21,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; - DustType = 22; + DustType = DustID.Pot; AddMapEntry(new Color(152, 89, 78)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/Runestone.png b/Tiles/SunkenSea/Runestone.png index 610bdefa21..a0f612e995 100644 Binary files a/Tiles/SunkenSea/Runestone.png and b/Tiles/SunkenSea/Runestone.png differ diff --git a/Tiles/SunkenSea/RunestoneTerracotta.png b/Tiles/SunkenSea/RunestoneTerracotta.png new file mode 100644 index 0000000000..610bdefa21 Binary files /dev/null and b/Tiles/SunkenSea/RunestoneTerracotta.png differ diff --git a/Tiles/SunkenSea/ScarletSeaGrass.png b/Tiles/SunkenSea/ScarletSeaGrass.png new file mode 100644 index 0000000000..4054602dfb Binary files /dev/null and b/Tiles/SunkenSea/ScarletSeaGrass.png differ diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.cs b/Tiles/SunkenSea/ScarletSeaGrassTile.cs new file mode 100644 index 0000000000..b413e27f6a --- /dev/null +++ b/Tiles/SunkenSea/ScarletSeaGrassTile.cs @@ -0,0 +1,276 @@ +using System; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + + + +namespace CalamityMod.Tiles.SunkenSea +{ + public class ScarletSeaGrassTile : ModTile + { + private int extraFrameHeight = 36; + private int extraFrameWidth = 90; + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = false; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + + DustType = DustID.Hive; + AddMapEntry(new Color(187, 43, 44)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + 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) + { + try + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + catch { } + } + } + private Color GetDrawColour(int i, int j) + { + int colType = Main.tile[i, j].TileColor; + 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; + } + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + 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 leaves = ModContent.Request("CalamityMod/Tiles/SunkenSea/ScarletSeaGrass").Value; + + DrawExtraTop(i, j, leaves, drawOffset, drawColour); + 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) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + brightness *= (float)MathF.Sin(-i / 40f + Main.GameUpdateCount * 0.01f + j); + brightness += 0.5f; + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + // Place LongScarletSeagrass + if (WorldGen.genRand.NextBool(1) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + // 16 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.dedServ) + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + + #region 'Extra Drapes' Drawing + private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface + */ + if ( + CheckTile(Type, false, 0, 1, i, j) || + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + DrawExtraOverhang(i, j, extras, drawOffset, drawColour); + } + } + private bool CheckTile(int type, bool equal, int x, int y, int i, int j) + { + //Subtract y so that y is vertical for ease of readability + return Main.tile[i + x, j - y].TileType == type == equal; + } + private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Ending the Extra when a wall is reached + */ + + //Left + if ( + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right + if ( + CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached + */ + + //Left + if ( + CheckTile(Type, false, -1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right + if ( + CheckTile(Type, false, 1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Hanging 'drapes' of the extra element + */ + + //Base + if ( + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) || + (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Left Wall + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right Wall + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Left Overhang + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right Overhang + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + + private int GetExtraState(string type) + { + switch (type) + { + case "middle": + return 36; + case "overhangLeft": + return 18; + case "overhangRight": + return 54; + case "wallEndLeft": + return 0; + case "wallEndRight": + return 72; + default: + Main.NewText(type.ToString() + " is not a valid Extra sheet state"); + return 0; + } + } + + private int GetExtraPattern(int i) + { + return i % 3 * extraFrameHeight; + } + + private int GetExtraVariant(int i, int j) + { + return Main.tile[i, j].TileFrameNumber * extraFrameWidth; + } + } +} +#endregion diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.png b/Tiles/SunkenSea/ScarletSeaGrassTile.png new file mode 100644 index 0000000000..561c962c9e Binary files /dev/null and b/Tiles/SunkenSea/ScarletSeaGrassTile.png differ diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index e588164a13..3c3f1ae585 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -9,28 +9,30 @@ namespace CalamityMod.Tiles.SunkenSea { public class SeaPrism : ModTile { - private const short subsheetWidth = 450; - private const short subsheetHeight = 198; + private const short subsheetWidth = 468; + private const short subsheetHeight = 90; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = false; + TileID.Sets.HasSlopeFrames[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); Main.tileLighted[Type] = true; - Main.tileShine[Type] = 3500; + Main.tileShine[Type] = 5000; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - DustType = 33; + DustType = DustID.Water; AddMapEntry(new Color(97, 212, 223)); HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; MinPick = 55; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -40,20 +42,20 @@ namespace CalamityMod.Tiles.SunkenSea public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - // (i & 0b0001) = (i % 2) - frameXOffset = (i & 0b0001) * subsheetWidth; - frameYOffset = (j & 0b0001) * subsheetHeight; + frameXOffset = i % 8 * subsheetWidth; + frameYOffset = j % 8 * subsheetHeight; } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { float brightness = 0.9f; - Color blue = new Color(67, 187, 204); - Color darkviolet = new Color(18, 67, 116); + Color blue = new Color(162, 216, 218); + Color darkviolet = new Color(18, 78, 96); Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 900f; - g = (value.G + value1.G) / 900f; - b = (value.B + value1.B) / 900f; + r = (value.R + value1.R) / 800f; + g = (value.G + value1.G) / 800f; + b = (value.B + value1.B) / 800f; r *= brightness; g *= brightness; b *= brightness; @@ -61,7 +63,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/SeaPrism.png b/Tiles/SunkenSea/SeaPrism.png index 7729be3702..7e6c12266c 100644 Binary files a/Tiles/SunkenSea/SeaPrism.png and b/Tiles/SunkenSea/SeaPrism.png differ diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs index fc65591926..fc2dc12221 100644 --- a/Tiles/SunkenSea/Shellstone.cs +++ b/Tiles/SunkenSea/Shellstone.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,20 +22,35 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; - DustType = 17; - AddMapEntry(new Color(113, 117, 160)); + DustType = DustID.CorruptPlants; + AddMapEntry(new Color(123, 127, 170)); - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - - this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); - this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); - this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + public override void RandomUpdate(int i, int j) + { + Tile Tile = Framing.GetTileSafely(i, j); + Tile Below = Framing.GetTileSafely(i, j + 1); + Tile Above = Framing.GetTileSafely(i, j - 1); + + if (!Below.HasTile && Below.LiquidType <= 0 && !Tile.BottomSlope) + { + if (Main.rand.NextBool(10)) + { + Below.TileType = (ushort)ModContent.TileType(); + Below.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/SunkenSea/ShellstoneSlab.cs b/Tiles/SunkenSea/ShellstoneSlab.cs index 19caa0a57f..bb2f5c706e 100644 --- a/Tiles/SunkenSea/ShellstoneSlab.cs +++ b/Tiles/SunkenSea/ShellstoneSlab.cs @@ -17,8 +17,12 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; HitSound = SoundID.Tink; - DustType = 17; + DustType = DustID.CorruptPlants; AddMapEntry(new Color(156, 191, 199)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/SmoothSeaPrism.png b/Tiles/SunkenSea/SmoothSeaPrism.png new file mode 100644 index 0000000000..de3c3f7ec7 Binary files /dev/null and b/Tiles/SunkenSea/SmoothSeaPrism.png differ diff --git a/Tiles/SunkenSea/SunkenKelp.png b/Tiles/SunkenSea/SunkenKelp.png new file mode 100644 index 0000000000..d6ef19a3c6 Binary files /dev/null and b/Tiles/SunkenSea/SunkenKelp.png differ diff --git a/Tiles/SunkenSea/VolcanicSand.cs b/Tiles/SunkenSea/VolcanicSand.cs index cd48e6d175..a184ad68d5 100644 --- a/Tiles/SunkenSea/VolcanicSand.cs +++ b/Tiles/SunkenSea/VolcanicSand.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - DustType = 147; + DustType = DustID.t_PearlWood; AddMapEntry(new Color(117, 79, 97)); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/WhitePearlPile.cs b/Tiles/SunkenSea/WhitePearlPile.cs index 6bd9a076bb..7ddecd594e 100644 --- a/Tiles/SunkenSea/WhitePearlPile.cs +++ b/Tiles/SunkenSea/WhitePearlPile.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,18 +23,23 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileShine2[Type] = true; HitSound = SoundID.Shatter; - DustType = 149; + DustType = DustID.Slush; AddMapEntry(new Color(217, 209, 213)); TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/YellowCoral.cs b/Tiles/SunkenSea/YellowCoral.cs index c098f500ce..687b972091 100644 --- a/Tiles/SunkenSea/YellowCoral.cs +++ b/Tiles/SunkenSea/YellowCoral.cs @@ -21,17 +21,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Firework_Yellow; AddMapEntry(new Color(198, 169, 24)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs index ebfd615be2..ac14c0266e 100644 --- a/Tiles/VernalSoil.cs +++ b/Tiles/VernalSoil.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -13,11 +15,12 @@ namespace CalamityMod.Tiles { public class VernalSoil : ModTile { - + private int extraFrameHeight = 36; + private int extraFrameWidth = 90; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = false; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Organic"]); CalamityUtils.MergeWithGeneral(Type); @@ -33,6 +36,19 @@ namespace CalamityMod.Tiles this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } + 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) + { + try + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + catch { } + } + } + public override void RandomUpdate(int i, int j) { bool underground = j >= (int)Main.worldSurface - 1 && j < Main.maxTilesY - 20; @@ -149,6 +165,289 @@ namespace CalamityMod.Tiles } } + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Tile uptile = Main.tile[i, j - 1]; + 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 = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j)); + Texture2D leaves = ModContent.Request("CalamityMod/Tiles/VernicFernGrass").Value; + + if (uptile.HasTile) + { + return; + } + else + { + + + DrawExtraTop(i, j, leaves, drawOffset, drawColour); + //DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); + DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); + } + } + + #region 'Extra Drapes' Drawing + private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface + */ + if ( + CheckTile(Type, false, 0, 1, i, j) || + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + DrawExtraOverhang(i, j, extras, drawOffset, drawColour); + } + } + + private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Ending the Extra when a wall is reached + */ + + //Left + if ( + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right + if ( + CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached + */ + + //Left + if ( + CheckTile(Type, false, -1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right + if ( + CheckTile(Type, false, 1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Hanging 'drapes' of the extra element + */ + + //Base + if ( + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) || + (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Wall + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Wall + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Overhang + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Overhang + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + #endregion + + #region Tile Data + private bool CheckTile(int type, bool equal, int x, int y, int i, int j) + { + //Subtract y so that y is vertical for ease of readability + return Main.tile[i + x, j - y].TileType == type == equal; + } + + private int GetExtraState(string type) + { + switch (type) + { + case "middle": + return 36; + case "overhangLeft": + return 18; + case "overhangRight": + return 54; + case "wallEndLeft": + return 0; + case "wallEndRight": + return 72; + default: + Main.NewText(type.ToString() + " is not a valid Extra sheet state"); + return 0; + } + } + + private int GetExtraPattern(int i) + { + return i % 3 * extraFrameHeight; + } + + private int GetExtraVariant(int i, int j) + { + return Main.tile[i, j].TileFrameNumber * extraFrameWidth; + } + + /* + private int GetTileVariant(int i, int j) + { + int variant = 0; //Default to using variant 1 + Tile sourceTile = Main.tile[i, j]; + //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using + int frameX = sourceTile.frameX / 18; + int frameY = sourceTile.frameY / 18; + if (frameY < 3 && !(frameX >= 6 && frameX < 9)) + { + int group = 0; + int[] group1XPos = new int[] { 1, 2, 3 }; + int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; + foreach (int k in group1XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 1; + } + } + foreach (int k in group2XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 2; + } + } + if (group == 1) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 3) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (group == 2) + { + if (frameY < 1) + { + variant = 0; + } + else if (frameY < 2) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + else if (frameX < 6 && frameY >= 3) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 4) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 6 && frameX < 9) + { + if (frameX < 7) + { + variant = 0; + } + else if (frameX < 8) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 9 && frameY >= 3) + { + if (frameX < 10) + { + variant = 0; + } + else if (frameX < 11) + { + variant = 1; + } + else + { + variant = 2; + } + } + return (variant); + } + */ + #endregion public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/VernalSoil.png b/Tiles/VernalSoil.png index 8c1e2f1c56..7d652bd739 100644 Binary files a/Tiles/VernalSoil.png and b/Tiles/VernalSoil.png differ diff --git a/Tiles/VernicFernGrass.png b/Tiles/VernicFernGrass.png new file mode 100644 index 0000000000..811123ffa9 Binary files /dev/null and b/Tiles/VernicFernGrass.png differ diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 021fe2f7e6..5d523812fc 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -276,7 +276,7 @@ namespace CalamityMod.UI NPCType(), // Hardmode Modded. - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), diff --git a/UI/DebuffSystem/BestiaryDebuffInfo.cs b/UI/DebuffSystem/BestiaryDebuffInfo.cs index 811012d588..30f3f2c546 100644 --- a/UI/DebuffSystem/BestiaryDebuffInfo.cs +++ b/UI/DebuffSystem/BestiaryDebuffInfo.cs @@ -9,7 +9,7 @@ using Terraria.UI; namespace CalamityMod.UI.DebuffSystem { - public class BestiaryDebuffInfo : IBestiaryInfoElement + public class BestiaryDebuffInfo : IBestiaryInfoElement, IBestiaryPrioritizedElement, ICategorizedBestiaryInfoElement { public string[] elements; @@ -18,6 +18,11 @@ namespace CalamityMod.UI.DebuffSystem this.elements = elements; } + // Below base stats (damage/defense/etc) + public float OrderPriority => -1f; + + public UIBestiaryEntryInfoPage.BestiaryInfoCategory ElementCategory => UIBestiaryEntryInfoPage.BestiaryInfoCategory.Stats; + public UIElement ProvideUIElement(BestiaryUICollectionInfo info) { // Don't show debuff info until stats are unlocked diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index 4e18a81e85..acc4d7cb1b 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -218,9 +218,9 @@ namespace CalamityMod.UI.ModeIndicator anyActiveMode = true; } } - string modeStr = CalamityUtils.GetTextValue("UI.ModeAppend"); + string modeStr = CalamityUtils.GetText("UI.ModeAppend").Format(modeToDisplay); string activeText = CalamityUtils.GetTextValue("UI." + (anyActiveMode ? "Active" : "NotActive")); - text = CalamityUtils.GetText("UI.DifficultyStatusText").WithFormatArgs(modeToDisplay + modeStr, activeText.ToLower()); + text = CalamityUtils.GetText("UI.DifficultyStatusText").WithFormatArgs(modeStr, activeText.ToLower()); } } @@ -354,7 +354,12 @@ namespace CalamityMod.UI.ModeIndicator modeHovered = true; text = GetDifficultyText(mode); - if (ClickingMouse) + + // Cannot switch to Death Mode if Master Mode isn't active. + // Cannot switch to Revengeance Mode if Master Mode is active. + // I hate how this is coded, it makes me want to smash my head through a wall. - Fabsol + bool cannotSwitchTo = (!Main.masterMode && mode == Difficulties[2]) || (Main.masterMode && mode == Difficulties[1]); + if (ClickingMouse && !cannotSwitchTo) SwitchToDifficulty(mode); } } diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index e4fb0c820a..b954995b71 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -153,16 +153,17 @@ namespace CalamityMod.UI.ResourceSets int deadPixels = (int)Math.Floor((snapshot.LifeMax - snapshot.Life) * pixelsPerLife); var bleedPixels = Math.Round(bleed * pixelsPerLife); - Color[] textureData = new Color[width * 12]; - + Color[] textureData = new Color[width * 12]; + // doze 19MAR2025 - I don't know if I could optimize this any further without switching to shaders. + // I don't expect performance issues, but at some point might be worth adding a config to disable the indicator in case of lag or accessibility concerns for (int i = 0; i < textureData.Length; i++) { - var bleedCol = new Color(0, 0, 0, 0); - if ((i % width < bleedPixels + deadPixels) && !(i % width < deadPixels)) + var i_MOD_width = i % width; //minor optimization, calculated here once instead of twice in the loop. + var bleedCol = Color.Transparent; + if ((i_MOD_width < bleedPixels + deadPixels) && !(i_MOD_width < deadPixels)) { bleedCol = barTextureData[((i % 12)+(i/width)*12)]; - //bleedCol = new Color(0f, 0.3f, 0.75f, 0.5f); } textureData[i] = bleedCol; diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 621eae94e4..286212804b 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -187,12 +187,15 @@ namespace CalamityMod // Spears actually work fine with Legendary, but vanilla doesn't give it to them, so we won't either. else { + // 14MAR2025: Ozzatron: Add support for allowing Ruthless over Godly if the player has more than 100% crit chance of the appropriate class + bool has100Crit = Main.LocalPlayer.GetTotalCritChance(item.DamageType) >= 100; + 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 } + /* 3 */ has100Crit ? new int[] { PrefixID.Godly, PrefixID.Ruthless } : new int[] { PrefixID.Godly } }; prefix = IteratePrefix(rand, meleeNoSpeedReforgeTiers, currentPrefix); } diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 3a661d6d56..cdea134597 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -416,7 +416,7 @@ namespace CalamityMod { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Poisoned, BuffID.Venom }) }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Electrified, ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Electrified, ModContent.BuffType() }) }, { ModContent.NPCType(), slime }, { ModContent.NPCType(), slime }, diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 64ca80e336..83c3e8e955 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -15,6 +15,7 @@ using CalamityMod.Tiles.FurnitureEutrophic; using CalamityMod.Tiles.FurnitureOtherworldly; using CalamityMod.Tiles.FurnitureProfaned; using CalamityMod.Tiles.FurnitureVoid; +using CalamityMod.Tiles.FurnitureWulfrum; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; @@ -443,7 +444,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), - TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -523,7 +524,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), - TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -646,6 +647,13 @@ namespace CalamityMod SetMerge(type, TileType()); SetMerge(type, TileType()); SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); } /// diff --git a/Walls/AnodizedWulfrumTrimWall.cs b/Walls/AnodizedWulfrumTrimWall.cs new file mode 100644 index 0000000000..55c63b2614 --- /dev/null +++ b/Walls/AnodizedWulfrumTrimWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class AnodizedWulfrumTrimWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(67, 6, 6)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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 PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; + } + } +} diff --git a/Walls/AnodizedWulfrumTrimWall.png b/Walls/AnodizedWulfrumTrimWall.png new file mode 100644 index 0000000000..3d8274c568 Binary files /dev/null and b/Walls/AnodizedWulfrumTrimWall.png differ diff --git a/Walls/AstralSnowWall.png b/Walls/AstralSnowWall.png index 0f07f2758a..48a3ee8982 100644 Binary files a/Walls/AstralSnowWall.png and b/Walls/AstralSnowWall.png differ diff --git a/Walls/ChargedWulfrumEnergyBarrierWall.cs b/Walls/ChargedWulfrumEnergyBarrierWall.cs new file mode 100644 index 0000000000..44a1fc0707 --- /dev/null +++ b/Walls/ChargedWulfrumEnergyBarrierWall.cs @@ -0,0 +1,108 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ChargedWulfrumEnergyBarrierWall : ModWall + { + internal static FramedMaskTexture GlowMask; + + public override void SetStaticDefaults() + { + GlowMask = new("CalamityMod/Walls/ChargedWulfrumEnergyBarrierWallReflect", 36, 36); + + Main.wallHouse[Type] = true; + Main.wallLight[Type] = true; + AddMapEntry(new Color(67, 146, 146)); + } + + public override void Unload() + { + GlowMask?.Unload(); + GlowMask = null; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.9f; + Color cyan = new Color(67, 146, 146); + Color blue = new Color(32, 93, 129); + Color value = Color.Lerp(cyan, blue, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(cyan, blue, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + + r = (value.R + value1.R) / 900f; + g = (value.G + value1.G) / 900f; + b = (value.B + value1.B) / 900f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowMask.Texture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor(tile.WallColor); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + if (Main.drawToScreen) + zero = Vector2.Zero; + + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + Color lightColor = Lighting.GetColor(i, j, Color.White); + + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.094f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + drawcolor *= brightness; + + float transparency = 0.02f + (wave1angle / 4); + Color glowColor = Color.White * transparency; + + for (int k = 0; k < 3; k++) + { + //Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/ChargedWulfrumEnergyBarrierWall.png b/Walls/ChargedWulfrumEnergyBarrierWall.png new file mode 100644 index 0000000000..d233bd32c2 Binary files /dev/null and b/Walls/ChargedWulfrumEnergyBarrierWall.png differ diff --git a/Walls/ChargedWulfrumEnergyBarrierWallReflect.png b/Walls/ChargedWulfrumEnergyBarrierWallReflect.png new file mode 100644 index 0000000000..75ab6e96d8 Binary files /dev/null and b/Walls/ChargedWulfrumEnergyBarrierWallReflect.png differ diff --git a/Walls/DriftwoodWall.png b/Walls/DriftwoodWall.png index f33778a6fe..8e691a4d26 100644 Binary files a/Walls/DriftwoodWall.png and b/Walls/DriftwoodWall.png differ diff --git a/Walls/EutrophicGlassWall.cs b/Walls/EutrophicGlassWall.cs new file mode 100644 index 0000000000..a3faeb192f --- /dev/null +++ b/Walls/EutrophicGlassWall.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class EutrophicGlassWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + Main.BackgroundEnabled = true; + Main.wallLight[Type] = true; + + 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, DustID.Chlorophyte, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 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 PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + + frameYOffset = (j % 10) * 180; + frameXOffset = (i % 10) * 468; + } + } +} diff --git a/Walls/EutrophicGlassWall.png b/Walls/EutrophicGlassWall.png new file mode 100644 index 0000000000..983a2380b9 Binary files /dev/null and b/Walls/EutrophicGlassWall.png differ diff --git a/Walls/GiantHiveWall.cs b/Walls/GiantHiveWall.cs new file mode 100644 index 0000000000..7af1f8f648 --- /dev/null +++ b/Walls/GiantHiveWall.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class GiantHiveWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + + AddMapEntry(new Color(155, 85, 15)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Hive, 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 PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; + } + } +} diff --git a/Walls/GiantHiveWall.png b/Walls/GiantHiveWall.png new file mode 100644 index 0000000000..2ea5425a9f Binary files /dev/null and b/Walls/GiantHiveWall.png differ diff --git a/Walls/PyreMantleWallSafe.cs b/Walls/PyreMantleWallSafe.cs index 59dc08ee04..09c4f0a539 100644 --- a/Walls/PyreMantleWallSafe.cs +++ b/Walls/PyreMantleWallSafe.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; + +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Walls/RoundedAnodizedWulfrumPanelWall.cs b/Walls/RoundedAnodizedWulfrumPanelWall.cs new file mode 100644 index 0000000000..604f75ffc6 --- /dev/null +++ b/Walls/RoundedAnodizedWulfrumPanelWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class RoundedAnodizedWulfrumPanelWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(98, 90, 75)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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 PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; + } + } +} diff --git a/Walls/RoundedAnodizedWulfrumPanelWall.png b/Walls/RoundedAnodizedWulfrumPanelWall.png new file mode 100644 index 0000000000..3412b5023d Binary files /dev/null and b/Walls/RoundedAnodizedWulfrumPanelWall.png differ diff --git a/Walls/RunestoneTerracottaWall.png b/Walls/RunestoneTerracottaWall.png new file mode 100644 index 0000000000..9a5db46bc6 Binary files /dev/null and b/Walls/RunestoneTerracottaWall.png differ diff --git a/Walls/RunestoneWall.png b/Walls/RunestoneWall.png index 9a5db46bc6..cbe470da4c 100644 Binary files a/Walls/RunestoneWall.png and b/Walls/RunestoneWall.png differ diff --git a/Walls/ScarletSeaGrassWall.cs b/Walls/ScarletSeaGrassWall.cs new file mode 100644 index 0000000000..75ea6d474c --- /dev/null +++ b/Walls/ScarletSeaGrassWall.cs @@ -0,0 +1,48 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ScarletSeaGrassWall : ModWall, IVisibleThroughWater + { + public static Asset leafTexture = null; + int IVisibleThroughWater.WaterMapEntry { get; set; } + public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + + public override void SetStaticDefaults() + { + // 18APR2025: Ozzatron: guessed a red dust for scarlet sea grass + DustType = DustID.CrimsonPlants; + + WallID.Sets.Conversion.Grass[Type] = true; + + AddMapEntry(new Color(103, 24, 24)); + this.AddMapEntryWithWaterVisibility(new Color(89, 49, 108)); + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/ScarletSeaGrassWall_Leaves"); + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) + { + Texture2D tex = leafTexture.Value; + var rand = new Random(i + (j * 100000)); + + float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; + float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + + spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, + new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/ScarletSeaGrassWall.png b/Walls/ScarletSeaGrassWall.png new file mode 100644 index 0000000000..5e0085193a Binary files /dev/null and b/Walls/ScarletSeaGrassWall.png differ diff --git a/Walls/ScarletSeaGrassWall_Leaves.png b/Walls/ScarletSeaGrassWall_Leaves.png new file mode 100644 index 0000000000..4db2083f0f Binary files /dev/null and b/Walls/ScarletSeaGrassWall_Leaves.png differ diff --git a/Walls/WulfrumComplexPanelWall.cs b/Walls/WulfrumComplexPanelWall.cs new file mode 100644 index 0000000000..f6f0b2af06 --- /dev/null +++ b/Walls/WulfrumComplexPanelWall.cs @@ -0,0 +1,92 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumComplexPanelWall : ModWall + { + internal static FramedMaskTexture GlowMask; + + public override void SetStaticDefaults() + { + GlowMask = new("CalamityMod/Walls/WulfrumComplexPanelWall_Glow", 36, 36); + + Main.wallHouse[Type] = true; + AddMapEntry(new Color(28, 28, 29)); + } + + public override void Unload() + { + GlowMask?.Unload(); + GlowMask = null; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowMask.Texture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor(tile.WallColor); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + if (Main.drawToScreen) + zero = Vector2.Zero; + + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + Color lightColor = Lighting.GetColor(i, j, Color.White); + + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.064f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + drawcolor *= brightness; + + float transparency = 0.02f + (wave1angle / 4); + Color glowColor = Color.White * transparency; + + for (int k = 0; k < 3; k++) + { + //Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/WulfrumComplexPanelWall.png b/Walls/WulfrumComplexPanelWall.png new file mode 100644 index 0000000000..d389733850 Binary files /dev/null and b/Walls/WulfrumComplexPanelWall.png differ diff --git a/Walls/WulfrumComplexPanelWall_Glow.png b/Walls/WulfrumComplexPanelWall_Glow.png new file mode 100644 index 0000000000..21ffc75e16 Binary files /dev/null and b/Walls/WulfrumComplexPanelWall_Glow.png differ diff --git a/Walls/WulfrumEnergyBarrierWall.cs b/Walls/WulfrumEnergyBarrierWall.cs new file mode 100644 index 0000000000..c7e535a658 --- /dev/null +++ b/Walls/WulfrumEnergyBarrierWall.cs @@ -0,0 +1,108 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumEnergyBarrierWall : ModWall + { + internal static FramedMaskTexture GlowMask; + + public override void SetStaticDefaults() + { + GlowMask = new("CalamityMod/Walls/WulfrumEnergyBarrierWallReflect", 36, 36); + + Main.wallHouse[Type] = true; + Main.wallLight[Type] = true; + AddMapEntry(new Color(116, 153, 40)); + } + + public override void Unload() + { + GlowMask?.Unload(); + GlowMask = null; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.9f; + Color lime = new Color(116, 153, 40); + Color green = new Color(46, 97, 56); + Color value = Color.Lerp(lime, green, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(lime, green, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + + r = (value.R + value1.R) / 900f; + g = (value.G + value1.G) / 900f; + b = (value.B + value1.B) / 900f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowMask.Texture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor(tile.WallColor); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + if (Main.drawToScreen) + zero = Vector2.Zero; + + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + Color lightColor = Lighting.GetColor(i, j, Color.White); + + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.064f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + drawcolor *= brightness; + + float transparency = 0.02f + (wave1angle / 4); + Color glowColor = Color.White * transparency; + + for (int k = 0; k < 3; k++) + { + //Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/WulfrumEnergyBarrierWall.png b/Walls/WulfrumEnergyBarrierWall.png new file mode 100644 index 0000000000..3f5da8222a Binary files /dev/null and b/Walls/WulfrumEnergyBarrierWall.png differ diff --git a/Walls/WulfrumEnergyBarrierWallReflect.png b/Walls/WulfrumEnergyBarrierWallReflect.png new file mode 100644 index 0000000000..55748b217f Binary files /dev/null and b/Walls/WulfrumEnergyBarrierWallReflect.png differ diff --git a/Walls/WulfrumPanelWall.cs b/Walls/WulfrumPanelWall.cs new file mode 100644 index 0000000000..1ac7199110 --- /dev/null +++ b/Walls/WulfrumPanelWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class WulfrumPanelWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(53, 67, 54)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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 PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; + } + } +} diff --git a/Walls/WulfrumPanelWall.png b/Walls/WulfrumPanelWall.png new file mode 100644 index 0000000000..85f4c847d4 Binary files /dev/null and b/Walls/WulfrumPanelWall.png differ diff --git a/Walls/WulfrumPillar.cs b/Walls/WulfrumPillar.cs new file mode 100644 index 0000000000..ee6324c9da --- /dev/null +++ b/Walls/WulfrumPillar.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumPillar : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(82, 109, 80)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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; + } +} diff --git a/Walls/WulfrumPillar.png b/Walls/WulfrumPillar.png new file mode 100644 index 0000000000..9a845a9850 Binary files /dev/null and b/Walls/WulfrumPillar.png differ diff --git a/Walls/WulfrumPlatingWall.png b/Walls/WulfrumPlatingWall.png index fb98b5631b..29d0772079 100644 Binary files a/Walls/WulfrumPlatingWall.png and b/Walls/WulfrumPlatingWall.png differ diff --git a/Walls/WulfrumSheetWall.cs b/Walls/WulfrumSheetWall.cs new file mode 100644 index 0000000000..6ebe16c96e --- /dev/null +++ b/Walls/WulfrumSheetWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class WulfrumSheetWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(73, 59, 48)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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 PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; + } + } +} diff --git a/Walls/WulfrumSheetWall.png b/Walls/WulfrumSheetWall.png new file mode 100644 index 0000000000..4acc4c0d2b Binary files /dev/null and b/Walls/WulfrumSheetWall.png differ diff --git a/Walls/WulfrumSidingWall.cs b/Walls/WulfrumSidingWall.cs new file mode 100644 index 0000000000..355c128989 --- /dev/null +++ b/Walls/WulfrumSidingWall.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumSidingWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(77, 92, 65)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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; + } +} diff --git a/Walls/WulfrumSidingWall.png b/Walls/WulfrumSidingWall.png new file mode 100644 index 0000000000..9848731066 Binary files /dev/null and b/Walls/WulfrumSidingWall.png differ diff --git a/Waters/SunkenSeaBurrowsWater.png b/Waters/SunkenSeaBurrowsWater.png index eab9dc5435..1dd5bd9f12 100644 Binary files a/Waters/SunkenSeaBurrowsWater.png and b/Waters/SunkenSeaBurrowsWater.png differ diff --git a/Waters/SunkenSeaBurrowsWater_Block.png b/Waters/SunkenSeaBurrowsWater_Block.png index 975fbe6dee..bbf43cea00 100644 Binary files a/Waters/SunkenSeaBurrowsWater_Block.png and b/Waters/SunkenSeaBurrowsWater_Block.png differ diff --git a/Waters/SunkenSeaBurrowsWaterflow.png b/Waters/SunkenSeaBurrowsWaterflow.png index 4a4540f32f..f2ea06818a 100644 Binary files a/Waters/SunkenSeaBurrowsWaterflow.png and b/Waters/SunkenSeaBurrowsWaterflow.png differ diff --git a/Waters/SunkenSeaPolypWater.png b/Waters/SunkenSeaPolypWater.png index ff90d56704..682fb25774 100644 Binary files a/Waters/SunkenSeaPolypWater.png and b/Waters/SunkenSeaPolypWater.png differ diff --git a/Waters/SunkenSeaPolypWater_Block.png b/Waters/SunkenSeaPolypWater_Block.png index 31eaa237d0..1f823d0ea9 100644 Binary files a/Waters/SunkenSeaPolypWater_Block.png and b/Waters/SunkenSeaPolypWater_Block.png differ diff --git a/Waters/SunkenSeaPolypWater_Slope.png b/Waters/SunkenSeaPolypWater_Slope.png index 8c28641b1b..9404893b7c 100644 Binary files a/Waters/SunkenSeaPolypWater_Slope.png and b/Waters/SunkenSeaPolypWater_Slope.png differ diff --git a/Waters/SunkenSeaPolypWaterflow.png b/Waters/SunkenSeaPolypWaterflow.png index 7632d15e9a..ee3de90b50 100644 Binary files a/Waters/SunkenSeaPolypWaterflow.png and b/Waters/SunkenSeaPolypWaterflow.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index 9bb6d96d14..84775f63b8 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -755,7 +755,7 @@ namespace CalamityMod.World } //pots - if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) && Y > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) { if (WorldGen.genRand.NextBool(5)) @@ -1132,7 +1132,7 @@ namespace CalamityMod.World Main.chest[ChestIndex].item[4].SetDefaults(ItemID.ManaPotion); Main.chest[ChestIndex].item[4].stack = WorldGen.genRand.Next(2, 5); - Main.chest[ChestIndex].item[5].SetDefaults(ModContent.ItemType()); + Main.chest[ChestIndex].item[5].SetDefaults(ModContent.ItemType()); Main.chest[ChestIndex].item[5].stack = WorldGen.genRand.Next(3, 12); Main.chest[ChestIndex].item[6].SetDefaults(ItemID.GoldCoin); @@ -1235,12 +1235,12 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), }; - + void getAttachedPoints(int x, int y, List points) { Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); Point p = new(x, y); - + if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) { return; diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 0a9c2e8a49..6fcb107f3b 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -455,32 +455,250 @@ namespace CalamityMod.World if (j < 181) j = 181; - int xOffset = GenVars.dungeonX < Main.maxTilesX / 2 ? WorldGen.genRand.Next(-100, -50) : WorldGen.genRand.Next(50, 100); + IList AstralTilesToCheckFor = new List(16); + int[] AstralTiles = new int[] + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + }; + foreach (int modTile in AstralTiles) + AstralTilesToCheckFor.Add((ushort)modTile); bool altarPlaced = false; + int altarX = i + (GenVars.dungeonX < Main.maxTilesX / 2 ? -50 : 50); + int altarY = j - 5; + + // Variables used for checking both the bottom and top of the potential altar location + int distanceToCheckForAstralTilesX = 40; + int distanceToCheckForAstralTilesY = 10; + int startCheckingX = altarX - 20; + int startCheckingY = altarY + 10; + int startCheckingY2 = altarY - 25; + + // Variables used for checking the bottom of the potential altar location + int astralTilesRequired = 200; + int emptyTilesRequiredToMove = 200; + + // Variables used for checking the top of the potential altar location + int emptyTilesRequired = 200; + + // Whether Magic Storage tiles need to be looked for + bool needsToCheckForMSTiles = magicStorage is not null; + + // Variables used for checking the entire potential altar location for critical tiles like chests, torches, etc. + int distanceToCheckForCriticalTilesX = 40; + int distanceToCheckForCriticalTilesY = 50; + + int attempts = 0; + int maxAttempts = 100000; while (!altarPlaced) { WorldGen.gen = true; - int x = i + xOffset; - int y = j - 100; - - while (!WorldGen.SolidTile(x, y) && y <= Main.worldSurface) + // Check if there are enough Astral tiles on the bottom of the altar's gen location + // 400 tiles checked in total + int astralTileCount = 0; + bool enoughAstralTilesOnBottom = false; + for (int astralTileCheckIndexX = startCheckingX; astralTileCheckIndexX < startCheckingX + distanceToCheckForAstralTilesX; astralTileCheckIndexX++) { - y += 5; + if (enoughAstralTilesOnBottom) + break; + + for (int astralTileCheckIndexY = startCheckingY; astralTileCheckIndexY < startCheckingY + distanceToCheckForAstralTilesY; astralTileCheckIndexY++) + { + if (Main.tile[astralTileCheckIndexX, astralTileCheckIndexY] != null) + { + if (Main.tile[astralTileCheckIndexX, astralTileCheckIndexY].HasTile) + { + if (AstralTilesToCheckFor.Contains(Main.tile[astralTileCheckIndexX, astralTileCheckIndexY].TileType)) + { + astralTileCount++; + if (astralTileCount >= astralTilesRequired) + { + enoughAstralTilesOnBottom = true; + break; + } + } + } + } + } } - if (Main.tile[x, y].HasTile || Main.tile[x, y].WallType > 0 && !TileID.Sets.Torch[Main.tile[x, y].TileType] && !TileID.Sets.IsAContainer[Main.tile[x, y].TileType] - && (magicStorage is not null && MSTilesToAvoid.Contains(Main.tile[x, y].TileType))) //AVOID HOUSES + // Check if there are too many empty tiles on the bottom of the altar's gen location + // 400 tiles checked in total + int emptyTileCount = 0; + bool tooManyEmptyTilesOnBottom = false; + for (int astralTileCheckIndexX = startCheckingX; astralTileCheckIndexX < startCheckingX + distanceToCheckForAstralTilesX; astralTileCheckIndexX++) { + if (tooManyEmptyTilesOnBottom) + break; - bool place = true; - SchematicManager.PlaceSchematic>(SchematicManager.AstralBeaconKey, new Point(x, y - 5), SchematicAnchor.Center, ref place); + for (int astralTileCheckIndexY = startCheckingY; astralTileCheckIndexY < startCheckingY + distanceToCheckForAstralTilesY; astralTileCheckIndexY++) + { + if (Main.tile[astralTileCheckIndexX, astralTileCheckIndexY] == null || !Main.tile[astralTileCheckIndexX, astralTileCheckIndexY].HasTile) + { + emptyTileCount++; + if (emptyTileCount >= emptyTilesRequiredToMove) + { + tooManyEmptyTilesOnBottom = true; + break; + } + } + } + } + + // Check for the number of empty tiles on the top of the altar's gen location + // 800 tiles checked in total + int emptyTileCount2 = 0; + bool enoughEmptyTilesOnTop = false; + for (int emptyTileCheckIndexX = startCheckingX; emptyTileCheckIndexX < startCheckingX + distanceToCheckForAstralTilesX; emptyTileCheckIndexX++) + { + if (enoughEmptyTilesOnTop) + break; + + for (int emptyTileCheckIndexY = startCheckingY2; emptyTileCheckIndexY < startCheckingY2 + distanceToCheckForAstralTilesY; emptyTileCheckIndexY++) + { + if (Main.tile[emptyTileCheckIndexX, emptyTileCheckIndexY] == null || !Main.tile[emptyTileCheckIndexX, emptyTileCheckIndexY].HasTile) + { + emptyTileCount2++; + if (emptyTileCount2 >= emptyTilesRequired) + { + enoughEmptyTilesOnTop = true; + break; + } + } + } + } + + // Check for houses and other critical bullshit + // 2000 tiles checked in total + bool criticalTileDetected = false; + for (int criticalTileCheckIndexX = startCheckingX; criticalTileCheckIndexX < startCheckingX + distanceToCheckForCriticalTilesX; criticalTileCheckIndexX++) + { + if (criticalTileDetected) + break; + + for (int criticalTileCheckIndexY = startCheckingY2; criticalTileCheckIndexY < startCheckingY2 + distanceToCheckForCriticalTilesY; criticalTileCheckIndexY++) + { + if (Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY] != null) + { + if (Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].HasTile) + { + if (needsToCheckForMSTiles) + { + if (TileID.Sets.Clock[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.Paintings[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.InteractibleByNPCs[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.CanBeSleptIn[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.AvoidedByNPCs[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.IsAContainer[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + MSTilesToAvoid.Contains(Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType)) + { + criticalTileDetected = true; + break; + } + } + else + { + if (TileID.Sets.Clock[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.Paintings[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.InteractibleByNPCs[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.CanBeSleptIn[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.AvoidedByNPCs[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType] || + TileID.Sets.IsAContainer[Main.tile[criticalTileCheckIndexX, criticalTileCheckIndexY].TileType]) + { + criticalTileDetected = true; + break; + } + } + } + } + } + } + + bool canPlaceAltar = enoughAstralTilesOnBottom && !tooManyEmptyTilesOnBottom && enoughEmptyTilesOnTop && !criticalTileDetected; + + if (canPlaceAltar) + { + SchematicManager.PlaceSchematic>(SchematicManager.AstralBeaconKey, new Point(altarX, altarY), SchematicAnchor.Center, ref canPlaceAltar); WorldGen.gen = false; altarPlaced = true; } + + // Move the location if the requirements are not met and check again + else + { + altarX += 5; + if (altarX >= i + 150) + altarX -= 300; + + if (!enoughEmptyTilesOnTop) + altarY -= 5; + else if (tooManyEmptyTilesOnBottom) + altarY += 5; + + if (altarY <= Main.worldSurface - 150) + altarY += 150; + else if (altarY >= Main.worldSurface + 150) + altarY -= 150; + + attempts++; + if (attempts >= maxAttempts) + { + // If all else fails, place the fucking thing anyway, by using the original code :^) + int altarX2 = i; + int altarY2 = j - 50; + bool forcedPlacedAltar = false; + while (!forcedPlacedAltar) + { + while (!WorldGen.SolidTile(altarX2, altarY2 + 15) && altarY2 + 15 <= Main.worldSurface) + altarY2 += 5; + + bool canPlaceAltar2 = false; + if (needsToCheckForMSTiles) + { + canPlaceAltar2 = !TileID.Sets.Clock[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.Paintings[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.InteractibleByNPCs[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.CanBeSleptIn[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.AvoidedByNPCs[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.IsAContainer[Main.tile[altarX2, altarY2].TileType] && + !MSTilesToAvoid.Contains(Main.tile[altarX2, altarY2].TileType); + } + else + { + canPlaceAltar2 = !TileID.Sets.Clock[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.Paintings[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.InteractibleByNPCs[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.CanBeSleptIn[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.AvoidedByNPCs[Main.tile[altarX2, altarY2].TileType] && + !TileID.Sets.IsAContainer[Main.tile[altarX2, altarY2].TileType]; + } + + if (canPlaceAltar2) + { + SchematicManager.PlaceSchematic>(SchematicManager.AstralBeaconKey, new Point(altarX2, altarY2), SchematicAnchor.Center, ref canPlaceAltar2); + + WorldGen.gen = false; + + forcedPlacedAltar = true; + altarPlaced = true; + } + } + } + } } } } diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 960944a967..11024b1055 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -524,7 +524,7 @@ namespace CalamityMod.World if (!firstItem) { - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ItemID.ObsidianWaterWalkingBoots, 1)); } else { diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs new file mode 100644 index 0000000000..50ad7c6c05 --- /dev/null +++ b/World/CustomUnderworld.cs @@ -0,0 +1,1288 @@ +using System; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.WorldBuilding; +using static tModPorter.ProgressUpdate; + +namespace CalamityMod.World +{ + public class CustomUnderworld + { + private const int MaxIslands = 8; + + public static void NewUnderworld() + { + // Generate lower Underworld ash + int ashDepth = Main.maxTilesY - WorldGen.genRand.Next(150, 190); + for (int x = 0; x < Main.maxTilesX; x++) + { + ashDepth += WorldGen.genRand.Next(-3, 4); + if (ashDepth < Main.maxTilesY - 190) + ashDepth = Main.maxTilesY - 190; + + if (ashDepth > Main.maxTilesY - 160) + ashDepth = Main.maxTilesY - 160; + + for (int y = ashDepth - 20 - WorldGen.genRand.Next(3); y < Main.maxTilesY; y++) + { + if (y >= ashDepth) + { + Main.tile[x, y].Get().HasTile = false; + Main.tile[x, y].Get().LiquidType = LiquidID.Water; + } + else + Main.tile[x, y].TileType = TileID.Ash; + } + } + + // Generate lava + int lavaDepth = Main.maxTilesY - WorldGen.genRand.Next(40, 70); + int lavaMaxDepth = Main.maxTilesY - 60; + int lavaMaxHeight = Main.maxTilesY - 110; + for (int x = 10; x < Main.maxTilesX - 10; x++) + { + lavaDepth += WorldGen.genRand.Next(-10, 11); + if (lavaDepth > lavaMaxDepth) + lavaDepth = lavaMaxDepth; + + if (lavaDepth < lavaMaxHeight) + lavaDepth = lavaMaxHeight; + + for (int y = lavaDepth; y < Main.maxTilesY - 10; y++) + { + if (!Main.tile[x, y].HasTile) + { + Main.tile[x, y].Get().LiquidType = LiquidID.Lava; + Main.tile[x, y].LiquidAmount = byte.MaxValue; + } + } + } + + // Generate background walls + int maxWallHeight = 68; + int randomizedWallSectionsHeight = 4; + int maxWallTypes = 4; + int newWallTypeStart = maxWallHeight / maxWallTypes; + int maxWallDepth = Main.maxTilesY - 40; + int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; + int cinderWallStartDepth = smoulderingStoneWallStartDepth + newWallTypeStart; + int emberWallStartDepth = cinderWallStartDepth + newWallTypeStart; + int magmaWallStartDepth = emberWallStartDepth + newWallTypeStart; + for (int x = 0; x < Main.maxTilesX; x++) + { + for (int y = smoulderingStoneWallStartDepth; y < maxWallDepth; y++) + { + // -100 to -97 + if (y < smoulderingStoneWallStartDepth + randomizedWallSectionsHeight) + { + switch (smoulderingStoneWallStartDepth + randomizedWallSectionsHeight - y) + { + case 4: + if (WorldGen.genRand.NextBool(5)) + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + + case 3: + if (WorldGen.genRand.NextBool(3)) + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + + case 2: + if (WorldGen.genRand.NextBool()) + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + + case 1: + if (WorldGen.genRand.Next(4) > 0) + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + } + } + + // -96 to -76 + else if (y < cinderWallStartDepth) + { + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + } + + // -75 to -72 + else if (y < cinderWallStartDepth + randomizedWallSectionsHeight) + { + switch (cinderWallStartDepth + randomizedWallSectionsHeight - y) + { + case 4: + if (WorldGen.genRand.NextBool(5)) + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + + case 3: + if (WorldGen.genRand.NextBool(3)) + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + + case 2: + if (WorldGen.genRand.NextBool()) + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + + case 1: + if (WorldGen.genRand.Next(4) > 0) + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe4; + break; + } + } + + // -71 to -51 + else if (y < emberWallStartDepth) + { + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + } + + // -50 to -47 + else if (y < emberWallStartDepth + randomizedWallSectionsHeight) + { + switch (emberWallStartDepth + randomizedWallSectionsHeight - y) + { + case 4: + if (WorldGen.genRand.NextBool(5)) + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + break; + + case 3: + if (WorldGen.genRand.NextBool(3)) + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + break; + + case 2: + if (WorldGen.genRand.NextBool()) + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + break; + + case 1: + if (WorldGen.genRand.Next(4) > 0) + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe2; + break; + } + } + + // -46 to -26 + else if (y < magmaWallStartDepth) + { + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + } + + // -25 to -22 + else if (y < magmaWallStartDepth + randomizedWallSectionsHeight) + { + switch (magmaWallStartDepth + randomizedWallSectionsHeight - y) + { + case 4: + if (WorldGen.genRand.NextBool(5)) + Main.tile[x, y].WallType = WallID.LavaUnsafe3; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + break; + + case 3: + if (WorldGen.genRand.NextBool(3)) + Main.tile[x, y].WallType = WallID.LavaUnsafe3; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + break; + + case 2: + if (WorldGen.genRand.NextBool()) + Main.tile[x, y].WallType = WallID.LavaUnsafe3; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + break; + + case 1: + if (WorldGen.genRand.Next(4) > 0) + Main.tile[x, y].WallType = WallID.LavaUnsafe3; + else + Main.tile[x, y].WallType = WallID.LavaUnsafe1; + break; + } + } + + // -21 to -1 + else + Main.tile[x, y].WallType = WallID.LavaUnsafe3; + } + } + + // Ash splotches + for (int x = 0; x < Main.maxTilesX; x++) + { + if (WorldGen.genRand.NextBool(50)) + { + int y = Main.maxTilesY - 65; + while (!Main.tile[x, y].HasTile && y > Main.maxTilesY - 135) + y--; + + WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), y + WorldGen.genRand.Next(20, 50), WorldGen.genRand.Next(15, 20), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); + } + } + + // Some cursed water function + Liquid.QuickWater(-2); + + // More Ash splotches + for (int x = 0; x < Main.maxTilesX; x++) + { + if (WorldGen.genRand.NextBool(13)) + { + int y = Main.maxTilesY - 65; + while ((Main.tile[x, y].LiquidAmount > 0 || Main.tile[x, y].HasTile) && y > Main.maxTilesY - 140) + y--; + + if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) + WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 30), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); + + double ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); + if (WorldGen.genRand.NextBool(3)) + ashSplotchSizeAdjustment *= 0.5; + + if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) + { + if (WorldGen.genRand.NextBool(2)) + WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, 1D, 0.3); + + if (WorldGen.genRand.NextBool(2)) + { + ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); + WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, -1D, 0.3); + } + } + + WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(5, 10), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); + if (WorldGen.genRand.NextBool(3)) + WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(10, 30), WorldGen.genRand.Next(10, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); + + if (WorldGen.genRand.NextBool(5)) + WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 10), WorldGen.genRand.Next(15, 30), WorldGen.genRand.Next(5, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); + } + } + + // Cursed lava placement tile runner, thanks redigit + for (int i = 0; i < Main.maxTilesX; i++) + WorldGen.TileRunner(WorldGen.genRand.Next(20, Main.maxTilesX - 20), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(2, 7), -2); + + // Another cursed lava placement tile runner...seriously, why the fuck is this? + for (int i = 0; i < Main.maxTilesX * 2; i++) + WorldGen.TileRunner(WorldGen.genRand.Next((int)(Main.maxTilesX * 0.35), (int)(Main.maxTilesX * 0.65)), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(5, 20), WorldGen.genRand.Next(5, 10), -2); + + // Place two lines of lava at maxTilesY - 145 and maxTilesY - 144 + if (Main.zenithWorld) + { + for (int x = 0; x < Main.maxTilesX; x++) + { + if (!Main.tile[x, Main.maxTilesY - 145].HasTile) + { + Main.tile[x, Main.maxTilesY - 145].LiquidAmount = byte.MaxValue; + Main.tile[x, Main.maxTilesY - 145].Get().LiquidType = LiquidID.Lava; + } + + if (!Main.tile[x, Main.maxTilesY - 144].HasTile) + { + Main.tile[x, Main.maxTilesY - 144].LiquidAmount = byte.MaxValue; + Main.tile[x, Main.maxTilesY - 144].Get().LiquidType = LiquidID.Lava; + } + } + } + + // Place hellstone splotches + for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008); i++) + WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), WorldGen.genRand.Next(Main.maxTilesY - 140, Main.maxTilesY), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(3, 7), TileID.Hellstone); + + // Remix world stuff, the Ash islands in the middle + + // Start generating islands at this point + int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.38 : 0.36)); + + // Stop generating islands at this point + int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.62 : 0.64)); + + // Ash island gen limits + int ashIslandDepthLimit = Main.maxTilesY - 135; + int ashIslandHeightLimit = Main.maxTilesY - 160; + + // Multiple islands in non-remix + if (!WorldGen.remixWorldGen) + { + // Large = 8, Medium = 6, Small = 4 + int numIslands = (int)(Main.maxTilesX / 4200f * 4f); + + // Total extra distance between islands for lava lakes + int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); + + // Extra distance per island + // Due to this being done on both sides of each island, it is divided by 2 + int extraDistanceBetweenAshIslands = totalExtraDistanceBetweenAshIslands / numIslands / 2; + + // Calculate distance between islands + int distanceBetweenIslands = (ashIslandX2 - ashIslandX) / numIslands; + + // Used for island height randomization + int[] randomHeightAdjustmentLimits = new int[MaxIslands] + { + 28, + 24, + 20, + 16, + 12, + 8, + 4, + 0 + }; + + // Used for island edge drop off randomization + // Taller islands have steeper drop offs + // This is also used to decrease the width of the islands + int[] randomDropOffAdjustmentLimits = new int[MaxIslands] + { + 3, + 4, + 5, + 7, + 9, + 11, + 15, + 19 + }; + + // Loop to gen the islands + int chosenIslandSize; + int previouslyChosenIslandSize = -1; + for (int i = 0; i < numIslands; i++) + { + // Do not repeat the same island size twice in a row + do chosenIslandSize = WorldGen.genRand.Next(MaxIslands); + while (previouslyChosenIslandSize == chosenIslandSize); + previouslyChosenIslandSize = chosenIslandSize; + + int randomizedIslandDropOffAdjustment = randomDropOffAdjustmentLimits[chosenIslandSize]; + int randomizedIslandHeightAdjustment = randomHeightAdjustmentLimits[chosenIslandSize]; + int randomizedAshIslandDepthLimit = ashIslandDepthLimit + randomizedIslandHeightAdjustment; + int randomizedAshIslandHeightLimit = ashIslandHeightLimit + randomizedIslandHeightAdjustment; + + int ashIslandXAdjustment = distanceBetweenIslands * i; + int ashIslandX2Adjustment = distanceBetweenIslands * (numIslands - i - 1); + + // Decrease the width of each island randomly + // Taller islands have a greater reduction in width + int randomWidthReduction_LeftSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); + int randomWidthReduction_RightSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); + int ashIslandTilePlacementX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands + randomWidthReduction_LeftSide; + int ashIslandTilePlacementX2 = ashIslandX2 - ashIslandX2Adjustment - extraDistanceBetweenAshIslands - randomWidthReduction_RightSide; + int ashIslandGenLimiter = Main.maxTilesY - 1; + bool ashIslandGenLimitHit = false; + Liquid.QuickWater(-2); + for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) + { + // Less random ash island terrain to make unmodified traversal less annoying + if (!ashIslandGenLimitHit) + { + // Steeper ash island edges + ashIslandGenLimiter -= WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); + if (ashIslandGenLimiter < randomizedAshIslandDepthLimit) + ashIslandGenLimitHit = true; + } + else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) + { + // Steeper ash island edges + ashIslandGenLimiter += WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); + if (ashIslandGenLimiter > Main.maxTilesY - 1) + ashIslandGenLimiter = Main.maxTilesY - 1; + } + else + { + if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) + { + // More randomized terrain depending on island type + // Lower islands have smoother terrain + switch (chosenIslandSize) + { + default: + case 0: + case 1: + if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(8)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + break; + + case 2: + case 3: + if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(9)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + + case 4: + case 5: + if (WorldGen.genRand.NextBool()) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + + case 6: + case 7: + if (WorldGen.genRand.NextBool()) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + } + } + + if (ashIslandGenLimiter < randomizedAshIslandHeightLimit) + ashIslandGenLimiter = randomizedAshIslandHeightLimit; + + if (ashIslandGenLimiter > randomizedAshIslandDepthLimit) + ashIslandGenLimiter = randomizedAshIslandDepthLimit; + } + + for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) + Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; + + for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) + { + Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); + Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; + Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; + } + } + + // This is necessary due to earlier calculations + int startX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands + randomWidthReduction_LeftSide; + + // Lava holes in ash islands + + // Small holes + double holeFrequency = 0.00005 / numIslands; + for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * holeFrequency); j++) + WorldGen.TileRunner(WorldGen.genRand.Next(startX, ashIslandTilePlacementX2), WorldGen.genRand.Next(randomizedAshIslandHeightLimit + 30, Main.maxTilesY), WorldGen.genRand.Next(4, 7), WorldGen.genRand.Next(4, 7), -2); + + // Place smaller hellstone splotches in the ash island + // I don't want there to be too many here because I don't want to encourage players to destroy the environmental Wall of Flesh arena + double hellstoneFrequency = 0.0002 / numIslands; + for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * hellstoneFrequency); j++) + WorldGen.TileRunner(WorldGen.genRand.Next(startX, ashIslandTilePlacementX2), WorldGen.genRand.Next(randomizedAshIslandHeightLimit, Main.maxTilesY), WorldGen.genRand.Next(1, 5), WorldGen.genRand.Next(2, 5), TileID.Hellstone); + } + } + else + { + int ashIslandTilePlacementX = ashIslandX; + int ashIslandTilePlacementX2 = ashIslandX2; + int ashIslandGenLimiter = Main.maxTilesY - 1; + bool ashIslandGenLimitHit = false; + Liquid.QuickWater(-2); + for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) + { + // Less random ash island terrain to make unmodified traversal less annoying + if (!ashIslandGenLimitHit) + { + // Steeper ash island edges + ashIslandGenLimiter -= WorldGen.genRand.Next(1, 4); + if (ashIslandGenLimiter < ashIslandDepthLimit) + ashIslandGenLimitHit = true; + } + else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) + { + // Steeper ash island edges + ashIslandGenLimiter += WorldGen.genRand.Next(1, 4); + if (ashIslandGenLimiter > Main.maxTilesY - 1) + ashIslandGenLimiter = Main.maxTilesY - 1; + } + else + { + if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) + { + if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(8)) + ashIslandGenLimiter += WorldGen.genRand.Next(-4, 5); + } + + if (ashIslandGenLimiter < ashIslandHeightLimit) + ashIslandGenLimiter = ashIslandHeightLimit; + + if (ashIslandGenLimiter > ashIslandDepthLimit) + ashIslandGenLimiter = ashIslandDepthLimit; + } + + for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) + Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; + + for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) + { + Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); + Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; + Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; + } + } + } + + // More cursed magic water function + Liquid.QuickWater(-2); + + // Create grass on ash + for (int x = ashIslandX; x < ashIslandX2 + 15; x++) + { + for (int y = Main.maxTilesY - 300; y < ashIslandDepthLimit + 30; y++) + { + Main.tile[x, y].LiquidAmount = 0; + + if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && + (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || + !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || + !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || + !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) + Main.tile[x, y].TileType = TileID.AshGrass; + } + } + + // Place ash trees + for (int x = ashIslandX; x < ashIslandX2 + 15; x++) + { + for (int y = Main.maxTilesY - 200; y < ashIslandDepthLimit + 30; y++) + { + if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) + WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); + } + } + + // Obsidian and hellstone towers... + AddHellHouses(); + + // Drunk world ash grass and trees + if (WorldGen.drunkWorldGen) + { + for (int x = 25; x < Main.maxTilesX - 25; x++) + { + for (int y = Main.maxTilesY - 300; y < Main.maxTilesY - 100 + WorldGen.genRand.Next(-1, 2); y++) + { + if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && + (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || + !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || + !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || + !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) + Main.tile[x, y].TileType = TileID.AshGrass; + } + } + + for (int x = 25; x < Main.maxTilesX - 25; x++) + { + for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 50; y++) + { + if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) + WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); + } + } + } + + // Place Geyser Traps on ash islands + if (!WorldGen.remixWorldGen) + { + // Small = 12.6 Medium = 19.2 Large = 25.2 + double trapFrequency = (double)Main.maxTilesX * 0.003; + if (WorldGen.noTrapsWorldGen) + trapFrequency = ((!WorldGen.tenthAnniversaryWorldGen && !WorldGen.notTheBees) ? (trapFrequency * 100D) : (trapFrequency * 5D)); + else if (WorldGen.getGoodWorldGen) + trapFrequency *= 1.5; + + if (Main.starGame) + trapFrequency *= Main.starGameMath(0.2); + + int maxTrapPlacementAttempts = 1150; + for (int trapIndex = 0; (double)trapIndex < trapFrequency; trapIndex++) + { + for (int trapIndex2 = 0; trapIndex2 < maxTrapPlacementAttempts; trapIndex2++) + { + int trapPlacementX = WorldGen.genRand.Next(ashIslandX, ashIslandX2); + int trapPlacementY = WorldGen.genRand.Next(Main.maxTilesY - 160, Main.maxTilesY - 100); + + if (GeyserTraps(trapPlacementX, trapPlacementY)) + break; + } + } + } + } + + private static bool GeyserTraps(int geyserX, int geyserY) + { + int geyserPlacementY = geyserY; + + while (!WorldGen.SolidTile(geyserX, geyserPlacementY)) + { + geyserPlacementY++; + if (geyserPlacementY > Main.maxTilesY - 10) + return false; + } + + geyserPlacementY--; + + if (!WorldGen.InWorld(geyserX, geyserPlacementY, 3)) + return false; + + if (Main.tile[geyserX, geyserPlacementY].HasUnactuatedTile || + Main.tile[geyserX - 1, geyserPlacementY].HasUnactuatedTile || + Main.tile[geyserX + 1, geyserPlacementY].HasUnactuatedTile || + Main.tile[geyserX, geyserPlacementY - 1].HasUnactuatedTile || + Main.tile[geyserX - 1, geyserPlacementY - 1].HasUnactuatedTile || + Main.tile[geyserX + 1, geyserPlacementY - 1].HasUnactuatedTile || + Main.tile[geyserX, geyserPlacementY - 2].HasUnactuatedTile || + Main.tile[geyserX - 1, geyserPlacementY - 2].HasUnactuatedTile || + Main.tile[geyserX + 1, geyserPlacementY - 2].HasUnactuatedTile) + return false; + + if (Main.tile[geyserX + 1, geyserPlacementY].HasTile) + return false; + + for (int k = geyserX; k <= geyserX + 1; k++) + { + int j2 = geyserPlacementY + 1; + if (!WorldGen.SolidTile(k, j2)) + return false; + } + + int geyserPlacementY2 = WorldGen.genRand.Next(2); + for (int l = 0; l < 2; l++) + { + Main.tile[geyserX + l, geyserPlacementY].Get().HasTile = true; + Main.tile[geyserX + l, geyserPlacementY].TileType = TileID.GeyserTrap; + Main.tile[geyserX + l, geyserPlacementY].TileFrameX = (short)(18 * l + 36 * geyserPlacementY2); + Main.tile[geyserX + l, geyserPlacementY].TileFrameY = 0; + } + + return true; + } + + private static void AddHellHouses() + { + // Original tower gen area was the outer quarters of the underworld + // New tower gen area is the outer thirds of the underworld + int towerGenArea = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.25 : 0.33)); + + // Generate towers + for (int i = 100; i < Main.maxTilesX - 100; i++) + { + if (i > towerGenArea && i < Main.maxTilesX - towerGenArea) + continue; + + int hellFortGenY = Main.maxTilesY - 40; + while (Main.tile[i, hellFortGenY].HasTile || Main.tile[i, hellFortGenY].LiquidAmount > 0) + hellFortGenY--; + + if (Main.tile[i, hellFortGenY + 1].HasTile) + { + ushort hellFortTileType = (ushort)WorldGen.genRand.Next(TileID.ObsidianBrick, TileID.HellstoneBrick + 1); + ushort wallType = WallID.HellstoneBrickUnsafe; + if (WorldGen.genRand.Next(5) > 0) + hellFortTileType = TileID.ObsidianBrick; + + if (hellFortTileType == TileID.ObsidianBrick) + wallType = WallID.ObsidianBrickUnsafe; + + if (WorldGen.getGoodWorldGen) + hellFortTileType = TileID.HellstoneBrick; + + // Place tower + WorldGen.HellFort(i, hellFortGenY, hellFortTileType, (byte)wallType); + + // Move index further along to keep towers spread apart + // Original min and max values were, respectively, 30 and 130 + // New min and max values are, respectively, 30 and 60 + i += WorldGen.genRand.Next(30, WorldGen.remixWorldGen ? 130 : 60); + + // Randomly add more distance between towers + // Original max value was 200 + // New max value is 50 + if (WorldGen.genRand.NextBool(10)) + i += WorldGen.genRand.Next(WorldGen.remixWorldGen ? 200 : 50); + } + } + + if (!WorldGen.remixWorldGen) + { + // Generate some small houses on the ash island + int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.38 : 0.36)); + int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.62 : 0.64)); + int ashIslandDistance = ashIslandX2 - ashIslandX; + int flatDistanceBetweenHellHouses = ashIslandDistance / 3; + + // Keep track of world size to adjust house distances + float houseDistanceMult = Main.maxTilesX / 4200f; + int maxRandomDistanceBetweenHouses = (int)(75 * houseDistanceMult); + + // ashIslandX + 100 places the first hell house at the perfect position on the left shore of the ash island + // Add some random variance so that it doesn't feel so artificial + int firstHouseLocation = ashIslandX + 100 + WorldGen.genRand.Next(maxRandomDistanceBetweenHouses); + + // Max amount of houses generated on ash island + int maxHouses = 3; + int placedHouses = 0; + for (int i = firstHouseLocation; i < ashIslandX2 - 100; i++) + { + // Start searching at Main.maxTilesY - 130 because ashIsland's max depth is Main.maxTilesY - 135 + int hellHouseGenY = Main.maxTilesY - 130; + while (Main.tile[i, hellHouseGenY].HasTile || Main.tile[i, hellHouseGenY].LiquidAmount > 0) + hellHouseGenY--; + + if (Main.tile[i, hellHouseGenY + 1].HasTile) + { + // Place house + // TODO -- Stip's houses will be generated here eventually + //WorldGen.HellHouse(i, hellHouseGenY); + + // Move index further along to keep houses spread apart + i += flatDistanceBetweenHellHouses + WorldGen.genRand.Next(maxRandomDistanceBetweenHouses); + + // Increment placed houses index and break loop once enough are placed + placedHouses++; + if (placedHouses >= maxHouses) + break; + } + } + } + + // Placing torches in towers + float torchAmountMult = Main.maxTilesX / 4200f; + for (int torchIndex = 0; (float)torchIndex < 200f * torchAmountMult; torchIndex++) + { + int attempts = 0; + bool placedTorch = false; + while (!placedTorch) + { + attempts++; + int x = WorldGen.genRand.Next((int)((double)Main.maxTilesX * 0.2), (int)((double)Main.maxTilesX * 0.8)); + int y = WorldGen.genRand.Next(Main.maxTilesY - 300, Main.maxTilesY - 20); + if (Main.tile[x, y].HasTile && (Main.tile[x, y].TileType == TileID.ObsidianBrick || Main.tile[x, y].TileType == TileID.HellstoneBrick)) + { + int xOffset = 0; + if (Main.tile[x - 1, y].WallType > 0) + xOffset = -1; + else if (Main.tile[x + 1, y].WallType > 0) + xOffset = 1; + + if (!Main.tile[x + xOffset, y].HasTile && !Main.tile[x + xOffset, y + 1].HasTile) + { + // Check if a torch has already been placed in this location + bool torchAlreadyPlaced = false; + for (int k = x - 8; k < x + 8; k++) + { + for (int l = y - 8; l < y + 8; l++) + { + if (Main.tile[k, l].HasTile && TileID.Sets.Torch[Main.tile[k, l].TileType]) + { + torchAlreadyPlaced = true; + break; + } + } + } + + // Place the torch + if (!torchAlreadyPlaced) + { + WorldGen.PlaceTile(x + xOffset, y, TileID.Torches, mute: true, forced: true, -1, 7); + placedTorch = true; + } + } + } + + if (attempts > 1000) + placedTorch = true; + } + } + + // Place furniture in the towers + double furnitureAmount = 4200000D / (double)Main.maxTilesX; + for (int furnitureIndex = 0; (double)furnitureIndex < furnitureAmount; furnitureIndex++) + { + int attempts = 0; + int furniturePlacementX = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); + int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + while ((Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) + { + furniturePlacementX = WorldGen.genRand.NextBool(2) ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); + y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + + attempts++; + if (attempts > 100000) + break; + } + + if (attempts > 100000 || (Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) + continue; + + for (; !WorldGen.SolidTile(furniturePlacementX, y) && y < Main.maxTilesY - 20; y++) + { + } + + y--; + int placementAdjustment = furniturePlacementX; + int placementAdjustment2 = furniturePlacementX; + while (!Main.tile[placementAdjustment, y].HasTile && WorldGen.SolidTile(placementAdjustment, y + 1)) + placementAdjustment--; + + placementAdjustment++; + for (; !Main.tile[placementAdjustment2, y].HasTile && WorldGen.SolidTile(placementAdjustment2, y + 1); placementAdjustment2++) + { + } + + placementAdjustment2--; + int placementSpaceLimit = placementAdjustment2 - placementAdjustment; + int x = (placementAdjustment2 + placementAdjustment) / 2; + if (Main.tile[x, y].HasTile || (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || !WorldGen.SolidTile(x, y + 1)) + continue; + + // Different styles of houses + int style = 16; + int style2 = 13; + int style3 = 14; + int style4 = 49; + int style5 = 4; + int style6 = 8; + int style7 = 15; + int style8 = 9; + int style9 = 10; + int style10 = 17; + int style11 = 25; + int style12 = 25; + int style13 = 23; + int style14 = 25; + int styleChoice = WorldGen.genRand.Next(13); + int sizeX = 0; + int sizeY = 0; + if (styleChoice == 0) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 1) + { + sizeX = 4; + sizeY = 3; + } + + if (styleChoice == 2) + { + sizeX = 3; + sizeY = 5; + } + + if (styleChoice == 3) + { + sizeX = 4; + sizeY = 6; + } + + if (styleChoice == 4) + { + sizeX = 3; + sizeY = 3; + } + + if (styleChoice == 5) + { + sizeX = 5; + sizeY = 3; + } + + if (styleChoice == 6) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 7) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 8) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 9) + { + sizeX = 3; + sizeY = 5; + } + + if (styleChoice == 10) + { + sizeX = 5; + sizeY = 3; + } + + if (styleChoice == 11) + { + sizeX = 2; + sizeY = 4; + } + + if (styleChoice == 12) + { + sizeX = 3; + sizeY = 3; + } + + // Check if there are any tiles in the way of furniture placement + for (int placementIndexX = x - sizeX; placementIndexX <= x + sizeX; placementIndexX++) + { + for (int placementIndexY = y - sizeY; placementIndexY <= y; placementIndexY++) + { + if (Main.tile[placementIndexX, placementIndexY].HasTile) + { + styleChoice = -1; + break; + } + } + } + + // Check if there is enough space to place furniture + if ((double)placementSpaceLimit < (double)sizeX * 1.75) + styleChoice = -1; + + switch (styleChoice) + { + case 0: + WorldGen.PlaceTile(x, y, TileID.Tables, mute: true, forced: false, -1, style2); + int candlePlacementX = WorldGen.genRand.Next(6); + if (candlePlacementX < 3) + WorldGen.PlaceTile(x + candlePlacementX, y - 2, TileID.Candles, mute: true, forced: false, -1, style12); + + if (!Main.tile[x, y].HasTile) + break; + + if (!Main.tile[x - 2, y].HasTile) + { + WorldGen.PlaceTile(x - 2, y, TileID.Chairs, mute: true, forced: false, -1, style); + if (Main.tile[x - 2, y].HasTile) + { + Main.tile[x - 2, y].TileFrameX += 18; + Main.tile[x - 2, y - 1].TileFrameX += 18; + } + } + + if (!Main.tile[x + 2, y].HasTile) + WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); + + break; + + case 1: + WorldGen.PlaceTile(x, y, TileID.WorkBenches, mute: true, forced: false, -1, style3); + int candlePlacementX2 = WorldGen.genRand.Next(4); + if (candlePlacementX2 < 2) + WorldGen.PlaceTile(x + candlePlacementX2, y - 1, TileID.Candles, mute: true, forced: false, -1, style12); + + if (!Main.tile[x, y].HasTile) + break; + + if (WorldGen.genRand.NextBool()) + { + if (!Main.tile[x - 1, y].HasTile) + { + WorldGen.PlaceTile(x - 1, y, TileID.Chairs, mute: true, forced: false, -1, style); + if (Main.tile[x - 1, y].HasTile) + { + Main.tile[x - 1, y].TileFrameX += 18; + Main.tile[x - 1, y - 1].TileFrameX += 18; + } + } + } + else if (!Main.tile[x + 2, y].HasTile) + WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); + + break; + + case 2: + WorldGen.PlaceTile(x, y, TileID.Statues, mute: true, forced: false, -1, style4); + break; + + case 3: + WorldGen.PlaceTile(x, y, TileID.Bookcases, mute: true, forced: false, -1, style5); + break; + + case 4: + + if (WorldGen.genRand.NextBool()) + { + WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); + Main.tile[x, y].TileFrameX += 18; + Main.tile[x, y - 1].TileFrameX += 18; + } + else + WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); + + break; + + case 5: + if (WorldGen.genRand.NextBool()) + WorldGen.Place4x2(x, y, TileID.Beds, 1, style6); + else + WorldGen.Place4x2(x, y, TileID.Beds, -1, style6); + break; + + case 6: + WorldGen.PlaceTile(x, y, TileID.Pianos, mute: true, forced: false, -1, style7); + break; + + case 7: + WorldGen.PlaceTile(x, y, TileID.Dressers, mute: true, forced: false, -1, style8); + break; + + case 8: + WorldGen.PlaceTile(x, y, TileID.Benches, mute: true, forced: false, -1, style9); + break; + + case 9: + WorldGen.PlaceTile(x, y, TileID.GrandfatherClocks, mute: true, forced: false, -1, style10); + break; + + case 10: + if (WorldGen.genRand.NextBool()) + WorldGen.Place4x2(x, y, TileID.Bathtubs, 1, style14); + else + WorldGen.Place4x2(x, y, TileID.Bathtubs, -1, style14); + break; + + case 11: + WorldGen.PlaceTile(x, y, TileID.Lamps, mute: true, forced: false, -1, style13); + break; + + case 12: + WorldGen.PlaceTile(x, y, TileID.Candelabras, mute: true, forced: false, -1, style11); + break; + } + } + + // Place paintings in the towers + furnitureAmount = 420000D / (double)Main.maxTilesX; + for (int paintingIndex = 0; (double)paintingIndex < furnitureAmount; paintingIndex++) + { + int attempts = 0; + int x = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); + int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + while ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile) + { + x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); + y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + + attempts++; + if (attempts > 100000) + break; + } + + if (attempts > 100000) + continue; + + int paintingPlacementX = x; + int paintingPlacementX2 = x; + int paintingPlacementY = y; + int paintingPlacementY2 = y; + int sizeY = 0; + for (int num32 = 0; num32 < 2; num32++) + { + paintingPlacementX = x; + paintingPlacementX2 = x; + while (!Main.tile[paintingPlacementX, y].HasTile && (Main.tile[paintingPlacementX, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX, y].WallType == WallID.ObsidianBrickUnsafe)) + paintingPlacementX--; + + paintingPlacementX++; + for (; !Main.tile[paintingPlacementX2, y].HasTile && (Main.tile[paintingPlacementX2, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX2, y].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementX2++) + { + } + + paintingPlacementX2--; + x = (paintingPlacementX + paintingPlacementX2) / 2; + paintingPlacementY = y; + paintingPlacementY2 = y; + while (!Main.tile[x, paintingPlacementY].HasTile && (Main.tile[x, paintingPlacementY].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY].WallType == WallID.ObsidianBrickUnsafe)) + paintingPlacementY--; + + paintingPlacementY++; + for (; !Main.tile[x, paintingPlacementY2].HasTile && (Main.tile[x, paintingPlacementY2].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY2].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementY2++) + { + } + + paintingPlacementY2--; + y = (paintingPlacementY + paintingPlacementY2) / 2; + } + + paintingPlacementX = x; + paintingPlacementX2 = x; + while (!Main.tile[paintingPlacementX, y].HasTile && !Main.tile[paintingPlacementX, y - 1].HasTile && !Main.tile[paintingPlacementX, y + 1].HasTile) + paintingPlacementX--; + + paintingPlacementX++; + for (; !Main.tile[paintingPlacementX2, y].HasTile && !Main.tile[paintingPlacementX2, y - 1].HasTile && !Main.tile[paintingPlacementX2, y + 1].HasTile; paintingPlacementX2++) + { + } + + paintingPlacementX2--; + paintingPlacementY = y; + paintingPlacementY2 = y; + while (!Main.tile[x, paintingPlacementY].HasTile && !Main.tile[x - 1, paintingPlacementY].HasTile && !Main.tile[x + 1, paintingPlacementY].HasTile) + paintingPlacementY--; + + paintingPlacementY++; + for (; !Main.tile[x, paintingPlacementY2].HasTile && !Main.tile[x - 1, paintingPlacementY2].HasTile && !Main.tile[x + 1, paintingPlacementY2].HasTile; paintingPlacementY2++) + { + } + + paintingPlacementY2--; + x = (paintingPlacementX + paintingPlacementX2) / 2; + y = (paintingPlacementY + paintingPlacementY2) / 2; + int sizeX = paintingPlacementX2 - paintingPlacementX; + sizeY = paintingPlacementY2 - paintingPlacementY; + if (sizeX <= 7 || sizeY <= 5) + continue; + + if (!WorldGen.nearPicture2(x, y)) + { + PaintingEntry paintingEntry = WorldGen.RandHellPicture(); + if (!WorldGen.nearPicture(x, y)) + WorldGen.PlaceTile(x, y, paintingEntry.tileType, mute: true, forced: false, -1, paintingEntry.style); + } + } + + // An array used for banner styles + int[] bannerArray = new int[3] + { + WorldGen.genRand.Next(16, 22), + WorldGen.genRand.Next(16, 22), + WorldGen.genRand.Next(16, 22) + }; + + while (bannerArray[1] == bannerArray[0]) + bannerArray[1] = WorldGen.genRand.Next(16, 22); + + while (bannerArray[2] == bannerArray[0] || bannerArray[2] == bannerArray[1]) + bannerArray[2] = WorldGen.genRand.Next(16, 22); + + // Place hanging tiles + furnitureAmount = 420000D / (double)Main.maxTilesX; + for (int hangingTileIndex = 0; (double)hangingTileIndex < furnitureAmount; hangingTileIndex++) + { + int attempts = 0; + int x; + int y; + do + { + x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); + y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + attempts++; + } + while (attempts <= 100000 && ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile)); + + if (attempts > 100000) + continue; + + while (!WorldGen.SolidTile(x, y) && y > 10) + y--; + + y++; + if (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) + continue; + + int hangingTileType = WorldGen.genRand.Next(3); + int chandelierStyle = 32; + int lanternStyle = 32; + int hangingTileSizeX; + int hangingTileSizeY; + switch (hangingTileType) + { + default: + hangingTileSizeX = 1; + hangingTileSizeY = 3; + break; + case 1: + hangingTileSizeX = 3; + hangingTileSizeY = 3; + break; + case 2: + hangingTileSizeX = 1; + hangingTileSizeY = 2; + break; + } + + for (int placementIndexX = x - 1; placementIndexX <= x + hangingTileSizeX; placementIndexX++) + { + for (int placementIndexY = y; placementIndexY <= y + hangingTileSizeY; placementIndexY++) + { + Tile tile = Main.tile[x, y]; + if (placementIndexX < x || placementIndexX == x + hangingTileSizeX) + { + if (tile.HasTile) + { + switch (tile.TileType) + { + case TileID.ClosedDoor: + case TileID.OpenDoor: + case TileID.Chandeliers: + case TileID.HangingLanterns: + case TileID.Banners: + hangingTileType = -1; + break; + } + } + } + else if (tile.HasTile) + hangingTileType = -1; + } + } + + switch (hangingTileType) + { + case 0: + WorldGen.PlaceTile(x, y, TileID.Banners, mute: true, forced: false, -1, bannerArray[WorldGen.genRand.Next(3)]); + break; + case 1: + WorldGen.PlaceTile(x, y, TileID.Chandeliers, mute: true, forced: false, -1, chandelierStyle); + break; + case 2: + WorldGen.PlaceTile(x, y, TileID.HangingLanterns, mute: true, forced: false, -1, lanternStyle); + break; + } + } + } + } +} diff --git a/World/GiantHive.cs b/World/GiantHive.cs index 96b8e31331..7845fa730c 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -11,6 +11,7 @@ using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.FurnitureAncient; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; @@ -86,7 +87,7 @@ namespace CalamityMod.World //place living mahogany leaves at the end of each branch foreach (Point item in list) { - WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), + WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(3, 5)), new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(TileID.LivingMahoganyLeaves), new Actions.SetFrames(frameNeighbors: true))); } } @@ -172,13 +173,20 @@ namespace CalamityMod.World Vector2 movingLarvaLocation = larvaLocation; int hiveTunnelTries = WorldGen.genRand.Next(2, 5); for (int j = 0; j < hiveTunnelTries; j++) - movingLarvaLocation = CreateHiveTunnel((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + movingLarvaLocation = MakeCell((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); larvaLocation = movingLarvaLocation; array[arrayInc] = (int)larvaLocation.X; array2[arrayInc] = (int)larvaLocation.Y; arrayInc++; } + for (int i = 0; i < numHiveTunnels; i++) + { + int hiveTunnelTries = WorldGen.genRand.Next(1, 2); + MakeCellHoney((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + } + MakeOuterCell((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + FrameOutAllHiveContents(origin, 50); @@ -206,7 +214,6 @@ namespace CalamityMod.World x += treeIndentDirection; if (!SpotActuallyNotInHive(x, y)) { - CreateBlockedHoneyCube(x, y); CreateDentForHoneyFall(x, y, treeIndentDirection); } } @@ -234,34 +241,51 @@ namespace CalamityMod.World // Honey chests Vector2 honeyChestLocation = default; - for (int l = 0; l < maxAttempts; l++) - { - Vector2 newStructureLocation = larvaLocation; - newStructureLocation.X += WorldGen.genRand.Next(-100, 101); - newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); - if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) - { - honeyChestLocation = newStructureLocation; - CreateStandAndPlaceHoneyChest(newStructureLocation); - break; - } - } - for (int l = 0; l < maxAttempts; l++) - { - Vector2 newStructureLocation = larvaLocation; - newStructureLocation.X += WorldGen.genRand.Next(-100, 101); - newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); - if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && Vector2.Distance(honeyChestLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) - { - CreateStandAndPlaceHoneyChest(newStructureLocation); - break; - } - } + //for (int l = 0; l < maxAttempts; l++) + //{ + // Vector2 newStructureLocation = larvaLocation; + // newStructureLocation.X += WorldGen.genRand.Next(-100, 101); + // newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); + // if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) + // { + // honeyChestLocation = newStructureLocation; + // CreateStandAndPlaceHoneyChest(newStructureLocation); + // break; + // } + //} + //for (int l = 0; l < maxAttempts; l++) + //{ + // Vector2 newStructureLocation = larvaLocation; + // newStructureLocation.X += WorldGen.genRand.Next(-100, 101); + // newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); + // if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && Vector2.Distance(honeyChestLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) + // { + // CreateStandAndPlaceHoneyChest(newStructureLocation); + // break; + // } + //} CalamityUtils.AddProtectedStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return true; } + public static bool PlaceLayer(int X, int Y, int height, int tileType) + { + for (int j = Y; j <= Y + height; j++) + { + if (Main.tile[X, j].HasTile && Main.tile[X, j + 1].HasTile && Main.tile[X, j + 2].HasTile && Main.tile[X, j + 3].HasTile && + Main.tile[X - 1, j + 3].HasTile && Main.tile[X + 1, j + 3].HasTile) + { + Main.tile[X, j].TileType = (ushort)tileType; + } + else + { + return false; + } + } + + return true; + } private static void FrameOutAllHiveContents(Point origin, int squareHalfWidth) { int maxXsize = Math.Max(10, origin.X - squareHalfWidth); @@ -272,125 +296,334 @@ namespace CalamityMod.World { for (int j = maxYSize; j < minYSize; j++) { - Tile tile = Main.tile[i, j]; - if (tile.HasTile && tile.TileType == TileID.Hive) - WorldGen.SquareTileFrame(i, j); + //Tile tile = Main.tile[i, j]; + //if (tile.HasTile && tile.TileType == TileID.Hive) + // WorldGen.SquareTileFrame(i, j); - if (tile.WallType == WallID.HiveUnsafe) - WorldGen.SquareWallFrame(i, j); + //if (tile.WallType == WallID.HiveUnsafe) + // WorldGen.SquareWallFrame(i, j); + bool canPlaceSand = false; + + if (Main.tile[i, j].TileType == TileID.Hive && !Main.tile[i, j - 1].HasTile && !Main.tile[i, j - 2].HasTile && !Main.tile[i, j - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceLayer(i, j, WorldGen.genRand.Next(2, 3), TileID.HoneyBlock); + } } } } - - private static Vector2 CreateHiveTunnel(int i, int j, UnifiedRandom random) + public static void CreateTunnel(int startX, int startY, int endX, int endY, int width = 6, int tileType = TileID.Hive) { - double randOffset = random.Next(20, 26); - float tunnelPlacementAttempts = random.Next(30, 41); - float miniMaxXTiles = Main.maxTilesX / 4200; - miniMaxXTiles = (miniMaxXTiles + 1f) / 2f; - randOffset *= (double)miniMaxXTiles; - tunnelPlacementAttempts *= miniMaxXTiles; + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - double randOffsetCopy = randOffset; - Vector2 result = default; - result.X = i; - result.Y = j; - Vector2 defaultTunnelPos = default; - defaultTunnelPos.X = random.Next(-10, 11) * 0.2f; - defaultTunnelPos.Y = random.Next(-10, 11) * 0.2f; - while (randOffset > 0.0 && tunnelPlacementAttempts > 0f) + for (int i = 0; i <= steps; i++) { - if (result.Y > (Main.maxTilesY - 250)) - tunnelPlacementAttempts = 0f; + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); - randOffset = randOffsetCopy * (double)(1f + random.Next(-20, 20) * 0.01f); - tunnelPlacementAttempts -= 1f; - int mainXOffset = (int)(result.X - randOffset); - int maxXOffset = (int)(result.X + randOffset); - int minYOffset = (int)(result.Y - randOffset); - int maxYOffset = (int)(result.Y + randOffset); - if (mainXOffset < 1) - mainXOffset = 1; - - if (maxXOffset > Main.maxTilesX - 1) - maxXOffset = Main.maxTilesX - 1; - - if (minYOffset < 1) - minYOffset = 1; - - if (maxYOffset > Main.maxTilesY - 1) - maxYOffset = Main.maxTilesY - 1; - - for (int k = mainXOffset; k < maxXOffset; k++) + // Draw a small circular path + for (int xi = -width; xi <= width; xi++) { - for (int l = minYOffset; l < maxYOffset; l++) + for (int yi = -width; yi <= width; yi++) { - if (!WorldGen.InWorld(k, l, 50)) + if (xi * xi + yi * yi <= width * width) { - tunnelPlacementAttempts = 0f; - } - else - { - if (Main.tile[k - 10, l].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; + int tileX = x + xi; + int tileY = y + yi; - if (Main.tile[k + 10, l].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; - - if (Main.tile[k, l - 10].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; - - if (Main.tile[k, l + 10].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; - } - - if (l < Main.worldSurface && Main.tile[k, l - 5].WallType == WallID.None) - tunnelPlacementAttempts = 0f; - - float tileXDist = Math.Abs(k - result.X); - float tileYDist = Math.Abs(l - result.Y); - double tileDistance = Math.Sqrt(tileXDist * tileXDist + tileYDist * tileYDist); - if (tileDistance < randOffsetCopy * 0.4 * (1.0 + random.Next(-10, 11) * 0.005)) - { - Main.tile[k, l].LiquidAmount = byte.MaxValue; - Main.tile[k, l].Get().LiquidType = LiquidID.Honey; - Main.tile[k, l].WallType = WallID.HiveUnsafe; - Main.tile[k, l].Get().HasTile = false; - Main.tile[k, l].Get().IsHalfBlock = false; - Main.tile[k, l].Get().Slope = SlopeType.Solid; - } - else if (tileDistance < randOffsetCopy * 0.75 * (1.0 + random.Next(-10, 11) * 0.005)) - { - Main.tile[k, l].LiquidAmount = 0; - if (Main.tile[k, l].WallType != WallID.HiveUnsafe) + if (WorldGen.InWorld(tileX, tileY)) { - Main.tile[k, l].Get().HasTile = true; - Main.tile[k, l].Get().IsHalfBlock = false; - Main.tile[k, l].Get().Slope = SlopeType.Solid; - Main.tile[k, l].TileType = TileID.Hive; - } - } - - if (tileDistance < randOffsetCopy * 0.6 * (1.0 + random.Next(-10, 11) * 0.005)) - { - Main.tile[k, l].WallType = WallID.HiveUnsafe; - if (random.NextBool()) - { - Main.tile[k, l].LiquidAmount = byte.MaxValue; - Main.tile[k, l].Get().LiquidType = LiquidID.Honey; + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); } } } } + } + } + public static void ClearTunnel(int startX, int startY, int endX, int endY, int width = 3) + { + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - result += defaultTunnelPos; - tunnelPlacementAttempts -= 1f; - defaultTunnelPos.Y += random.Next(-10, 11) * 0.05f; - defaultTunnelPos.X += random.Next(-10, 11) * 0.05f; + for (int i = 0; i <= steps; i++) + { + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); + + for (int xi = -width; xi <= width; xi++) + { + for (int yi = -width; yi <= width; yi++) + { + if (xi * xi + yi * yi <= width * width) + { + int tileX = x + xi; + int tileY = y + yi; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + tTile.WallType = (ushort)ModContent.WallType(); + tTile.LiquidAmount = 0; + + WorldGen.SquareWallFrame(tileX, tileY); + + // Optional: Add honey with low chance + if (WorldGen.genRand.NextBool(10)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + } + } + public static void CreateHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + if (!doWalls) + { + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); + } + else + { + tTile.WallType = WallID.HiveUnsafe; + WorldGen.SquareWallFrame(tileX, tileY); + } + } + } + } + } + public static void CreateGiantHiveHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + if (!doWalls) + { + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); + } + else + { + tTile.WallType = (ushort)ModContent.WallType(); + WorldGen.SquareWallFrame(tileX, tileY); + } + } + } + } + } + public static void ClearHexagon(int centerX, int centerY, int hexagonSize) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + tTile.WallType = WallID.HiveUnsafe; + tTile.LiquidAmount = 0; + WorldGen.SquareWallFrame(tileX, tileY); + if (WorldGen.genRand.NextBool(15)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + public static void GiantHiveWallHexagon(int centerX, int centerY, int hexagonSize) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + tTile.WallType = (ushort)ModContent.WallType(); + tTile.LiquidAmount = 0; + WorldGen.SquareWallFrame(tileX, tileY); + if (WorldGen.genRand.NextBool(15)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + public static Vector2 MakeCell(int x, int y, UnifiedRandom random) + { + CreateHexagon(x, y - 30, 110, TileID.Hive); + CreateGiantHiveHexagon(x, y - 30, 108, TileID.Hive, true); + GiantHiveWallHexagon(x, y - 22, 90); + + + + return new Vector2(x, y); + } + public static Vector2 MakeCellHoney(int x, int y, UnifiedRandom random) + { + int attempts = 0; + int hexagonsToPlace = WorldGen.genRand.Next(1, 3); // number of honey hexagons to place + + while (attempts < 100 && hexagonsToPlace > 0) + { + attempts++; + + int offsetX = WorldGen.genRand.Next(-60, 60); + int offsetY = WorldGen.genRand.Next(-50, 50); + + int targetX = x + offsetX; + int targetY = y + offsetY; + + // Check a 3x3 area for mostly Hive tiles to confirm it's inside the hive + bool valid = true; + for (int i = -1; i <= 1 && valid; i++) + { + for (int j = -1; j <= 1 && valid; j++) + { + int checkX = targetX + i; + int checkY = targetY + j; + + if (!WorldGen.InWorld(checkX, checkY)) + valid = false; + else if (!Main.tile[checkX, checkY].HasTile || Main.tile[checkX, checkY].TileType != TileID.Hive) + valid = false; + } + } + + if (valid) + { + int radius = WorldGen.genRand.Next(7, 10); + CreateHexagon(targetX, targetY, radius, TileID.HoneyBlock); + hexagonsToPlace--; + } } - return result; + return new Vector2(x, y); } + public static Vector2 MakeOuterCell(int x, int y, UnifiedRandom random) + { + int numConnections = WorldGen.genRand.Next(3, 6); + List placedHexes = new List(); + int chestsPlaced = 0; + int chestMax = 4; // Number of chests to spawn in outer cells + + for (int i = 0; i < numConnections; i++) + { + bool placed = false; + int attempts = 0; + + while (!placed && attempts < 10) + { + attempts++; + + float angle = MathHelper.ToRadians(WorldGen.genRand.Next(0, 180)); + float distance = WorldGen.genRand.Next(80, 120); + + int newX = x + (int)(Math.Cos(angle) * distance); + int newY = y + (int)(Math.Sin(angle) * distance); + Vector2 newPos = new Vector2(newX, newY); + + bool overlaps = placedHexes.Any(pos => Vector2.Distance(pos, newPos) < 60); + + if (!overlaps) + { + int hexRadius = WorldGen.genRand.Next(30, 45); + CreateGiantHiveHexagon(newX, newY - 15, hexRadius - 1, TileID.Hive, true); + CreateHexagon(newX, newY - 15, hexRadius, TileID.Hive); + ClearTunnel(x, y + 30, newX, newY, 5); + CreateTunnel(x, y + 30, newX, newY); + ClearTunnel(x, y + 30, newX, newY, 3); + GiantHiveWallHexagon(newX, newY - 10, WorldGen.genRand.Next(19, 26)); + + // Place honey chest in this cell with a small chance + if (chestsPlaced < chestMax) + { + CreateStandAndPlaceHoneyChest(new Vector2(newX, newY)); + chestsPlaced++; + } + + placedHexes.Add(newPos); + placed = true; + } + } + } + + GiantHiveWallHexagon(x, y - 22, 90); + ClearHexagon(x, y - 18, 80); + + return new Vector2(x, y); + } + private static bool TooCloseToImportantLocations(Point origin) { @@ -441,26 +674,26 @@ namespace CalamityMod.World } } - private static void CreateBlockedHoneyCube(int x, int y) - { - for (int i = x - 1; i <= x + 2; i++) - { - for (int j = y - 1; j <= y + 2; j++) - { - if (i >= x && i <= x + 1 && j >= y && j <= y + 1) - { - Main.tile[i, j].Get().HasTile = false; - Main.tile[i, j].LiquidAmount = byte.MaxValue; - Main.tile[i, j].Get().LiquidType = LiquidID.Honey; - } - else - { - Main.tile[i, j].Get().HasTile = true; - Main.tile[i, j].TileType = TileID.Hive; - } - } - } - } + //private static void CreateBlockedHoneyCube(int x, int y) + //{ + // for (int i = x - 1; i <= x + 2; i++) + // { + // for (int j = y - 1; j <= y + 2; j++) + // { + // if (i >= x && i <= x + 1 && j >= y && j <= y + 1) + // { + // Main.tile[i, j].Get().HasTile = false; + // Main.tile[i, j].LiquidAmount = byte.MaxValue; + // Main.tile[i, j].Get().LiquidType = LiquidID.Honey; + // } + // else + // { + // Main.tile[i, j].Get().HasTile = true; + // Main.tile[i, j].TileType = TileID.Hive; + // } + // } + // } + //} private static bool SpotActuallyNotInHive(int x, int y) { diff --git a/World/MechanicShed.cs b/World/MechanicShed.cs index 653edd2d18..86d7e392ef 100644 --- a/World/MechanicShed.cs +++ b/World/MechanicShed.cs @@ -17,25 +17,95 @@ namespace CalamityMod.World string mapKey = MechanicShedKey; var schematic = TileMaps[mapKey]; - int placementPositionX = WorldGen.genRand.Next(GenVars.snowOriginLeft + 100, GenVars.snowOriginRight - 100); - int placementPositionY = (int)Main.worldSurface - (Main.maxTilesY / 12); + int leftLimit = GenVars.snowOriginLeft + 100; + int rightLimit = GenVars.snowOriginRight - 100; + int placementPositionX = WorldGen.genRand.Next(leftLimit, rightLimit); + int placementPositionY = (int)Main.worldSurface - 50; + + int distanceToCheckForSnowTilesX = 30; + int distanceToCheckForSnowTilesY = 5; + int snowTilesRequired = 100; + int emptyTilesRequired = 100; bool foundValidGround = false; int attempts = 0; - while (!foundValidGround && attempts++ < 100000) + int maxAttempts = 100000; + while (!foundValidGround && attempts <= maxAttempts) { - while (!WorldGen.SolidTile(placementPositionX, placementPositionY) && placementPositionY <= Main.worldSurface) + attempts++; + + // Check if there are enough snow tiles on the bottom of the shed's gen location + // 150 tiles checked in total + int snowTileCount = 0; + bool enoughSnowTilesOnBottom = false; + for (int shedTileCheckIndexX = placementPositionX - 15; shedTileCheckIndexX < placementPositionX - 15 + distanceToCheckForSnowTilesX; shedTileCheckIndexX++) { - placementPositionY++; + if (enoughSnowTilesOnBottom) + break; + + for (int shedTileCheckIndexY = placementPositionY - 5; shedTileCheckIndexY < placementPositionY - 5 + distanceToCheckForSnowTilesY; shedTileCheckIndexY++) + { + if (Main.tile[shedTileCheckIndexX, shedTileCheckIndexY] != null) + { + if (Main.tile[shedTileCheckIndexX, shedTileCheckIndexY].HasTile) + { + if (Main.tile[shedTileCheckIndexX, shedTileCheckIndexY].TileType == TileID.SnowBlock) + { + snowTileCount++; + if (snowTileCount >= snowTilesRequired) + { + enoughSnowTilesOnBottom = true; + break; + } + } + } + } + } } - if (Main.tile[placementPositionX, placementPositionY].HasTile || Main.tile[placementPositionX, placementPositionY].WallType > 0) + // Check if there are enough empty tiles on the top of the shed's gen location + // 150 tiles checked in total + int emptyTileCount = 0; + bool enoughEmptyTilesOnTop = false; + for (int shedTileCheckIndexX = placementPositionX - 15; shedTileCheckIndexX < placementPositionX - 15 + distanceToCheckForSnowTilesX; shedTileCheckIndexX++) { - foundValidGround = true; + if (enoughEmptyTilesOnTop) + break; + + for (int shedTileCheckIndexY = placementPositionY - 20; shedTileCheckIndexY < placementPositionY - 20 + distanceToCheckForSnowTilesY; shedTileCheckIndexY++) + { + if ((Main.tile[shedTileCheckIndexX, shedTileCheckIndexY] == null || + !Main.tile[shedTileCheckIndexX, shedTileCheckIndexY].HasTile) && + Main.tile[shedTileCheckIndexX, shedTileCheckIndexY].WallType == WallID.None) + { + emptyTileCount++; + if (emptyTileCount >= emptyTilesRequired) + { + enoughEmptyTilesOnTop = true; + break; + } + } + } + } + + if (enoughSnowTilesOnBottom && enoughEmptyTilesOnTop) + { + break; + } + else + { + placementPositionX += 5; + if (placementPositionX > rightLimit) + placementPositionX = leftLimit; + + if (!enoughEmptyTilesOnTop) + placementPositionY -= 5; + else if (!enoughSnowTilesOnBottom) + placementPositionY += 5; } } - Point placementPoint = new Point(placementPositionX, placementPositionY + 5); + Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); SchematicAnchor anchorType = SchematicAnchor.BottomCenter; diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index b8a0091c89..f36f8899d5 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -7,7 +7,9 @@ using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Walls; using Microsoft.Xna.Framework; using ReLogic.Threading; +using ReLogic.Utilities; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -29,15 +31,14 @@ namespace CalamityMod.World /* ena todo - fix the fucking forest being shaved + fix the fucking forest being shaved (done - HPU) cut a half oval out of the top of forest in anticipation of structure placement - change the type of noise both reefs and forest use (reefs more jagged, forest more flat) - cut a curve out of the top of shores (the desert part) + change the type of noise both reefs and forest use (reefs more jagged, forest more flat) (done - HPU) + cut a curve out of the top of shores (the desert part) (done - HPU) extend basalt to hell - DONE - convert normal terrain blocks below basalt into basalt + convert normal terrain blocks below basalt into basalt (maybe??? - HPU) BLOTCHES EVERYWHERE */ - public static void NormalForLoop(int fromInclusive, int toExclusive, int step, Action action) { for (int i = fromInclusive; i < toExclusive; i += step) @@ -80,7 +81,7 @@ namespace CalamityMod.World // // Places a trapezoid of circles to serve as the main area for the biome. // - const float steepness = 15f; + const float steepness = 25f; static float trapezoidLateralSteep(float x) { if (x <= 1f / steepness) @@ -90,14 +91,14 @@ namespace CalamityMod.World else return -steepness * x + steepness; } - ForLoop.Invoke(startPosX - biomeSize - 20, startPosX + biomeSize + 20, 15, (X) => + ForLoop.Invoke(startPosX - biomeSize - 5, startPosX + biomeSize + 20, 15, (X) => { float height = MathHelper.Lerp( - startPosY + 50, - startPosY - 35, + startPosY + 35, //top + startPosY - 15, //bottom trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); - for (int Y = startPosY + 50; Y >= height; Y -= 10) + for (int Y = startPosY + 25; Y >= height; Y -= 10) { ShapeData circle = new ShapeData(); WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] @@ -112,18 +113,18 @@ namespace CalamityMod.World // // Makes the bottom borders of the Timeless Shores curved downwards. // - const int totalCuveDepth = 40; - ForLoop.Invoke(startPosX - biomeSize - 20, startPosX - biomeSize + 200, 10, (x) => + const int totalCuveDepth = 90; + ForLoop.Invoke(startPosX - biomeSize - 10, startPosX - biomeSize + 200, 10, (x) => { int curveDepth = (int)MathHelper.Lerp( totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); - for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] { //new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle), @@ -131,17 +132,17 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); } }); - ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 20, 5, (x) => + ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 10, 5, (x) => { int curveDepth = (int)MathHelper.Lerp( totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); - for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] { //new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle), @@ -151,18 +152,28 @@ namespace CalamityMod.World }); //clear a smaller square out of the center where the biomes stuff will be - ForLoop.Invoke(startPosX - biomeSize + 35, startPosX + biomeSize - 35, 1, (X) => + //Added curves to the top of the biome via curve depth -hpu 02/19/25 + ForLoop.Invoke(startPosX - biomeSize + 10, startPosX + biomeSize - 10, 1, (X) => { - for (int Y = startPosY - 65; Y <= startPosY + 50; Y++) + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, X, true))); + int random = WorldGen.genRand.Next(-40, 10); + for (int Y = startPosY - 25 + curveDepth + curveDepth2; Y <= startPosY + 50; Y++) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 5)), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + random), new Shapes.Mound(WorldGen.genRand.Next(7, 10),5), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + random), new ModShapes.All(circle), Actions.Chain(new GenAction[] { new Actions.Clear() })); @@ -172,26 +183,29 @@ namespace CalamityMod.World // // Places slopes at the sides of the shores to actually make shores. // - ForLoop.Invoke(startPosX - biomeSize + 20, startPosX - biomeSize + 200, 20, (moundX) => + ForLoop.Invoke(startPosX - biomeSize - 15, startPosX - biomeSize + 200, 20, (moundX) => { + int RandomX = Main.rand.Next(15, 20); ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startPosY + 60; + int moundY = startPosY + 75; int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize + 27, startPosX - biomeSize + 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); - ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 20, 20, (moundX) => + ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 15, 20, (moundX) => { ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startPosY + 60; + int moundY = startPosY + 75; int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize - 27, startPosX + biomeSize - 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); }); + // // Makes a large platform in the middle of the Timeless Shores. @@ -208,7 +222,7 @@ namespace CalamityMod.World { WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] { - new Actions.Clear(), // Clears all tiles and walls. + new Actions.ClearTile(), // Clears all tiles new Actions.PlaceTile((ushort)ModContent.TileType()) // Places tiles. })); } @@ -218,49 +232,39 @@ namespace CalamityMod.World float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, x, true)); int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); WorldUtils.Gen(new Point(x, startPosY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); - }); - - // - // Makes a hole into the actual Sunken Sea at the botoom-left and bottom-right of the middle platform of the Timeless Shores. - // - const int furthestDistanceFromCenter = 55; - const int shortestDistanceFromCenter = 35; - const int holeStart = 50; - const int holeDepth = 35; - ForLoop.Invoke(startPosX - furthestDistanceFromCenter, startPosX - shortestDistanceFromCenter, 1, (holeX) => + }); + const int furthestDistanceFromCenter = 100; + const int shortestDistanceFromCenter = 60; + const int holeStart = 10; + const int holeDepth = 80; + // Platu + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => { - for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) + int randomDisplacement = WorldGen.genRand.Next(-27, 46); + int RandomX = Main.rand.Next(15, 20); + int RandomH = Main.rand.Next(20, 35); + + for (int wallPillarY = startPosY + RandomH; wallPillarY <= startPosY + 60; wallPillarY += 10) { - ShapeData circle = new(); + // Along the height of the pillar, it becomes shorter the more closer to the center we get. + int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - RandomH, startPosY + 45, wallPillarY)) * 25); - // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. - int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 20); + ShapeData rectangle = new ShapeData(); + GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); + GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 30, startPosY + 70, wallPillarY) + 0.25, 1)); - // may or may not be useful later - //GenAction dither = new Modifiers.RadialDither(2 * sizeIncrement, 5 * sizeIncrement); - - WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(sizeIncrement), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Circle(RandomX - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] { - new Actions.ClearTile(), // The shape removes tiles. - new Actions.SetLiquid() // The shape adds liquid (Default to max water). + blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. })); - } - }); - ForLoop.Invoke(startPosX + shortestDistanceFromCenter, startPosX + furthestDistanceFromCenter, 1, (holeX) => - { - for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) - { - ShapeData circle = new(); - // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. - int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 20); - - WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(sizeIncrement), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { - new Actions.ClearTile(), // The shape removes tiles. - new Actions.SetLiquid() // The shape adds liquid (Default to max water). - })); + new Actions.SetTile((ushort)ModContent.TileType()) + })) + ; } + }); //place water below the clear barrier for the islands so that theres water inbetween them @@ -272,44 +276,15 @@ namespace CalamityMod.World Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; } }); - - //slope tiles - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => - { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) - { - Tile.SmoothSlope(X, Y); - } - }); - - //place layer of sand on valid runestone blocks - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => - { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) - { - bool canPlaceSand = false; - - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 5, ModContent.TileType()); - } - } - }); - // // Generates pillars made out of walls at random points in the Timeless Shores. // - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => + ForLoop.Invoke(startPosX - (biomeSize / 2) - furthestDistanceFromCenter, startPosX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => { - int randomDisplacementX = WorldGen.genRand.Next(-10, 30); + int randomDisplacementX = WorldGen.genRand.Next(-10, 10); + int RandomX = Main.rand.Next(3, 6); - for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 70; wallPillarY += 10) + for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 80; wallPillarY += 10) { // Along the height of the pillar, it becomes shorter the more closer to the center we get. int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - 75, startPosY + 50, wallPillarY)) * 25); @@ -318,7 +293,7 @@ namespace CalamityMod.World GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 40, startPosY + 70, wallPillarY) + 0.25, 1)); - WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 12), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 15), Actions.Chain(new GenAction[] { ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. @@ -327,7 +302,8 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. - })); + })) + ; } }); @@ -335,25 +311,33 @@ namespace CalamityMod.World // Makes the transition area to the Timeless Shores. // Replaces tiles, walls, and places some water spots. // - ForLoop.Invoke(startPosX - biomeSize - 25, startPosX + biomeSize + 25, 20, (x) => + ForLoop.Invoke(startPosX - biomeSize - 30, startPosX + biomeSize + 30, 20, (x) => { - for (int y = startPosY - 70; y >= startPosY - 200; y -= 15) + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 30, startPosX + biomeSize - 200, x, true))); + int curveDepth2 = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 30, startPosX - biomeSize + 200, x, true))); + for (int y = startPosY - 5; y >= startPosY - 149; y -= 15) { float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - float ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + float ditherStrength = MathHelper.Lerp(0f, 0.0f, interpolator); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles(TileID.Sand, TileID.HardenedSand), - new Modifiers.Dither(ditherStrength + 0.2f), + new Modifiers.Dither(ditherStrength + 0f), new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceTile((ushort)ModContent.TileType()), })); // changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. still looks nice imo :) interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 200, y, true); - ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), new Modifiers.Dither(ditherStrength), @@ -363,14 +347,23 @@ namespace CalamityMod.World // i forgot to change this one. :peepotired: interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles(TileID.Sandstone), new Modifiers.Dither(ditherStrength), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); + interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); + ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Modifiers.Dither(ditherStrength), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); @@ -384,12 +377,79 @@ namespace CalamityMod.World })); } } + + //place layer of sand on valid runestone blocks + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + { + for (int Y = startPosY - 100; Y <= startPosY + 100; Y++) + { + bool canPlaceSand = false; + + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); + } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + //Timeless Shores ambiant tiles + //if (Main.tile[X, Y].TileType == ModContent.TileType()) + //{ + // //Driftwood Ambiance + // if (WorldGen.genRand.NextBool(150)) + // { + // ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + // WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + // } + //} + //if (Main.tile[X, Y].TileType == ModContent.TileType()) + //{ + // //Driftwood Ambiance + // if (WorldGen.genRand.NextBool(150)) + // { + // ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + // WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + // } + //} + } + + }); + + + //slope tiles + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + { + for (int Y = startPosY - 300; Y <= startPosY + 200; Y++) + { + Tile.SmoothSlope(X, Y); + } + }); }); } //sides of the sunken sea (radiant reefs) - //LeftSideBarrier is used to make the barrier of basalt either on the left or right, since the sunken sea is meant to have barriers on both sides and the reefs is generated twice - public static void PlaceRadiantReefs(int startPosX, int startPosY, bool LeftSideBarrier) + public static void PlaceRadiantReefs(int startPosX, int startPosY) { int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); @@ -397,78 +457,23 @@ namespace CalamityMod.World Point origin = new Point(startPosX, startPosY); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - float angle = MathHelper.Pi * 0.15f; + float angle = MathHelper.Pi * 0.20f; float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 180 + (Main.maxTilesX / 180); + int biomeSize = 280 + (Main.maxTilesX / 180); float actualSize = biomeSize * 16f; float constant = actualSize * 2f / (float)Math.Sin(angle); float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); + int verticalRadius = (int)(constant / 20f); Vector2 fociOffset = Vector2.UnitY * fociSpacing; Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - //first, place a basalt barrier on the left and right of the biome - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 60) - { - if (LeftSideBarrier) - { - if (X <= origin.X && Main.tile[X - 40, Y - 25].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X - 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X - 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - if (X >= origin.X && Main.tile[X + 40, Y - 25].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X + 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X + 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - } - } - } - } - }); - + bool runonce = false; // this is used to make the wall on the left side go boom on the second run //generate the actual caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -476,11 +481,21 @@ namespace CalamityMod.World { float percent = dist / constant; float blurPercent = 0.99f; + if (percent > blurPercent) { + if (runonce = false) //place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + { + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + runonce = true; + } + if (runonce = true) + //place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + { + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), false, 0f, 0f, true, true); + } } else { @@ -488,11 +503,11 @@ namespace CalamityMod.World Main.tile[X, Y].ClearEverything(); //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, unchecked(cavePerlinSeed - 1)) + 0.5f; float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.280f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.380f; //kill or place tiles depending on the noise map if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) @@ -504,11 +519,13 @@ namespace CalamityMod.World WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); } + + //place walls in the biome using a different "seed" so it differs from the cave generation //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 2, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; @@ -516,6 +533,10 @@ namespace CalamityMod.World { WorldGen.PlaceWall(X, Y, ModContent.WallType()); } + if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) + { + WorldGen.KillTile(X, Y); + } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; @@ -618,13 +639,13 @@ namespace CalamityMod.World int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(startPosX, startPosY); + Point origin = new Point(startPosX, startPosY - 200); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); float angle = MathHelper.Pi * 0.15f; float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 120 + (Main.maxTilesX / 180); + int biomeSize = 150 + (Main.maxTilesX / 180); float actualSize = biomeSize * 16f; float constant = actualSize * 2f / (float)Math.Sin(angle); @@ -638,9 +659,10 @@ namespace CalamityMod.World //place the polyp forest caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + // Modify this part so that the generation happens from bottom to top + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { float percent = dist / constant; float blurPercent = 0.98f; @@ -648,11 +670,12 @@ namespace CalamityMod.World //biome "blending" on the edges (disabled for now) if (percent > blurPercent) { + if (Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) { ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + GenAction blotchMod = new Modifiers.Blotches(4, 0.7); + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); @@ -670,8 +693,8 @@ namespace CalamityMod.World //generate perlin noise caves float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; @@ -688,8 +711,8 @@ namespace CalamityMod.World //place walls in the biome using a different "seed" so it differs from the cave generation //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.235f; @@ -699,6 +722,10 @@ namespace CalamityMod.World WorldGen.PlaceWall(X, Y, ModContent.WallType()); } + if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) + { + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; } @@ -751,11 +778,35 @@ namespace CalamityMod.World if (canPlaceSand) { - PlaceSand(X, Y, 5, ModContent.TileType()); + PlaceSand(X, Y, 4, ModContent.TileType()); + } + + } + } + }); + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + { + bool canPlaceGrass = false; + + //place sand clumps on top of exposed limestone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceGrass = true; + } + + if (canPlaceGrass) + { + PlaceSand(X, Y, 0, ModContent.TileType()); } } } }); + //cleanup again ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => @@ -793,7 +844,6 @@ namespace CalamityMod.World } }); } - //bottom of the biome (gleaming burrows) public static void PlaceGleamingBurrows(int startPosX, int startPosY) { @@ -834,11 +884,11 @@ namespace CalamityMod.World ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(10, 0.4); - WorldUtils.Gen(new Point(X, Y - 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + 5), new Shapes.Rectangle(10, 10), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X, Y - 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + 5), new ModShapes.All(circle), Actions.Chain(new GenAction[] { new Actions.Clear(), new Actions.PlaceTile((ushort)ModContent.TileType()) @@ -849,6 +899,8 @@ namespace CalamityMod.World } }); + + //place the gleaming burrows caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { @@ -872,7 +924,7 @@ namespace CalamityMod.World { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); @@ -925,6 +977,7 @@ namespace CalamityMod.World } } + //cleanup the perlin caves ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { @@ -952,6 +1005,7 @@ namespace CalamityMod.World } }); + //place extra tiles ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { @@ -1018,52 +1072,210 @@ namespace CalamityMod.World } } + //Very bottom of the biome (Clam Den) + public static void PlaceClamDen(int startPosX, int startPosY) + { + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(startPosX, startPosY); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.70f; + float otherAngle = MathHelper.PiOver2 - angle; + + int biomeSize = 80 + (Main.maxTilesX / 180); + float actualSize = biomeSize * 16f; + float constant = actualSize * 2f / (float)Math.Sin(angle); + + float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); + int verticalRadius = (int)(constant / 10f); + + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; + + //place the Clam Den caverns + for (int X = origin.X - biomeSize - 190; X <= origin.X + biomeSize + 190; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) + { + if (Y > origin.Y - 50) + { + //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + } + //place clean transition between the burrows and the other biomes + if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + else + { + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //place walls in the biome using a different "seed" so it differs from the cave generation + //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; + + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) + { + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + + //cleanup the perlin caves + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + } + } + }); + + + //place extra tiles + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + bool canPlaceSand = false; + + //place sand clumps on top of exposed navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 4, ModContent.TileType()); + } + } + } + }); + + //cleanup again + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); + } + } + } + } + //basalt biome underneath the sunken sea public static void PlaceBasaltGully(int startPosX, int startPosY) { - int biomeSize = 200 + (Main.maxTilesX / 180); - - int XLeft = GenVars.UndergroundDesertLocation.Left + 30; - int XRight = GenVars.UndergroundDesertLocation.Right - 30; - - //place circles of basalt along the 2 edges of the area - for (int Y = startPosY - 60; Y <= Main.maxTilesY - 230; Y += 20) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - int radius = WorldGen.genRand.Next(30, 45); - int RandomX = Main.rand.Next(-25, 25); - - WorldUtils.Gen(new Point(XLeft, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(XLeft, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - - WorldUtils.Gen(new Point(XRight, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(XRight, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - } + int biomeSize = 250 + (Main.maxTilesX / 180); + int XLeft = GenVars.UndergroundDesertLocation.Left + 40; + int XRight = GenVars.UndergroundDesertLocation.Right - 70; //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - ForLoop.Invoke(startPosX - biomeSize - 25, startPosX + biomeSize + 25, 1, (X) => + ForLoop.Invoke(startPosX - biomeSize - 60, startPosX + biomeSize + 60, 1, (X) => { - for (int Y = startPosY - 30; Y <= Main.maxTilesY - 200; Y++) + //const int totalCuveDepth = -120; + //const int totalCuveDepth2 = 120; + int basaltbordernoise = Main.rand.Next(180, 185); + int basaltbordernoisetop = Main.rand.Next(645, 650); + const int totalCuveDepth = -220; + const int totalCuveDepth2 = 90; + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 60, startPosX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 60, startPosX - biomeSize + 200, X, true))); + int curveDepthtop = (int)MathHelper.Lerp( + totalCuveDepth2, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 60, startPosX + biomeSize - 200, X, true))); + int curveDepth2top = (int)MathHelper.Lerp( + totalCuveDepth2, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 60, startPosX - biomeSize + 200, X, true))); + + for (int Y = startPosY - 650 + curveDepthtop + curveDepth2top; Y <= Main.maxTilesY - 185 + curveDepth + curveDepth2; Y++) { Main.tile[X, Y].ClearEverything(); WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); @@ -1071,31 +1283,10 @@ namespace CalamityMod.World } }); - //place another wall of circles along the bottom of the biome so it doesnt just end unnaturally - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 20, (X) => - { - int Y = Main.maxTilesY - 250; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - }); - //place caverns and lava for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startPosY; Y <= Main.maxTilesY - 190; Y++) { if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1195,6 +1386,7 @@ namespace CalamityMod.World } } + //place all the ambient tiles in the sunken sea public static void PlaceSunkenSeaAmbience() { @@ -1207,15 +1399,15 @@ namespace CalamityMod.World for (int Y = 20; Y <= Main.maxTilesY - 20; Y++) { //place coral blobs in the radiant reefs - if (WorldGen.genRand.NextBool(100) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || + if (WorldGen.genRand.NextBool(1000) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) { ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - + ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 4)), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); @@ -1225,7 +1417,27 @@ namespace CalamityMod.World new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Corals)) })); } + //Timeless Shores ambiant tiles + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(100)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(100)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } + } //gleaming burrows ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1274,8 +1486,32 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); } } - if (Main.tile[X, Y].TileType == ModContent.TileType()) + if (Main.tile[X, Y].TileType == ModContent.TileType()) { + //Medium Sea Prism down + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 7); + } + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 5); + } + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 4); + } + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 2); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { //stalactites if (WorldGen.genRand.NextBool(10)) { @@ -1289,6 +1525,7 @@ namespace CalamityMod.World { WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } + //stalagmites if (WorldGen.genRand.NextBool(12)) @@ -1320,11 +1557,168 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); } + if (WorldGen.genRand.NextBool(8)) + { + ushort[] NavystoneAmbients = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(NavystoneAmbients)); + } + } + //Polyp Forest Ambient tiles + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //BranchCoralsOnLimestone + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 7); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 1); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 5); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 4); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 2); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 6); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(50) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType(),(ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + //BranchCoralsOnSand + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 1); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 5); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 4); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 2); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 8); + } + if (WorldGen.genRand.NextBool(30)) + { + ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DigitateCorals)); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); + } + if (WorldGen.genRand.NextBool(8)) + { + ushort[] WideScarletSeagrasss = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(WideScarletSeagrasss)); + } + if (WorldGen.genRand.NextBool(8)) + { + ushort[] StalkCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(StalkCorals)); + } + if (WorldGen.genRand.NextBool(10)) + { + ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); + } + if (WorldGen.genRand.NextBool(10)) + { + ushort[] TallDigitateCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(TallDigitateCorals)); + } + + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(15)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } } //radiant reefs ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { + if (WorldGen.genRand.NextBool(100) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(7), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(15)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } //multi-colored corals if (WorldGen.genRand.NextBool(3)) { @@ -1365,14 +1759,23 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); } } + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + if (WorldGen.genRand.NextBool(1)) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } //grow depth vines on navystone if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) { - if (WorldGen.genRand.NextBool(7)) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } + // 18APR2025: Ozzatron: removed guaranteed RNG check here, since it was intended to be guaranteed + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1400,6 +1803,27 @@ namespace CalamityMod.World WorldGen.PlaceTile(X - 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); } } + // Pearl Autism + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(50) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + } } } } @@ -1450,6 +1874,7 @@ namespace CalamityMod.World ShapeData circle3 = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + GenAction blotchMod2 = new Modifiers.Blotches(1, 0.1); //first circle of navystone WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] @@ -1476,7 +1901,7 @@ namespace CalamityMod.World //clear out the middle of the circle WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 9), Actions.Chain(new GenAction[] { - blotchMod.Output(circle3) + blotchMod2.Output(circle3) })); WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle3), Actions.Chain(new GenAction[] { @@ -1502,6 +1927,12 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), }; void getAttachedPoints(int x, int y, List points) @@ -1545,6 +1976,7 @@ namespace CalamityMod.World }); } + //method to make sure things only generate in each biome circle public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false, bool collapseBottom = false) { diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 409cacaa03..2cb56c1145 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -4,7 +4,6 @@ using System.Linq; using CalamityMod.Items.Accessories; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; @@ -102,7 +101,7 @@ namespace CalamityMod.World do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.05f), (int)(Main.maxTilesX * 0.95f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.15f), (int)(Main.maxTilesY * 0.5f)); + int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface, (int)(Main.maxTilesY * 0.5f)); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0) / 2, TileMaps[mapKey].GetLength(1)); //Fooling the system into thinking the shrine is smaller than it actually is so it fits into chasms @@ -193,7 +192,7 @@ namespace CalamityMod.World do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.05f), (int)(Main.maxTilesX * 0.95f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.15f), (int)(Main.maxTilesY * 0.5f)); + int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface, (int)(Main.maxTilesY * 0.5f)); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -1010,7 +1009,7 @@ namespace CalamityMod.World { new ChestItem(ItemType(), 1), new ChestItem(dropType, 1), - new ChestItem(ItemType(), WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), new ChestItem(ItemType(), WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)),