diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 17046163cc..1db3befd52 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -341,6 +341,9 @@ namespace CalamityMod.Balancing // 35% resist to Venusian Trident's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); + // 25% resist to Corinth Prime's Grenades. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 909a5b35e7..42fa3d16a1 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -488,6 +488,7 @@ namespace CalamityMod.CalPlayer public bool unstableGraniteCore = false; public bool regenator = false; public bool theBee = false; + public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; public bool alluringBait = false; public bool enchantedPearl = false; @@ -511,6 +512,7 @@ namespace CalamityMod.CalPlayer public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; public bool ascendantTrail = false; + public bool frozenWingsCold = false; public bool magmaStoneVisuals = true; public bool eGauntlet = false; public bool eGauntletVisuals = true; // Used to control dust spawned when swinging @@ -1738,6 +1740,7 @@ namespace CalamityMod.CalPlayer cryogenSoul = false; ascendantInsignia = false; ascendantTrail = false; + frozenWingsCold = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index b511891b08..fddbf4e15d 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -839,7 +839,7 @@ namespace CalamityMod.CalPlayer if (theBee && theBeeCooldown <= 0 && lifeAndShieldCondition) { contactDamageReduction += 0.5; - theBeeCooldown = 600; + shouldTriggerBeeCooldown = true; } // Apply Adrenaline DR if available @@ -1078,7 +1078,7 @@ namespace CalamityMod.CalPlayer if (theBee && theBeeCooldown <= 0 && lifeAndShieldCondition) { projectileDamageReduction += 0.5; - theBeeCooldown = 600; + shouldTriggerBeeCooldown = true; } // Apply Adrenaline DR if available @@ -1176,6 +1176,14 @@ namespace CalamityMod.CalPlayer if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID) && hurtInfo.Damage > 0) Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, "default"); + // Same thing with The Bee + if (theBee && shouldTriggerBeeCooldown) + { + shouldTriggerBeeCooldown = false; + if (hurtInfo.Damage > 0) + theBeeCooldown = TheBee.CooldownLength; + } + if (NPC.AnyNPCs(ModContent.NPCType())) Player.AddBuff(ModContent.BuffType(), 15, true); @@ -1299,6 +1307,14 @@ namespace CalamityMod.CalPlayer } } + // Apply The Bee cooldown, must be applied here so that it does not apply on dodges + if (theBee && shouldTriggerBeeCooldown) + { + shouldTriggerBeeCooldown = false; + if (hurtInfo.Damage > 0) + theBeeCooldown = TheBee.CooldownLength; + } + if (proj.hostile && hurtInfo.Damage > 0) { if (proj.type == ProjectileID.TorchGod) @@ -2515,10 +2531,6 @@ namespace CalamityMod.CalPlayer if (hurtInfo.Damage > 0) { SoundEngine.PlaySound(SoundID.Item93, Player.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; // Start with base damage, then apply the best damage class you can int sDamage = 6; @@ -2529,32 +2541,17 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - for (int i = 0; i < (transformer ? 5 : 4); i++) + float sparkCount = transformer ? 10f : 8f; + for (float i = 0f; i < sparkCount; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spark1 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI, 0f, 0f); - int spark2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI, 0f, 0f); - if (spark1.WithinBounds(Main.maxProjectiles)) + Vector2 velocity = (MathHelper.TwoPi * i / sparkCount).ToRotationVector2() * 5f; + Projectile spark = Projectile.NewProjectileDirect(source, Player.Center, velocity, ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI); + spark.timeLeft = 120; + if (transformer) { - Main.projectile[spark1].timeLeft = 120; - Main.projectile[spark1].DamageType = DamageClass.Generic; - if (transformer) - { - Main.projectile[spark1].timeLeft = 240; - Main.projectile[spark1].extraUpdates = 1; - Main.projectile[spark1].penetrate = 10; - } - } - if (spark2.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark2].timeLeft = 120; - Main.projectile[spark2].DamageType = DamageClass.Generic; - if (transformer) - { - Main.projectile[spark2].timeLeft = 240; - Main.projectile[spark2].extraUpdates = 1; - Main.projectile[spark2].penetrate = 10; - } + spark.timeLeft = 240; + spark.extraUpdates = 1; + spark.penetrate = 10; } } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ba743f5ccc..0e083e7e7b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3327,13 +3327,9 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(10)) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); - if (spark.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark].DamageType = DamageClass.Generic; - Main.projectile[spark].localNPCHitCooldown = -2; - Main.projectile[spark].penetrate = 5; - } + Projectile spark = Projectile.NewProjectileDirect(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); + spark.localNPCHitCooldown = -2; + spark.timeLeft = 30; } } } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index a00e5a4ff0..c8dae6d018 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -71,6 +71,7 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; + target.Calamity().IncreasedColdEffects_FrozenWings = frozenWingsCold; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; target.Calamity().IncreasedElectricityEffects_Transformer = transformer; @@ -212,6 +213,7 @@ namespace CalamityMod.CalPlayer witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); cgn.IncreasedColdEffects_EskimoSet = eskimoSet; + cgn.IncreasedColdEffects_FrozenWings = frozenWingsCold; cgn.IncreasedColdEffects_CryoStone = CryoStone; cgn.IncreasedElectricityEffects_Transformer = transformer; diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index e42faa21c3..030506fa76 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public bool HasFlavorTooltip => true; + public Color? TooltipExtensionColor => new(195, 223, 255); public override void SetStaticDefaults() { diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index c9c6108f35..549733c0b9 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories public class ElysianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; - + public bool HasFlavorTooltip => true; public Color? TooltipExtensionColor => new(195, 223, 255); public const int ShieldSlamDamage = 500; diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index 8d9aac1e0c..71dd921abe 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Items.Accessories { public class TheBee : ModItem, ILocalizedModType { + public static int CooldownLength = 600; public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 52e8fc8117..47319bfbf7 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -20,6 +20,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; @@ -1417,10 +1418,9 @@ namespace CalamityMod.Items player.noFallDmg = true; if (player.head == ArmorIDs.Head.FrostHelmet && player.body == ArmorIDs.Body.FrostBreastplate && player.legs == ArmorIDs.Legs.FrostLeggings) { - player.GetDamage() += 0.02f; - player.GetDamage() += 0.02f; - player.GetCritChance() += 1; - player.GetCritChance() += 1; + player.GetDamage() += 0.04f; + player.GetDamage() += 0.04f; + player.Calamity().frozenWingsCold = true; } } else if (item.type == ItemID.FlameWings) // Bonus to melee stats @@ -1766,10 +1766,19 @@ namespace CalamityMod.Items #endregion #region On Create + private static int cachedForgeID = -1; public override void OnCreated(Item item, ItemCreationContext context) { // ChoosePrefix also happens on craft so go reset it here too storedPrefix = -1; + + // 05JUL2024: Ozzatron: Register the usage of Draedon's Forge for the purposes of his dialogue. + // This was moved out of an On edit in the DraedonsForge item for Magic Storage compatibility. + Player p = Main.LocalPlayer; + if (cachedForgeID < 0) + cachedForgeID = ModContent.TileType(); + if (context is RecipeItemCreationContext && p.adjTile[cachedForgeID]) + p.Calamity().HasCraftedDraedonsForge = true; } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index f444e8be4c..0c4058647f 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -1301,9 +1301,8 @@ namespace CalamityMod.Items AddWingStats(7.5f, 1f, 1, 160, "5% increased melee damage and critical strike chance"); if (item.type == ItemID.FrozenWings) - AddWingStats(6.75f, 1f, 1, 130, "2% increased melee and ranged damage\n" + - "and 1% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor"); + AddWingStats(6.75f, 1f, 1, 130, "4% increased melee and ranged damage\n" + + "and multiplies all cold debuff damage by 1.25x while wearing Frost armor"); if (item.type == ItemID.GhostWings) AddWingStats(7.5f, 1f, 1, 170, "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 60d8f1eb10..229205fecf 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -9,20 +9,6 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public class DraedonsForge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Terraria.On_Recipe.ConsumeForCraft += DraeforgeUnlockDetour; - } - - private static bool DraeforgeUnlockDetour(On_Recipe.orig_ConsumeForCraft orig, Recipe self, Item item, Item requiredItem, ref int stackRequired) - { - if (self.HasTile(ModContent.TileType())) - { - Main.LocalPlayer.Calamity().HasCraftedDraedonsForge = true; - } - return orig(self, item, requiredItem, ref stackRequired); - } - public override void SetDefaults() { Item.width = 58; diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index a0f4c67292..06a09a61b2 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -31,10 +31,9 @@ namespace CalamityMod.Items.Potions.Alcohol Item.value = Item.sellPrice(silver: 30); } - public override bool? UseItem(Player player) + public override void GetHealLife(Player player, bool quickHeal, ref int healValue) { - Item.healLife = player.Calamity().baguette ? 250 : 200; - return null; + healValue = player.Calamity().baguette ? 250 : 200; } public override void OnConsumeItem(Player player) diff --git a/Items/Weapons/Melee/HolyCollider.png b/Items/Weapons/Melee/HolyCollider.png index 713bd1e425..44fc67fa01 100644 Binary files a/Items/Weapons/Melee/HolyCollider.png and b/Items/Weapons/Melee/HolyCollider.png differ diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index 745e017d1c..236639769c 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -10,8 +10,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class TheSevensStriker : ModItem, ILocalizedModType + public class TheSevensStriker : ModItem, ILocalizedModType, IHoldShiftTooltipItem { + public bool ShowExtensionIndicator => false; public new string LocalizationCategory => "Items.Weapons.Ranged"; public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f }; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index bd9fd2d3e7..4fda6ed14d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -689,13 +689,13 @@ ElysianAegis: { Allows the ability to dash, empowered by holy fire This dash can ram through enemies without taking damage Grants immunity to knockback, fire blocks, as well as multiple debuffs - Blessed by the Profaned Flame ''' HoldShiftTooltip: ''' On Fire!, Hellfire, Cursed Inferno, Shadowflame, Daybroken, Holy Flames, Brimstone Flames, Burning ''' + FlavorTooltip: "'Blessed by the Profaned Flame'" } EnchantedPearl: { @@ -1199,8 +1199,8 @@ OldDukeScales: { [c/c3dfff: Stamina will gradually restore after not dashing for 1 second] [c/c3dfff: Stamina recovers faster when you are stationary] [c/c3dfff: If your stamina reaches 0%, you become exhausted] - [c/CE0E18: While exhausted, this item's damage reduction and movement bonuses are negated] - [c/CE0E18: Being exhausted reduces movement speed by 30% and dash velocity by 50%] + [c/e3545c: While exhausted, this item's damage reduction and movement bonuses are negated] + [c/e3545c: Being exhausted reduces movement speed by 30% and dash velocity by 50%] [c/c3dfff: This debuff lasts until your stamina reaches 100% again] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 40446e5cd3..1eb75ba619 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1339,6 +1339,7 @@ TheSevensStriker: { 'A gun given to a great gunslinger Forged by the arms of a man given no name' ''' + HoldShiftTooltip: "[c/ADD8E6:'LET'S GO GAMBLING!']" } TheStorm: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index d357ccd042..d51e5d1554 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -90,7 +90,7 @@ BrittleStarStaff: { Summons a small brittle starfish that will dash through enemies until it shatters Starfish will quickly regenerate after shattering Holding right click will swap starfish between dashing and circling you - When the starfish are circling, each one provides you with 3 defense + When the starfish are circling, each one provides you with 4 defense ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index cf339d0bda..435f7da56d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -107,7 +107,6 @@ EonBolt.DisplayName: Eon Bolt EssenceFlame2.DisplayName: Essence Flame EssenceScythe.DisplayName: Essence Scythe EutrophicScimitarProj.DisplayName: Scimitar Zap -EutrophicSpark.DisplayName: Eutrophic Spark ExcelsusBlue.DisplayName: Excelsus ExcelsusMain.DisplayName: Excelsus ExcelsusPink.DisplayName: Excelsus @@ -230,7 +229,6 @@ SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam SoulScythe.DisplayName: Soul Scythe SoulScytheExplosion.DisplayName: Soul Explosion -Spark.DisplayName: Spark SpatialSpear.DisplayName: Elemental Spear SpatialSpear2.DisplayName: Elemental Spear SpatialSpear3.DisplayName: Elemental Spear diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 9466199407..54849a57f6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -59,6 +59,7 @@ FlameLickedHellblast.DisplayName: Flame Licked Hellblast FuckYou.DisplayName: Explosion FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem +GenericElectricSpark.DisplayName: Electric Spark GhostlyBolt.DisplayName: Bolt GodKiller.DisplayName: God Killer GodSlayerShrapnel.DisplayName: Flame diff --git a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson index ab3f2729d1..3501e19e70 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson @@ -28,7 +28,7 @@ AureusBossText2: A faint ethereal click can be heard from the dungeon. // Golem BabyBossText: A plague has befallen the Jungle. // Astrum Deus -AstralBossText: The seal of the stars has been broken! You can now mine Astral Ore. +AstralBossText: The seal of the stars has been broken! You can now harvest Astral Ore. // Moon Lord MoonBossText: The profaned flame blazes fiercely! FutureOreText: A cold and dark energy has materialized in space. diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 3eda2702e2..33e2529e3d 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -740,9 +740,26 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); + if (npc.alpha < 255) + { + npc.velocity *= 0.9f; + npc.alpha += 2; + if (npc.alpha > 255) + npc.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + npc.active = false; + + npc.active = false; return; } @@ -1058,9 +1075,25 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); + if (npc.alpha < 255) + { + npc.velocity *= 0.9f; + npc.alpha += 2; + if (npc.alpha > 255) + npc.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + npc.active = false; + return; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index dc552f1218..a6b3a39cad 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -117,14 +117,15 @@ namespace CalamityMod.NPCs public const double VulnerableToDoTDamageMult = 2D; public const double VulnerableToDoTDamageMult_Worms_SlimeGod = 1.5; - // Eskimo Set and Cryo Stone effects + // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; + public bool IncreasedColdEffects_FrozenWings = false; public bool IncreasedColdEffects_CryoStone = false; // Transformer effect public bool IncreasedElectricityEffects_Transformer = false; - // Fireball, Cinnamon Roll and Hellfire Treads effects + // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; public bool IncreasedHeatEffects_FlameWakerBoots = false; @@ -412,6 +413,7 @@ namespace CalamityMod.NPCs myClone.VulnerableToWater = VulnerableToWater; myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; + myClone.IncreasedColdEffects_FrozenWings = IncreasedColdEffects_FrozenWings; myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; myClone.IncreasedElectricityEffects_Transformer = IncreasedElectricityEffects_Transformer; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; @@ -844,6 +846,8 @@ namespace CalamityMod.NPCs if (IncreasedColdEffects_EskimoSet) coldDamageMult += 0.25; + if (IncreasedColdEffects_FrozenWings) + coldDamageMult += 0.25; if (IncreasedColdEffects_CryoStone) coldDamageMult += 0.5; @@ -1418,7 +1422,6 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.GolemHeadFree) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.7); npc.dontTakeDamage = false; } else if (npc.type == NPCID.HallowBoss) diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index 316dc14574..24b60695c5 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -217,9 +217,9 @@ namespace CalamityMod.NPCs.NormalNPCs // Spawn less frequently in the inner third of the world. if (spawnInfo.PlayerFloorX > Main.maxTilesX * 0.333f && spawnInfo.PlayerFloorX < Main.maxTilesX - Main.maxTilesX * 0.333f) - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.01f : 0.06f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.015f : 0.06f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.033f : 0.15f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.0375f : 0.15f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 8131fe0a1e..e3d97d8ecd 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index adb4b9b685..6c40b1dd86 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index 38fdb46dda..a63b1c1fc8 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index bbaee7f27e..52be53013a 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 4fd355c97a..9b7de91cea 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -164,10 +164,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; + Vector2 drawLocation = NPC.Center - screenPos; + Color backAfterimageColor = PlaguebringerGoliath.BackglowColor * NPC.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4f; + spriteBatch.Draw(texture, drawLocation + drawOffset, NPC.frame, backAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + if (CalamityConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) @@ -177,18 +185,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = GlowTexture.Value; + texture = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -199,13 +206,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath secondAfterimageColor = Color.Lerp(secondAfterimageColor, Color.White, 0.5f); secondAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - secondAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + secondAfterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 79ab47cdae..f9a10891e9 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -121,18 +121,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + Color backAfterimageColor = PlaguebringerGoliath.BackglowColor * NPC.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4f; + spriteBatch.Draw(texture, drawLocation + drawOffset, NPC.frame, backAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } - texture2D15 = GlowTexture.Value; + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + texture = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 2476cf67ac..0d37d654b4 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -36,6 +36,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath [AutoloadBossHead] public class PlaguebringerGoliath : ModNPC { + // Use for all projectiles and spawned enemies. + public static Color BackglowColor => new Color(255, 100, 24, 80) * 0.6f; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private const float MissileAngleSpread = 60; private const int MissileProjectiles = 8; @@ -464,8 +467,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeed = revenge ? 25f : 20f; - float lineUpAccel = revenge ? 0.75f : 0.6f; + float maxLineUpSpeed = revenge ? 20f : 16f; + float lineUpAccel = revenge ? 0.4f : 0.3f; if (phase2) { maxLineUpSpeed += 3f; @@ -628,9 +631,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer bool canHitTarget = Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height); float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -711,9 +714,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -800,9 +803,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -892,9 +895,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -1039,8 +1042,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeed = revenge ? 31f : 26f; - float lineUpAccel = revenge ? 1.05f : 0.9f; + float maxLineUpSpeed = revenge ? 26f : 22f; + float lineUpAccel = revenge ? 0.7f : 0.6f; maxLineUpSpeed += 7f * enrageScale; lineUpAccel += 0.35f * enrageScale; @@ -1164,8 +1167,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath private void Movement(float distanceAboveTarget, Player player, float enrageScale) { - float acceleration = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 0.24f : 0.48f; // Reduce acceleration while spawning minions - float velocity = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 12f : (NPC.ai[0] == 2f ? 18f : 24f); // Reduce velocity while preparing to spawn minions and spawning minions + float acceleration = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 0.12f : (NPC.ai[0] == 2f ? 0.15f : 0.18f); // Reduce acceleration while spawning minions + float velocity = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 12f : (NPC.ai[0] == 2f ? 15f : 18f); // Reduce velocity while preparing to spawn minions and spawning minions acceleration *= 0.5f * enrageScale + 1f; velocity *= 1f + enrageScale * 0.5f; Vector2 hoverDestination = player.Center - Vector2.UnitY * distanceAboveTarget; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 2075680e34..66835d789d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -1756,33 +1756,31 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocity = bossRush ? 12f : masterMode ? 8.4f : 7.2f; float acceleration = bossRush ? 0.1f : masterMode ? 0.07f : 0.06f; + float deceleration = 1f - acceleration; - Vector2 probeCenter = npc.Center; - float probeTargetX = targetData.Center.X; - float probeTargetY = targetData.Center.Y; - probeTargetX = (int)(probeTargetX / 8f) * 8; - probeTargetY = (int)(probeTargetY / 8f) * 8; - probeCenter.X = (int)(probeCenter.X / 8f) * 8; - probeCenter.Y = (int)(probeCenter.Y / 8f) * 8; - probeTargetX -= probeCenter.X; - probeTargetY -= probeCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(probeTargetX * probeTargetX + probeTargetY * probeTargetY); - float distance2 = distanceFromTarget; - - bool farAwayFromTarget = false; - if (distanceFromTarget > 600f) - farAwayFromTarget = true; - - if (distanceFromTarget == 0f) + if (targetDead) { - probeTargetX = npc.velocity.X; - probeTargetY = npc.velocity.Y; + Vector2 destination = npc.Center - Vector2.UnitY; + Vector2 idealVelocity = npc.SafeDirectionTo(destination) * velocity * 0.5f; + idealVelocity.X *= npc.direction; + idealVelocity.Y *= 2.5f; + npc.SimpleFlyMovement(idealVelocity, acceleration); + npc.EncourageDespawn(10); + } + else if (npc.Distance(targetData.Center) > 400f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(idealVelocity, acceleration); } else { - distanceFromTarget = velocity / distanceFromTarget; - probeTargetX *= distanceFromTarget; - probeTargetY *= distanceFromTarget; + if (npc.Distance(targetData.Center) < 160f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(-idealVelocity, acceleration); + } + else + npc.velocity *= deceleration; } for (int i = 0; i < Main.maxNPCs; i++) @@ -1806,29 +1804,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (distance2 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - npc.velocity.Y += 0.023f; - else - npc.velocity.Y -= 0.023f; - - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - npc.velocity.X += 0.023f; - else - npc.velocity.X -= 0.023f; - - if (npc.ai[0] > 200f) - npc.ai[0] = -200f; - } - - if (targetDead) - { - probeTargetX = npc.direction * velocity / 2f; - probeTargetY = -velocity / 2f; - } - if (npc.ai[3] != 0f) { if (NPC.IsMechQueenUp) @@ -1882,22 +1857,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } else - { npc.dontTakeDamage = false; - if (npc.velocity.X < probeTargetX) - npc.velocity.X += acceleration; - else if (npc.velocity.X > probeTargetX) - npc.velocity.X -= acceleration; - - if (npc.velocity.Y < probeTargetY) - npc.velocity.Y += acceleration; - else if (npc.velocity.Y > probeTargetY) - npc.velocity.Y -= acceleration; - } - npc.localAI[0] += 1f; - if (npc.justHit && !masterMode) + if ((npc.justHit && !masterMode) || targetDead) npc.localAI[0] = 0f; float laserGateValue = NPC.IsMechQueenUp ? ProbeLaserGateValue_Mechdusa : bossRush ? ProbeLaserGateValue_BossRush : ProbeLaserGateValue_Rev; @@ -1921,12 +1884,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int totalProjectiles = oblivionAlive ? 2 : (CalamityWorld.death || bossRush) ? 3 : 1; - Vector2 npcCenter = new Vector2(probeTargetX, probeTargetY); + Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - float projectileVelocity = 8f; - npcCenter = v.SafeNormalize(Vector2.UnitY) * projectileVelocity; + projectileVelocity = v.SafeNormalize(Vector2.UnitY) * 8f; } for (int i = 0; i < totalProjectiles; i++) { @@ -1936,14 +1898,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses case 0: break; case 1: - velocityMultiplier = 0.9f; + velocityMultiplier = 0.95f; break; case 2: - velocityMultiplier = 0.8f; + velocityMultiplier = 0.9f; break; } - Vector2 laserVelocity = npcCenter * velocityMultiplier; - Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = projectileVelocity * velocityMultiplier; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); } npc.netUpdate = true; @@ -1955,47 +1917,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (WorldGen.InWorld(x, y) && !WorldGen.SolidTile(x, y)) Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); - if (probeTargetX > 0f) + if (targetData.Center.X - npc.Center.X > 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX); + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); } - if (probeTargetX < 0f) + else { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX) + MathHelper.Pi; - } - - float tilePosX = -0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * tilePosX; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * tilePosX; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) - npc.velocity.Y = -2f; - } - - if (farAwayFromTarget) - { - if ((npc.velocity.X > 0f && probeTargetX > 0f) || (npc.velocity.X < 0f && probeTargetX < 0f)) - { - if (Math.Abs(npc.velocity.X) < (NPC.IsMechQueenUp ? 5f : 12f)) - npc.velocity.X *= 1.05f; - } - else - npc.velocity.X *= 0.9f; + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; } if (NPC.IsMechQueenUp && npc.ai[2] == 0f) @@ -2006,13 +1936,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * 120; } - if (targetDead) - { - npc.velocity.Y -= acceleration * 2f; - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) npc.netUpdate = true; @@ -2025,61 +1948,37 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, default); NPCAimedTarget targetData = npc.GetTargetData(); - bool flag = false; + bool targetDead = false; if (targetData.Type == NPCTargetType.Player) - flag = Main.player[npc.target].dead; + targetDead = Main.player[npc.target].dead; - float num = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; - float num2 = Main.expertMode ? 0.06f : 0.05f; + float velocity = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; + float acceleration = Main.expertMode ? 0.06f : 0.05f; + float deceleration = 1f - acceleration; - Vector2 vector = npc.Center; - float num4 = targetData.Center.X; - float num5 = targetData.Center.Y; - num4 = (int)(num4 / 8f) * 8; - num5 = (int)(num5 / 8f) * 8; - vector.X = (int)(vector.X / 8f) * 8; - vector.Y = (int)(vector.Y / 8f) * 8; - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5); - float num7 = num6; - bool flag2 = false; - if (num6 > 600f) - flag2 = true; - - if (num6 == 0f) + if (targetDead || Main.IsItDay()) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + Vector2 destination = npc.Center - Vector2.UnitY; + Vector2 idealVelocity = npc.SafeDirectionTo(destination) * velocity * 0.5f; + idealVelocity.X *= npc.direction; + idealVelocity.Y *= 2.5f; + npc.SimpleFlyMovement(idealVelocity, acceleration); + npc.EncourageDespawn(10); + } + else if (npc.Distance(targetData.Center) > 400f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(idealVelocity, acceleration); } else { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - npc.velocity.Y += 0.023f; + if (npc.Distance(targetData.Center) < 160f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(-idealVelocity, acceleration); + } else - npc.velocity.Y -= 0.023f; - - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - npc.velocity.X += 0.023f; - else - npc.velocity.X -= 0.023f; - - if (npc.ai[0] > 200f) - npc.ai[0] = -200f; - } - - if (flag) - { - num4 = (float)npc.direction * num / 2f; - num5 = (0f - num) / 2f; + npc.velocity *= deceleration; } if (npc.ai[3] != 0f) @@ -2135,25 +2034,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } else - { npc.dontTakeDamage = false; - if (npc.velocity.X < num4) - npc.velocity.X += num2; - else if (npc.velocity.X > num4) - npc.velocity.X -= num2; - - if (npc.velocity.Y < num5) - npc.velocity.Y += num2; - else if (npc.velocity.Y > num5) - npc.velocity.Y -= num2; - } - npc.localAI[0] += 1f; if (npc.ai[3] != 0f) npc.localAI[0] += 2f; - if (npc.justHit && !Main.masterMode) + if ((npc.justHit && !Main.masterMode) || targetDead) npc.localAI[0] = 0f; float num10 = ProbeLaserGateValue; @@ -2179,15 +2066,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 vector3 = new Vector2(num4, num5); + Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - float num12 = 8f; - vector3 = v.SafeNormalize(Vector2.UnitY) * num12; + projectileVelocity = v.SafeNormalize(Vector2.UnitY) * 8f; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector + vector3.SafeNormalize(Vector2.UnitY) * 50f, vector3, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); } } @@ -2198,54 +2084,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (WorldGen.InWorld(num13, num14) && !WorldGen.SolidTile(num13, num14)) Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); - if (num4 > 0f) + if (targetData.Center.X - npc.Center.X > 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(num5, num4); + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); } - - if (num4 < 0f) + else { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(num5, num4) + MathHelper.Pi; - } - - float num15 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * (0f - num15); - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * (0f - num15); - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - npc.velocity.Y = -2f; - } - - if (flag2) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - int num27 = 12; - if (NPC.IsMechQueenUp) - num27 = 5; - - if (Math.Abs(npc.velocity.X) < (float)num27) - npc.velocity.X *= 1.05f; - } - else - npc.velocity.X *= 0.9f; + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; } if (NPC.IsMechQueenUp && npc.ai[2] == 0f) @@ -2257,12 +2104,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28; } - if (Main.IsItDay() || flag) - { - npc.velocity.Y -= num2 * 2f; - npc.EncourageDespawn(10); - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) npc.netUpdate = true; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index cbcf4efead..e4c312fd4c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -350,7 +350,72 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } else - NormalJump(); + { + if (npc.ai[3] == 0f) + npc.ai[3] = !headAlive ? Main.rand.Next(2) + 1f : 1f; + + switch ((int)npc.ai[3]) + { + default: + case 0: + case 1: + NormalJump(); + break; + + // Jump directly above the target's head and slam down + case 2: + + npc.noTileCollide = true; + + npc.ai[2] += 1f; + float jumpVelocity = death ? 23f : 21f; + if (enrage) + jumpVelocity *= 1.25f; + if (turboEnrage) + jumpVelocity *= 1.5f; + + float minJumpTime = 15f; + float maxJumpTime = 45f; + if ((npc.ai[2] >= minJumpTime && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= jumpVelocity) || npc.ai[2] >= maxJumpTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + + Vector2 center = npc.Center; + if (!Main.player[npc.target].dead && Main.player[npc.target].active && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= despawnDistance) + center = Main.player[npc.target].Center; + + center.Y -= 480f; + if (npc.velocity.Y == 0f) + { + npc.velocity = center - npc.Center; + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); + npc.velocity *= jumpVelocity; + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + + float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) + speedMult += distanceBelowTarget * multiplier; + + float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + if (speedMult > speedMultLimit) + speedMult = speedMultLimit; + + if (Main.player[npc.target].position.Y < npc.Bottom.Y) + npc.velocity.Y *= speedMult; + } + else + npc.velocity.Y *= 0.95f; + + break; + } + } void NormalJump() { @@ -1328,21 +1393,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[3] -= 1f + - ((phase2 || turboEnrage) ? 1f : 0f) + - ((phase3 || turboEnrage) ? 1f : 0f) + - ((phase4 || turboEnrage) ? 2f : 0f); + (turboEnrage ? 1f : phase2 ? 0.5f : 0f) + + (turboEnrage ? 1f : phase3 ? 0.5f : 0f) + + (turboEnrage ? 2f : phase4 ? 1f : 0f); float offsetX = calamityGlobalNPC.newAI[0]; float offsetY = calamityGlobalNPC.newAI[1]; Vector2 destination = Main.player[npc.target].Center + new Vector2(offsetX, offsetY); // Velocity and acceleration - float velocity = 16f + - ((phase2 || turboEnrage) ? 8f : 0f) + - ((phase3 || turboEnrage) ? 8f : 0f); + float velocity = (turboEnrage ? 15f : 10f) + + (turboEnrage ? 7.5f : phase2 ? 5f : 0f) + + (turboEnrage ? 7.5f : phase3 ? 5f : 0f); if (enrage) - velocity = (phase3 || turboEnrage) ? 40f : 32f; + velocity = (phase3 || turboEnrage) ? 35f : 25f; float acceleration = phase3 ? 0f : turboEnrage ? 6f : enrage ? 4.8f : phase2 ? 1.2f : 0.8f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 20bcd90c8e..2124eb4498 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses distanceFromTarget = targetPosition - npcPosition; float halfAverageScreenWidth = 960f; - float distanceBeforeSlowingDown = 400f; + float distanceBeforeSlowingDown = 480f; float timeBeforeEnrage = (masterMode ? 150f : 600f) - (death ? (masterMode ? 130f : 390f) * (1f - lifeRatio) : 0f); float speedMult = 1f; @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[0] -= 1f; } - speedMult = MathHelper.Clamp(speedMult, 0.75f, 2f); + speedMult = MathHelper.Clamp(speedMult, 0.4f, 2f); } // Enrage if target is off screen for too long @@ -450,51 +450,56 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.rand.NextBool(chance)) { - int hungryAmt = 0; - float[] array = new float[10]; - for (int j = 0; j < Main.maxNPCs; j++) + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(2f, 8f, npc.life / (float)npc.lifeMax)); + if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { - if (hungryAmt < 10 && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) + int hungryAmt = 0; + int maxHungries = 10; + float[] array = new float[maxHungries]; + for (int j = 0; j < Main.maxNPCs; j++) { - array[hungryAmt] = Main.npc[j].ai[0]; - hungryAmt++; - } - } - - int maxValue = 1 + hungryAmt * 2; - if (masterMode) - maxValue /= 2; - - if (maxValue < 2) - maxValue = 2; - - if (hungryAmt < 10 && Main.rand.Next(maxValue) <= 1) - { - int spawnHungryControl = -1; - for (int k = 0; k < 1000; k++) - { - int randomHungrySpawnValue = Main.rand.Next(10); - float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; - bool shouldRespawnHungry = true; - for (int i = 0; i < hungryAmt; i++) + if (hungryAmt < maxHungries && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) { - if (hungryArrayValue == array[i]) + array[hungryAmt] = Main.npc[j].ai[0]; + hungryAmt++; + } + } + + int maxValue = 1 + hungryAmt * 2; + if (masterMode) + maxValue /= 2; + + if (maxValue < 2) + maxValue = 2; + + if (hungryAmt < maxHungries && Main.rand.Next(maxValue) <= 1) + { + int spawnHungryControl = -1; + for (int k = 0; k < 1000; k++) + { + int randomHungrySpawnValue = Main.rand.Next(maxHungries); + float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; + bool shouldRespawnHungry = true; + for (int i = 0; i < hungryAmt; i++) { - shouldRespawnHungry = false; + if (hungryArrayValue == array[i]) + { + shouldRespawnHungry = false; + break; + } + } + if (shouldRespawnHungry) + { + spawnHungryControl = randomHungrySpawnValue; break; } } - if (shouldRespawnHungry) + if (spawnHungryControl >= 0) { - spawnHungryControl = randomHungrySpawnValue; - break; + int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); + Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; } } - if (spawnHungryControl >= 0) - { - int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); - Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; - } } } } @@ -724,6 +729,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool shouldFireLasers = true; float phase2LifeRatio = 0.5f; bool masterModeDetach = lifeRatio < phase2LifeRatio && masterMode; + 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) { npc.position.X = Main.npc[Main.wofNPCIndex].position.X; @@ -759,7 +765,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - float distanceAboveTarget = 240f * npc.ai[0]; + float distanceAboveTarget = (canHit ? 240f : 120f) * npc.ai[0]; float distanceAwayFromTargetX = 560f; float distanceAwayFromTargetXLeeway = 40f; float distanceAwayFromTargetY = Main.player[npc.target].Center.Y - npc.Center.Y; @@ -864,8 +870,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float shootBoost = fireEnragedLasers ? (death ? 5f : 4f) : (death ? 3f : 3f * (1f - lifeRatio)); npc.localAI[1] += 1f + shootBoost; - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[2] == 0f) { if (npc.localAI[1] > LaserShootGateValue) @@ -1111,6 +1115,24 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = 0f; npc.position.Y = num368; + float targetPosition = Main.player[npc.target].Center.X; + float npcPosition = npc.Center.X; + + // Slow down if close + float distanceFromTarget; + if (npc.velocity.X < 0f) + distanceFromTarget = npcPosition - targetPosition; + else + distanceFromTarget = targetPosition - npcPosition; + + float distanceBeforeSlowingDown = 480f; + float speedMult = 1f; + + if (distanceFromTarget < distanceBeforeSlowingDown) + speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; + + speedMult = MathHelper.Clamp(speedMult, 0.4f, 1f); + float masterModeVelocityBoost = 0f; if (Main.masterMode) { @@ -1175,6 +1197,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num369 += 0.2f; } + num369 *= speedMult; + if (npc.velocity.X == 0f) { npc.TargetClosest(); @@ -1255,66 +1279,71 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) { - int num378 = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); - num378 *= num378; - if (num378 < 400) - num378 = (num378 * 19 + 400) / 20; + int chanceToSpawnHungry = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); + chanceToSpawnHungry *= chanceToSpawnHungry; + if (chanceToSpawnHungry < 400) + chanceToSpawnHungry = (chanceToSpawnHungry * 19 + 400) / 20; - if (num378 < 60) - num378 = (num378 * 3 + 60) / 4; + if (chanceToSpawnHungry < 60) + chanceToSpawnHungry = (chanceToSpawnHungry * 3 + 60) / 4; - if (num378 < 20) - num378 = (num378 + 20) / 2; + if (chanceToSpawnHungry < 20) + chanceToSpawnHungry = (chanceToSpawnHungry + 20) / 2; - num378 = (int)((double)num378 * (Main.masterMode ? 0.5 : 0.7)); - if (num378 < 2) - num378 = 2; + chanceToSpawnHungry = (int)((double)chanceToSpawnHungry * (Main.masterMode ? 0.5 : 0.7)); + if (chanceToSpawnHungry < 2) + chanceToSpawnHungry = 2; - if (Main.rand.NextBool(num378)) + if (Main.rand.NextBool(chanceToSpawnHungry)) { - int num379 = 0; - float[] array = new float[10]; - for (int num380 = 0; num380 < Main.maxNPCs; num380++) + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(2f, 8f, npc.life / (float)npc.lifeMax)); + if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { - if (num379 < 10 && Main.npc[num380].active && Main.npc[num380].type == NPCID.TheHungry) + int hungryCount = 0; + int maxHungries = 10; + float[] hungryArray = new float[maxHungries]; + for (int i = 0; i < Main.maxNPCs; i++) { - array[num379] = Main.npc[num380].ai[0]; - num379++; - } - } - - int maxValue = 1 + num379 * 2; - if (Main.masterMode) - maxValue /= 2; - if (maxValue < 2) - maxValue = 2; - - if (num379 < 10 && Main.rand.Next(maxValue) <= 1) - { - int num381 = -1; - for (int num382 = 0; num382 < 1000; num382++) - { - int num383 = Main.rand.Next(10); - float num384 = (float)num383 * 0.1f - 0.05f; - bool flag26 = true; - for (int num385 = 0; num385 < num379; num385++) + if (hungryCount < maxHungries && Main.npc[i].active && Main.npc[i].type == NPCID.TheHungry) { - if (num384 == array[num385]) + hungryArray[hungryCount] = Main.npc[i].ai[0]; + hungryCount++; + } + } + + int maxValue = 1 + hungryCount * 2; + if (Main.masterMode) + maxValue /= 2; + if (maxValue < 2) + maxValue = 2; + + if (hungryCount < maxHungries && Main.rand.Next(maxValue) <= 1) + { + int ai0 = -1; + for (int i = 0; i < 1000; i++) + { + int randomHungryLocation = Main.rand.Next(maxHungries); + float hungryLocation = (float)randomHungryLocation * 0.1f - 0.05f; + bool spawnHungry = true; + for (int j = 0; j < hungryCount; j++) { - flag26 = false; + if (hungryLocation == hungryArray[j]) + { + spawnHungry = false; + break; + } + } + + if (spawnHungry) + { + ai0 = randomHungryLocation; break; } } - if (flag26) - { - num381 = num383; - break; - } + if (ai0 >= 0) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)ai0 * 0.1f - 0.05f); } - - if (num381 >= 0) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)num381 * 0.1f - 0.05f); } } } diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index f9ffe4065f..31fc250b1a 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -4,11 +4,13 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DestroyerCursedLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.width = 4; @@ -25,32 +27,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.75f / 255f, 0f); + if (Projectile.alpha > 0) - { Projectile.alpha -= 125; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } + if (Projectile.localAI[1] == 0f) { SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); Projectile.localAI[1] = 1f; } - if (Projectile.velocity.Length() < 12f) - { + + if (Projectile.velocity.Length() < CalamityGlobalProjectile.AcceleratingBossLaserVelocityCap) Projectile.velocity *= 1.0025f; - } } public override Color? GetAlpha(Color lightColor) { if (Projectile.alpha < 200) - { return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); - } + return Color.Transparent; } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 75ff1f1ed5..5a30ce18b1 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -5,11 +5,13 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DestroyerElectricLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.ignoreWater = true; @@ -26,32 +28,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); + if (Projectile.alpha > 0) - { Projectile.alpha -= 125; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } + if (Projectile.localAI[1] == 0f) { SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); Projectile.localAI[1] = 1f; } - if (Projectile.velocity.Length() < 12f) - { + + if (Projectile.velocity.Length() < CalamityGlobalProjectile.AcceleratingBossLaserVelocityCap) Projectile.velocity *= 1.0025f; - } } public override Color? GetAlpha(Color lightColor) { if (Projectile.alpha < 200) - { return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); - } + return Color.Transparent; } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index fb00892801..2b4199bdcb 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -83,6 +84,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawProjectileWithBackglow(PlaguebringerGoliath.BackglowColor, lightColor, 4f); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index f8cb269e5c..c2b3dffdb8 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.PlaguebringerGoliath; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -52,6 +53,12 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 90); } + public override bool PreDraw(ref Color lightColor) + { + Projectile.DrawProjectileWithBackglow(PlaguebringerGoliath.BackglowColor, lightColor, 4f); + return false; + } + public override void PostDraw(Color lightColor) { Vector2 center = new Vector2(Projectile.Center.X, Projectile.Center.Y); diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index d379ddf72f..822a848f4f 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.PlaguebringerGoliath; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -42,6 +43,12 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 90); } + public override bool PreDraw(ref Color lightColor) + { + Projectile.DrawProjectileWithBackglow(PlaguebringerGoliath.BackglowColor, lightColor, 4f); + return false; + } + public override void PostDraw(Color lightColor) { Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 54bd91cfab..b0f5b94fb5 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles public bool CreatedByPlayerDash = false; // Speed cap for accelerating boss laser projectiles with 2 extraUpdates. - public const float AcceleratingBossLaserVelocityCap = 10f; + public const float AcceleratingBossLaserVelocityCap = 8f; // Damage Adjusters public const float PierceResistHarshness = 0.12f; diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs deleted file mode 100644 index c305f82456..0000000000 --- a/Projectiles/Melee/EutrophicSpark.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EutrophicSpark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.timeLeft = 30; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int eutrophicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[eutrophicDust]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[eutrophicDust]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[eutrophicDust].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[eutrophicDust].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[eutrophicDust]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool()) - { - int eutrophicDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[eutrophicDust2]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[eutrophicDust2]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[eutrophicDust2].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[eutrophicDust2].noGravity = true; - Main.dust[eutrophicDust2].velocity *= 0.1f; - } - if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs index d14369a186..20871afe34 100644 --- a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs +++ b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -48,16 +49,15 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - var source = Projectile.GetSource_FromThis(); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Main.myPlayer); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnSparks(target); - public override void OnHitPlayer(Player target, Player.HurtInfo info) + public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnSparks(target); + + public void SpawnSparks(Entity target) { var source = Projectile.GetSource_FromThis(); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Main.myPlayer); + Projectile spark = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Main.myPlayer); + spark.DamageType = DamageClass.Melee; } } } diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs deleted file mode 100644 index 682e49ad7d..0000000000 --- a/Projectiles/Melee/Spark.cs +++ /dev/null @@ -1,93 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Spark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.timeLeft = 60; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; - Projectile.DamageType = DamageClass.Melee; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void AI() - { - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[sparky]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[sparky]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparky].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[sparky]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool()) - { - int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[sparkier]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[sparkier]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[sparkier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparkier].noGravity = true; - Main.dust[sparkier].velocity *= 0.1f; - } - if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 1e2568e1ea..9ec49d7203 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.Center = Vector2.Lerp(Projectile.Center, idleDestination, 0.15f); AITimer++; - Owner.statDefense += 5; + Owner.statDefense += 4; Projectile.rotation += MoveWidth * 0.2f; } if (!MinionBuffMode && !Reforming) // Minion when ramming diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index 1b27ab23b2..e196726c0a 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -1,6 +1,5 @@ using System; using CalamityMod.Buffs.Summon; -using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -280,7 +279,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(1, 4); i++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } sparkCounter = 0; } @@ -313,17 +312,7 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < Main.rand.Next(1, 4); j++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (spark.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark].DamageType = DamageClass.Summon; - Main.projectile[spark].originalDamage = Projectile.originalDamage; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } sparkCounter = 0; } diff --git a/Projectiles/Summon/StormjawSpark.cs b/Projectiles/Summon/StormjawSpark.cs index 0758cf42e9..6c06785a0a 100644 --- a/Projectiles/Summon/StormjawSpark.cs +++ b/Projectiles/Summon/StormjawSpark.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - //literally had to make another projectile cuz whips exist + // Clone of Typeless/GenericElectricSpark but specfically benefits from whips public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; public override void SetDefaults() @@ -24,65 +26,48 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void AI() { if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } + Projectile.velocity.X *= -0.1f; if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; + Projectile.velocity.Y *= -0.5f; + + Projectile.ai[0]++; if (Projectile.ai[0] > 5f) { Projectile.ai[0] = 5f; if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) + Projectile.velocity.X *= 0.97f; + if (MathF.Abs(Projectile.velocity.X) < 0.01f) { Projectile.velocity.X = 0f; Projectile.netUpdate = true; } } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + Projectile.velocity.Y += 0.2f; } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[sparky]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[sparky]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparky].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[sparky]; - expr_89E7_cp_0.velocity.Y -= 2f; + Dust spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0f, 0.5f); + spark.noGravity = true; + spark.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[sparkier]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[sparkier]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[sparkier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparkier].noGravity = true; - Main.dust[sparkier].velocity *= 0.1f; + spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0.3f, 0.8f); + spark.noGravity = true; + spark.velocity *= 0.1f; } - if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) - { Projectile.velocity.Y = 16f; - } } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Typeless/GenericElectricSpark.cs b/Projectiles/Typeless/GenericElectricSpark.cs new file mode 100644 index 0000000000..607550060d --- /dev/null +++ b/Projectiles/Typeless/GenericElectricSpark.cs @@ -0,0 +1,72 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GenericElectricSpark : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + + public override void AI() + { + if (Projectile.velocity.X != Projectile.velocity.X) + Projectile.velocity.X *= -0.1f; + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) + Projectile.velocity.Y *= -0.5f; + + Projectile.ai[0]++; + if (Projectile.ai[0] > 5f) + { + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + { + Projectile.velocity.X *= 0.97f; + if (MathF.Abs(Projectile.velocity.X) < 0.01f) + { + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; + } + } + Projectile.velocity.Y += 0.2f; + } + Dust spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0f, 0.5f); + spark.noGravity = true; + spark.velocity.Y -= 2f; + if (Main.rand.NextBool()) + { + spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0.3f, 0.8f); + spark.noGravity = true; + spark.velocity *= 0.1f; + } + + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 2b9da5ece9..0b1f23af65 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Astral; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -28,7 +30,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; - MinPick = 210; + MinPick = 110; DustType = 173; AddMapEntry(new Color(255, 153, 255), CreateMapEntryName()); MineResist = 3f; @@ -36,7 +38,8 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; + // TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; + TileID.Sets.AvoidedByMeteorLanding[Type] = true; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } @@ -57,14 +60,23 @@ namespace CalamityMod.Tiles.Ores } } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) + public override void RandomUpdate(int i, int j) { - return DownedBossSystem.downedAstrumDeus; + if (Main.rand.NextBool(4)) + { + int xRandom = Main.rand.Next(-3, 3); + int yRandom = Main.rand.Next(-3, 3); + if (Main.tile[i + xRandom, j + yRandom].TileType == TileID.Meteorite) + AstralBiome.ConvertToAstral(i + xRandom, j + yRandom, true); + } } - public override bool CanExplode(int i, int j) + public override IEnumerable GetItemDrops(int i, int j) { - return false; + if (!DownedBossSystem.downedAstrumDeus) + yield return new Item(ModContent.ItemType(), Main.rand.Next(1, 2 + 1)); + else + yield return new Item(ModContent.ItemType()); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index bc1389ee03..b38c4b12b4 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -723,6 +723,7 @@ namespace CalamityMod.World case TileID.Lead: case TileID.Tungsten: case TileID.Platinum: + case TileID.Meteorite: if (convertOre) { Main.tile[x, y].TileType = (ushort)ModContent.TileType();