diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 9cc73f84a1..0dd7b09f45 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -93,12 +93,12 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges = new List(); #region Desert Scourge - // 25% resist to true melee. + // 20% 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 +185,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 +213,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 +253,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 +300,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 diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 590cc74fcd..4a0c2f914f 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -50,6 +50,7 @@ #region Dashes and Dodges // Dash cooldowns (in frames) internal const int UniversalDashCooldown = 30; + internal const int UniversalSashDashCooldown = 23; internal const int UniversalShieldSlamCooldown = 30; internal const int UniversalShieldBonkCooldown = 30; internal const int OnShieldBonkCooldown = 30; 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/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1dbe674969..a634f65b31 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -300,6 +300,7 @@ 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; public int rOfResilienceCooldown = 0; public int rOfResilienceEffect = 0; @@ -312,7 +313,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; @@ -361,7 +362,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; @@ -736,6 +737,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; @@ -780,6 +785,9 @@ namespace CalamityMod.CalPlayer public bool eTalisman = false; /// Counter variable used for spawning Statis' Void Sash's scythes when dashing. public int statisTimer = 0; + public bool statisNinjaBelt = false; + public bool voidSashVisuals = true; + public bool statisVoidSash = false; public bool nucleogenesis = false; public bool nuclearFuelRod = false; public bool nebulousCore = false; @@ -799,9 +807,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; @@ -818,6 +828,9 @@ 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; @@ -886,7 +899,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; @@ -911,6 +924,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; @@ -925,7 +939,8 @@ namespace CalamityMod.CalPlayer 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; @@ -1007,7 +1022,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; @@ -1029,7 +1044,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. @@ -1044,7 +1059,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; @@ -1156,7 +1171,7 @@ 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. @@ -1395,7 +1410,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. @@ -2105,7 +2119,7 @@ namespace CalamityMod.CalPlayer omegaBlueChestplate = false; omegaBlueSet = false; - omegaBlueHentai = false; + omegaBlueAbyssalMadness = false; molluskHelmet = false; molluskChest = false; @@ -2143,6 +2157,10 @@ namespace CalamityMod.CalPlayer arcFlashRingVisual = false; bGlassBand = false; bGlassBandVisual = false; + aFossil = false; + aPowder = false; + fallingBlockProtection = false; + trapProtection = false; alluringBait = false; enchantedPearl = false; fishingStation = false; @@ -2163,11 +2181,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; @@ -2186,6 +2208,8 @@ namespace CalamityMod.CalPlayer eGauntlet = false; eGauntletVisuals = true; gloveLevel = 0; + statisNinjaBelt = false; + statisVoidSash = false; alreadyHasFrogLeg = false; eTalisman = false; nucleogenesis = false; @@ -2231,7 +2255,7 @@ namespace CalamityMod.CalPlayer shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; - Pauldron = false; + sPauldron = false; XykVisualsBlue = false; XykVisualsOrange = false; manaOverloader = false; @@ -2546,7 +2570,6 @@ namespace CalamityMod.CalPlayer aquaticStar = false; SP = false; dCreeper = false; - bClot = false; eAxe = false; endoCooper = false; apexShark = false; @@ -3279,7 +3302,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) @@ -4084,7 +4107,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; @@ -4103,7 +4126,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 @@ -4397,6 +4420,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) + @@ -4458,6 +4483,8 @@ namespace CalamityMod.CalPlayer ModDashMovement(); } #endregion + + Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it } #endregion 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 dcc2c5d56e..69f7664d61 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -814,7 +814,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. @@ -995,7 +995,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 @@ -1003,6 +1003,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) { @@ -1049,7 +1063,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. diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index d686181a32..4a0a14505e 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -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) @@ -428,6 +433,7 @@ namespace CalamityMod.CalPlayer // Count up total frames spent healing for slowdown. if (PurityHealSlowdownFrames < 900) ++PurityHealSlowdownFrames; + purityRegen += (60 / (float)healFrameCadence); } // If the defense should be ticking down to some lower value, do that. @@ -771,6 +777,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 64f5c79438..f7a91431c8 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -227,6 +227,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 +307,19 @@ namespace CalamityMod.CalPlayer { if (dashStart) { - Player.velocity.X *= 1.2f; + Player.velocity.X *= 3f; // +200% 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 +327,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) @@ -532,13 +485,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) { @@ -1270,9 +1227,6 @@ namespace CalamityMod.CalPlayer // Increase fall speed if (!Player.mount.Active) { - if (Player.IsUnderwater() && ironBoots) - Player.maxFallSpeed = 9f; - if (!Player.wet) { if (cirrusDress) @@ -1283,6 +1237,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; @@ -1403,7 +1366,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; @@ -1414,10 +1377,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; @@ -1726,6 +1689,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; @@ -1861,6 +1867,8 @@ namespace CalamityMod.CalPlayer if (arsenalCooldown > 0) arsenalCooldown--; + if (Main.zenithWorld) + arsenalCooldown = 0; if (killModeCooldown > 0) killModeCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) @@ -2109,8 +2117,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) @@ -3652,8 +3660,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) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 699a106462..0a0d1df195 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -774,9 +774,9 @@ namespace CalamityMod.CalPlayer } } } - 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); @@ -1256,12 +1256,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 diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs index a0253e7f77..ee1a612583 100644 --- a/CalPlayer/Dashes/StatisNinjaBeltDash.cs +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -1,8 +1,10 @@ -using CalamityMod.Enums; +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 { @@ -13,45 +15,45 @@ namespace CalamityMod.CalPlayer.Dashes public override bool IsOmnidirectional => false; public int Time = 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++) + for (int i = 0; i < 15; i++) { - 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); + 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..f9d18cc35d 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 @@ -16,29 +22,84 @@ 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 override float CalculateDashSpeed(Player player) => 25.4f; + public override float CalculateDashSpeed(Player player) => (75f * player.moveSpeed); public override void OnDashEffects(Player player) { + 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) + aimVel = Vector2.Lerp(aimVel, player.velocity, 0.2f); + + float fxFade = Utils.GetLerpValue(5, 15, Math.Abs(aimVel.X), true); + + 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) { - 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); + 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) + { + 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); + } } // Periodically release scythes. player.Calamity().statisTimer++; - if (Main.myPlayer == player.whoAmI && player.Calamity().statisTimer % 5 == 0) + if (Main.myPlayer == player.whoAmI && player.Calamity().statisTimer % 2 == 0 && false) { int scytheDamage = (int)player.GetBestClassDamage().ApplyTo(250); @@ -54,8 +115,7 @@ namespace CalamityMod.CalPlayer.Dashes } - // Dash at a faster speed than the default value. - dashSpeed = 14f; + player.velocity.X *= 0.912f; } } } diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index 029b50fe1b..9d364b2ec0 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -84,6 +84,8 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/GaussRifleGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value; else if (itemType == ModContent.ItemType()) 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/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 26ccaea36d..e1ebbd3f93 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -707,13 +707,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 } }, 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/ExtraTextures/BasicMess.png b/ExtraTextures/BasicMess.png new file mode 100644 index 0000000000..1e752bf91a Binary files /dev/null and b/ExtraTextures/BasicMess.png 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/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 8a366bd53a..e7af14fa61 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -177,7 +177,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; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 982f343ba2..8563814c11 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); 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..0a6598e7c6 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -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/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/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/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/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/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/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/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/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/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/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/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/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 603f41df6c..aa46204ec2 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Accessories; 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; @@ -543,15 +544,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; } diff --git a/Items/DraedonMisc/EncryptedSchematicHell.cs b/Items/DraedonMisc/EncryptedSchematicHell.cs index 73fc317a35..69f3014040 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/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index d0389e89e5..bc6eed8da8 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); diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 0969ede8cc..44285f5ab2 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -66,6 +66,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Dandy", "Dia", "dozezoze", + "Eddie Spaghetti", "enamoured", "ENNWAY", "Flowaria", @@ -73,7 +74,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "HaguriHat", "Heart Plus Up!", "Hugekraken", - "Lilac Olligoci", "LordMetarex", "Memes", "Mercutio 'Merkalto' Takle", @@ -85,6 +85,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "PokerFace", "Poroboros", "Raesh", + "Sagittariod", "Shade", "SharZz", "Shayy", @@ -146,6 +147,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "L0st", "Leon", "Leviathan", + "Lilac Olligoci", "Lompl Allimath", "Lucille Karma", "MarieArk", 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/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/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/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/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/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/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index ea4fe97f92..5988a7d135 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -5,6 +5,7 @@ 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; @@ -22,34 +23,62 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 112; - Item.height = 36; + Item.width = 70; + Item.height = 30; Item.DamageType = DamageClass.Ranged; - Item.damage = 150; - Item.knockBack = 30f; - Item.useAnimation = Item.useTime = 32; + Item.damage = 100; + Item.knockBack = 0.2f; + Item.useTime = Item.useAnimation = 10; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = CommonCalamitySounds.GaussWeaponFire; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/GaussFire") with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) }; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 27f; + Item.shootSpeed = 7f; modItem.UsesCharge = true; modItem.MaxCharge = 135f; - modItem.ChargePerUse = 0.1125f; + modItem.ChargePerUse = 0.0225f; } 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); + Projectile.NewProjectile(source, position + velocity * 6, velocity.RotatedByRandom(0.03f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); 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/GaussRifleGlow").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; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(70, 30); + Vector2 itemOrigin = new Vector2(-18, 6); + + 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; + if (animProgress < 0.4f) + rotation += -0.025f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.png b/Items/Weapons/DraedonsArsenal/GaussRifle.png index f1e885da7d..ac001b522d 100644 Binary files a/Items/Weapons/DraedonsArsenal/GaussRifle.png and b/Items/Weapons/DraedonsArsenal/GaussRifle.png differ diff --git a/Items/Weapons/DraedonsArsenal/GaussRifleGlow.png b/Items/Weapons/DraedonsArsenal/GaussRifleGlow.png new file mode 100644 index 0000000000..89cc2dc642 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/GaussRifleGlow.png 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..a2ae0bcf56 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 = 30; + Item.height = 62; Item.DamageType = DamageClass.Ranged; - Item.damage = 100; - Item.knockBack = 11f; - Item.useAnimation = Item.useTime = 33; + Item.damage = 57; + 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/Weapons/DraedonsArsenal/HolofiberImmolator.png b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.png new file mode 100644 index 0000000000..cda04308bb Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.png differ diff --git a/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png b/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png new file mode 100644 index 0000000000..b0ce820d9a Binary files /dev/null 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/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..e0a0bbacfb 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -42,16 +42,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/ScattershotSkewer.cs b/Items/Weapons/DraedonsArsenal/ScattershotSkewer.cs new file mode 100644 index 0000000000..6c3f6ac653 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/ScattershotSkewer.cs @@ -0,0 +1,86 @@ +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")] + public class ScattershotSkewer : 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 = 135; + 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/ScattershotSkewerGlow").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/ScattershotSkewer.png b/Items/Weapons/DraedonsArsenal/ScattershotSkewer.png new file mode 100644 index 0000000000..bd3c28d67f Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/ScattershotSkewer.png differ diff --git a/Items/Weapons/DraedonsArsenal/ScattershotSkewerGlow.png b/Items/Weapons/DraedonsArsenal/ScattershotSkewerGlow.png new file mode 100644 index 0000000000..dc1111d379 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/ScattershotSkewerGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index af84e0175b..2c598004ac 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -4,9 +4,12 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Sounds; +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 @@ -14,36 +17,108 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class Taser : 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 = 50; - Item.height = 26; - Item.damage = 16; + Item.width = 42; + Item.height = 24; 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.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; - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.05f; + 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 bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + 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(). diff --git a/Items/Weapons/DraedonsArsenal/Taser.png b/Items/Weapons/DraedonsArsenal/Taser.png index 16aeb51518..d493b95d2e 100644 Binary files a/Items/Weapons/DraedonsArsenal/Taser.png and b/Items/Weapons/DraedonsArsenal/Taser.png differ diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index 8853f072ea..857568aad3 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 30; - Item.height = 34; + Item.width = 58; + Item.height = 48; Item.damage = 16; Item.DamageType = RogueDamageClass.Instance; Item.useTime = 40; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.UsesCharge = true; modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.07f; + modItem.ChargePerUse = 0.05f; } 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/DraedonsArsenal/TrackingDisk.png b/Items/Weapons/DraedonsArsenal/TrackingDisk.png index 4ddea6ac7d..f56766fafb 100644 Binary files a/Items/Weapons/DraedonsArsenal/TrackingDisk.png and b/Items/Weapons/DraedonsArsenal/TrackingDisk.png 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/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index b641a22307..d1ca9b7beb 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, 6). 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/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/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/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/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/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/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/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 65e5339690..1c5a70b475 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 = 310; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; 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/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index e1aa81d309..8ac9e7131e 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public bool Trail = true; public int shotCount = 0; - public static int boomTime = 6; + public static int boomTime = 60; public override Color? TooltipExtensionColor => new Color(255, 140, 0); @@ -32,7 +32,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; @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.altFunctionUse == 2) { Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int) (damage * 0.7f), knockback, player.whoAmI); //.7x base damage Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); dust.noGravity = true; diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 2c5775d3a2..cb31b705a1 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 = 116; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 25; 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/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/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/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/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/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/SeashineSword.cs b/Items/Weapons/Summon/SeashineHilt.cs similarity index 98% rename from Items/Weapons/Summon/SeashineSword.cs rename to Items/Weapons/Summon/SeashineHilt.cs index 3425ef6d93..8168f5fff6 100644 --- a/Items/Weapons/Summon/SeashineSword.cs +++ b/Items/Weapons/Summon/SeashineHilt.cs @@ -13,7 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class SeashineSword : ModItem, ILocalizedModType + [LegacyName("SeashineSword")] + public class SeashineHilt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() diff --git a/Items/Weapons/Summon/SeashineSword.png b/Items/Weapons/Summon/SeashineHilt.png similarity index 100% rename from Items/Weapons/Summon/SeashineSword.png rename to Items/Weapons/Summon/SeashineHilt.png 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.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index df6bdae49d..814669c952 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 ''' } @@ -1000,7 +1006,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: { @@ -1030,8 +1042,9 @@ LeviathanAmbergris: { DisplayName: Leviathan Ambergris Tooltip: ''' - 20% increased dash velocity, and dash cooldown is 33% faster + 200% 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 ''' } @@ -1143,8 +1156,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 ''' } @@ -1358,16 +1372,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: { @@ -1375,6 +1395,7 @@ 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 ''' } @@ -1596,6 +1617,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 ''' } @@ -1671,12 +1693,10 @@ 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 ''' HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1685,13 +1705,11 @@ 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 ''' HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1935,7 +1953,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 ''' @@ -2007,7 +2025,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 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index f94a0fd15a..022993b838 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -307,7 +307,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: ''' @@ -359,8 +359,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 +383,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 +445,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: ''' @@ -481,7 +481,7 @@ SilvaLeggings: { Tooltip: ''' 10% increased movement speed - 12% increased damage and critical strike chance + 11% increased damage and critical strike chance ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 74cc606294..159ae929e0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -4198,3 +4198,28 @@ 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: "" +} 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..750f5d6e64 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -50,16 +50,25 @@ GaussPistol: { GaussRifle: { DisplayName: Gauss Rifle - Tooltip: Fires a devastating powerful high-velocity blast with absurd knockback -} - -HeavyLaserRifle: { - DisplayName: Heavy Laser Rifle 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.'] + A magnet powered energy rifle that fires piercing shots, creating magnetic implosions that pull in weak enemies on hit + Implosions only spawn on the first enemy hit by the beam + [c/1FFBFF:'Many soldiers underestimate the destructive capabilities of magnetism.] + [c/1FFBFF:This rifle has reliably pulled in skeptics of its crushing efficiency.'] + ''' +} + +HolofiberImmolator: { + DisplayName: Holofiber Immolator + Tooltip: + ''' + 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,15 +83,6 @@ 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 @@ -139,7 +139,12 @@ PulseDragon: { PulsePistol: { DisplayName: Pulse Pistol - Tooltip: Fires a pulse that arcs to a new target on enemy hits + 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: { @@ -164,6 +169,19 @@ PulseTurretRemote: { ''' } +ScattershotSkewer: { + DisplayName: Scattershot Skewer + 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.'] + ''' +} + SnakeEyes: { DisplayName: Snake Eyes Tooltip: @@ -199,8 +217,11 @@ 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 + 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} ''' } @@ -228,8 +249,10 @@ TrackingDisk: { 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 + 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 fire lasers at a faster rate and distance, can fire at multiple different targets, and lasers deal small amounts of damage ''' } 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 f221281fd1..fbba76be1c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -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 ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index e4025b826b..c7ac384dca 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -82,7 +82,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 +471,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 ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index fa60f07171..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,7 @@ 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 50e9c95edd..dff9c92674 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -669,8 +669,8 @@ ScabRipper: { Tooltip: Summons a baby blood crawler to protect you } -SeashineSword: { - DisplayName: Seashine Sword +SeashineHilt: { + DisplayName: Seashine Hilt Tooltip: ''' Summons a brilliant sea prism blade to slice your enemies diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index f77eb428b6..558e433089 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -189,7 +189,12 @@ 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 diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 9c5863d7c5..ca350858b2 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 diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 9e64da189d..0808ef37fd 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.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 953ee69725..2106b8f772 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -14,6 +14,9 @@ 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 @@ -28,6 +31,8 @@ PulsePistolShot.DisplayName: Pulse Bolt PulseRifleShot.DisplayName: Pulse Bolt PulseTurret.DisplayName: Pulse Turret PulseTurretShot.DisplayName: Pulse Bolt +ScattershotLance.DisplayName: Laser Lance +ScattershotLaser.DisplayName: Scattershot Laser SnakeEyesSummon.DisplayName: Snake Eyes SnakeEyesProjectile.DisplayName: Inescapable Bolt StarSwallowerAcid.DisplayName: Acid diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 403a7a04c0..f6af7b2cf0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -224,6 +224,7 @@ SuperradiantSawLingering.DisplayName: Ultraradiant Saw TauCannonBeam.DisplayName: Tau Cannon Beam TauCannonBolt.DisplayName: Tau Cannon Bolt TauCannonPortal.DisplayName: Tau Cannon Portal +TaserExplosion.DisplayName: Taser Explosion TelluricGlareArrow.DisplayName: Radiant Arrow TheMaelstromExplosion.DisplayName: Reaper Explosion TheMaelstromShark.DisplayName: Reaper Shark @@ -261,3 +262,4 @@ LeviatitanMeteor.DisplayName: Leviatitan Meteor LeviatitanExplosion.DisplayName: Leviatitan Explosion SulphuricDrop.DisplayName: Sulphuric Drop AcidRocket.DisplayName: Acid Rocket +TaserShot.DisplayName: Taser Shot diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index dc46a26af4..9934224d3d 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 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/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6021aa24d0..fa559206d5 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -338,6 +338,18 @@ 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; + /// /// 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 +386,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; @@ -2872,9 +2884,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: @@ -4048,7 +4060,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); @@ -5784,6 +5796,9 @@ namespace CalamityMod.NPCs if (veriumDoomTimer > 0) veriumDoomTimer--; + if (laserBurnTimer > 0) + laserBurnTimer--; + if (veriumDoomTimer == 0 && veriumDoomMarked) { for (int d = 0; d < 14 + veriumDoomStacks; d++) @@ -5817,6 +5832,41 @@ namespace CalamityMod.NPCs } } + if (laserBurnTimer <= 0 && 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)(6 + laserBurnStacks * 0.35f); d++) + { + float partScale = Main.rand.NextFloat(0.7f, 1f); + Vector2 partVel = (new Vector2(15, 15) * (laserBurnStacks * 0.025f)).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + for (int i = 0; i < 2; i++) + { + Particle sparks = new SparkParticle(npc.Center, partVel, false, 30, i == 0 ? partScale : partScale * 0.4f, i == 0 ? Color.Red : Color.White); + GeneralParticleHandler.SpawnParticle(sparks); + } + + Dust dust = Dust.NewDustPerfect(npc.Center, 278); + dust.velocity = (new Vector2(10, 10) * (laserBurnStacks * 0.05f)).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f) + new Vector2(0, -1); + dust.scale = Main.rand.NextFloat(0.8f, 1.1f); + dust.noGravity = false; + dust.color = Color.Red; + } + + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/LaserBurn") { Volume = 0.6f, PitchVariance = 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 if (pearlAura > 0) @@ -7337,6 +7387,23 @@ namespace CalamityMod.NPCs } } + 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)); + Particle markedParticle = new GlowOrbParticle(randPosition, Vector2.Zero, false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.45f) + (laserBurnStacks * 0.045f), Color.Red); + GeneralParticleHandler.SpawnParticle(markedParticle); + } + if (laserBurnType == 0) + { + Main.NewText("No Burn Type Set", Color.OrangeRed); + laserBurnMarked = false; + laserBurnTimer = 0; + } + } + if (voidfrost > 0) Voidfrost.DrawEffects(npc, ref drawColor); @@ -7438,7 +7505,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) @@ -7634,10 +7701,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++) @@ -8420,7 +8487,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]; @@ -8483,7 +8550,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); @@ -8576,7 +8643,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) { @@ -9793,5 +9860,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/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index ccf0720218..7971485fc8 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 = { diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index ebc7f6a7a6..f239be5713 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 ? 12 : phase3 ? 6 : phase2 ? 3 : 1; + float fireRate = phase4 ? 6f : phase3 ? 4f : 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); + 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); } } } @@ -262,12 +258,11 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (phase3) NPC.ai[1] += 2f; - if (NPC.justHit && masterMode) - NPC.ai[1] += 4f; 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 ? 30f : expertMode ? 60f : 120f; if (NPC.ai[1] >= idleTime) { NPC.TargetClosest(); @@ -288,6 +283,8 @@ namespace CalamityMod.NPCs.Crabulon walkingVelocity += 0.5f; if (phase3) walkingVelocity += 1f; + if (phase4) + walkingVelocity += 1.5f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) walkingVelocity *= 2f; @@ -367,9 +364,9 @@ namespace CalamityMod.NPCs.Crabulon { 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 +408,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); @@ -433,22 +432,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 +510,7 @@ namespace CalamityMod.NPCs.Crabulon } } } - else + else if (NPC.ai[0] == 3f) { if (NPC.velocity.Y == 0f) { @@ -505,7 +531,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 ? 32 : phase4 ? 18 : CalamityWorld.death ? (phase3 ? 12 : 20) : 16; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -528,7 +556,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 ? 20 : phase4 ? 10 : (phase3 && death) ? 6 : 10; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -611,7 +641,7 @@ namespace CalamityMod.NPCs.Crabulon float slowDownMultiplier = death ? 0.84f : expertMode ? 0.92f : 0.96f; NPC.velocity.X *= slowDownMultiplier; - float fallSpeedIncrease = death ? 0.24f : expertMode ? 0.12f : 0.06f; + float fallSpeedIncrease = phase4 ? 0.36f : death ? 0.24f : expertMode ? 0.12f : 0.06f; NPC.velocity.Y += fallSpeedIncrease; } else @@ -622,16 +652,171 @@ namespace CalamityMod.NPCs.Crabulon 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 ? 6f : 4f; + 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) + { + NPC.ai[1] += 1f; + if (NPC.ai[1] >= DelayBeforeBigJump) + { + if ((NPC.ai[1] == DelayBeforeBigJump || NPC.velocity.Y != 0f) && 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 -= 384f; + center.X += Math.Abs(player.Center.X - NPC.Center.X) * ((player.Center.X - NPC.Center.X > 0f) ? 1 : -1); + if (NPC.velocity.Y == 0f) + { + NPC.ai[2] = 1f; + NPC.ai[3] = NPC.Bottom.Y; + NPC.noTileCollide = true; + NPC.velocity = center - NPC.Center; + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero); + NPC.velocity *= bossRush ? 24f : death ? 21f : 18f; + NPC.netUpdate = true; + } + else + NPC.velocity.Y *= 0.95f; + } + else + { + float mushroomFireRate = death ? 20f : 10f; + if (NPC.ai[1] % mushroomFireRate == 0f) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float yVelocity = death ? 4f : 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); + } + } + + // 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.height) + { + SoundEngine.PlaySound(SlamSound, NPC.Center); + + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.noTileCollide = false; + NPC.netUpdate = true; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float xVelocity = death ? 2f : 1f; + int numProj = 5; + Vector2 initialVelocity = Vector2.UnitX * xVelocity; + Vector2 initialSpawnLocation = NPC.Center + 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 / 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 / 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); + } + } + } + } + } } } } @@ -733,7 +918,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[1] < (DelayBeforeBigJump - TelegraphTimeBeforeBigJump) && NPC.ai[0] == 4f && NPC.ai[2] == 0f))) // Idle just before jump { if (stomping) stomping = false; @@ -743,7 +928,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 +962,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,6 +991,7 @@ 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) { @@ -816,6 +1002,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 +1013,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/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 3b033e67f9..a784898e74 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -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) { diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 55f0ff65dd..d6cd2de839 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -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) { diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index e39685f9e3..bdcf8bfb0d 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -303,7 +303,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 +358,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 +509,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/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..f4f93d596d 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -125,6 +125,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; @@ -442,6 +445,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 +458,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; } } @@ -674,6 +683,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 +764,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/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index b34e664e92..e5cdfab281 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -442,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/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 51fbaba5ae..5d63ecff3b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -441,7 +441,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..edd68d41ba 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -121,6 +121,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 +265,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 +278,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 +583,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 +685,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 +976,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..f94c77c2ff 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -441,7 +441,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/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index d8dcab9b15..84308ac51a 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 choice = masterMode ? 1 : -1; do { choice++; @@ -372,18 +388,21 @@ namespace CalamityMod.NPCs.HiveMind case 1: type = NPCID.EaterofSouls; break; + case 2: type = NPCID.DevourerHead; break; + case 3: case 4: type = ModContent.NPCType(); break; + default: break; } } - while (NPC.AnyNPCs(type) && choice < 5); + while (NPC.CountNPCS(type) < 2 && choice < 5); if (choice < 5) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), type); @@ -845,13 +864,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 +947,24 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity = Vector2.Zero; dashStarted = false; - if (revenge && lifeRatio < 0.53f) + if (revenge && lifeRatio < 0.53f && 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 +990,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 +1041,7 @@ namespace CalamityMod.NPCs.HiveMind // Avoid cheap bullshit NPC.damage = 0; + performingLungeCombo = death; state = 6; phase2timer = 0; deceleration = NPC.velocity / decelerationTime; @@ -1065,7 +1091,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 +1130,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 +1149,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 +1158,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 +1173,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.ai[0] == 10f) { + performingRainDashCombo = death; state = 6; NPC.ai[0] = 0f; deceleration = NPC.velocity / decelerationTime; @@ -1166,8 +1193,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(); } 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/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 344b2dbdec..efb21cd705 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; 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/TownNPCs/Cirrus.cs b/NPCs/TownNPCs/Cirrus.cs index 4b0de8366a..f7a6fd143d 100644 --- a/NPCs/TownNPCs/Cirrus.cs +++ b/NPCs/TownNPCs/Cirrus.cs @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.TownNPCs public class Cirrus : ModNPC { public static Asset AltTexture; + public static Asset WorkoutTexture; public override void SetStaticDefaults() { @@ -65,6 +66,7 @@ namespace CalamityMod.NPCs.TownNPCs if (!Main.dedServ) { AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); + WorkoutTexture = ModContent.Request(Texture + "_Workout", AssetRequestMode.AsyncLoad); } } @@ -95,6 +97,13 @@ namespace CalamityMod.NPCs.TownNPCs 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 = WorkoutTexture.Height() / Main.npcFrameCount[Type]; + int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); if (NPC.velocity.Y == 0f) { @@ -711,6 +720,7 @@ namespace CalamityMod.NPCs.TownNPCs bool wifeIsAround = wife != -1; bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; bool beLessDrunk = wifeIsAround && worldIsSafer; + bool workoutOutfit = Main.dayTime && beLessDrunk; if (Main.bloodMoon) { @@ -750,7 +760,8 @@ namespace CalamityMod.NPCs.TownNPCs if (ChildSafety.Disabled) dialogue.Add(this.GetLocalization("Chat.Normal4Alt").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); + if (workoutOutfit) + dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); } int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); @@ -924,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/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/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/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..a246c16b25 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.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; // Causes it to split far more in death mode @@ -70,17 +69,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 +92,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); @@ -123,7 +122,7 @@ 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); + calamityGlobalNPC.newAI[0] += ((npc.justHit && death && calamityGlobalNPC.newAI[0] < 30f) ? 10f : 1f); else calamityGlobalNPC.newAI[0] -= 1f; @@ -190,10 +189,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 +344,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; @@ -401,7 +396,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses segmentAcceleration += 0.04f * (enrageScale + 1f); } - if (masterMode) + if (death) { segmentVelocity += (npc.justHit ? 8f : 2f); segmentAcceleration += (npc.justHit ? 0.16f : 0.04f); @@ -472,7 +467,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) 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..65dc62059c 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; @@ -205,7 +204,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int phase; int maxRandom = phase4 ? 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; @@ -221,13 +220,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 +247,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 +273,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 +316,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 +389,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 +399,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 +410,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 +430,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 +491,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 +531,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 +544,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 +567,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 +620,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 +678,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 +705,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 +729,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 +764,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 +818,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 +852,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 +860,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 +897,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; 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/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/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/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/Projectiles/Boss/MushBombGround.cs b/Projectiles/Boss/MushBombGround.cs new file mode 100644 index 0000000000..39b4588c9d --- /dev/null +++ b/Projectiles/Boss/MushBombGround.cs @@ -0,0 +1,115 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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; + + 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.05f; + float xVelocityLimit = BossRushEvent.BossRushActive ? 24f : 12f; + if (Math.Abs(Projectile.velocity.X) < xVelocityLimit) + { + Projectile.velocity.X *= xVelocityMultiplier; + if (Math.Abs(Projectile.velocity.X) > xVelocityLimit) + Projectile.velocity.X = xVelocityLimit; + } + } + + 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 = Terraria.GameContent.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); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D texture = Terraria.GameContent.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 Microsoft.Xna.Framework.Rectangle?(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++) + { + int shroomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 1.5f); + 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 < 12; j++) + { + int shroomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); + 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/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..707183fea6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -203,7 +203,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 +526,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 +1246,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; @@ -4218,6 +4218,26 @@ namespace CalamityMod.Projectiles } #endregion + #region On Hit NPC + public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) + { + // 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 3f29fce51a..f443bd8369 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. @@ -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.InfluxWaver, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2)) }, + { ProjectileID.IchorBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { 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,319 @@ namespace CalamityMod.Projectiles { ProjectileID.ThornBall, Do(Main.zenithWorld ? IgnoreWater : DontIgnoreWater, DefenseDamage) }, // Plantera bouncing thorn balls { ProjectileID.UnholyTridentHostile, defenseDamage }, #endregion + + #region CATEGORY 6: Static Iframe 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.BoneJavelin, 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.CombatWrench, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes + {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.Daybreak, 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.MechanicWrench, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes + {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.StardustCellMinionShot, 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 +785,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/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs index c45efa1f29..cc03f8632e 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -1,8 +1,6 @@ -using System; -using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal @@ -11,59 +9,97 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { 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.width = Projectile.height = 20; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 0; + Projectile.penetrate = -1; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } - public override void AI() { - Time++; - Projectile.tileCollide = Time > 3f; - if (!Main.dedServ) + if (Projectile.timeLeft == 600) { - // Idle dust. - for (int i = 0; i < 10; i++) + for (int i = 0; i < 3; 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; + Particle Square = new GlowSquareParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(1f, 3f), false, 15, Main.rand.NextFloat(0.5f, 1.2f), Color.Goldenrod, false, Main.rand.NextFloat(-3, 3)); + GeneralParticleHandler.SpawnParticle(Square); } } + if (Projectile.extraUpdates < 30 && Projectile.timeLeft % 3 == 0) + Projectile.extraUpdates++; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.timeLeft % 2 == 0 && targetDist < 1400 && Projectile.timeLeft <= 585) + { + float cLerp = Utils.GetLerpValue(500, 600, Projectile.timeLeft); + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.08f, Color.Lerp(Color.Gold, Color.Goldenrod, cLerp), new Vector2(0.3f, 1), true, true); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(7)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 267); + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod; + } + if (Projectile.timeLeft == 600) + { + Particle pulse = new GlowSparkParticle(Projectile.Center, Projectile.velocity * 3, false, 8, 0.042f, Color.Goldenrod, new Vector2(1.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + 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), Color.Goldenrod * 0.9f, new Vector2(1, 0.5f), true); + GeneralParticleHandler.SpawnParticle(spark); + + if (Projectile.numHits == 0) + { + Particle bolt2 = new CustomPulse(target.Center, Vector2.Zero, Color.Gold * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 1.4f, 0, 23); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomPulse(target.Center, Vector2.Zero, Color.Gold * 0.35f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 1.6f, 0, 18); + GeneralParticleHandler.SpawnParticle(bolt3); + + for (int i = 0; i < 8; i++) + { + Vector2 dustVel = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(3f, 7f); + Dust dust = Dust.NewDustPerfect(target.Center + dustVel * 5, 267, -dustVel * 0.5f, 0, default, Main.rand.NextFloat(0.5f, 1f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod; + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, 0, Projectile.owner); + } + for (int i = 0; i < MathHelper.Clamp(5 - Projectile.numHits, 1, 5); i++) + { + Particle Square = new GlowSquareParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(1f, 3f), false, 18, Main.rand.NextFloat(0.8f, 1.8f), Color.Goldenrod, false, Main.rand.NextFloat(-3, 3)); + GeneralParticleHandler.SpawnParticle(Square); + } + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.84f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnKill(int timeLeft) { - if (Main.myPlayer == Projectile.owner) + for (int i = 0; i < 5; i++) { - SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66); + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust.velocity = Projectile.velocity.RotateRandom(0.3f) * Main.rand.NextFloat(1, 3); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.LightYellow : Color.Gold; + dust.noLight = true; } } } diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs index 4b65478c95..86d085f658 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -9,41 +10,37 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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.width = Projectile.height = 200; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; + Projectile.timeLeft = 12; Projectile.penetrate = -1; - Projectile.timeLeft = 20; + Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Time++; - if (!Main.dedServ) + for (int i = 0; i < Main.maxNPCs; i++) { - for (int i = 0; i < 50; i++) + NPC target = Main.npc[i]; + if (target.CanBeMoved(true) && target.CanBeChasedBy(Projectile, false)) { - 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; + if (target != null && !CalamityPlayer.areThereAnyDamnBosses) + { + if (Vector2.Distance(target.Center, Projectile.Center) > 5 && Vector2.Distance(target.Center, Projectile.Center) < 500) + { + target.velocity += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.4f; + target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.8f; + } + } } } } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } 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..cd48e5136c --- /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 = -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); + 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/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/ScattershotLance.cs b/Projectiles/DraedonsArsenal/ScattershotLance.cs new file mode 100644 index 0000000000..9523bc49e5 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ScattershotLance.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 ScattershotLance : 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/ScattershotLaser.cs b/Projectiles/DraedonsArsenal/ScattershotLaser.cs new file mode 100644 index 0000000000..3664b2675f --- /dev/null +++ b/Projectiles/DraedonsArsenal/ScattershotLaser.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 ScattershotLaser : 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/ScattershotSkewerHoldout.cs b/Projectiles/DraedonsArsenal/ScattershotSkewerHoldout.cs new file mode 100644 index 0000000000..ce3fa169f3 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ScattershotSkewerHoldout.cs @@ -0,0 +1,359 @@ +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 ScattershotSkewerHoldout : 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/ScattershotChargeLoop"); + ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); + } + if ((!soundPlaying || !audio.IsPlaying) && startChargeLoop) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotCharge"); + StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center); + startChargeLoop = false; + } + if (chargeTimer == chargeRate) // Reached max charge + { + SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeMax"); + 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 * (50 + (didDash ? 10 : 0))); // Seems high but its on a cooldown and is a melee attack so might be okay + 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/ScattershotChargeShoot"); + 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/ScattershotShoot"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + // Holdout velocity weirdly can be a bit finnicky here. apparently. + Vector2 shootVelocity = Projectile.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.UnitY) * 6f; + for (int i = 0; i < 6; i++) + { + float offset = MathHelper.ToRadians(MathHelper.Lerp(-5f, 5f, i / 5f)); + float timeFactor = MathHelper.Lerp(1.0875f, 0.65f, MathF.Abs(2.5f - i) / 2.5f); + Vector2 spreadVelocity = shootVelocity.RotatedBy(offset) * (i % 3 == 1 ? 0.8f : MathF.Abs(2.5f - i) > 2f ? 0.9f : 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 2, spreadVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, timeFactor); + } + + 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/ScattershotSkewer").Value; + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/ScattershotSkewerGlow").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/TaserExplosion.cs b/Projectiles/DraedonsArsenal/TaserExplosion.cs new file mode 100644 index 0000000000..6eeabc511c --- /dev/null +++ b/Projectiles/DraedonsArsenal/TaserExplosion.cs @@ -0,0 +1,51 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class TaserExplosion : 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/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index fc876533ee..4caa43adb9 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -1,8 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using Terraria; -using Terraria.ID; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal @@ -10,6 +14,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public class TaserHook : 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, @@ -35,51 +42,117 @@ namespace CalamityMod.Projectiles.DraedonsArsenal set => Projectile.localAI[0] = value; } - public const float ReelbackSpeed = 25f; + public const float ReelbackSpeed = 40f; + public Color hookColor = Color.SlateGray; + public SlotId Hum { get; set; } public override void SetDefaults() { Projectile.width = 14; - Projectile.height = 14; + Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = 2; - Projectile.tileCollide = true; + Projectile.extraUpdates = 8; + Projectile.tileCollide = false; Projectile.ownerHitCheck = true; Projectile.DamageType = DamageClass.Ranged; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 15; + Projectile.ArmorPenetration = 10; } public override void AI() { - Time++; + 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: - float distanceFromPlayer = Projectile.Distance(player.Center); - if (distanceFromPlayer > 600f || Time >= 90f) + if (distanceFromPlayer > 800f || 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) + 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; } - - Projectile.Center = Main.npc[ElectrocutionTarget].Center; + 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.velocity = Projectile.SafeDirectionTo(player.Center) * ReelbackSpeed; + Projectile.extraUpdates = 8; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(player.Center) * (ReelbackSpeed / Projectile.extraUpdates), 0.02f); break; } @@ -111,37 +184,59 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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); + 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 < 50; i++) + for (int i = 0; i < 30; 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; + 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); diff --git a/Projectiles/DraedonsArsenal/TaserHook.png b/Projectiles/DraedonsArsenal/TaserHook.png index 1efdfb0ad7..9dd6e3ffc9 100644 Binary files a/Projectiles/DraedonsArsenal/TaserHook.png and b/Projectiles/DraedonsArsenal/TaserHook.png differ diff --git a/Projectiles/DraedonsArsenal/TaserShot.cs b/Projectiles/DraedonsArsenal/TaserShot.cs new file mode 100644 index 0000000000..90181fcf62 --- /dev/null +++ b/Projectiles/DraedonsArsenal/TaserShot.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 TaserShot : 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/TrackingDiskLaser.cs b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs index 7e42868aea..bbd94f55ac 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs @@ -1,5 +1,7 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal @@ -14,8 +16,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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; @@ -31,30 +31,68 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); - + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); Time++; - if (Time >= 10f) + if (Time == 1) { - for (int i = 0; i < 2; i++) + for (int i = 0; i < 7; 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 dust = Dust.NewDustPerfect(Projectile.Center, 267); + dust.velocity = (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1f); + dust.scale = Main.rand.NextFloat(0.6f, 0.8f); dust.noGravity = true; + dust.color = Color.Red; + } + } + if (Time >= 15f) + { + if (Projectile.timeLeft % 11 == 0 && targetDist < 1400) + { + Particle spark = new LineParticle(Projectile.Center - Projectile.velocity * 10, -Projectile.velocity * 0.01f, false, 4, 1.5f * Projectile.scale, Color.Red); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft % 2 == 0 && targetDist < 1400) + { + Particle spark2 = new LineParticle(Projectile.Center - Projectile.velocity * 10, -Projectile.velocity * 0.01f, false, 4, 0.35f * Projectile.scale, Color.White); + GeneralParticleHandler.SpawnParticle(spark2); } } } + 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++; + + if (Projectile.scale == 1) + { + Projectile.damage = 1; + modifiers.HideCombatText(); + } + else + modifiers.SourceDamage *= 0.15f; + } public override void OnKill(int timeLeft) { - Projectile.ExpandHitboxBy(60); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); + 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; + } } } } diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index 5bb2ae7fd9..f9d518e7c2 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -2,6 +2,8 @@ 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; @@ -12,6 +14,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/TrackingDisk"; + public NPC extraShotTarget; public bool ReturningToPlayer { @@ -25,40 +28,47 @@ 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 = 15; + 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 = 58; + Projectile.height = 48; 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.Red.ToVector3() * 0.4f); Player player = Main.player[Projectile.owner]; Time++; + + if (Time == 5) + Projectile.tileCollide = true; + if (!ReturningToPlayer) { - if (Time >= 45f) + if (Time >= 55f) { ReturningToPlayer = true; Projectile.tileCollide = false; @@ -72,13 +82,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 +97,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 +120,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (targetCount >= MaxLaserCountPerShot) break; - Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, - Projectile.SafeDirectionTo(target.Center) * 4f, + Vector2 spawnLocation = Projectile.Center + new Vector2(25, 0).RotatedBy(Projectile.rotation * Utils.GetLerpValue(300, 30, Time, true)); + Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnLocation, + (spawnLocation - target.Center).SafeNormalize(Vector2.UnitX) * -3f, ModContent.ProjectileType(), - (int)(damage * 0.6f), + (int)(damage), Projectile.knockBack, Projectile.owner, 1f); laser.scale *= 1.6f; 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(), spawnLocation, + (spawnLocation - extraShotTarget.Center).SafeNormalize(Vector2.UnitX) * -3f, + ModContent.ProjectileType(), + (int)(damage), + Projectile.knockBack, + Projectile.owner, + 1f); } } else @@ -122,7 +150,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(), spawnLocation, (spawnLocation - potentialTarget.Center).SafeNormalize(Vector2.UnitX) * -3f, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner); } } } @@ -141,7 +170,21 @@ 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 rotationPoint = texture.Size() * 0.5f; + 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); + // Glow Orb + Main.EntitySpriteDraw(rechargeTexture, drawPosition, null, Color.Red with { A = 0 } * 0.65f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.4f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, drawPosition, null, Color.White with { A = 0 } * 0.35f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.2f, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(texture.Value, drawPosition, null, lightColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; } } 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/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..75a229df18 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -31,6 +31,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/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/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..6c8a87d6fe 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Projectiles.Magic { 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 +29,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/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/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/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/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/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/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index cc1d8ddeb6..a07c9598a1 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -25,6 +25,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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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..355ee730d8 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -50,7 +50,7 @@ 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; + Projectile.damage *= (int) 5.5; FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); 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/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/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/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/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index cd6fc21372..d10b880aa1 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -235,7 +235,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/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/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/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/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/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/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 6d6bd45d06..c048eb3b75 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -24,6 +24,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/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/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 836b7d10e8..a2989bbd16 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -243,7 +243,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/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/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/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/WhitewaterProj.cs b/Projectiles/Rogue/WhitewaterProj.cs index 1bc378ec2d..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.2f), 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/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/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 index a138121bc1..3e5862a8e1 100644 --- a/Projectiles/Summon/SeashineSwordProj.cs +++ b/Projectiles/Summon/SeashineSwordProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon 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) + 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; 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/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/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/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/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/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 3bb6f28ae9..ef4a20ab8e 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Projectiles.Typeless 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 +44,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 +62,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 +71,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 +82,7 @@ namespace CalamityMod.Projectiles.Typeless { distance /= 8f; } + if (range > 120f) //switch to fast return mode { Projectile.ai[0] = -1f; @@ -94,7 +95,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 +111,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 +119,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 +135,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 +151,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 +169,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 +183,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 +197,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/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/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/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/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/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/GaussFire.ogg b/Sounds/Item/GaussFire.ogg new file mode 100644 index 0000000000..00a153e283 Binary files /dev/null and b/Sounds/Item/GaussFire.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..4bb07b3d93 Binary files /dev/null and b/Sounds/Item/LaserBurn.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/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/ScattershotCharge.ogg b/Sounds/Item/ScattershotCharge.ogg new file mode 100644 index 0000000000..dba7b23381 Binary files /dev/null and b/Sounds/Item/ScattershotCharge.ogg differ diff --git a/Sounds/Item/ScattershotChargeLoop.ogg b/Sounds/Item/ScattershotChargeLoop.ogg new file mode 100644 index 0000000000..873f8d3dce Binary files /dev/null and b/Sounds/Item/ScattershotChargeLoop.ogg differ diff --git a/Sounds/Item/ScattershotChargeMax.ogg b/Sounds/Item/ScattershotChargeMax.ogg new file mode 100644 index 0000000000..b04d83e262 Binary files /dev/null and b/Sounds/Item/ScattershotChargeMax.ogg differ diff --git a/Sounds/Item/ScattershotChargeShoot.ogg b/Sounds/Item/ScattershotChargeShoot.ogg new file mode 100644 index 0000000000..09e40f39d2 Binary files /dev/null and b/Sounds/Item/ScattershotChargeShoot.ogg differ diff --git a/Sounds/Item/ScattershotShoot.ogg b/Sounds/Item/ScattershotShoot.ogg new file mode 100644 index 0000000000..a827d96e41 Binary files /dev/null and b/Sounds/Item/ScattershotShoot.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/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/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/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs new file mode 100644 index 0000000000..347f591e44 --- /dev/null +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumEnergyBarrier.cs @@ -0,0 +1,87 @@ +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; + MinPick = 55; + } + + 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/WulfrumEnergyBarrier.cs b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.cs new file mode 100644 index 0000000000..872f025b5c --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumEnergyBarrier.cs @@ -0,0 +1,87 @@ +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; + MinPick = 55; + } + + 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..3ac385ca08 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumPanels.cs @@ -0,0 +1,38 @@ +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); + + 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) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumPanels.png b/Tiles/FurnitureWulfrum/WulfrumPanels.png new file mode 100644 index 0000000000..9f68bf6a08 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPanels.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.cs b/Tiles/FurnitureWulfrum/WulfrumPlating.cs index 6132c842d2..f9b1c6972e 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPlating.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPlating.cs @@ -19,8 +19,10 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { 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)); 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/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/TileUtils.cs b/Utilities/TileUtils.cs index 64ca80e336..56e3eb250a 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; @@ -646,6 +647,9 @@ namespace CalamityMod SetMerge(type, TileType()); SetMerge(type, TileType()); SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); } /// 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/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