diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 7abc394a1f..d675ac0b01 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -89,6 +89,10 @@ namespace CalamityMod.Buffs //Vanilla buffs switch (type) { + case BuffID.Archery: + tip = "20% increased arrow speed and 1.05x arrow damage"; + break; + case BuffID.Swiftness: tip = "15% increased movement speed"; break; diff --git a/Buffs/StatBuffs/DivineBless.cs b/Buffs/StatBuffs/DivineBless.cs index 1f61ad062d..4a75db454f 100644 --- a/Buffs/StatBuffs/DivineBless.cs +++ b/Buffs/StatBuffs/DivineBless.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Divine Bless"); - Description.SetDefault("+5% damage, increased health regen, attacks inflict Banishing Fire"); + Description.SetDefault("Increased health regen and minions inflict Banishing Fire"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs index cda8a37727..a7dd6475f3 100644 --- a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/HallowedRuneDefBuff.cs b/Buffs/StatBuffs/HallowedRuneDefBuff.cs index 4856abe2bf..22ed3eb7b9 100644 --- a/Buffs/StatBuffs/HallowedRuneDefBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneDefBuff.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs index c85e46f920..50968cfcde 100644 --- a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/PhantomicArmourBuff.cs b/Buffs/StatBuffs/PhantomicArmourBuff.cs index fae17dd3a1..82e4305808 100644 --- a/Buffs/StatBuffs/PhantomicArmourBuff.cs +++ b/Buffs/StatBuffs/PhantomicArmourBuff.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs index 52ba453934..868a457554 100644 --- a/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs +++ b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/PhantomicRestorationBuff.cs b/Buffs/StatBuffs/PhantomicRestorationBuff.cs index ace3972774..936c8c7af2 100644 --- a/Buffs/StatBuffs/PhantomicRestorationBuff.cs +++ b/Buffs/StatBuffs/PhantomicRestorationBuff.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 8558718f5b..456de988c2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -12,7 +12,6 @@ using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Dyes; -using CalamityMod.Items.LoreItems; using CalamityMod.Items.Mounts; using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; @@ -3506,6 +3505,7 @@ namespace CalamityMod.CalPlayer for (int n = 13; n < 18 + player.extraAccessorySlots; n++) { Item item = player.armor[n]; + if (item.type == ModContent.ItemType()) { snowmanHide = false; @@ -3535,6 +3535,13 @@ namespace CalamityMod.CalPlayer public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) { + // Ankh Shield Mighty Wind immunity. + for (int i = 0; i < 8 + player.extraAccessorySlots; i++) + { + if (player.armor[i].type == ItemID.AnkhShield) + player.buffImmune[BuffID.WindPushed] = true; + } + if (CalamityConfig.Instance.BossHealthBar) { drawBossHPBar = true; @@ -7428,7 +7435,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 180); } - if (fBarrier || (sirenBoobs && NPC.downedBoss3)) + if ((fBarrier || (sirenBoobs && NPC.downedBoss3)) && !areThereAnyDamnBosses) { Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 27); for (int m = 0; m < Main.maxNPCs; m++) @@ -8032,7 +8039,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -8064,8 +8071,8 @@ namespace CalamityMod.CalPlayer player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(135 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(90 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; + if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 300); bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) @@ -8091,7 +8098,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -8123,8 +8130,8 @@ namespace CalamityMod.CalPlayer player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(120 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(80 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; + if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[player.whoAmI] = 6; bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) { @@ -8149,7 +8156,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -8180,8 +8187,8 @@ namespace CalamityMod.CalPlayer } player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; + if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[player.whoAmI] = 6; bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) { @@ -8206,7 +8213,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -8236,8 +8243,8 @@ namespace CalamityMod.CalPlayer direction = 1; } player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; + if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 60); bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) @@ -8263,7 +8270,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -8281,8 +8288,8 @@ namespace CalamityMod.CalPlayer direction = 1; } player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; + if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 300); bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) @@ -8308,7 +8315,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) @@ -8353,8 +8360,8 @@ namespace CalamityMod.CalPlayer direction = 1; } player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; + if (npc.Calamity().dashImmunityTime[player.whoAmI] < 6) + npc.Calamity().dashImmunityTime[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 600); bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) @@ -8782,6 +8789,7 @@ namespace CalamityMod.CalPlayer private bool DoADash(float dashDistance) { + bool godSlayerDash = dashMod == 9; bool justDashed = false; int direction = 0; @@ -8790,7 +8798,7 @@ namespace CalamityMod.CalPlayer if (dashTimeMod < 0) dashTimeMod++; - if (dashMod == 9) + if (godSlayerDash) { if (player.controlUp && player.controlLeft) { @@ -8938,7 +8946,7 @@ namespace CalamityMod.CalPlayer // Left case -1: - player.velocity = possibleVelocities[6]; + player.velocity = godSlayerDash ? possibleVelocities[6] : new Vector2(possibleVelocities[6].X, player.velocity.Y); break; // Nothing @@ -8947,7 +8955,7 @@ namespace CalamityMod.CalPlayer // Right case 1: - player.velocity = possibleVelocities[2]; + player.velocity = godSlayerDash ? possibleVelocities[2] : new Vector2(possibleVelocities[2].X, player.velocity.Y); break; // Down @@ -8969,7 +8977,7 @@ namespace CalamityMod.CalPlayer Point point5 = (player.Center + new Vector2(MathHelper.Clamp(direction, -1f, 1f) * player.width / 2 + 2, player.gravDir * -player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); Point point6 = (player.Center + new Vector2(MathHelper.Clamp(direction, -1f, 1f) * player.width / 2 + 2, 0f)).ToTileCoordinates(); if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - player.velocity.X = player.velocity.X / 2f; + player.velocity.X /= 2f; player.dashDelay = -1; } @@ -9184,7 +9192,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.immune[player.whoAmI] == 0) + if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.Calamity().dashImmunityTime[player.whoAmI] <= 0) { Rectangle rect = nPC.getRect(); if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(player.position, player.width, player.height, nPC.position, nPC.width, nPC.height))) @@ -9202,7 +9210,7 @@ namespace CalamityMod.CalPlayer { player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); } - nPC.immune[player.whoAmI] = NPCImmuneTime; + nPC.Calamity().dashImmunityTime[player.whoAmI] = NPCImmuneTime; bool isImmune = false; for (int j = 0; j < player.hurtCooldowns.Length; j++) { @@ -9375,8 +9383,17 @@ namespace CalamityMod.CalPlayer ? player.itemAnimation == player.itemAnimationMax - 1 // Standard weapon (first frame of use animation) : player.itemTime == it.useTime; // Clockwork weapon (first frame of any individual use event) - if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon && StealthStrikeAvailable()) - ConsumeStealthByAttacking(); + if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon) + { + bool canStealthStrike = StealthStrikeAvailable(); + + // If you can stealth strike, you do. + if (canStealthStrike) + ConsumeStealthByAttacking(); + // Otherwise you get a "partial stealth strike" (stealth damage is still added to the weapon) and return to normally attacking. + else + rogueStealth = 0f; + } } private void ProvideStealthStatBonuses() diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 00ac66956e..5eaaf80cc2 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -408,7 +408,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.divineBless) { - if (player.whoAmI == Main.myPlayer && player.miscCounter % 15 == 0) + if (player.whoAmI == Main.myPlayer && player.miscCounter % 15 == 0) // Flat 4 health per second { if (!modPlayer.noLifeRegen) player.statLife += 1; @@ -797,41 +797,6 @@ namespace CalamityMod.CalPlayer player.statLife += 1; } - if (modPlayer.divineBless) - { - player.lifeRegenTime++; - - int lifeRegenMaxBoost2 = 1; - float lifeRegenLifeRegenTimeMaxBoost2 = 4f; - - player.lifeRegen += lifeRegenMaxBoost2; - - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost2) - num3 = lifeRegenLifeRegenTimeMaxBoost2; - - player.lifeRegen += (int)num3; - } - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int regen = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 200, default, 1f); - Main.dust[regen].noGravity = true; - Main.dust[regen].fadeIn = 1.3f; - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); - Main.dust[regen].velocity = velocity; - velocity.Normalize(); - velocity *= 34f; - Main.dust[regen].position = player.Center - velocity; - } - } - } - // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) if (!player.shinyStone) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 0d808e139d..6d0c408fbb 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2931,7 +2931,19 @@ namespace CalamityMod.CalPlayer if (modPlayer.gState) { player.statDefense -= GlacialState.DefenseReduction; - player.velocity = Vector2.Zero; + player.velocity.X *= 0.5f; + player.velocity.Y += 0.05f; + if (player.velocity.Y > 15f) + player.velocity.Y = 15f; + } + + if (modPlayer.eFreeze) + { + player.statDefense -= GlacialState.DefenseReduction; + player.velocity.X *= 0.5f; + player.velocity.Y += 0.1f; + if (player.velocity.Y > 15f) + player.velocity.Y = 15f; } if (modPlayer.eFreeze || modPlayer.silvaStun || modPlayer.eutrophication) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 4efb64ab4c..8a7635bdce 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -18,6 +18,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using CalamityMod.Items.Accessories; namespace CalamityMod.CalPlayer { @@ -558,15 +559,18 @@ namespace CalamityMod.CalPlayer if (modPlayer.moonCrown && modProj.stealthStrike && modPlayer.moonCrownCooldown <= 0 && modProj.stealthStrikeHitCount < 5) { + int lunarFlareDamage = (int)(MoonstoneCrown.BaseDamage * player.RogueDamage()); + float lunarFlareKB = 3f; for (int i = 0; i < 3; i++) { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 10f; - int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, (int)(60 * player.RogueDamage()), 3, proj.owner); + int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, lunarFlareDamage, lunarFlareKB, proj.owner); if (flare.WithinBounds(Main.maxProjectiles)) Main.projectile[flare].Calamity().forceTypeless = true; - modPlayer.moonCrownCooldown = 60; } + + modPlayer.moonCrownCooldown = 60; } if (modPlayer.nanotech && modProj.stealthStrike && modPlayer.nanoFlareCooldown <= 0 && modProj.stealthStrikeHitCount < 5) diff --git a/CalamityLists.cs b/CalamityLists.cs index ff5a841a25..e50c2e6460 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -22,6 +22,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; @@ -35,6 +36,7 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; @@ -307,11 +309,8 @@ namespace CalamityMod ProjectileID.MushroomSpear, ProjectileID.Gungnir, ProjectileID.ObsidianSwordfish, - ProjectileID.ChlorophytePartisan, ProjectileID.MonkStaffT1, ProjectileID.MonkStaffT2, - ProjectileID.MonkStaffT3, - ProjectileID.NorthPoleWeapon, // Tools ProjectileID.CobaltDrill, @@ -345,28 +344,14 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType() @@ -490,6 +475,8 @@ namespace CalamityMod NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, + NPCID.PirateShipCannon, + NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, @@ -498,7 +485,11 @@ namespace CalamityMod NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.Plantera, + NPCID.PlanterasTentacle, + NPCID.Everscream, + NPCID.SantaNK1, NPCID.IceQueen, + NPCID.MourningWood, NPCID.Pumpking, NPCID.Mothron, NPCID.Golem, @@ -506,12 +497,21 @@ namespace CalamityMod NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, - NPCID.GolemHeadFree, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerTurret, NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, NPCID.CultistBoss, - NPCID.MoonLordHead, + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordHead, NPCID.MoonLordHand, NPCID.MoonLordCore, NPCID.MoonLordFreeEye, @@ -550,8 +550,47 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), - NPCType() - }; + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; confusionEnemyList = new List() { @@ -1265,7 +1304,8 @@ namespace CalamityMod sixtySixDamageBuffList = new List() { - ItemID.TrueNightsEdge, + ItemID.PulseBow, + ItemID.TrueNightsEdge, ItemID.MedusaHead, ItemID.StaffofEarth, ItemID.ChristmasTreeSword, @@ -1277,11 +1317,12 @@ namespace CalamityMod fiftyDamageBuffList = new List() { - ItemID.EldMelter, + ItemID.IceBow, + ItemID.Marrow, + ItemID.EldMelter, ItemID.Flamethrower, ItemID.MoonlordTurretStaff, ItemID.WaspGun, - ItemID.PulseBow, ItemID.PaladinsHammer, ItemID.SolarEruption, ItemID.DayBreak, @@ -1299,8 +1340,6 @@ namespace CalamityMod thirtyThreeDamageBuffList = new List() { ItemID.WandofSparking, - ItemID.IceBow, - ItemID.Marrow, ItemID.CrystalVileShard, ItemID.SoulDrain, ItemID.ClingerStaff, @@ -1337,6 +1376,52 @@ namespace CalamityMod tenDamageBuffList = new List() { + ItemID.WoodenArrow, + ItemID.FlamingArrow, + ItemID.UnholyArrow, + ItemID.JestersArrow, + ItemID.HellfireArrow, + ItemID.HolyArrow, + ItemID.CursedArrow, + ItemID.FrostburnArrow, + ItemID.ChlorophyteArrow, + ItemID.IchorArrow, + ItemID.VenomArrow, + ItemID.BoneArrow, + ItemID.EndlessQuiver, + ItemID.MoonlordArrow, + ItemID.DD2BetsyBow, + ItemID.BorealWoodBow, + ItemID.CopperBow, + ItemID.DemonBow, + ItemID.EbonwoodBow, + ItemID.GoldBow, + ItemID.HellwingBow, + ItemID.IronBow, + ItemID.LeadBow, + ItemID.MoltenFury, + ItemID.PalmWoodBow, + ItemID.PearlwoodBow, + ItemID.DD2PhoenixBow, + ItemID.PlatinumBow, + ItemID.RichMahoganyBow, + ItemID.ShadewoodBow, + ItemID.ShadowFlameBow, + ItemID.SilverBow, + ItemID.TendonBow, + ItemID.BeesKnees, + ItemID.TinBow, + ItemID.Tsunami, + ItemID.TungstenBow, + ItemID.WoodenBow, + ItemID.AdamantiteRepeater, + ItemID.ChlorophyteShotbow, + ItemID.CobaltRepeater, + ItemID.HallowedRepeater, + ItemID.MythrilRepeater, + ItemID.OrichalcumRepeater, + ItemID.PalladiumRepeater, + ItemID.TitaniumRepeater, ItemID.MagnetSphere, ItemID.BatScepter, ItemID.ElectrosphereLauncher @@ -1434,8 +1519,8 @@ namespace CalamityMod tenDamageNerfList = new List() { - ItemID.Phantasm, - ItemID.StarWrath + ItemID.DaedalusStormbow, + ItemID.StarWrath }; quarterDamageNerfList = new List() @@ -1443,7 +1528,6 @@ namespace CalamityMod ItemID.LastPrism, ItemID.DemonScythe, ItemID.Razorpine, - ItemID.DaedalusStormbow, ItemID.PhoenixBlaster, ItemID.InfluxWaver, ItemID.Xenopopper, @@ -1717,7 +1801,10 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), - }; + NPCType(), + NPCType(), + NPCType() + }; needsDebuffIconDisplayList = new List() { diff --git a/CalamityMod.cs b/CalamityMod.cs index 4b4fa6982b..d333d5ba40 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.OldDuke; @@ -576,6 +577,10 @@ namespace CalamityMod { ModContent.NPCType(), 9000 }, { ModContent.NPCType(), 15300 }, { ModContent.NPCType(), 18000 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, { ModContent.NPCType(), 18000 } }; } @@ -700,6 +705,10 @@ namespace CalamityMod { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), bitingEnemeyVelocityScale } }; } diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png b/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png new file mode 100644 index 0000000000..8facdfbb48 Binary files /dev/null and b/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png differ diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png b/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png new file mode 100644 index 0000000000..fe2d7fe372 Binary files /dev/null and b/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png differ diff --git a/Gores/Thanatos/ThanatosBody1.png b/Gores/Thanatos/ThanatosBody1.png new file mode 100644 index 0000000000..846ec8a27e Binary files /dev/null and b/Gores/Thanatos/ThanatosBody1.png differ diff --git a/Gores/Thanatos/ThanatosBody1_2.png b/Gores/Thanatos/ThanatosBody1_2.png new file mode 100644 index 0000000000..b5aa29046b Binary files /dev/null and b/Gores/Thanatos/ThanatosBody1_2.png differ diff --git a/Gores/Thanatos/ThanatosBody1_3.png b/Gores/Thanatos/ThanatosBody1_3.png new file mode 100644 index 0000000000..d22ecb673b Binary files /dev/null and b/Gores/Thanatos/ThanatosBody1_3.png differ diff --git a/Gores/Thanatos/ThanatosBody2.png b/Gores/Thanatos/ThanatosBody2.png new file mode 100644 index 0000000000..88b0bd01e5 Binary files /dev/null and b/Gores/Thanatos/ThanatosBody2.png differ diff --git a/Gores/Thanatos/ThanatosBody2_2.png b/Gores/Thanatos/ThanatosBody2_2.png new file mode 100644 index 0000000000..cb7ae15507 Binary files /dev/null and b/Gores/Thanatos/ThanatosBody2_2.png differ diff --git a/Gores/Thanatos/ThanatosBody2_3.png b/Gores/Thanatos/ThanatosBody2_3.png new file mode 100644 index 0000000000..97eb4cc715 Binary files /dev/null and b/Gores/Thanatos/ThanatosBody2_3.png differ diff --git a/Gores/Thanatos/ThanatosHead.png b/Gores/Thanatos/ThanatosHead.png new file mode 100644 index 0000000000..dfb3f287c6 Binary files /dev/null and b/Gores/Thanatos/ThanatosHead.png differ diff --git a/Gores/Thanatos/ThanatosHead2.png b/Gores/Thanatos/ThanatosHead2.png new file mode 100644 index 0000000000..7df1a911da Binary files /dev/null and b/Gores/Thanatos/ThanatosHead2.png differ diff --git a/Gores/Thanatos/ThanatosHead3.png b/Gores/Thanatos/ThanatosHead3.png new file mode 100644 index 0000000000..ecc13b3891 Binary files /dev/null and b/Gores/Thanatos/ThanatosHead3.png differ diff --git a/Gores/Thanatos/ThanatosTail.png b/Gores/Thanatos/ThanatosTail.png new file mode 100644 index 0000000000..38ec9513fb Binary files /dev/null and b/Gores/Thanatos/ThanatosTail.png differ diff --git a/Gores/Thanatos/ThanatosTail2.png b/Gores/Thanatos/ThanatosTail2.png new file mode 100644 index 0000000000..ec5cf41bdb Binary files /dev/null and b/Gores/Thanatos/ThanatosTail2.png differ diff --git a/Gores/Thanatos/ThanatosTail3.png b/Gores/Thanatos/ThanatosTail3.png new file mode 100644 index 0000000000..22acef22dc Binary files /dev/null and b/Gores/Thanatos/ThanatosTail3.png differ diff --git a/Gores/Thanatos/ThanatosTail4.png b/Gores/Thanatos/ThanatosTail4.png new file mode 100644 index 0000000000..09c638cebf Binary files /dev/null and b/Gores/Thanatos/ThanatosTail4.png differ diff --git a/Gores/Thanatos/ThanatosVentParticle1.png b/Gores/Thanatos/ThanatosVentParticle1.png new file mode 100644 index 0000000000..ec84d9232c Binary files /dev/null and b/Gores/Thanatos/ThanatosVentParticle1.png differ diff --git a/Gores/Thanatos/ThanatosVentParticle2.png b/Gores/Thanatos/ThanatosVentParticle2.png new file mode 100644 index 0000000000..50a693e93e Binary files /dev/null and b/Gores/Thanatos/ThanatosVentParticle2.png differ diff --git a/Gores/Thanatos/ThanatosVentParticle3.png b/Gores/Thanatos/ThanatosVentParticle3.png new file mode 100644 index 0000000000..221e95e948 Binary files /dev/null and b/Gores/Thanatos/ThanatosVentParticle3.png differ diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 35ceb5509b..c7002d826b 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -66,6 +66,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Silenced] = true; player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; + player.buffImmune[BuffID.WindPushed] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index ca086946d4..a0e1bd0fd4 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Silenced] = true; player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; + player.buffImmune[BuffID.WindPushed] = true; player.statLifeMax2 += 20; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.statDefense += 16; } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 0f0b4f89c7..eb509e1d5b 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Items.Accessories { public class MoonstoneCrown : ModItem { + // Base damage of lunar flares on stealth strikes. Increased by rogue damage stats, but not stealth damage. + internal const int BaseDamage = 85; + public override void SetStaticDefaults() { DisplayName.SetDefault("Moonstone Crown"); @@ -20,9 +23,9 @@ namespace CalamityMod.Items.Accessories { item.width = 46; item.height = 40; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.accessory = true; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Ammo/ArcticArrow.cs b/Items/Ammo/ArcticArrow.cs index 6c58499897..04a923661c 100644 --- a/Items/Ammo/ArcticArrow.cs +++ b/Items/Ammo/ArcticArrow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 16; + item.damage = 18; item.ranged = true; item.width = 22; item.height = 36; diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 5691cc88d9..303fb49dda 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 26; + item.damage = 29; item.ranged = true; item.width = 14; item.height = 36; diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index f78dee1983..cf2930ecdb 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 18; + item.damage = 20; item.ranged = true; item.width = 22; item.height = 36; diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index 1373462cb4..ac17b39ed5 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 14; + item.damage = 15; item.ranged = true; item.consumable = true; item.width = 18; diff --git a/Items/Ammo/NapalmArrow.cs b/Items/Ammo/NapalmArrow.cs index a8fb3b28e6..032e8f60f5 100644 --- a/Items/Ammo/NapalmArrow.cs +++ b/Items/Ammo/NapalmArrow.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 13; + item.damage = 14; item.ranged = true; item.width = 22; item.height = 36; diff --git a/Items/Ammo/TerraArrow.cs b/Items/Ammo/TerraArrow.cs index 8d50387403..12da4f9279 100644 --- a/Items/Ammo/TerraArrow.cs +++ b/Items/Ammo/TerraArrow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 14; + item.damage = 15; item.ranged = true; item.width = 22; item.height = 36; diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 448e0a2f8a..c3a3efd966 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +18,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 22; + item.damage = 24; item.ranged = true; item.width = 22; item.height = 46; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index f927f33194..79912e5635 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -215,6 +215,8 @@ namespace CalamityMod.Items } if (item.type == ItemID.StarCannon) item.UseSound = null; + if (item.type == ItemID.CelestialSigil) + item.consumable = false; } #endregion @@ -810,7 +812,11 @@ namespace CalamityMod.Items #region Modify Weapon Damage public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat) { - if (item.type < ItemID.Count) + // Nerf archery potion damage buff from 1.2x to 1.05x + if (item.useAmmo == AmmoID.Arrow && player.archery) + mult *= 0.875f; + + if (item.type < ItemID.Count) return; // Summon weapons specifically do not have their damage affected by charge. They still require charge to function however. diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index bf5da7bdde..43f918915b 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Items { // Apply standard post-ML rarities to the item's color first. Color? standardRarityColor = CalamityUtils.GetRarityColor(customRarity); - if (standardRarityColor.HasValue) + if (!item.expert && standardRarityColor.HasValue) nameLine.overrideColor = standardRarityColor.Value; #region Uniquely Colored Developer Items @@ -264,6 +264,10 @@ namespace CalamityMod.Items if (item.type == ItemID.RodofDiscord) EditTooltipByNum(0, (line) => line.text += "\nTeleportation is disabled while Chaos State is active"); + // Indicate that the Ankh Shield provides sandstorm wind push immunity + if (item.type == ItemID.AnkhShield) + EditTooltipByNum(1, (line) => line.text += ", including Mighty Wind"); + // Water removing items cannot be used in the Abyss string noAbyssLine = "\nCannot be used in the Abyss"; if (item.type == ItemID.SuperAbsorbantSponge) @@ -288,6 +292,10 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.text += immunityLine); } + // Nerfed Archery Potion tooltip + if (item.type == ItemID.ArcheryPotion) + EditTooltipByNum(0, (line) => line.text = "20% increased arrow speed and 1.05x arrow damage"); + // Hand Warmer provides Death Mode cold protection and has a side bonus with Eskimo armor if (item.type == ItemID.HandWarmer) { @@ -318,7 +326,7 @@ namespace CalamityMod.Items // Black Belt and Master Ninja Gear have guaranteed dodges on a 60 second cooldown. #region Dodging Belt Tooltips string beltDodgeLine = "Grants the ability to dodge attacks\n" + - $"The dodge has a {CalamityPlayer.BeltDodgeCooldown} second cooldown which is shared with all other dodges and reflects"; + $"The dodge has a {CalamityPlayer.BeltDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects"; if (item.type == ItemID.BlackBelt) EditTooltipByNum(0, (line) => line.text = beltDodgeLine); if (item.type == ItemID.MasterNinjaGear) diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index 10bcb5b0d7..983d631458 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -10,7 +10,9 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Odd Mushroom"); - Tooltip.SetDefault("Trippy"); + Tooltip.SetDefault("Causes you to see many fake, vibrant copies of all nearby entities\n" + + "These visual effects may be nauseating or otherwise bad for some\n" + + "Trippy"); } public override void SetDefaults() diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index f9c834c700..904c086a72 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -1,9 +1,10 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using CalamityMod.Projectiles.Typeless; +using static Terraria.ModLoader.ModContent; + namespace CalamityMod.Items.Tools { public class BobbitHook : ModItem @@ -11,17 +12,18 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { DisplayName.SetDefault("Bobbit Hook"); - Tooltip.SetDefault(@"Retracts upon attaching to a tile with extreme speeds -Reach: 40 -Launch Velocity: 25 -Pull Velocity: 28"); + Tooltip.SetDefault($@"Retracts upon attaching to a tile with extreme speeds +Reach: {BobbitHead.GrappleRangInTiles} +Launch Velocity: {BobbitHead.LaunchSpeed} +Reelback Velocity: {BobbitHead.ReelbackSpeed} +Pull Velocity: {BobbitHead.PullSpeed}"); } public override void SetDefaults() { // Instead of copying these values, we can clone and modify the ones we want to copy item.CloneDefaults(ItemID.AmethystHook); - item.shootSpeed = 25f; // how quickly the hook is shot. + item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. item.shoot = ProjectileType(); item.value = Item.buyPrice(1, 40, 0, 0); item.rare = ItemRarityID.Red; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 709fd95d9e..5155800c48 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CalamityGlobalItem modItem = item.Calamity(); item.shootSpeed = 10f; - item.damage = 310; + item.damage = 248; item.mana = 12; item.width = 38; item.height = 24; diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index ff177f9721..ff1244b646 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 30; item.width = 78; item.height = 78; - item.useTime = 33; - item.useAnimation = 33; + item.useTime = 41; + item.useAnimation = 41; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index e9f89d7ad1..af14db8a61 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 132; + item.damage = 155; item.magic = true; item.mana = 12; item.width = 80; item.height = 84; - item.useTime = 6; - item.useAnimation = 12; + item.useTime = 8; + item.useAnimation = 16; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 3ca1053c46..95db22cf7f 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 87; + item.damage = 150; item.magic = true; item.mana = 20; item.width = 72; diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index bbc3a8a0ec..8ac53ca068 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 200; + item.damage = 250; item.magic = true; item.mana = 10; item.width = 20; diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 751de4be03..d5c849419b 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 60; item.width = 130; item.height = 130; - item.useTime = 41; - item.useAnimation = 41; + item.useTime = 49; + item.useAnimation = 49; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 0f; diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 3c22271df5..aeef4ac3ea 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 102; - item.damage = 150; + item.damage = 140; item.melee = true; item.useAnimation = 15; item.useTime = 15; diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index a1c4df303f..5a119fb044 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 80; - item.damage = 1500; + item.damage = 900; item.useAnimation = 14; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 14; diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 1cf75ab8cc..e67e97b43a 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -29,7 +29,7 @@ Summons a barrage of petals and waterfalls on enemy hits"); item.width = 76; item.height = 82; item.melee = true; - item.damage = 1350; + item.damage = 660; item.knockBack = 9f; item.useAnimation = 20; item.useTime = 20; diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 7119bbaa05..115134a6c8 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 240; + item.damage = 1350; item.knockBack = 7.5f; item.useAnimation = item.useTime = 25; item.melee = true; diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index d16adc1054..1174c47e2b 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Weapons.Melee { public class ElementalExcalibur : ModItem { - private static int BaseDamage = 10000; + private static int BaseDamage = 2000; private int BeamType = 0; - private int alpha = 50; + private const int alpha = 50; public override void SetStaticDefaults() { diff --git a/Items/Weapons/Melee/ExoGladius.cs b/Items/Weapons/Melee/ExoGladius.cs index c8dd5e0755..38ce59ea03 100644 --- a/Items/Weapons/Melee/ExoGladius.cs +++ b/Items/Weapons/Melee/ExoGladius.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 12; item.width = 56; item.height = 56; - item.damage = 810; + item.damage = 690; item.melee = true; item.knockBack = 9.9f; item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index f1a7052f94..386badac26 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 60; item.height = 62; - item.damage = 380; + item.damage = 323; item.knockBack = 5.5f; item.scale = 1.5f; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index d7a7fa90c3..28ea5cf715 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.height = 128; item.width = 56; - item.damage = 6001; + item.damage = 2001; item.melee = true; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index 344be62473..fd80f86eb2 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { public const int YoyoBaseDamage = 115; public const int AuraBaseDamage = 40; - public const int AuraMaxDamage = 120; + public const int AuraMaxDamage = 105; public override void SetStaticDefaults() { diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index f8d2f52bbb..0b762aaddf 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 62; - item.damage = 60; + item.damage = 600; item.melee = true; item.useTime = 15; item.useAnimation = 15; diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 0a795ae9c0..a04e4965b7 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 150; + item.damage = 165; item.ranged = true; item.width = 60; item.height = 90; diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index 84e4d61ad4..7cb7a5f98d 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; + item.damage = 36; item.ranged = true; item.width = 82; item.height = 34; diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 0ad0be634b..2540705c3e 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 116; + item.damage = 128; item.ranged = true; item.width = 44; item.height = 100; diff --git a/Items/Weapons/Ranged/AstralRepeater.cs b/Items/Weapons/Ranged/AstralRepeater.cs index e321180af6..43525a57a8 100644 --- a/Items/Weapons/Ranged/AstralRepeater.cs +++ b/Items/Weapons/Ranged/AstralRepeater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; + item.damage = 99; item.ranged = true; item.width = 38; item.height = 78; diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 5cf4379c51..5dd3378fd9 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 139; + item.damage = 153; item.ranged = true; item.width = 40; item.height = 78; diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index f98abee769..df949f4a2a 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 8; + item.damage = 9; item.ranged = true; item.width = 30; item.height = 44; diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index 6b03d405bc..5497dd59bb 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 25; + item.damage = 28; item.ranged = true; item.width = 30; item.height = 42; diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index 545d583223..835e63e05b 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Bladedge Railbow"); Tooltip.SetDefault("Fires 4 arrows at once\n" + - "Fires 2 additional leafs"); + "Fires 2 additional leaves"); } public override void SetDefaults() { - item.damage = 25; + item.damage = 28; item.ranged = true; item.width = 74; item.height = 24; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; } Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index 8368c9ad7b..76746e2800 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 22; + item.damage = 25; item.ranged = true; item.width = 38; item.height = 68; @@ -63,11 +63,11 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 4.0), knockBack * 60f, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 4D), knockBack * 60f, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index 585546dc92..b2c3c43ffa 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 35; + item.damage = 39; item.ranged = true; item.width = 30; item.height = 58; diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 2ea823ab10..d5cf85a26a 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 60; + item.damage = 66; item.ranged = true; item.width = 34; item.height = 100; @@ -94,7 +94,7 @@ namespace CalamityMod.Items.Weapons.Ranged num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-600, 601) * 0.01f; float speedY5 = num79 + (float)Main.rand.Next(-600, 601) * 0.01f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, 0f); + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i); Main.projectile[projectile].tileCollide = false; Main.projectile[projectile].timeLeft = 240; Main.projectile[projectile].noDropItem = true; diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 20f30b579a..669d33a369 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 800; + item.damage = 880; item.ranged = true; item.width = 22; item.height = 50; diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 945f52d4de..5c23f18ce0 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; + item.damage = 88; item.ranged = true; item.width = 30; item.height = 38; diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index af5ae67f9d..068e05a682 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 35; + item.damage = 39; item.ranged = true; item.width = 40; item.height = 76; diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 10e9fed762..fea2ef351e 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 123; + item.damage = 135; item.width = 62; item.height = 128; item.useTime = 12; diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 54265c5709..d125919ff9 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 34; + item.damage = 37; item.ranged = true; item.width = 34; item.height = 62; @@ -41,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage, knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage / 2, knockBack, player.whoAmI); Main.projectile[projectile].penetrate = 3; return false; } diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 36b8b1227b..11cf5186af 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 225; + item.damage = 248; item.ranged = true; item.width = 40; item.height = 82; @@ -50,11 +50,11 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } else { - int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index a164c41246..f1ced9fdd0 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -24,7 +24,7 @@ Right click to fire two devastating barrages of five empowered fireballs. public override void SetDefaults() { - item.damage = 210; + item.damage = 231; item.knockBack = 1f; item.shootSpeed = 18f; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Ranged/EffluviumBow.cs b/Items/Weapons/Ranged/EffluviumBow.cs index 7f93344f01..b6ea7a4a0c 100644 --- a/Items/Weapons/Ranged/EffluviumBow.cs +++ b/Items/Weapons/Ranged/EffluviumBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 51; + item.damage = 56; item.ranged = true; item.width = 26; item.height = 70; diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index b9cf8264a0..0655bc5e9f 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - item.damage = 73; + item.damage = 80; item.ranged = true; item.width = 38; item.height = 62; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; return true; diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index 6ba4c06caa..6c4e1d6f48 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 15; + item.damage = 17; item.ranged = true; item.width = 20; item.height = 62; @@ -55,12 +55,12 @@ namespace CalamityMod.Items.Weapons.Ranged } if (type == ProjectileID.WoodenArrowFriendly) { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); Main.projectile[num123].noDropItem = true; } else { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index 3ab6e4f38e..07fb34fb34 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 16; + item.damage = 18; item.ranged = true; item.width = 32; item.height = 52; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI); } return true; } diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index 285b48b6cb..2683865d18 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; + item.damage = 33; item.ranged = true; item.width = 30; item.height = 50; diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 94ee9b1fbb..ee6f68dc88 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 31; + item.damage = 34; item.ranged = true; item.width = 18; item.height = 36; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged { type = ProjectileID.FireArrow; } - int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged ProjectileID.HellfireArrow, ProjectileID.IchorArrow }); - int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; Main.projectile[index].usesLocalNPCImmunity = true; Main.projectile[index].localNPCHitCooldown = 10; diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 79778836df..cad26edbf9 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 180; + item.damage = 198; item.ranged = true; item.width = 44; item.height = 58; diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index a906748203..b7ac84a6a4 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 29; + item.damage = 32; item.ranged = true; item.width = 22; item.height = 62; diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 62e7d7bde6..5f6ad22d3b 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 51; + item.damage = 56; item.ranged = true; item.width = 36; item.height = 58; diff --git a/Items/Weapons/Ranged/MandibleBow.cs b/Items/Weapons/Ranged/MandibleBow.cs index ef54421387..1efd420107 100644 --- a/Items/Weapons/Ranged/MandibleBow.cs +++ b/Items/Weapons/Ranged/MandibleBow.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -//using TerrariaOverhaul; namespace CalamityMod.Items.Weapons.Ranged { @@ -14,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 13; + item.damage = 14; item.ranged = true; item.width = 22; item.height = 40; @@ -28,13 +27,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.UseSound = SoundID.Item5; item.autoReuse = false; item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 30f; + item.shootSpeed = 15f; item.useAmmo = AmmoID.Arrow; } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ } } diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index ef39ff086c..7e1aba9f60 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 27; + item.damage = 30; item.ranged = true; item.width = 36; item.height = 110; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged int randomExtraUpdates = Main.rand.Next(3); float SpeedX = speedX + Main.rand.NextFloat(-10f, 10f) * 0.05f; float SpeedY = speedY + Main.rand.NextFloat(-10f, 10f) * 0.05f; - int arrow = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int arrow = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[arrow].noDropItem = true; Main.projectile[arrow].extraUpdates += randomExtraUpdates; //0 to 2 extra updates if (type == ProjectileID.JestersArrow) diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index bfe974a56c..b83678ce00 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 110; + item.damage = 121; item.ranged = true; item.width = 46; item.height = 78; diff --git a/Items/Weapons/Ranged/NettlelineGreatbow.cs b/Items/Weapons/Ranged/NettlelineGreatbow.cs index 9e484532a9..12e903e8e3 100644 --- a/Items/Weapons/Ranged/NettlelineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlelineGreatbow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 66; + item.damage = 73; item.ranged = true; item.width = 36; item.height = 64; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged { value9 -= vector7; } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; } return false; diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 4b19f9360e..09058c828c 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 100; + item.damage = 125; item.ranged = true; item.width = 80; item.height = 46; diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index d7e01f2558..443615e0cd 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 100; + item.damage = 110; item.width = 20; item.height = 12; item.useTime = 12; diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 613c13324a..cac500b1b0 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 53; + item.damage = 58; item.ranged = true; item.width = 58; item.height = 102; @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float speedX4 = num78 + Main.rand.Next(-120, 121) * 0.02f; float speedY5 = num79 + Main.rand.Next(-120, 121) * 0.02f; - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/RaidersGlory.cs b/Items/Weapons/Ranged/RaidersGlory.cs index 8f1a6ee389..e9455cec62 100644 --- a/Items/Weapons/Ranged/RaidersGlory.cs +++ b/Items/Weapons/Ranged/RaidersGlory.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 40; + item.damage = 44; item.ranged = true; item.width = 50; item.height = 22; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI); Main.projectile[projectile].extraUpdates++; return false; } diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index 3885ee3097..88ea30d220 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 11; + item.damage = 12; item.ranged = true; item.width = 22; item.height = 46; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)((double)damage * 0.4), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 0.4), 0f, player.whoAmI); return true; } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index d76e7cdcbc..3239ae9374 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; + item.damage = 33; item.ranged = true; item.width = 30; item.height = 38; diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index e73b4c60e5..6d0280ffd7 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 160; + item.damage = 176; item.ranged = true; item.width = 54; item.height = 92; diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 580fe39378..947b4357db 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; + item.damage = 99; item.ranged = true; item.width = 40; item.height = 70; diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index 3caceec9a9..21453f6289 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 22; + item.damage = 24; item.ranged = true; item.width = 34; item.height = 50; @@ -87,17 +87,17 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.01f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i); } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i); Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i, 0f, 0f); + int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i); Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i, 0f, 0f); + int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 8e04d265c1..54d92d0889 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 8; + item.damage = 9; item.ranged = true; item.width = 20; item.height = 54; diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index e42439a840..19d0b237cf 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 105; + item.damage = 116; item.ranged = true; item.width = 44; item.height = 58; diff --git a/Items/Weapons/Ranged/WulfrumBow.cs b/Items/Weapons/Ranged/WulfrumBow.cs index 232004bc1d..1660639d10 100644 --- a/Items/Weapons/Ranged/WulfrumBow.cs +++ b/Items/Weapons/Ranged/WulfrumBow.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; -//using TerrariaOverhaul; namespace CalamityMod.Items.Weapons.Ranged { @@ -15,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 10; + item.damage = 11; item.ranged = true; item.width = 27; item.height = 38; @@ -33,11 +32,6 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = AmmoID.Arrow; } - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 4e02ac68b3..11fd20a13e 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 340; + item.damage = 272; item.knockBack = 6f; item.useAnimation = item.useTime = 20; item.Calamity().rogue = true; diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index b4843872dd..59dd4e0c13 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 10 && counter == 0 && stealth.WithinBounds(Main.maxProjectiles)) { - damage = (int)(damage * 1.07); + damage = (int)(damage * 3.21); Main.projectile[stealth].Calamity().stealthStrike = true; Main.PlaySound(SoundID.Item73, player.position); for (float i = 0; i < 5; i++) diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 2635b81f18..39f4604d36 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -40,10 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.Calamity().StealthStrikeAvailable()) - { type = ModContent.ProjectileType(); - damage = (int)(damage * 0.36); - } int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) @@ -57,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 005fdbf436..6f0dce3d0f 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -39,6 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (player.Calamity().StealthStrikeAvailable()) + damage /= 2; + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index edb8f783e4..050935ff19 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue { bool usingStealth = player.Calamity().StealthStrikeAvailable() && counter == 0; if (usingStealth) - damage *= 2; + damage = (int)(damage * 3.61); int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (usingStealth && stealth.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index 7a2f600c95..e3ae13baf5 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Ghoulish Gouger"); Tooltip.SetDefault("Throws sets of four ghoulish scythes at ultra high velocity\n" + - "Stealth strikes spawn tormented souls on hit"); + "Stealth strikes summon a flurry of tormented souls on hit"); } public override void SafeSetDefaults() diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index ef16687c58..4a27fc49f1 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -69,6 +69,7 @@ Right click to delete all existing spiky balls"); modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { + damage = (int)(damage * 1.12); int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 31d88e5346..ddd8c0c2d6 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -7,13 +7,16 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Hypothermia : RogueWeapon + public class Hypothermia : RogueWeapon { + // For more consistent DPS, always alternates between throwing 1 and 2 instead of picking randomly + private bool throwTwo = true; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hypothermia"); - Tooltip.SetDefault("Fires a constant barrage of black ice shards\n" + - "Stealth strikes additionally fire short ranged ice chunks that shatter into ice shards"); + Tooltip.SetDefault("Throws a constant barrage of black ice shards\n" + + "Stealth strikes hurl a set of razor sharp ice chunks that shatter on impact"); } public override void SafeSetDefaults() @@ -24,11 +27,11 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.noMelee = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item9; + item.UseSound = SoundID.Item7; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = ItemRarityID.Red; - item.damage = 206; + item.damage = 200; item.useAnimation = 21; item.useTime = 3; item.reuseDelay = 1; @@ -40,33 +43,37 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.Calamity().StealthStrikeAvailable()) - damage = (int)(damage * 1.55); - - if (player.Calamity().StealthStrikeAvailable() && player.itemAnimation == item.useAnimation - 1) //setting up the stealth strikes { - damage = (int)(damage * 1.7); - - for (int i = 0; i < 4; i++) + int stealthDamage = (int)(damage * 1.2f); + for (int i = 0; i < 4; ++i) { - Vector2 chunkVelocity = new Vector2(speedX, speedY).RotatedByRandom(0.13f) * Main.rand.NextFloat(1f, 1.1f); - int stealth = Projectile.NewProjectile(position, chunkVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Vector2 chunkVelocity = new Vector2(speedX, speedY).RotatedByRandom(0.07f) * Main.rand.NextFloat(1.1f, 1.18f); + int stealth = Projectile.NewProjectile(position, chunkVelocity, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } + + // On a stealth strike, only the chunks are thrown. + return false; + } + + // Regular attacks alternate between throwing one and two shards at a time. + int projAmt = throwTwo ? 2 : 1; + throwTwo = !throwTwo; + + for (int i = 0; i < projAmt; ++i) + { + float SpeedX = speedX + Main.rand.NextFloat(-2f, 2f); + float SpeedY = speedY + Main.rand.NextFloat(-2f, 2f); + int texID = Main.rand.Next(4); + Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, damage, knockBack, player.whoAmI, texID, 0f); } - int projAmt = Main.rand.Next(1, 3); - for (int index = 0; index < projAmt; ++index) - { - float SpeedX = speedX + Main.rand.NextFloat(-2f, 2f); - float SpeedY = speedY + Main.rand.NextFloat(-2f, 2f); - Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, damage, knockBack, player.whoAmI, Main.rand.Next(4), 0f); - } return false; } diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index 2ff79176df..989447ddb2 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 72; - item.damage = 300; + item.damage = 700; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 13; @@ -38,6 +38,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 0.6); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index cbc7939b8b..a0819b7d78 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -43,6 +43,7 @@ Stealth strikes release energy as they fly"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { + damage = (int)(damage * 0.9f); int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index a3e20d95f5..1f220218c9 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.Calamity().StealthStrikeAvailable()) - damage = (int)(damage * 0.8); + damage = (int)(damage * 0.68); int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index c40b9b7876..4500d58c06 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue Tooltip.SetDefault("Space chickens, that is all.\n" + "Fires random utensils in bursts of three\n" + "Grants Well Fed on enemy hits\n" + - "Stealth strikes replace the first utensil with a powerful butcher knife"); + "Stealth strikes replace any utensil with a powerful butcher knife"); } public override void SafeSetDefaults() @@ -44,11 +44,12 @@ namespace CalamityMod.Items.Weapons.Rogue { CalamityPlayer mp = player.Calamity(); - // On a stealth strike, the first projectile is replaced with a butcher knife. - if (mp.StealthStrikeAvailable() && counter == 0) + if (mp.StealthStrikeAvailable()) { - int stealthDamage = damage; - int stealth = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); + int stealthDamage = damage * 2; + float stealthSpeedMult = 1.4f; + Vector2 stealthVelocity = new Vector2(speedX, speedY) * stealthSpeedMult; + int stealth = Projectile.NewProjectile(position, stealthVelocity, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index ff58061afe..ca405e227c 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.mana = 50; - item.damage = 100; + item.damage = 83; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 32; item.height = 32; diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 5bc22b7197..2959295f06 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; item.summon = true; item.mana = 11; - item.damage = 114; + item.damage = 97; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index b99c68d965..bd29889670 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.mana = 100; - item.damage = 900; + item.damage = 630; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 74; item.height = 72; diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 921e12ebcf..13e8d4b50c 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 139; + item.damage = 111; item.mana = 10; item.width = 46; item.height = 28; diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index ceb7ee7c54..7895ed20d6 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item60; item.summon = true; item.mana = 10; - item.damage = 225; + item.damage = 180; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index b72784fbb9..e98a584151 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item42; item.summon = true; item.mana = 16; - item.damage = 216; + item.damage = 173; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 15; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index a58bd10a06..447091eaa0 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 240; + item.damage = 96; item.mana = 12; item.width = item.height = 32; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 204798affb..1a19d8ed1a 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.mana = 100; - item.damage = 170; + item.damage = 145; item.knockBack = 4f; item.useTime = item.useAnimation = 10; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 3fc0a3b48d..2f5d64f4fd 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Summon public class StaffoftheMechworm : ModItem { // This value is also referenced by the God Slayer and Auric summoner helmets. - public const int BaseDamage = 161; // originally 325 + public const int BaseDamage = 144; // originally 325 public override void SetStaticDefaults() { DisplayName.SetDefault("Staff of the Mechworm"); diff --git a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs index 15e199468e..9302bb29e3 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Abyss npc.width = 60; npc.height = 88; npc.defense = 0; - npc.LifeMaxNERB(1000000, 1150000); + npc.LifeMaxNERB(1750000, 2012500); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -47,31 +47,41 @@ namespace CalamityMod.NPCs.Abyss if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } - if (!NPC.AnyNPCs(ModContent.NPCType())) - npc.active = false; + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - bool invisiblePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 1f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 5f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 7f; - if (!invisiblePhase) + float chargePhaseGateValue = 300f; + float lightningChargePhaseGateValue = 180f; + + bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; + bool invisiblePhase = calamityGlobalNPC_Head.newAI[0] == 1f || calamityGlobalNPC_Head.newAI[0] == 5f || calamityGlobalNPC_Head.newAI[0] == 7f; + if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { - npc.Opacity += 0.15f; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } @@ -83,6 +93,30 @@ namespace CalamityMod.NPCs.Abyss npc.Opacity = 0f; } + bool shootShadowFireballs = (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || + (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FinalPhase && calamityGlobalNPC_Head.newAI[1] > 0f); + if (shootShadowFireballs && Main.netMode != NetmodeID.MultiplayerClient) + { + if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) + { + npc.ai[3] += 1f; + float shootShadowFireballGateValue = 90f; + float divisor = 5f; + if (npc.ai[3] % divisor == 0f && npc.ai[3] >= shootShadowFireballGateValue) + { + npc.ai[3] = 0f; + float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); + float fireballVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; + Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center; + Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; + int type = ProjectileID.CultistBossFireBallClone; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + } + } + } + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); diff --git a/NPCs/Abyss/EidolonWyrmBodyHuge.cs b/NPCs/Abyss/EidolonWyrmBodyHuge.cs index 94f858815b..197f7113c1 100644 --- a/NPCs/Abyss/EidolonWyrmBodyHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyHuge.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Abyss npc.width = 60; npc.height = 88; npc.defense = 0; - npc.LifeMaxNERB(1000000, 1150000); + npc.LifeMaxNERB(1750000, 2012500); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -47,31 +47,41 @@ namespace CalamityMod.NPCs.Abyss if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } - if (!NPC.AnyNPCs(ModContent.NPCType())) - npc.active = false; + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - bool invisiblePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 1f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 5f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 7f; - if (!invisiblePhase) + float chargePhaseGateValue = 300f; + float lightningChargePhaseGateValue = 180f; + + bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; + bool invisiblePhase = calamityGlobalNPC_Head.newAI[0] == 1f || calamityGlobalNPC_Head.newAI[0] == 5f || calamityGlobalNPC_Head.newAI[0] == 7f; + if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { - npc.Opacity += 0.15f; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } @@ -83,21 +93,26 @@ namespace CalamityMod.NPCs.Abyss npc.Opacity = 0f; } - bool shootShadowFireballs = (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 6f && Main.npc[(int)npc.ai[2]].Calamity().newAI[2] > 0f) || - (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 10f && Main.npc[(int)npc.ai[2]].Calamity().newAI[1] > 0f); + bool shootShadowFireballs = (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || + (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FinalPhase && calamityGlobalNPC_Head.newAI[1] > 0f); if (shootShadowFireballs && Main.netMode != NetmodeID.MultiplayerClient) { - if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 320f) + if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) { npc.ai[3] += 1f; - if (npc.ai[3] >= 90f) + float spawnAncientLightGateValue = 180f; + float divisor = 10f; + if (npc.ai[0] % divisor == 0f && npc.ai[3] >= spawnAncientLightGateValue) { - float fireballVelocity = 4f; + npc.ai[3] = 0f; + float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); + float lightVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center; - Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; - int type = ProjectileID.CultistBossIceMist; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer); + Vector2 velocity = Vector2.Normalize(destination) * lightVelocity; + int type = NPCID.AncientLight; + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; + int light = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, type, 0, 0f, ai, velocity.X, velocity.Y, 255); + Main.npc[light].velocity = velocity; } } } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index c587300883..6e15d84c4f 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -73,7 +73,13 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState || NPC.AnyNPCs(ModContent.NPCType())) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState || adultWyrmAlive) { detectsPlayer = true; npc.damage = Main.expertMode ? 340 : 170; @@ -146,31 +152,23 @@ namespace CalamityMod.NPCs.Abyss npc.localAI[0] = 0f; npc.TargetClosest(true); npc.netUpdate = true; - int damage = 80; - if (Main.expertMode) - { - damage = 60; - } + int damage = adultWyrmAlive ? (Main.expertMode ? 150 : 200) : (Main.expertMode ? 60 : 80); float xPos = Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f; Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); int random = Main.rand.Next(3); if (random == 0) { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector2, Vector2.Zero, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); } else if (random == 1) { Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); if (vec.HasNaNs()) { - vec = new Vector2((float)npc.direction, 0f); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); + vec = new Vector2(npc.direction, 0f); } + Vector2 vector4 = vec * (adultWyrmAlive ? 6f : 4f); + Projectile.NewProjectile(vector2, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); } else { @@ -279,6 +277,14 @@ namespace CalamityMod.NPCs.Abyss num188 = 15f; num189 = 0.25f; } + if (adultWyrmAlive) + { + if (!Main.player[npc.target].Calamity().ZoneAbyssLayer4) + { + num188 = 22.5f; + num189 = 0.375f; + } + } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 2ecc01a400..a7182ef055 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -16,9 +16,10 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { - public class EidolonWyrmHeadHuge : ModNPC + [AutoloadBossHead] + public class EidolonWyrmHeadHuge : ModNPC { - private enum Phase + public enum Phase { ChargeOne = 0, LightningRain = 1, @@ -33,19 +34,40 @@ namespace CalamityMod.NPCs.Abyss FinalPhase = 10 } - private float AIState + public float AIState { get => npc.Calamity().newAI[0]; set => npc.Calamity().newAI[0] = value; } + // Base distance from the target for most attacks + private const float baseDistance = 1000f; + + // Base distance from target location in order to continue turning + private const float baseTurnDistance = 160f; + + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 2800f; + + // The end location of each charge Vector2 chargeDestination = default; + + // Length variables private const int minLength = 40; private const int maxLength = 41; + + // Variable used to stop the segment spawning loop private bool TailSpawned = false; + + // The direction to spin in during spin phases private int rotationDirection = 0; + + // Used in the lerp to smoothly scale velocity up and down private float chargeVelocityScalar = 0f; + // How much less time is needed before activating fast charge + private const float fastChargeGateValue = 120f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eidolon Wyrm"); @@ -62,7 +84,7 @@ namespace CalamityMod.NPCs.Abyss npc.DR_NERD(0.4f); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(1000000, 1150000); + npc.LifeMaxNERB(1750000, 2012500); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -112,6 +134,8 @@ namespace CalamityMod.NPCs.Abyss { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.adultEidolonWyrmHead = npc.whoAmI; + // Difficulty modes bool malice = CalamityWorld.malice; bool death = CalamityWorld.death || malice; @@ -143,17 +167,16 @@ namespace CalamityMod.NPCs.Abyss // Target variable Player player = Main.player[npc.target]; + bool targetDownDeep = player.Calamity().ZoneAbyssLayer4; + if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; // Play spawn sound if (!TailSpawned && npc.ai[0] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), Main.player[Main.myPlayer].Center); } // Spawn segments @@ -176,9 +199,9 @@ namespace CalamityMod.NPCs.Abyss lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } @@ -205,33 +228,6 @@ namespace CalamityMod.NPCs.Abyss } } - // Delete self if far from target or tail doesn't exist - if (Vector2.Distance(player.Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) - npc.active = false; - - // Adjust opacity - bool invisiblePhase = calamityGlobalNPC.newAI[0] == (float)Phase.LightningRain || calamityGlobalNPC.newAI[0] == (float)Phase.IceMist || calamityGlobalNPC.newAI[0] == (float)Phase.AncientDoomSummon; - npc.dontTakeDamage = invisiblePhase; - if (!invisiblePhase) - { - npc.Opacity += 0.15f; - if (npc.Opacity > 1f) - npc.Opacity = 1f; - } - else - { - npc.Opacity -= 0.05f; - if (npc.Opacity < 0f) - npc.Opacity = 0f; - } - - // Rotation and direction - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; - int direction = npc.direction; - npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1); - if (direction != npc.direction) - npc.netUpdate = true; - // General AI pattern // Charge // Charge : Phase 2 - Spin around target and summon Shadow Fireballs @@ -257,13 +253,49 @@ namespace CalamityMod.NPCs.Abyss // Phase 5 - 0, 6, 8, 1, 2, 2, 4, 7, 8, 5, 2, 2 // Phase 6 - 10 + // Phase gate values + float velocityAdjustTime = 20f; + float chargePhaseGateValue = 300f; + float lightningRainDuration = 180f; + float eidolonWyrmPhaseDuration = 180f; + float iceMistDuration = 180f; + float spinPhaseDuration = 300f; + float ancientDoomPhaseGateValue = 30f; + float ancientDoomGateValue = 120f; + float lightningChargePhaseGateValue = 180f; + + // Adjust opacity + bool invisiblePartOfChargePhase = calamityGlobalNPC.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC.newAI[2] <= chargePhaseGateValue + 1f && (AIState == (float)Phase.ChargeOne || AIState == (float)Phase.ChargeTwo || AIState == (float)Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC.newAI[2] <= lightningChargePhaseGateValue + 1f && AIState == (float)Phase.LightningCharge; + bool invisiblePhase = AIState == (float)Phase.LightningRain || AIState == (float)Phase.IceMist || AIState == (float)Phase.AncientDoomSummon; + npc.dontTakeDamage = invisiblePartOfChargePhase || invisiblePartOfLightningChargePhase || invisiblePhase; + if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Rotation and direction + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + int direction = npc.direction; + npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1); + if (direction != npc.direction) + npc.netUpdate = true; + // Default vector to swim to Vector2 destination = player.Center; // Charge variables - Vector2 chargeVector = default; - float chargeDistance = 1000f; - float turnDistance = 640f; + Vector2 chargeVector = Vector2.Zero; + float chargeDistance = baseDistance; + float turnDistance = baseTurnDistance; float chargeLocationDistance = turnDistance * 0.2f; switch ((int)calamityGlobalNPC.newAI[1]) { @@ -298,37 +330,35 @@ namespace CalamityMod.NPCs.Abyss } Vector2 chargeLocation = destination + chargeVector; Vector2 chargeVectorFlipped = chargeVector * -1f; + float chargePredictionAmt = 60f; // Lightning Rain variables - Vector2 lightningRainLocation = new Vector2(0f, -1200f); + Vector2 lightningRainLocation = new Vector2(0f, -baseDistance); float lightningRainLocationDistance = turnDistance * 0.2f; // Wyrm and Eidolist variables - Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, 1200f); + Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, baseDistance); float eidolonWyrmPhaseLocationDistance = turnDistance * 0.5f; - int maxEidolists = 10; + int maxEidolists = targetDownDeep ? 3 : 5; // Ice Mist variables - Vector2 iceMistLocation = new Vector2(0f, 1200f); + Vector2 iceMistLocation = new Vector2(0f, baseDistance); float iceMistLocationDistance = turnDistance * 0.2f; // Spin variables - float spinRadius = 800f; + float spinRadius = baseDistance; Vector2 spinLocation = new Vector2(0f, -spinRadius); float spinLocationDistance = turnDistance * 0.1f; - float degreesOfRotation = 2f; - int totalRotations = 3; // Ancient Doom variables - Vector2 ancientDoomLocation = new Vector2(0f, -1200f); + Vector2 ancientDoomLocation = new Vector2(0f, -baseDistance); float ancientDoomLocationDistance = turnDistance * 0.2f; - int ancientDoomLimit = 6; - int ancientDoomDegrees = 360 / ancientDoomLimit; - int ancientDoomDistance = 640; + int ancientDoomLimit = targetDownDeep ? 3 : 5; + int ancientDoomDistance = 550; float maxAncientDoomRings = 3f; // Lightning charge variables - Vector2 lightningChargeVector = npc.localAI[2] == 0f ? new Vector2(1000f, 0f) : new Vector2(-1000f, 0f); + Vector2 lightningChargeVector = npc.localAI[2] == 0f ? new Vector2(baseDistance, 0f) : new Vector2(-baseDistance, 0f); float lightningChargeLocationDistance = turnDistance * 0.2f; Vector2 lightningChargeLocation = destination + lightningChargeVector; Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; @@ -338,28 +368,15 @@ namespace CalamityMod.NPCs.Abyss float distanceBetweenBolts = lightningSpawnY * 2f / numLightningBolts; // Velocity and turn speed values - float baseVelocity = !player.wet ? player.velocity.Length() + 8f : player.velocity.Length() + 4f; - float turnSpeed = !player.wet ? MathHelper.ToRadians(4f) : MathHelper.ToRadians(2f); + float baseVelocity = targetDownDeep ? 12f : 18f; + float turnSpeed = targetDownDeep ? MathHelper.ToRadians(1.5f) : MathHelper.ToRadians(2.25f); float normalChargeVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); - float normalChargeTurnSpeedMult = 1f - MathHelper.Lerp(0f, 0.5f, chargeVelocityScalar); + float normalChargeTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar); float invisiblePhaseVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); + float invisiblePhaseTurnSpeedMult = MathHelper.Lerp(1f, 6f, chargeVelocityScalar); float fastChargeVelocityMult = MathHelper.Lerp(1f, 3f, chargeVelocityScalar); - float fastChargeTurnSpeedMult = 1f - MathHelper.Lerp(0f, 0.5f, chargeVelocityScalar); - float chargeVelocityScalarIncrement = 0.05f; - - // Phase gate values - float chargePhaseGateValue = 180f; - float chargeGateValue = chargePhaseGateValue + 10f; - float lightningRainDuration = 180f; - float lightningRainPhaseDuration = lightningRainDuration + 30f; - float eidolonWyrmPhaseDuration = 600f; - float iceMistDuration = 180f; - float iceMistPhaseDuration = iceMistDuration + 30f; - float spinPhaseDuration = 360 * totalRotations / degreesOfRotation; - float ancientDoomPhaseGateValue = 30f; - float ancientDoomGateValue = 120f; - float lightningChargePhaseGateValue = 90f; - float lightningChargeGateValue = lightningChargePhaseGateValue + 10f; + float fastChargeTurnSpeedMult = MathHelper.Lerp(1f, 12f, chargeVelocityScalar); + float chargeVelocityScalarIncrement = 0.025f; // Phase switch switch ((int)AIState) @@ -369,68 +386,75 @@ namespace CalamityMod.NPCs.Abyss if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } + + baseVelocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; turnDistance = chargeLocationDistance; + if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { - if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - - if (calamityGlobalNPC.newAI[2] < chargeGateValue) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - // Turn for 10 frames before the charge - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == chargeGateValue) - chargeDestination = destination + chargeVectorFlipped; + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + + chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; } else { // Charge - // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; - - baseVelocity *= normalChargeVelocityMult; - turnSpeed *= normalChargeTurnSpeedMult; + // Become totally visible + npc.Opacity = 1f; destination = chargeDestination; - if ((destination - npc.Center).Length() < chargeLocationDistance) + if ((destination - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[3] > 1f) { - npc.ai[3] += 1f; - float maxCharges = phase4 ? 1 : phase2 ? 2 : 3; - if (npc.ai[3] >= maxCharges) + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) { - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.ShadowFireballSpin : (float)Phase.LightningRain; - } - else if (phase2) - calamityGlobalNPC.newAI[0] = (float)Phase.ShadowFireballSpin; + npc.ai[3] += 1f; + float maxCharges = phase4 ? 1 : phase2 ? 2 : 3; + if (npc.ai[3] >= maxCharges) + { + npc.ai[3] = 0f; + AIState = phase4 ? (float)Phase.ShadowFireballSpin : (float)Phase.LightningRain; + } + else if (phase2) + AIState = (float)Phase.ShadowFireballSpin; - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] > 7f) - calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - - chargeVelocityScalar = 0f; - - if (phase6) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; + calamityGlobalNPC.newAI[3] = 1f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); } - - npc.TargetClosest(); } } } else - destination += chargeLocation; + destination += chargeVector; } else calamityGlobalNPC.newAI[2] += 1f; @@ -445,116 +469,115 @@ namespace CalamityMod.NPCs.Abyss turnDistance = lightningRainLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } baseVelocity *= invisiblePhaseVelocityMult; - turnSpeed *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; if ((destination - npc.Center).Length() < lightningRainLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { - if (calamityGlobalNPC.newAI[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), npc.Center); - - calamityGlobalNPC.newAI[2] += 1f; - - if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < lightningRainDuration && Main.netMode != NetmodeID.MultiplayerClient) + if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < lightningRainDuration) { - int maxTargets = 2; - int[] whoAmIArray = new int[maxTargets]; - Vector2[] targetCenterArray = new Vector2[maxTargets]; - int numProjectiles = 0; - float maxDistance = 2400f; + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.player[Main.myPlayer].Center); - for (int i = 0; i < Main.maxPlayers; i++) + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (!Main.player[i].active || Main.player[i].dead) - continue; + int maxTargets = 2; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; - Vector2 playerCenter = Main.player[i].Center; - float distance = Vector2.Distance(playerCenter, npc.Center); - if (distance < maxDistance && Collision.CanHit(npc.Center, 1, 1, playerCenter, 1, 1)) + for (int i = 0; i < Main.maxPlayers; i++) { - whoAmIArray[numProjectiles] = i; - targetCenterArray[numProjectiles] = playerCenter; - int num34 = numProjectiles + 1; - numProjectiles = num34; - if (num34 >= targetCenterArray.Length) - break; + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } } - } - float predictionAmt = 40f; - float lightningVelocity = 8f; - for (int i = 0; i < numProjectiles; i++) - { - // Predictive bolt - Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; - float ai = Main.rand.Next(100); - Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - int type = ProjectileID.CultistBossLightningOrbArc; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + float predictionAmt = targetDownDeep ? 45f : 60f; + float lightningVelocity = targetDownDeep ? 6f : 8f; + for (int i = 0; i < numProjectiles; i++) + { + // Predictive bolt + Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + float ai = Main.rand.Next(100); + Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; + int type = ProjectileID.CultistBossLightningOrbArc; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + Main.projectile[proj].tileCollide = false; - // Opposite bolt - projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; - ai = Main.rand.Next(100); - projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + // Opposite bolt + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + ai = Main.rand.Next(100); + projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; + proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + Main.projectile[proj].tileCollide = false; - // Normal bolt - projectileDestination = targetCenterArray[i] - npc.Center; - ai = Main.rand.Next(100); - projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + // Normal bolt + projectileDestination = targetCenterArray[i] - npc.Center; + ai = Main.rand.Next(100); + projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; + proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + Main.projectile[proj].tileCollide = false; + } } } + calamityGlobalNPC.newAI[2] += 1f; + Lighting.AddLight(npc.Center, 0.4f, 0.85f, 0.9f); - float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num737 < -0.5f) - num737 = -0.5f; - if (num737 > 0.5f) - num737 = 0.5f; + float rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); + Vector2 dustPosition = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + int dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - npc.Center) * 2f; + Main.dust[dust].noGravity = true; - Vector2 value40 = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(num737 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - int num738 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - Main.dust[num738].position = npc.Center + value40; - Main.dust[num738].velocity = Vector2.Normalize(Main.dust[num738].position - npc.Center) * 2f; - Main.dust[num738].noGravity = true; + rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); + dustPosition = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[dust].velocity = Vector2.Zero; + Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].noGravity = true; - float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num740 < -0.5f) - num740 = -0.5f; - if (num740 > 0.5f) - num740 = 0.5f; - - Vector2 value41 = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(num740 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - int num741 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - Main.dust[num741].velocity = Vector2.Zero; - Main.dust[num741].position = npc.Center + value41; - Main.dust[num741].noGravity = true; - - if (calamityGlobalNPC.newAI[2] >= lightningRainPhaseDuration) + if (calamityGlobalNPC.newAI[2] >= lightningRainDuration) { - npc.localAI[0] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FastCharge; - calamityGlobalNPC.newAI[2] = 90f; + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; - chargeVelocityScalar = 0f; - - if (phase6) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; + npc.localAI[0] = 0f; + AIState = (float)Phase.FastCharge; + calamityGlobalNPC.newAI[2] = fastChargeGateValue; + calamityGlobalNPC.newAI[3] = 1f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); } - - npc.TargetClosest(); } } @@ -565,80 +588,89 @@ namespace CalamityMod.NPCs.Abyss if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } + + baseVelocity *= fastChargeVelocityMult; + turnSpeed *= fastChargeTurnSpeedMult; turnDistance = chargeLocationDistance; + if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { - if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - - if (calamityGlobalNPC.newAI[2] < chargeGateValue) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - // Slow down and quickly turn for 10 frames before the charge - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == chargeGateValue) - chargeDestination = destination + chargeVectorFlipped; + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + + chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; } else { // Charge very quickly - // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; + // Become totally visible + npc.Opacity = 1f; - baseVelocity *= fastChargeVelocityMult; - turnSpeed *= fastChargeTurnSpeedMult; destination = chargeDestination; - if ((destination - npc.Center).Length() < chargeLocationDistance) + if ((destination - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[3] > 1f) { - if (!phase5) + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) { - calamityGlobalNPC.newAI[0] = npc.localAI[0] == 0f ? (float)Phase.EidolonWyrmSpawn : (float)Phase.EidolistSpawn; - calamityGlobalNPC.newAI[2] = 0f; - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 2f) + if (!phase5) { - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[0] = npc.localAI[0] == 0f ? (float)Phase.ChargeTwo : (float)Phase.ChargeOne; + AIState = npc.localAI[0] == 0f ? (float)Phase.EidolonWyrmSpawn : (float)Phase.EidolistSpawn; calamityGlobalNPC.newAI[2] = 0f; } else - calamityGlobalNPC.newAI[2] = 90f; + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 2f) + { + npc.ai[3] = 0f; + AIState = npc.localAI[0] == 0f ? (float)Phase.ChargeTwo : (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + } + else + calamityGlobalNPC.newAI[2] = fastChargeGateValue; + } + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[3] = 1f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); } - - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] > 7f) - calamityGlobalNPC.newAI[1] = 0f; - - chargeVelocityScalar = 0f; - - if (phase6) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; - } - - npc.TargetClosest(); } } } else - destination += chargeLocation; + destination += chargeVector; } else calamityGlobalNPC.newAI[2] += 1f; break; - // Summon an Eidolon Wyrm and swim below the target for 10 seconds, or less, if the Wyrm dies + // Summon an Eidolon Wyrm and swim below the target for 3 seconds, or less, if the Wyrm dies case (int)Phase.EidolonWyrmSpawn: destination += eidolonWyrmPhaseLocation; @@ -647,25 +679,24 @@ namespace CalamityMod.NPCs.Abyss if (Main.netMode != NetmodeID.MultiplayerClient) { if (calamityGlobalNPC.newAI[2] == 0f) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + { + if (!NPC.AnyNPCs(ModContent.NPCType())) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), Main.player[Main.myPlayer].Center); + + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + } + } } calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration || !NPC.AnyNPCs(ModContent.NPCType())) + if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration) { - calamityGlobalNPC.newAI[0] = (float)Phase.ChargeTwo; + AIState = (float)Phase.ChargeTwo; calamityGlobalNPC.newAI[2] = 0f; - - if (phase6) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; - } - + FinalPhaseCheck(); npc.TargetClosest(); } @@ -676,68 +707,75 @@ namespace CalamityMod.NPCs.Abyss if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } + + baseVelocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; turnDistance = chargeLocationDistance; + if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { - if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - - if (calamityGlobalNPC.newAI[2] < chargeGateValue) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - // Slow down and quickly turn for 10 frames before the charge - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == chargeGateValue) - chargeDestination = destination + chargeVectorFlipped; + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + + chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; } else { // Charge - // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; - - baseVelocity *= normalChargeVelocityMult; - turnSpeed *= normalChargeTurnSpeedMult; + // Become totally visible + npc.Opacity = 1f; destination = chargeDestination; - if ((destination - npc.Center).Length() < chargeLocationDistance) + if ((destination - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[3] > 1f) { - npc.ai[3] += 1f; - float maxCharges = phase4 ? 1 : phase3 ? 2 : 3; - if (npc.ai[3] >= maxCharges) + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) { - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.AncientDoomSummon : (float)Phase.IceMist; - } - else if (phase3) - calamityGlobalNPC.newAI[0] = (float)Phase.AncientDoomSummon; + npc.ai[3] += 1f; + float maxCharges = phase4 ? 1 : phase3 ? 2 : 3; + if (npc.ai[3] >= maxCharges) + { + npc.ai[3] = 0f; + AIState = phase4 ? (float)Phase.AncientDoomSummon : (float)Phase.IceMist; + } + else if (phase3) + AIState = (float)Phase.AncientDoomSummon; - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] > 7f) - calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - - chargeVelocityScalar = 0f; - - if (phase6) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; + calamityGlobalNPC.newAI[3] = 1f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); } - - npc.TargetClosest(); } } } else - destination += chargeLocation; + destination += chargeVector; } else calamityGlobalNPC.newAI[2] += 1f; @@ -752,18 +790,19 @@ namespace CalamityMod.NPCs.Abyss turnDistance = iceMistLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } baseVelocity *= invisiblePhaseVelocityMult; - turnSpeed *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; if ((destination - npc.Center).Length() < iceMistLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { - calamityGlobalNPC.newAI[2] += 1f; - - if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient) + if (calamityGlobalNPC.newAI[2] % 60f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient) { int maxTargets = 2; int[] whoAmIArray = new int[maxTargets]; @@ -778,19 +817,19 @@ namespace CalamityMod.NPCs.Abyss Vector2 playerCenter = Main.player[i].Center; float distance = Vector2.Distance(playerCenter, npc.Center); - if (distance < maxDistance && Collision.CanHit(npc.Center, 1, 1, playerCenter, 1, 1)) + if (distance < maxDistance) { whoAmIArray[numProjectiles] = i; targetCenterArray[numProjectiles] = playerCenter; - int num34 = numProjectiles + 1; - numProjectiles = num34; - if (num34 >= targetCenterArray.Length) + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) break; } } - float predictionAmt = 60f; - float iceMistVelocity = 16f; + float predictionAmt = targetDownDeep ? 90f : 120f; + float iceMistVelocity = targetDownDeep ? 12f : 16f; for (int i = 0; i < numProjectiles; i++) { // Predictive mist @@ -805,57 +844,49 @@ namespace CalamityMod.NPCs.Abyss projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); - // Normal mist + // Normal bolt projectileDestination = targetCenterArray[i] - npc.Center; projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); } } + calamityGlobalNPC.newAI[2] += 1f; + Lighting.AddLight(npc.Center, 0.3f, 0.75f, 0.9f); - float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num737 < -0.5f) - num737 = -0.5f; - if (num737 > 0.5f) - num737 = 0.5f; + float rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); + Vector2 dustPosition = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + int dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - npc.Center) * 2f; + Main.dust[dust].noGravity = true; - Vector2 value40 = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(num737 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - int num738 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); - Main.dust[num738].position = npc.Center + value40; - Main.dust[num738].velocity = Vector2.Normalize(Main.dust[num738].position - npc.Center) * 2f; - Main.dust[num738].noGravity = true; + rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f); + dustPosition = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[dust].velocity = Vector2.Zero; + Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].noGravity = true; - float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num740 < -0.5f) - num740 = -0.5f; - if (num740 > 0.5f) - num740 = 0.5f; - - Vector2 value41 = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(num740 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); - int num741 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); - Main.dust[num741].velocity = Vector2.Zero; - Main.dust[num741].position = npc.Center + value41; - Main.dust[num741].noGravity = true; - - if (calamityGlobalNPC.newAI[2] >= iceMistPhaseDuration) + if (calamityGlobalNPC.newAI[2] >= iceMistDuration) { - npc.localAI[0] = 1f; - calamityGlobalNPC.newAI[0] = (float)Phase.FastCharge; - calamityGlobalNPC.newAI[2] = 90f; + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; - chargeVelocityScalar = 0f; - - if (phase6) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; + npc.localAI[0] = 1f; + AIState = (float)Phase.FastCharge; + calamityGlobalNPC.newAI[2] = fastChargeGateValue; + calamityGlobalNPC.newAI[3] = 1f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); } - - npc.TargetClosest(); } } @@ -869,45 +900,60 @@ namespace CalamityMod.NPCs.Abyss turnDistance = spinLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } baseVelocity *= invisiblePhaseVelocityMult; - turnSpeed *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; // Spin around target if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { - if (rotationDirection == 0) - rotationDirection = player.direction; - calamityGlobalNPC.newAI[2] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.Center = player.Center + new Vector2(spinRadius, 0).RotatedBy(npc.localAI[1]); - - npc.localAI[1] += MathHelper.ToRadians(degreesOfRotation) * rotationDirection; - - if (calamityGlobalNPC.newAI[2] >= spinPhaseDuration) + float spinVelocityDivisor = baseVelocity * 2f; + if (rotationDirection == 0) { - rotationDirection = 0; - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeOne; - calamityGlobalNPC.newAI[2] = 0f; + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + rotationDirection = 1; + else if (Main.player[npc.target].velocity.X < 0f) + rotationDirection = -1; + else + rotationDirection = player.direction; - chargeVelocityScalar = 0f; + // Set spin velocity + npc.velocity.X = MathHelper.Pi * spinRadius / spinVelocityDivisor; + npc.velocity *= -rotationDirection; + npc.netUpdate = true; + } + else + { + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); - if (phase6) + if (calamityGlobalNPC.newAI[2] >= spinPhaseDuration) { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; - } + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; - npc.TargetClosest(); + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) + { + rotationDirection = 0; + AIState = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 1f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } } // Return to prevent other velocity code from being called @@ -935,9 +981,9 @@ namespace CalamityMod.NPCs.Abyss { // Spawn 3 (or more) circles of Ancient Dooms around the target int ancientDoomScale = (int)(aiGateValue / ancientDoomGateValue); - ancientDoomLimit = 4 + ancientDoomScale; - ancientDoomDegrees = 360 / ancientDoomLimit; - ancientDoomDistance = 550 + ancientDoomScale * 45; + ancientDoomLimit += ancientDoomScale; + ancientDoomDistance += ancientDoomScale * 45; + int ancientDoomDegrees = 360 / ancientDoomLimit; for (int i = 0; i < ancientDoomLimit; i++) { float ai2 = i * ancientDoomDegrees; @@ -957,18 +1003,9 @@ namespace CalamityMod.NPCs.Abyss if (npc.localAI[1] >= ancientDoomGateValue + maxAncientDoomRings) { npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeTwo; + AIState = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeTwo; calamityGlobalNPC.newAI[2] = 0f; - - if (phase6) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; - } - + FinalPhaseCheck(); npc.TargetClosest(); } } @@ -980,30 +1017,37 @@ namespace CalamityMod.NPCs.Abyss if (calamityGlobalNPC.newAI[2] >= lightningChargePhaseGateValue) { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 1f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } + + baseVelocity *= fastChargeVelocityMult; + turnSpeed *= fastChargeTurnSpeedMult; turnDistance = lightningChargeLocationDistance; + if ((lightningChargeLocation - npc.Center).Length() < lightningChargeLocationDistance || calamityGlobalNPC.newAI[2] > lightningChargePhaseGateValue) { - if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - - if (calamityGlobalNPC.newAI[2] < lightningChargeGateValue) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue + 1f) { - // Slow down and quickly turn for 10 frames before the charge - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == lightningChargeGateValue) - chargeDestination = destination + lightningChargeVectorFlipped; + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center); + + chargeDestination = destination + lightningChargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; } else { // Charge - // Use a lerp to smoothly scale up velocity and turn speed - chargeVelocityScalar += chargeVelocityScalarIncrement; - if (chargeVelocityScalar > 1f) - chargeVelocityScalar = 1f; - - baseVelocity *= fastChargeVelocityMult; - turnSpeed *= fastChargeTurnSpeedMult; + // Become totally visible + npc.Opacity = 1f; destination = chargeDestination; @@ -1018,43 +1062,46 @@ namespace CalamityMod.NPCs.Abyss lightningSpawnLocation.Y += distanceBetweenBolts * i; Vector2 projectileDestination = player.Center - lightningSpawnLocation; float ai = Main.rand.Next(100); - Projectile.NewProjectile(lightningSpawnLocation, npc.velocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + int proj = Projectile.NewProjectile(lightningSpawnLocation, npc.velocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + Main.projectile[proj].tileCollide = false; } } - if ((destination - npc.Center).Length() < lightningChargeLocationDistance) + if ((destination - npc.Center).Length() < lightningChargeLocationDistance || calamityGlobalNPC.newAI[3] > 1f) { - calamityGlobalNPC.newAI[0] = npc.localAI[2] == 0f ? (float)Phase.LightningRain : (float)Phase.IceMist; - calamityGlobalNPC.newAI[2] = 0f; + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; - npc.localAI[2] += 1f; - if (npc.localAI[2] > 1f) - npc.localAI[2] = 0f; - - chargeVelocityScalar = 0f; - - if (phase6) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; + AIState = npc.localAI[2] == 0f ? (float)Phase.LightningRain : (float)Phase.IceMist; calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; - } + calamityGlobalNPC.newAI[3] = 1f; - npc.TargetClosest(); + npc.localAI[2] += 1f; + if (npc.localAI[2] > 1f) + npc.localAI[2] = 0f; + + npc.localAI[3] = 0f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } } } } else - destination += lightningChargeLocation; + destination += lightningChargeVector; } else calamityGlobalNPC.newAI[2] += 1f; break; - // Summon Eidolists and swim below the target for 10 seconds, or less, if the Eidolists die + // Summon Eidolists and swim below the target for 3 seconds, or less, if the Eidolists die case (int)Phase.EidolistSpawn: destination += eidolonWyrmPhaseLocation; @@ -1062,34 +1109,40 @@ namespace CalamityMod.NPCs.Abyss if (calamityGlobalNPC.newAI[2] == 0f) { - // Spawn Eidolists randomly around the target - for (int i = 0; i < maxEidolists; i++) + if (!NPC.AnyNPCs(ModContent.NPCType())) { - Point npcCenter = npc.Center.ToTileCoordinates(); - Point playerCenter = player.Center.ToTileCoordinates(); - Vector2 distance = player.Center - npc.Center; + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/EidolistDeath"), Main.player[Main.myPlayer].Center); - int baseDistance = 20; - int minDistance = 3; - int maxDistance = 7; - int collisionRange = 2; - int iterations = 0; - bool tooFar = distance.Length() > 2800f; - while (!tooFar && iterations < 100) + // Spawn Eidolists randomly around the target + for (int i = 0; i < maxEidolists; i++) { - iterations++; - int randomX = Main.rand.Next(playerCenter.X - baseDistance, playerCenter.X + baseDistance + 1); - int randomY = Main.rand.Next(playerCenter.Y - baseDistance, playerCenter.Y + baseDistance + 1); - if ((randomY < playerCenter.Y - maxDistance || randomY > playerCenter.Y + maxDistance || randomX < playerCenter.X - maxDistance || randomX > playerCenter.X + maxDistance) && (randomY < npcCenter.Y - minDistance || randomY > npcCenter.Y + minDistance || randomX < npcCenter.X - minDistance || randomX > npcCenter.X + minDistance) && !Main.tile[randomX, randomY].nactive()) - { - bool canSpawn = true; - if (canSpawn && Collision.SolidTiles(randomX - collisionRange, randomX + collisionRange, randomY - collisionRange, randomY + collisionRange)) - canSpawn = false; + Point npcCenter = npc.Center.ToTileCoordinates(); + Point playerCenter = player.Center.ToTileCoordinates(); + Vector2 distance = player.Center - npc.Center; - if (canSpawn) + int baseSpawnDistance = 60; + int minDistance = 3; + int maxDistance = 7; + int collisionRange = 2; + int iterations = 0; + bool tooFar = distance.Length() > 2800f; + while (!tooFar && iterations < 100) + { + iterations++; + int randomX = Main.rand.Next(playerCenter.X - baseSpawnDistance, playerCenter.X + baseSpawnDistance + 1); + int randomY = Main.rand.Next(playerCenter.Y - baseSpawnDistance, playerCenter.Y + baseSpawnDistance + 1); + if ((randomY < playerCenter.Y - maxDistance || randomY > playerCenter.Y + maxDistance || randomX < playerCenter.X - maxDistance || randomX > playerCenter.X + maxDistance) && (randomY < npcCenter.Y - minDistance || randomY > npcCenter.Y + minDistance || randomX < npcCenter.X - minDistance || randomX > npcCenter.X + minDistance) && !Main.tile[randomX, randomY].nactive()) { - NPC.NewNPC(randomX * 16 + 8, randomY * 16 + 8, ModContent.NPCType(), 0, npc.whoAmI); - break; + bool canSpawn = true; + if (canSpawn && Collision.SolidTiles(randomX - collisionRange, randomX + collisionRange, randomY - collisionRange, randomY + collisionRange)) + canSpawn = false; + + if (canSpawn) + { + NPC.NewNPC(randomX * 16 + 8, randomY * 16 + 8, ModContent.NPCType()); + break; + } } } } @@ -1097,20 +1150,11 @@ namespace CalamityMod.NPCs.Abyss } calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration || !NPC.AnyNPCs(ModContent.NPCType())) + if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration) { - calamityGlobalNPC.newAI[0] = (float)Phase.ChargeOne; + AIState = (float)Phase.ChargeOne; calamityGlobalNPC.newAI[2] = 0f; - - if (phase6) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = (float)Phase.FinalPhase; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - rotationDirection = 0; - } - + FinalPhaseCheck(); npc.TargetClosest(); } @@ -1130,9 +1174,9 @@ namespace CalamityMod.NPCs.Abyss { // Spawn 3 (or more) circles of Ancient Dooms around the target int ancientDoomScale = (int)(aiGateValue / ancientDoomGateValue); - ancientDoomLimit = 4 + ancientDoomScale; - ancientDoomDegrees = 360 / ancientDoomLimit; - ancientDoomDistance = 550 + ancientDoomScale * 45; + ancientDoomLimit += ancientDoomScale; + ancientDoomDistance += ancientDoomScale * 45; + int ancientDoomDegrees = 360 / ancientDoomLimit; for (int i = 0; i < ancientDoomLimit; i++) { float ai2 = i * ancientDoomDegrees; @@ -1159,20 +1203,53 @@ namespace CalamityMod.NPCs.Abyss chargeVelocityScalar = 1f; baseVelocity *= invisiblePhaseVelocityMult; - turnSpeed *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; // Spin around target if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[1] > 0f) { - if (rotationDirection == 0) - rotationDirection = player.direction; - calamityGlobalNPC.newAI[1] += 1f; + float spinVelocityDivisor = baseVelocity * 2f; + if (rotationDirection == 0) + { + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + rotationDirection = 1; + else if (Main.player[npc.target].velocity.X < 0f) + rotationDirection = -1; + else + rotationDirection = player.direction; - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.Center = player.Center + new Vector2(spinRadius, 0).RotatedBy(npc.localAI[1]); + // Set spin velocity + npc.velocity.X = MathHelper.Pi * spinRadius / spinVelocityDivisor; + npc.velocity *= -rotationDirection; + npc.netUpdate = true; + } + else + { + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); - npc.localAI[1] += MathHelper.ToRadians(degreesOfRotation) * rotationDirection; + // Swim above target again if enough time has passed + if (calamityGlobalNPC.newAI[1] >= spinPhaseDuration) + { + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= chargeVelocityScalarIncrement * 2f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime + 1f) + { + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[3] = 1f; + + chargeVelocityScalar = 0f; + rotationDirection = 0; + + npc.TargetClosest(); + } + } + } // Return to prevent other velocity code from being called return; @@ -1181,9 +1258,21 @@ namespace CalamityMod.NPCs.Abyss break; } + void FinalPhaseCheck() + { + if (phase6) + { + npc.localAI[1] = 0f; + AIState = (float)Phase.FinalPhase; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + rotationDirection = 0; + } + } + // Increase velocity if velocity is ever zero if (npc.velocity == Vector2.Zero) - npc.velocity.X = 2f * player.direction; + npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; // Acceleration if (!((destination - npc.Center).Length() < turnDistance)) @@ -1213,6 +1302,21 @@ namespace CalamityMod.NPCs.Abyss } } + private void ChargeDust(int dustAmt, float pie) + { + for (int num1474 = 0; num1474 < dustAmt; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 172, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; @@ -1295,7 +1399,8 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 600, true); + if (npc.Opacity == 1f) + player.AddBuff(ModContent.BuffType(), 600, true); } } } diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge_Head_Boss.png b/NPCs/Abyss/EidolonWyrmHeadHuge_Head_Boss.png new file mode 100644 index 0000000000..ffafb0bc3b Binary files /dev/null and b/NPCs/Abyss/EidolonWyrmHeadHuge_Head_Boss.png differ diff --git a/NPCs/Abyss/EidolonWyrmTailHuge.cs b/NPCs/Abyss/EidolonWyrmTailHuge.cs index 8fdd938774..bec65dd492 100644 --- a/NPCs/Abyss/EidolonWyrmTailHuge.cs +++ b/NPCs/Abyss/EidolonWyrmTailHuge.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Abyss npc.width = 86; npc.height = 120; npc.defense = 0; - npc.LifeMaxNERB(1000000, 1150000); + npc.LifeMaxNERB(1750000, 2012500); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -47,31 +47,41 @@ namespace CalamityMod.NPCs.Abyss if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } - if (!NPC.AnyNPCs(ModContent.NPCType())) - npc.active = false; + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - bool invisiblePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 1f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 5f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 7f; - if (!invisiblePhase) + float chargePhaseGateValue = 300f; + float lightningChargePhaseGateValue = 180f; + + bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; + bool invisiblePhase = calamityGlobalNPC_Head.newAI[0] == 1f || calamityGlobalNPC_Head.newAI[0] == 5f || calamityGlobalNPC_Head.newAI[0] == 7f; + if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { - npc.Opacity += 0.15f; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index c4aadc9463..cc3d4cd060 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -17,7 +16,6 @@ using Microsoft.Xna.Framework; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.BrimstoneElemental @@ -91,7 +89,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental player.AddBuff(ModContent.BuffType(), 180, true); } - public override void FindFrame(int frameHeight) //9 total frames + public override void FindFrame(int frameHeight) // 9 total frames { npc.frameCounter += 1.0; if (npc.ai[0] <= 2f) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 9bc5f24d5e..3ce8203a46 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -97,11 +97,17 @@ namespace CalamityMod.NPCs float enrageScale = 0f; if ((!player.Calamity().ZoneSulphur && notOcean) || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } Vector2 vectorCenter = npc.Center; @@ -662,11 +668,17 @@ namespace CalamityMod.NPCs if (!player.ZoneUnderworldHeight || malice) enrageScale += 1f; if (!modPlayer.ZoneCalamity || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.15f; @@ -1360,11 +1372,17 @@ namespace CalamityMod.NPCs float enrageScale = 0f; if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } // Rotation float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); @@ -2049,11 +2067,17 @@ namespace CalamityMod.NPCs float enrageScale = 0f; if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); @@ -2336,11 +2360,17 @@ namespace CalamityMod.NPCs float enrageScale = 0f; if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); @@ -2617,11 +2647,17 @@ namespace CalamityMod.NPCs float enrageScale = 0f; if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -3253,11 +3289,17 @@ namespace CalamityMod.NPCs float enrageScale = 0f; if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1.5f; + } if (BossRushEvent.BossRushActive) enrageScale += 0.5f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 0.5f; + } // Deus cannot hit for 3 seconds if (calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage) @@ -4050,6 +4092,7 @@ namespace CalamityMod.NPCs // Scale multiplier based on nearby active tiles float tileEnrageMult = enraged ? 1.5f : BossRushEvent.BossRushActive ? 1.375f : malice ? 1.25f : 1f; + npc.Calamity().CurrentlyEnraged = (tileEnrageMult > 1f && !BossRushEvent.BossRushActive) || enraged; // Set AI variable to be used by Dark Energies npc.ai[1] = tileEnrageMult; @@ -4566,10 +4609,16 @@ namespace CalamityMod.NPCs // Enrage scale float enrageScale = death ? 1.5f : 1f; if (npc.localAI[1] >= 300f || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; + } if (npc.localAI[2] > 0f || malice) enrageScale += 1f; + if (enraged) + npc.Calamity().CurrentlyEnraged = true; + if (enrageScale > 3f) enrageScale = 3f; @@ -5433,6 +5482,7 @@ namespace CalamityMod.NPCs bool enrage = !BossRushEvent.BossRushActive && (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + npc.Calamity().CurrentlyEnraged = enrage || enraged; // If the player isn't in the ocean biome or Old Duke is transitioning between phases, become immune if (!phase3AI) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index c7ca50d0a6..67ad19225b 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -41,9 +41,10 @@ namespace CalamityMod.NPCs bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away @@ -518,12 +519,18 @@ namespace CalamityMod.NPCs float num5 = (float)(death ? 20 - Math.Round(5f * (1f - lifeRatio)) : 20); float enrageScale = 0f; - if (Main.dayTime || malice) - enrageScale += 2f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1369,10 +1376,16 @@ namespace CalamityMod.NPCs npc.TargetClosest(); float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) - enrageScale += 1f; - if (!Main.player[npc.target].ZoneCorrupt || malice) - enrageScale += 2f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!Main.player[npc.target].ZoneCorrupt || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) @@ -1911,14 +1924,23 @@ namespace CalamityMod.NPCs npc.TargetClosest(); float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) - enrageScale += 1f; - if (!Main.player[npc.target].ZoneCrimson || malice) - enrageScale += 2f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!Main.player[npc.target].ZoneCrimson || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } // Spawn Creepers if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) @@ -2579,10 +2601,16 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || malice; float enrageScale = death ? 0.25f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) - enrageScale += 0.5f; - if (!Main.player[npc.target].ZoneJungle || malice) - enrageScale += 0.5f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 0.5f; + } + if (!Main.player[npc.target].ZoneJungle || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 0.5f; + } if (enrageScale > 1f) enrageScale = 1f; @@ -2590,8 +2618,11 @@ namespace CalamityMod.NPCs if (BossRushEvent.BossRushActive) enrageScale = 2f; - if (enraged) - enrageScale = 3f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale = 3f; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -3222,8 +3253,9 @@ namespace CalamityMod.NPCs bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = npc.Center; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -3938,9 +3970,10 @@ namespace CalamityMod.NPCs bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; - // Despawn - if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) + // Despawn + if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) npc.active = false; // Get a target @@ -4535,12 +4568,18 @@ namespace CalamityMod.NPCs npc.TargetClosest(); float enrageScale = 0f; - if (Main.dayTime || malice) - enrageScale += 2f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } // Enrage variable if player is flying upside down bool targetFloatingUp = player.gravDir == -1f; @@ -5542,12 +5581,18 @@ namespace CalamityMod.NPCs npc.TargetClosest(); float enrageScale = 0f; - if (Main.dayTime || malice) - enrageScale += 1f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } if (BossRushEvent.BossRushActive) enrageScale += 0.5f; - if (enraged) - enrageScale += 0.5f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 0.5f; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -7010,9 +7055,10 @@ namespace CalamityMod.NPCs bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); // Despawn safety, make sure to target another player if the current player target is too far away @@ -8954,6 +9000,8 @@ namespace CalamityMod.NPCs acceleration = 0.15f; } + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && enrage) || enraged; + // Detect active tiles around Plantera int radius = 20; // 20 tile radius int diameter = radius * 2; @@ -9783,6 +9831,8 @@ namespace CalamityMod.NPCs if (enraged) turboEnrage = true; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (enrage || turboEnrage)) || enraged; + // Alpha if (npc.alpha > 0) { @@ -10813,6 +10863,8 @@ namespace CalamityMod.NPCs (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && enrage) || enraged; + // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune if (!phase3AI) npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; @@ -11756,8 +11808,10 @@ namespace CalamityMod.NPCs idleTime = enraged ? 15 : 30; } - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(false); // Center and target @@ -12712,6 +12766,16 @@ namespace CalamityMod.NPCs if (npc.ai[0] >= 0f) { + // Triple damage if the Adult Eidolon Wyrm is alive + if (npc.ai[0] == 0f) + { + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + npc.damage *= 3; + } + } + npc.ai[0] += 1f; float duration = 120f; @@ -12748,8 +12812,12 @@ namespace CalamityMod.NPCs // Percent life remaining for Cultist or Eidolon Wyrm float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > Main.npc[(int)npc.ai[0]].Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = Main.npc[(int)npc.ai[0]].Calamity().killTimeRatio_IncreasedAggression; + bool phase2 = lifeRatio < 0.7f; - bool phase3 = lifeRatio < 0.55f; + bool phase3 = lifeRatio < (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType() ? 0.6f : 0.55f); bool phase4 = lifeRatio < 0.4f; bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; @@ -12838,6 +12906,11 @@ namespace CalamityMod.NPCs { int type = ProjectileID.AncientDoomProjectile; int damage = npc.GetProjectileDamage(type); + + // Triple damage if the Adult Eidolon Wyrm is alive + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + damage *= 3; + kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -12896,7 +12969,9 @@ namespace CalamityMod.NPCs if (enraged) aggressionLevel = 5; - if (npc.type == NPCID.MoonLordCore) + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + if (npc.type == NPCID.MoonLordCore) { // Play a random Moon Lord sound if (npc.ai[0] != -1f && npc.ai[0] != 2f && Main.rand.NextBool(200)) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 28ea59693f..151e7ceffb 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -21,6 +21,7 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; @@ -103,6 +104,10 @@ namespace CalamityMod.NPCs // Max velocity used in contact damage scaling public float maxVelocity = 0f; + // Dash damage immunity timer + public const int maxPlayerImmunities = Main.maxPlayers + 1; + public int[] dashImmunityTime = new int[maxPlayerImmunities]; + // Town NPC shop alert animation variables public int shopAlertAnimTimer = 0; public int shopAlertAnimFrame = 0; @@ -205,6 +210,15 @@ namespace CalamityMod.NPCs public static int draedonExoMechTwinRed = -1; public static int draedonExoMechTwinGreen = -1; public static int draedonExoMechPrime = -1; + public static int adultEidolonWyrmHead = -1; + + // Boss Enrage variable for use with the boss health UI. + // The logic behind this is as follows: + // 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player. + // 2 - Otherwise, check if the demonshade enrage is active. If it is, register this as true. If not, go to step 3. + // 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4. + // 4 - Check if malice is active and Boss Rush isn't. If so, set this to true. + public bool CurrentlyEnraged; // Collections public static SortedDictionary BossRushHPChanges = new SortedDictionary @@ -685,13 +699,18 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref SCal, NPCType()); ResetSavedIndex(ref SCalWorm, NPCType()); - /*ResetSavedIndex(ref draedonExoMechWorm, NPCType()); - ResetSavedIndex(ref draedonExoMechTwinRed, NPCType()); + ResetSavedIndex(ref draedonExoMechWorm, NPCType()); + /*ResetSavedIndex(ref draedonExoMechTwinRed, NPCType()); ResetSavedIndex(ref draedonExoMechTwinGreen, NPCType()); ResetSavedIndex(ref draedonExoMechPrime, NPCType());*/ + ResetSavedIndex(ref adultEidolonWyrmHead, NPCType()); + CalamityGlobalTownNPC.ResetTownNPCNameBools(npc, mod); - } + + // Reset the enraged state every frame. The expectation is that bosses will continuously set it back to true if necessary. + CurrentlyEnraged = false; + } #endregion #region Life Regen @@ -948,10 +967,10 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(electrified, electrifiedDamage, displayedValue, ref npc.lifeRegen, ref damage); else ApplyDPSDebuff(electrified, electrifiedDamage * 4, displayedValue * 4, ref npc.lifeRegen, ref damage); - if (npc.lifeMax < 25000000) - ApplyDPSDebuff(banishingFire, 20000, 4000, ref npc.lifeRegen, ref damage); - else - ApplyDPSDebuff(banishingFire, npc.lifeMax / 2500, npc.lifeMax / 2500, ref npc.lifeRegen, ref damage); + if (npc.lifeMax < 1000000) // 2000 hp per second as minimum + ApplyDPSDebuff(banishingFire, 4000, 800, ref npc.lifeRegen, ref damage); + else // On big health enemies, do 0.2% hp per second + ApplyDPSDebuff(banishingFire, npc.lifeMax / 500, npc.lifeMax / 2500, ref npc.lifeRegen, ref damage); } public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -972,7 +991,10 @@ namespace CalamityMod.NPCs #region Set Defaults public override void SetDefaults(NPC npc) { - for (int m = 0; m < maxAIMod; m++) + for (int i = 0; i < maxPlayerImmunities; i++) + dashImmunityTime[i] = 0; + + for (int m = 0; m < maxAIMod; m++) newAI[m] = 0f; // Apply DR to vanilla NPCs. @@ -1957,6 +1979,13 @@ namespace CalamityMod.NPCs { CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod); + // Decrement each immune timer if it's greater than 0. + for (int i = 0; i < maxPlayerImmunities; i++) + { + if (dashImmunityTime[i] > 0) + dashImmunityTime[i]--; + } + if (CalamityPlayer.areThereAnyDamnBosses) { if (npc.velocity.Length() > maxVelocity) @@ -3905,7 +3934,7 @@ namespace CalamityMod.NPCs damage = (int)(damage * 0.795); if (projectile.type == ProjectileType() || projectile.type == ProjectileID.FlamingJack) - damage = (int)(damage * 0.6); + damage = (int)(damage * 0.39); } else if (npc.type == NPCType()) { @@ -3916,7 +3945,40 @@ namespace CalamityMod.NPCs { if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.95); - } + } + else if (npc.type == NPCType()) + { + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.5); + } + else if (npc.type == NPCType()) + { + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.85); + } + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.8); + + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.81); + } + else if (npc.type == NPCType() || npc.type == NPCType()) + { + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.9); + } + else if (npc.type == NPCType()) + { + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.8); + } + else if (npc.type == NPCType()) + { + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.9); + } else if (npc.type == NPCID.CultistBoss) { if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 59f1215a0b..ba46c99cd3 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -88,11 +88,11 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabShroomGlow"); diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index b6a9035614..fc3221a734 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -136,14 +136,23 @@ namespace CalamityMod.NPCs.Crabulon npc.timeLeft = 1800; float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) - enrageScale += 1f; - if (!player.ZoneGlowshroom || malice) - enrageScale += 1f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!player.ZoneGlowshroom || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } if (npc.ai[0] != 0f && npc.ai[0] < 3f) { diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index f3a2ff50c9..2ce5d9644b 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -107,7 +107,10 @@ namespace CalamityMod.NPCs.Cryogen float enrageScale = death ? 0.5f : 0f; if (!player.ZoneSnow || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; + } if (enrageScale > 2f) enrageScale = 2f; @@ -116,7 +119,10 @@ namespace CalamityMod.NPCs.Cryogen enrageScale = 3f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale = 4f; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index b1c6399ef2..4d65853932 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -100,12 +100,18 @@ namespace CalamityMod.NPCs.DesertScourge Player player = Main.player[npc.target]; float enrageScale = 0f; - if (!player.ZoneDesert || malice) - enrageScale += 2f; + if (!player.ZoneDesert || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 16f516601e..3dc0107f23 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -121,6 +121,8 @@ namespace CalamityMod.NPCs.DevourerofGods bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.2f; + npc.Calamity().CurrentlyEnraged = malice; + // Light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index cdfd04662b..393cc02709 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -173,8 +173,10 @@ namespace CalamityMod.NPCs.DevourerofGods bool phase4 = lifeRatio < 0.3f; bool phase5 = lifeRatio < 0.15f; - // Light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Worm shit again if (npc.ai[2] > 0f) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs new file mode 100644 index 0000000000..a994d1eb50 --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -0,0 +1,526 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + public class ThanatosBody1 : ModNPC + { + // Whether the body is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.width = 148; + npc.height = 98; + npc.defense = 100; + npc.DR_NERD(0.99f); + npc.Calamity().unbreakableDR = true; + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.Opacity = 0f; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(vulnerable); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + vulnerable = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void AI() + { + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + + // Set vulnerable to false by default + vulnerable = false; + + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Set timer to whoAmI so that segments don't all fire lasers at the same time + if (npc.localAI[2] == 0f) + npc.localAI[2] = npc.ai[0]; + + bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootTrackingLasers) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Only charge up lasers if not venting or firing lasers + if (npc.Calamity().newAI[0] == 0f) + npc.ai[3] += 1f; + + if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) + { + float divisor = 120f; + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = malice ? 25D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + for (int i = 0; i < numProjectiles; i++) + { + // Normal laser + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + else + { + npc.ai[3] += 1f; + float shootProjectile = 120f; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = malice ? 40f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + for (int i = 0; i < numProjectiles; i++) + { + // Fire normal lasers if head is in passive state + if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive) + { + // Normal laser + Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + else + { + // Predictive laser + Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + + // Opposite laser + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + } + } + else + { + // Set alternating laser-firing body segments every 3 seconds + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + } + + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + else + { + // Body is vulnerable while venting + vulnerable = true; + } + } + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.99f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + if (vulnerable) + { + // Noise + if (npc.localAI[0] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + + // Steam + float maxSteamTime = 180f; + int maxGores = 4; + if (npc.localAI[0] < maxSteamTime) + { + npc.localAI[0] += 1f; + int goreAmt = maxGores - (int)Math.Round(npc.localAI[0] / 60f); + CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity); + } + } + else + npc.localAI[0] = 0f; + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 50f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootTrackingLasers) + { + npc.frameCounter += 1D; + if (npc.Calamity().newAI[1] == 0f) + { + if (npc.frameCounter >= 12D) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type]; + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + + Vector2 center = npc.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow"); + spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) + { + int baseDust = vulnerable ? 3 : 1; + for (int k = 0; k < baseDust; k++) + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + + if (npc.life <= 0) + { + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_3"), 1f); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (npc.Opacity == 1f) + { + int duration = vulnerable ? 120 : 60; + player.AddBuff(BuffID.Ichor, duration); + player.AddBuff(BuffID.CursedInferno, duration); + player.AddBuff(ModContent.BuffType(), duration / 4); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(BuffID.Frostburn, duration); + player.AddBuff(BuffID.OnFire, duration); + } + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.png b/NPCs/ExoMechs/Thanatos/ThanatosBody1.png index 23312b4833..a1bbe33f52 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosBody1.png and b/NPCs/ExoMechs/Thanatos/ThanatosBody1.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow.png b/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow.png new file mode 100644 index 0000000000..cfa0941d35 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs new file mode 100644 index 0000000000..fe0c033757 --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -0,0 +1,526 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + public class ThanatosBody2 : ModNPC + { + // Whether the body is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.width = 136; + npc.height = 100; + npc.defense = 100; + npc.DR_NERD(0.99f); + npc.Calamity().unbreakableDR = true; + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.Opacity = 0f; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(vulnerable); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + vulnerable = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void AI() + { + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + + // Set vulnerable to false by default + vulnerable = false; + + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Set timer to whoAmI so that segments don't all fire lasers at the same time + if (npc.localAI[2] == 0f) + npc.localAI[2] = npc.ai[0]; + + bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootTrackingLasers) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Only charge up lasers if not venting or firing lasers + if (npc.Calamity().newAI[0] == 0f) + npc.ai[3] += 1f; + + if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) + { + float divisor = 120f; + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = malice ? 25D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + for (int i = 0; i < numProjectiles; i++) + { + // Normal laser + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + else + { + npc.ai[3] += 1f; + float shootProjectile = 120f; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = malice ? 40f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + for (int i = 0; i < numProjectiles; i++) + { + // Fire normal lasers if head is in passive state + if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive) + { + // Normal laser + Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + else + { + // Predictive laser + Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + + // Opposite laser + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + } + } + else + { + // Set alternating laser-firing body segments every 3 seconds + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + } + + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + else + { + // Body is vulnerable while venting + vulnerable = true; + } + } + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.99f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + if (vulnerable) + { + // Noise + if (npc.localAI[0] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + + // Steam + float maxSteamTime = 180f; + int maxGores = 4; + if (npc.localAI[0] < maxSteamTime) + { + npc.localAI[0] += 1f; + int goreAmt = maxGores - (int)Math.Round(npc.localAI[0] / 60f); + CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity); + } + } + else + npc.localAI[0] = 0f; + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 50f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootTrackingLasers) + { + npc.frameCounter += 1D; + if (npc.Calamity().newAI[1] == 0f) + { + if (npc.frameCounter >= 12D) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type]; + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + + Vector2 center = npc.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow"); + spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) + { + int baseDust = vulnerable ? 3 : 1; + for (int k = 0; k < baseDust; k++) + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + + if (npc.life <= 0) + { + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_3"), 1f); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (npc.Opacity == 1f) + { + int duration = vulnerable ? 120 : 60; + player.AddBuff(BuffID.Ichor, duration); + player.AddBuff(BuffID.CursedInferno, duration); + player.AddBuff(ModContent.BuffType(), duration / 4); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(BuffID.Frostburn, duration); + player.AddBuff(BuffID.OnFire, duration); + } + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.png b/NPCs/ExoMechs/Thanatos/ThanatosBody2.png index 30f22df80b..eb178bfffc 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosBody2.png and b/NPCs/ExoMechs/Thanatos/ThanatosBody2.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow.png b/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow.png new file mode 100644 index 0000000000..8fea258abe Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs new file mode 100644 index 0000000000..25ac275364 --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -0,0 +1,840 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + //[AutoloadBossHead] + public class ThanatosHead : ModNPC + { + public enum Phase + { + Charge = 0, + UndergroundLaserBarrage = 1, + Deathray = 2 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + public enum SecondaryPhase + { + Nothing = 0, + Passive = 1, + PassiveAndImmune = 2 + } + + public float SecondaryAIState + { + get => npc.Calamity().newAI[1]; + set => npc.Calamity().newAI[1] = value; + } + + // Whether the head is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Base distance from the target for most attacks + private const float baseDistance = 1200f; + + // Base distance from target location in order to continue turning + private const float baseTurnDistance = 160f; + + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 2800f; + + // Length variables + public const int minLength = 100; + private const int maxLength = 101; + + // Variable used to stop the segment spawning loop + private bool TailSpawned = false; + + // Used in the lerp to smoothly scale velocity up and down + private float chargeVelocityScalar = 0f; + + // Total duration of the deathray telegraph + private const float deathrayTelegraphDuration = 180f; + + // Total duration of the deathray + private const float deathrayDuration = 180f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.width = 104; + npc.height = 174; + npc.defense = 80; + npc.DR_NERD(0.99f); + npc.Calamity().unbreakableDR = true; + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.Opacity = 0f; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(10, 0, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + npc.chaseable = false; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(chargeVelocityScalar); + writer.Write(vulnerable); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + chargeVelocityScalar = reader.ReadSingle(); + vulnerable = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.draedonExoMechWorm = npc.whoAmI; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + bool exoPrimeAlive = false; + bool exoSpazAlive = false; + bool exoRetAlive = false; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + otherExoMechsAlive++; + exoPrimeAlive = true; + } + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { + otherExoMechsAlive++; + exoSpazAlive = true; + } + } + if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) + { + otherExoMechsAlive++; + exoRetAlive = true; + } + } + + // These are 5 by default to avoid triggering passive phases after the other mechs are dead + float exoPrimeLifeRatio = defaultLifeRatio; + float exoSpazLifeRatio = defaultLifeRatio; + float exoRetLifeRatio = defaultLifeRatio; + if (exoPrimeAlive) + exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + if (exoSpazAlive) + exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax; + if (exoRetAlive) + exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax; + float totalOtherExoMechLifeRatio = exoPrimeLifeRatio + exoSpazLifeRatio + exoRetLifeRatio; + + // Check if any of the other mechs are passive + bool exoPrimePassive = false; + bool exoSpazPassive = false; + bool exoRetPassive = false; + /*if (exoPrimeAlive) + exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].newAI[1] == (float)AresBody.SecondaryPhase.Passive; + if (exoSpazAlive) + exoSpazPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].newAI[1] == (float)Apollo.SecondaryPhase.Passive; + if (exoRetAlive) + exoRetPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].newAI[1] == (float)Artemis.SecondaryPhase.Passive;*/ + bool anyOtherExoMechPassive = exoPrimePassive || exoSpazPassive || exoRetPassive; + + // Phases + bool lessThan70PercentLife = lifeRatio < 0.7f; + bool phase2 = lessThan70PercentLife && otherExoMechsAlive <= 1; + bool berserk = lifeRatio < 0.4f || totalOtherExoMechLifeRatio > 3f; + + // Set vulnerable to false by default + vulnerable = false; + + // If Thanatos doesn't go berserk + bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoSpazLifeRatio < 0.4f || exoRetLifeRatio < 0.4f; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Target variable + Player player = Main.player[npc.target]; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Spawn segments + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + else + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + } + else + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + + // Despawn if target is dead + if (player.dead) + { + npc.TargetClosest(false); + + npc.velocity.Y += 2f; + if (npc.position.Y > Main.worldSurface * 16.0) + npc.velocity.Y += 2f; + + if (npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + + // General AI pattern + // Fly towards the target for 7 seconds, gradually speeding up for the first 5 seconds and slowing down for the last 2 seconds, fire lasers from segments that are venting + // Fly underneath the target and fire barrages of lasers + // Fire deathray from mouth with a telegraph similar to the railgun from enter the gungeon, turn speed is very low during this to avoid cheap hits + // Go passive and fly underneath the target while firing lasers + // Go passive, immune and invisible; fly far underneath the target and do nothing until next phase + + // Attack patterns + // If spawned first + // Phase 1 - 0, 1, 0, 2 + // Phase 2 - 4 + // Phase 3 - 3 + + // If berserk, this is the last phase of thanatos + // Phase 4 - 0, 1, 0, 2 + + // If not berserk + // Phase 4 - 4 + // Phase 5 - 0, 1, 0, 2 + + // If berserk, this is the last phase of thanatos + // Phase 6 - 0, 1, 0, 2 + + // If not berserk + // Phase 6 - 4 + // Phase 7 - 0, 1, 0, 2 + + // Phase gate values + float velocityAdjustTime = 20f; + float speedUpTime = 300f; + float slowDownTime = 120f; + float chargePhaseGateValue = speedUpTime + slowDownTime; + + float laserBarrageDuration = 420f; + + // Adjust opacity + bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Rotation and direction + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + int direction = npc.direction; + npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1); + if (direction != npc.direction) + npc.netUpdate = true; + + // Default vector to fly to + Vector2 destination = player.Center; + + // Charge variables + float turnDistance = baseTurnDistance; + float chargeLocationDistance = turnDistance * 0.2f; + + // Laser Barrage variables + Vector2 laserBarrageLocation = new Vector2(0f, baseDistance); + float laserBarrageLocationDistance = turnDistance * 5f; + + // Velocity and turn speed values + float baseVelocity = malice ? 12f : death ? 11f : revenge ? 10.5f : expertMode ? 10f : 9f; + float turnDegrees = malice ? 1.33f : death ? 1.22f : revenge ? 1.17f : expertMode ? 1.11f : 1f; + if (berserk) + { + baseVelocity *= 1.2f; + turnDegrees *= 1.2f; + } + float turnSpeed = MathHelper.ToRadians(turnDegrees); + float chargeVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); + float chargeTurnSpeedMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); + float laserBarragePhaseVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); + float laserBarragePhaseTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar); + float deathrayVelocityMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar); + float deathrayTurnSpeedMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar); + + // Base scale on total time spent in phase + float chargeVelocityScalarIncrement = 1f / speedUpTime; + float chargeVelocityScalarDecrement = 1f / slowDownTime; + + // Scalar to use during laser barrage, passive and immune phases + float laserBarrageVelocityScalarIncrement = 0.01f; + float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; + + // Distance from target + float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + + // Passive and Immune phases + switch ((int)SecondaryAIState) + { + case (int)SecondaryPhase.Nothing: + + // Spawn the other mechs if Thanatos is first + if (otherExoMechsAlive == 0) + { + if (phase2 && !berserk) + { + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn code here + } + } + } + else + { + // If not spawned first, go to passive state if any other mech is passive or if Thanatos is under 70% life + // Do not run this if berserk + // Do not run this if any exo mech is dead + if ((anyOtherExoMechPassive || lessThan70PercentLife) && !berserk && totalOtherExoMechLifeRatio < 5f) + { + // Tells Thanatos to return to the battle in passive state + SecondaryAIState = (float)SecondaryPhase.Passive; + } + + // Go passive and immune if one of the other mechs is berserk + // This is only called if two exo mechs are alive + if (otherMechIsBerserk) + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + } + + break; + + // Fly underneath target and fire lasers + case (int)SecondaryPhase.Passive: + + // Fire lasers while passive + AIState = (float)Phase.UndergroundLaserBarrage; + + // Enter passive and invincible phase if one of the other exo mechs is berserk + if (otherMechIsBerserk) + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + + // If Thanatos is the first mech to go berserk + if (berserk) + { + // Reset + AIState = (float)Phase.Charge; + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + + // Fly underneath target and become immune + case (int)SecondaryPhase.PassiveAndImmune: + + // Fire lasers while passive + AIState = (float)Phase.UndergroundLaserBarrage; + + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk + if ((exoPrimeLifeRatio < 0.7f || exoSpazLifeRatio < 0.7f || exoRetLifeRatio < 0.7f) && !otherMechIsBerserk) + { + // Tells Thanatos to return to the battle in passive state + // Return to normal phases if one or more mechs have been downed + SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; + } + + if (berserk) + { + // Reset + AIState = (float)Phase.Charge; + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + } + + // Attacking phases + switch ((int)AIState) + { + // Fly towards target and gain velocity over time + case (int)Phase.Charge: + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 0f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar >= 1f) + { + chargeVelocityScalar = 1f; + calamityGlobalNPC.newAI[3] = 1f; + } + } + else + { + chargeVelocityScalar -= chargeVelocityScalarDecrement; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + } + + baseVelocity *= chargeVelocityMult; + turnSpeed *= chargeTurnSpeedMult; + turnDistance = chargeLocationDistance; + + // Gradually turn slower if within 20 tiles of the target + if (distanceFromTarget < 320f) + turnSpeed *= distanceFromTarget / 320f; + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) + { + AIState = npc.localAI[0] == 1f ? (float)Phase.Deathray : (float)Phase.UndergroundLaserBarrage; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + + break; + + // Fly below and summon barrages of lasers + case (int)Phase.UndergroundLaserBarrage: + + // Fly down + destination += laserBarrageLocation; + turnDistance = laserBarrageLocationDistance; + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 0f) + { + chargeVelocityScalar += laserBarrageVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } + + baseVelocity *= laserBarragePhaseVelocityMult; + turnSpeed *= laserBarragePhaseTurnSpeedMult; + + if ((destination - npc.Center).Length() < laserBarrageLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + calamityGlobalNPC.newAI[2] += 1f; + + if (SecondaryAIState != (float)SecondaryPhase.Passive && SecondaryAIState != (float)SecondaryPhase.PassiveAndImmune) + { + if (calamityGlobalNPC.newAI[2] >= laserBarrageDuration) + { + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= laserBarrageVelocityScalarDecrement; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime) + { + npc.localAI[0] = 1f; + AIState = (float)Phase.Charge; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + } + } + } + + break; + + // Move close to target, reduce velocity and turn speed when close enough, create telegraph beams, reduce turn speed, fire deathray + case (int)Phase.Deathray: + + // Head is vulnerable while charging and firing deathray + vulnerable = true; + + // If close enough to the target, prepare to fire deathray + bool readyToFireDeathray = distanceFromTarget < 800f; + if (readyToFireDeathray) + npc.localAI[2] = 1f; + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 0f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar >= 1f) + { + chargeVelocityScalar = 1f; + + // If ready to fire deathray, start reducing the velocity scalar + if (npc.localAI[2] == 1f) + calamityGlobalNPC.newAI[3] = 1f; + } + } + else + { + chargeVelocityScalar -= chargeVelocityScalarDecrement; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + } + + baseVelocity *= deathrayVelocityMult; + turnSpeed *= deathrayTurnSpeedMult; + turnDistance = chargeLocationDistance; + + // Gradually turn and move slower if within 50 tiles of the target + if (npc.localAI[2] == 1f) + { + baseVelocity *= distanceFromTarget / 800f; + turnSpeed *= distanceFromTarget / 800f; + + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + { + // Fire deathray telegraph beams + if (calamityGlobalNPC.newAI[2] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + for (int b = 0; b < 6; b++) + { + int beam = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, 0, 0f, 255, npc.whoAmI); + + // Determine the initial offset angle of telegraph. It will be smoothened to give a "stretch" effect. + if (Main.projectile.IndexInRange(beam)) + { + float squishedRatio = (float)Math.Pow((float)Math.Sin(MathHelper.Pi * b / 6f), 2D); + float smoothenedRatio = MathHelper.SmoothStep(0f, 1f, squishedRatio); + Main.projectile[beam].ai[1] = MathHelper.Lerp(-0.74f, 0.74f, smoothenedRatio); + } + } + Projectile.NewProjectile(npc.Center, Vector2.Zero, type, 0, 0f, 255, npc.whoAmI); + } + } + } + else + { + // Fire deathray + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, 255, npc.whoAmI); + } + } + } + + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + AIState = (float)Phase.Charge; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + calamityGlobalNPC.newAI[2] += 1f; + } + + break; + } + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.99f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + if (vulnerable) + { + // Noise + if (npc.localAI[1] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + + // Steam + float maxSteamTime = 180f; + int maxGores = 4; + if (npc.localAI[1] < maxSteamTime) + { + npc.localAI[1] += 1f; + int goreAmt = maxGores - (int)Math.Round(npc.localAI[1] / 60f); + CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity); + } + } + else + npc.localAI[1] = 0f; + + // Increase velocity if velocity is ever zero + if (npc.velocity == Vector2.Zero) + npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + + // Acceleration + if (!((destination - npc.Center).Length() < turnDistance)) + { + float targetAngle = npc.AngleTo(destination); + float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + npc.velocity = f.ToRotationVector2() * baseVelocity; + } + + // Velocity upper limit + if (npc.velocity.Length() > baseVelocity) + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; + + // Reduce Y velocity if it's less than 1 + if (Math.Abs(npc.velocity.Y) < 1f) + npc.velocity.Y -= 0.1f; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 50f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + if (AIState == (float)Phase.Charge || AIState == (float)Phase.UndergroundLaserBarrage) + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type]; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + + Vector2 center = npc.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow"); + spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + + public override void NPCLoot() + { + /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32);*/ + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + + if (npc.life <= 0) + { + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead3"), 1f); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (npc.Opacity == 1f) + { + int duration = vulnerable ? 180 : 90; + player.AddBuff(BuffID.Ichor, duration); + player.AddBuff(BuffID.CursedInferno, duration); + player.AddBuff(ModContent.BuffType(), duration / 4); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(BuffID.Frostburn, duration); + player.AddBuff(BuffID.OnFire, duration); + } + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.png b/NPCs/ExoMechs/Thanatos/ThanatosHead.png index 814198e065..1cdc250fc9 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosHead.png and b/NPCs/ExoMechs/Thanatos/ThanatosHead.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png b/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png new file mode 100644 index 0000000000..b4a0e95b3b Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs new file mode 100644 index 0000000000..5c195cc6f9 --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -0,0 +1,527 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + public class ThanatosTail : ModNPC + { + // Whether the tail is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.width = 84; + npc.height = 118; + npc.defense = 120; + npc.DR_NERD(0.99f); + npc.Calamity().unbreakableDR = true; + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.Opacity = 0f; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(vulnerable); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + vulnerable = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void AI() + { + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + + // Set vulnerable to false by default + vulnerable = false; + + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Set timer to whoAmI so that segments don't all fire lasers at the same time + if (npc.localAI[2] == 0f) + npc.localAI[2] = npc.ai[0]; + + bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootTrackingLasers) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Only charge up lasers if not venting or firing lasers + if (npc.Calamity().newAI[0] == 0f) + npc.ai[3] += 1f; + + if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) + { + float divisor = 120f; + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = malice ? 25D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + for (int i = 0; i < numProjectiles; i++) + { + // Normal laser + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + else + { + npc.ai[3] += 1f; + float shootProjectile = 120f; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = malice ? 40f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + for (int i = 0; i < numProjectiles; i++) + { + // Fire normal lasers if head is in passive state + if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive) + { + // Normal laser + Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + else + { + // Predictive laser + Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + + // Opposite laser + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + } + } + else + { + // Set alternating laser-firing body segments every 3 seconds + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + } + + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + else + { + // Body is vulnerable while venting + vulnerable = true; + } + } + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.99f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + if (vulnerable) + { + // Noise + if (npc.localAI[0] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + + // Steam + float maxSteamTime = 180f; + int maxGores = 4; + if (npc.localAI[0] < maxSteamTime) + { + npc.localAI[0] += 1f; + int goreAmt = maxGores - (int)Math.Round(npc.localAI[0] / 60f); + CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity); + } + } + else + npc.localAI[0] = 0f; + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 45f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootTrackingLasers) + { + npc.frameCounter += 1D; + if (npc.Calamity().newAI[1] == 0f) + { + if (npc.frameCounter >= 12D) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type]; + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + else + { + npc.frameCounter += 1D; + if (npc.frameCounter >= 12D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + + Vector2 center = npc.Center - Main.screenPosition; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow"); + spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) + { + int baseDust = vulnerable ? 3 : 1; + for (int k = 0; k < baseDust; k++) + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + + if (npc.life <= 0) + { + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail4"), 1f); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (npc.Opacity == 1f) + { + int duration = vulnerable ? 60 : 30; + player.AddBuff(BuffID.Ichor, duration); + player.AddBuff(BuffID.CursedInferno, duration); + player.AddBuff(ModContent.BuffType(), duration / 4); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(ModContent.BuffType(), duration); + player.AddBuff(BuffID.Frostburn, duration); + player.AddBuff(BuffID.OnFire, duration); + } + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.png b/NPCs/ExoMechs/Thanatos/ThanatosTail.png index 77ef4ee8de..22edba05fd 100644 Binary files a/NPCs/ExoMechs/Thanatos/ThanatosTail.png and b/NPCs/ExoMechs/Thanatos/ThanatosTail.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTailGlow.png b/NPCs/ExoMechs/Thanatos/ThanatosTailGlow.png new file mode 100644 index 0000000000..54a5e2ecaf Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosTailGlow.png differ diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index e2e6de894b..11cde0cb95 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -116,10 +116,16 @@ namespace CalamityMod.NPCs.HiveMind CalamityGlobalNPC.hiveMind = npc.whoAmI; float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) - enrageScale += 1f; - if (!player.ZoneCorrupt || malice) - enrageScale += 1f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!player.ZoneCorrupt || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 7ec811026b..fc85ac2df0 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -319,14 +319,23 @@ namespace CalamityMod.NPCs.HiveMind bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) - enrageScale += 1f; - if (!player.ZoneCorrupt || malice) - enrageScale += 1f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!player.ZoneCorrupt || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } if (npc.alpha != 0) { diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 84c5a6c09d..ac1f344a3f 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -154,12 +154,18 @@ namespace CalamityMod.NPCs.Leviathan bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); float enrageScale = 0f; - if (notOcean || malice) - enrageScale += 2f; + if (notOcean || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; - if (enraged) - enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } npc.dontTakeDamage = spawnAnimation; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 1de6c2b86d..2b69aa12f4 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -114,11 +114,17 @@ namespace CalamityMod.NPCs.Leviathan float enrageScale = 0f; if (notOcean || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1.5f; + } if (BossRushEvent.BossRushActive) enrageScale += 0.5f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 0.5f; + } float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index b417aae330..922081c5e2 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.lifeMax = 10000; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 50; + npc.Opacity = 0f; npc.noGravity = true; npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit13; @@ -56,8 +56,19 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.4f, 0.5f); - if (npc.justHit || NPC.AnyNPCs(ModContent.NPCType())) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + npc.Opacity += 0.15f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.4f, 0.5f); + if (npc.justHit || adultWyrmAlive) { hasBeenHit = true; } @@ -114,7 +125,7 @@ namespace CalamityMod.NPCs.NormalNPCs return; } npc.noTileCollide = true; - float num1446 = 7f; + float num1446 = adultWyrmAlive ? 14f : 7f; float num1447 = 480f; if (npc.localAI[1] == 1f) { @@ -131,12 +142,13 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 vector251 = Main.player[npc.target].Center - value53; bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= Main.rand.Next(90, 601)) { - npc.localAI[0] = 0f; + npc.localAI[0] = -90f; + npc.netUpdate = true; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float speed = 5f; + float speed = adultWyrmAlive ? 10f : 5f; Vector2 vector = new Vector2(npc.Center.X, npc.Center.Y); float xDist = Main.player[npc.target].Center.X - vector.X + Main.rand.NextFloat(-10f, 10f); float yDist = Main.player[npc.target].Center.Y - vector.Y + Main.rand.NextFloat(-10f, 10f); @@ -145,7 +157,7 @@ namespace CalamityMod.NPCs.NormalNPCs targetDist = speed / targetDist; targetVec.X *= targetDist; targetVec.Y *= targetDist; - int damage = Main.expertMode ? 30 : 40; + int damage = adultWyrmAlive ? (Main.expertMode ? 150 : 200) : (Main.expertMode ? 30 : 40); if (Main.rand.NextBool(2)) { Projectile.NewProjectile(npc.Center, targetVec, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 7311e96419..23b73d341a 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -116,13 +116,22 @@ namespace CalamityMod.NPCs.Perforator float enrageScale = 0f; if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; + } if (!Main.player[npc.target].ZoneCrimson || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; + } if (BossRushEvent.BossRushActive) enrageScale += 1f; if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; enrageScale += 1f; + } if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index ef807a2ba7..7b4e654352 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -175,8 +175,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Enrage float enrageScale = death ? 0.5f : 0f; - if (!player.ZoneJungle || malice) - enrageScale += 1.5f; + if (!player.ZoneJungle || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1.5f; + } if (enrageScale > 1.5f) enrageScale = 1.5f; @@ -184,8 +187,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (BossRushEvent.BossRushActive) enrageScale = 2f; - if (enraged) - enrageScale = 2.5f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale = 2.5f; + } bool diagonalDash = revenge && phase2; diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 8e91356f76..e1f431f5ee 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -1,4 +1,4 @@ -using CalamityMod.Events; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -51,8 +51,11 @@ namespace CalamityMod.NPCs.Polterghast { start = false; - for (int num621 = 0; num621 < 5; num621++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + } npc.ai[1] = npc.ai[0]; } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index f7672c7462..5cd1258aa3 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.World; @@ -143,15 +141,26 @@ namespace CalamityMod.NPCs.Polterghast acceleration += revenge ? 0.035f : 0.025f; } - // Look at target - float num740 = player.Center.X - vector.X; - float num741 = player.Center.Y - vector.Y; + // Predictiveness + float chargePredictionAmt = 10f + 20f * (tileEnrageMult - 1f); + Vector2 predictionVector = chargePhase && revenge ? player.velocity * chargePredictionAmt : Vector2.Zero; + Vector2 lookAt = player.Center + predictionVector; + Vector2 rotationVector = lookAt - vector; + + // Rotation + float num740 = player.Center.X + predictionVector.X - vector.X; + float num741 = player.Center.Y + predictionVector.Y - vector.Y; npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; npc.damage = npc.defDamage; if (!chargePhase) { + // Set this here to avoid despawn issues + reachedChargingPoint = false; + + npc.ai[0] = 0f; + npc.Opacity += 0.02f; if (npc.Opacity > 0.8f) npc.Opacity = 0.8f; @@ -262,7 +271,7 @@ namespace CalamityMod.NPCs.Polterghast if (npc.Calamity().newAI[1] == 0f) { - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; npc.Calamity().newAI[1] = 1f; } else @@ -281,6 +290,7 @@ namespace CalamityMod.NPCs.Polterghast npc.Calamity().newAI[1] = 0f; npc.Calamity().newAI[2] = 0f; npc.Calamity().newAI[3] = 0f; + npc.ai[0] = 0f; npc.ai[1] += 1f; if (npc.ai[1] >= 3f) @@ -299,6 +309,7 @@ namespace CalamityMod.NPCs.Polterghast { npc.velocity = Vector2.Zero; npc.ai[0] = Main.rand.Next(2) + 1; + npc.netUpdate = true; } // Pick a charging location @@ -337,22 +348,31 @@ namespace CalamityMod.NPCs.Polterghast npc.Opacity = 0f; } - int numUpdates = reachedChargingPoint ? 5 : 1; - for (int i = 0; i < numUpdates; i++) + if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue || reachedChargingPoint) { - if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue) + // Emit dust + if (!reachedChargingPoint) { - reachedChargingPoint = true; + Main.PlaySound(SoundID.Item125, npc.position); + for (int i = 0; i < 30; i++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + } + } - npc.velocity *= 0.5f; - } + reachedChargingPoint = true; + npc.velocity = Vector2.Zero; + npc.Center = chargeVector; + } + else + { + // Reduce velocity and acceleration to allow for smoother movement inside this loop + if (Vector2.Distance(vector, chargeVector) > 1200f) + npc.velocity = chargeLocationVelocity; else - { - if (Vector2.Distance(vector, chargeVector) > 1200f) - npc.velocity = chargeLocationVelocity; - else - npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); - } + npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); } } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 02ce465f12..91afd6a9b0 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -29,7 +29,8 @@ namespace CalamityMod.NPCs.Polterghast public class Polterghast : ModNPC { private int despawnTimer = 600; - private int chargeTelegraphTimer = 60; + private const int chargeTelegraphTimerMax = 15; + private int chargeTelegraphTimer = chargeTelegraphTimerMax; private bool reachedChargingPoint = false; public override void SetStaticDefaults() @@ -163,6 +164,23 @@ namespace CalamityMod.NPCs.Polterghast { speedBoost = true; despawnBoost = true; + reachedChargingPoint = false; + chargeTelegraphTimer = chargeTelegraphTimerMax; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + if (cloneAlive) + { + Main.npc[CalamityGlobalNPC.ghostBossClone].ai[0] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].ai[1] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[0] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[1] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[2] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[3] = 0f; + } } } @@ -296,6 +314,8 @@ namespace CalamityMod.NPCs.Polterghast if (enraged) tileEnrageMult = 2.25f; + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && tileEnrageMult >= 1.6f; + // Used to inform clone and hooks about number of active tiles nearby npc.ai[3] = tileEnrageMult; @@ -313,9 +333,15 @@ namespace CalamityMod.NPCs.Polterghast if (speedBoost) baseProjectileVelocity *= 1.25f; - // Look at target - float num740 = player.Center.X - vector.X; - float num741 = player.Center.Y - vector.Y; + // Predictiveness + float chargePredictionAmt = 10f + 20f * (tileEnrageMult - 1f); + Vector2 predictionVector = chargePhase && revenge ? player.velocity * chargePredictionAmt : Vector2.Zero; + Vector2 lookAt = player.Center + predictionVector; + Vector2 rotationVector = lookAt - vector; + + // Rotation + float num740 = player.Center.X + predictionVector.X - vector.X; + float num741 = player.Center.Y + predictionVector.Y - vector.Y; npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; if (!chargePhase) @@ -435,7 +461,7 @@ namespace CalamityMod.NPCs.Polterghast if (calamityGlobalNPC.newAI[1] == 0f) { - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; calamityGlobalNPC.newAI[1] = 1f; } else @@ -451,7 +477,7 @@ namespace CalamityMod.NPCs.Polterghast // Reset and either go back to normal or charge again if (calamityGlobalNPC.newAI[2] >= totalChargeTime) { - chargeTelegraphTimer = 15; + chargeTelegraphTimer = chargeTelegraphTimerMax; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; @@ -494,59 +520,59 @@ namespace CalamityMod.NPCs.Polterghast float chargeDistanceGateValue = 40f; bool clonePositionCheck = cloneAlive ? Vector2.Distance(Main.npc[CalamityGlobalNPC.ghostBossClone].Center, cloneChargeVector) <= chargeDistanceGateValue : true; - // Loop velocity code multiple times per frame if charge location is reached - // This effectively quadruples the velocity and acceleration while maintaining smooth movement - int numUpdates = reachedChargingPoint ? 5 : 1; - for (int i = 0; i < numUpdates; i++) + // Line up a charge + if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue || reachedChargingPoint) { - // Line up a charge - if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue) + // Emit dust + if (!reachedChargingPoint) { - reachedChargingPoint = true; - - npc.velocity *= 0.5f; - - if (clonePositionCheck) + Main.PlaySound(SoundID.Item125, npc.position); + for (int i = 0; i < 30; i++) { - // Pause for 15 frames before actually charging - // This is 15 frames because this code runs 4 times per frame once a charge location is found - if (chargeTelegraphTimer > 0) + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + } + } + + reachedChargingPoint = true; + npc.velocity = Vector2.Zero; + npc.Center = chargeVector; + + if (clonePositionCheck) + { + // Pause for 15 frames before actually charging + if (chargeTelegraphTimer > 0) + { + chargeTelegraphTimer--; + } + else + { + // Initiate charge + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 1f; + + // Tell clone to charge + if (cloneAlive) { - chargeTelegraphTimer--; - } - else - { - // Initiate charge - npc.velocity = Vector2.Zero; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 1f; + Main.npc[CalamityGlobalNPC.ghostBossClone].ai[0] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[1] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[2] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[3] = 1f; - // Tell clone to charge - if (cloneAlive) - { - Main.npc[CalamityGlobalNPC.ghostBossClone].velocity = Vector2.Zero; - Main.npc[CalamityGlobalNPC.ghostBossClone].ai[0] = 0f; - Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[1] = 0f; - Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[2] = 0f; - Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[3] = 1f; - - // - // CODE TWEAKED BY: OZZATRON - // September 21st, 2020 - // reason: fixing Polter charge MP desync bug - // - // removed Polter syncing the clone's newAI array. The clone now auto syncs its own newAI every frame. - } - - // Break because looping beyond this point is useless - break; + // + // CODE TWEAKED BY: OZZATRON + // September 21st, 2020 + // reason: fixing Polter charge MP desync bug + // + // removed Polter syncing the clone's newAI array. The clone now auto syncs its own newAI every frame. } } } - else - npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); } + else + npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); } npc.netUpdate = true; @@ -658,7 +684,7 @@ namespace CalamityMod.NPCs.Polterghast calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - Main.PlaySound(SoundID.Item122, npc.position); + Main.PlaySound(SoundID.Item122, npc.Center); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); @@ -679,10 +705,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -806,7 +832,7 @@ namespace CalamityMod.NPCs.Polterghast } } - Main.PlaySound(SoundID.Item122, npc.position); + Main.PlaySound(SoundID.Item122, npc.Center); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); @@ -827,10 +853,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -1111,7 +1137,7 @@ namespace CalamityMod.NPCs.Polterghast public override void HitEffect(int hitDirection, double damage) { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Ectoplasm, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { npc.position.X = npc.position.X + (npc.width / 2); @@ -1132,10 +1158,10 @@ namespace CalamityMod.NPCs.Polterghast } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index a735b1e9c8..69783fe160 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -154,10 +154,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (immuneTimer > 0) immuneTimer--; + else + npc.Calamity().CurrentlyEnraged = true; } else immuneTimer = 300; + if (enraged) + npc.Calamity().CurrentlyEnraged = true; + // Take damage or not npc.dontTakeDamage = immuneTimer <= 0; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index f3aa1929d5..196eae8887 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -94,6 +94,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (immuneTimer > 0) immuneTimer--; + else + npc.Calamity().CurrentlyEnraged = true; } else immuneTimer = 300; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 5bac65b170..772cc7d613 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -94,6 +94,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (immuneTimer > 0) immuneTimer--; + else + npc.Calamity().CurrentlyEnraged = true; } else immuneTimer = 300; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 199312fff7..25cf8a729f 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -214,6 +214,8 @@ namespace CalamityMod.NPCs.Providence if (nightTime) projectileDamageMult = 2; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (nightTime || malice)) || enraged; + // Projectile damage values int holyLaserDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; int crystalDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; @@ -934,10 +936,9 @@ namespace CalamityMod.NPCs.Providence } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(fireFrom, velocity2, type, 0, 0f, Main.myPlayer, 0f, nightTime ? -300 : npc.GetProjectileDamageNoScaling(type)); - Main.projectile[proj].extraUpdates += 1; + Projectile.NewProjectile(fireFrom, velocity2, type, 0, 0f, Main.myPlayer, 0f, nightTime ? -300 : npc.GetProjectileDamageNoScaling(type)); } } } @@ -1344,10 +1345,8 @@ namespace CalamityMod.NPCs.Providence DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); } - if (Main.netMode != NetmodeID.MultiplayerClient) - { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.Top.Y >= (Main.maxTilesY - 240f) * 16f) SpawnLootBox(); - } // If Providence has not been killed, notify players of Uelibloom Ore if (!CalamityWorld.downedProvidence) @@ -1380,7 +1379,7 @@ namespace CalamityMod.NPCs.Providence { int tileCenterX = (int)npc.Center.X / 16; int tileCenterY = (int)npc.Center.Y / 16; - int halfBox = npc.width / 2 / 16 + 1; + int halfBox = 5; for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) { for (int y = tileCenterY - halfBox; y <= tileCenterY + halfBox; y++) diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 02c22c4755..a37ea32161 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -101,8 +101,10 @@ namespace CalamityMod.NPCs.Ravager bool death = CalamityWorld.death || malice; bool enraged = calamityGlobalNPC.enraged > 0; - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; // Increase aggression if player is taking a long time to kill the boss if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index c48f4ef170..c2734c6dd4 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -117,7 +117,9 @@ namespace CalamityMod.NPCs.Signus bool phase3 = lifeRatio < 0.5f; bool phase4 = lifeRatio < 0.33f; - npc.damage = npc.defDamage; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + npc.damage = npc.defDamage; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index a130a91e5f..c934236acc 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -65,6 +65,8 @@ namespace CalamityMod.NPCs.SlimeGod bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + Vector2 vector = npc.Center; float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index bd72f61683..a08be74c81 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -94,6 +94,7 @@ namespace CalamityMod.NPCs.SlimeGod bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -647,7 +648,6 @@ namespace CalamityMod.NPCs.SlimeGod // This loot code is shared with every other Slime God component. public static void DropSlimeGodLoot(NPC npc) { - CalamityMod mod = ModContent.GetInstance(); DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 4f3ed35348..45a09f2b30 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -68,7 +68,9 @@ namespace CalamityMod.NPCs.SlimeGod bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; - Vector2 vector = npc.Center; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vector = npc.Center; float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 244504ae1d..e549251fd3 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -70,7 +70,9 @@ namespace CalamityMod.NPCs.SlimeGod bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; - Vector2 vector = npc.Center; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vector = npc.Center; float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index f423f1801b..190827cb5c 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -70,7 +70,9 @@ namespace CalamityMod.NPCs.SlimeGod bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; - Vector2 vector = npc.Center; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vector = npc.Center; float lifeRatio = npc.life / (float)npc.lifeMax; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 7ef426a647..7b7a42732c 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -85,6 +85,8 @@ namespace CalamityMod.NPCs.StormWeaver bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + if (!Main.raining && !BossRushEvent.BossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) { CalamityUtils.StartRain(); diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 52381db3d8..c256241bd9 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -113,6 +113,7 @@ namespace CalamityMod.NPCs.StormWeaver bool death = CalamityWorld.death || malice; bool revenge = CalamityWorld.revenge || malice; bool expertMode = Main.expertMode || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; if (invinceTime > 0) { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 440c0feb0a..62abf5c11a 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -535,6 +535,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } protectionBoost = false; } + npc.Calamity().CurrentlyEnraged = !player.Hitbox.Intersects(safeBox); // Set DR to be 99% and unbreakable if enraged. Boost DR during the 5th attack. CalamityGlobalNPC global = npc.Calamity(); diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 90d13d2ebd..f796b9c74a 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -352,6 +352,7 @@ namespace CalamityMod.NPCs.Yharon else { enraged = !player.Hitbox.Intersects(safeBox); + npc.Calamity().CurrentlyEnraged = enraged; if (enraged) { phaseSwitchTimer = 15; diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index ee59e5b66b..9cfb695807 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -39,9 +39,8 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 2) - { projectile.frame = 0; - } + if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; @@ -52,14 +51,14 @@ namespace CalamityMod.Projectiles.Boss projectile.spriteDirection = 1; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); } + Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0f); + projectile.ai[0] += 1f; if (projectile.ai[0] > 9f) { if (projectile.alpha > 0) - { projectile.alpha -= 5; - } } } diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index 4500b25e80..35c1eadd39 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Boss get => projectile.ai[0]; set => projectile.ai[0] = value; } + public bool CreatedWithStarcore => projectile.ai[1] == 1f; public const int TotalSinePeriods = 6; public const int PulseTime = 45; public const int TotalRitualTime = 420; @@ -37,26 +38,28 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = TotalRitualTime; } - public override void AI() - { - Time++; - if (Time == TotalRitualTime - PulseTime) - { - int idx = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); - if (idx != -1) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), projectile.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.BossAwakenMessage(idx); - } - else - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); - } - } - } - } + public override void AI() + { + projectile.extraUpdates = CreatedWithStarcore.ToInt(); + + Time++; + if (Time == TotalRitualTime - PulseTime) + { + int idx = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); + if (idx != -1) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), projectile.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.BossAwakenMessage(idx); + } + else + { + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); + } + } + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ExoDestroyerBeamStart.cs new file mode 100644 index 0000000000..3d2c5ee560 --- /dev/null +++ b/Projectiles/Boss/ExoDestroyerBeamStart.cs @@ -0,0 +1,271 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ExoDestroyerBeamStart : ModProjectile + { + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; + public ref float Time => ref projectile.localAI[0]; + public ref float LengthOfLaser => ref projectile.localAI[1]; + public const int Lifetime = 180; + public const float BeamPosOffset = 16f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thanatos Deathray"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Time); + writer.Write(LengthOfLaser); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Time = reader.ReadSingle(); + LengthOfLaser = reader.ReadSingle(); + } + + public override void AI() + { + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // The direction of the host NPC. + Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); + + // Offset to move the beam forward so that it starts inside the NPC's mouth. + float beamStartForwardsOffset = -18f; + + // Set the starting location of the beam to the center of the NPC. + projectile.Center = ThingToAttachTo.Center; + // Add a fixed offset to align with the NPC's spritesheet (?) + projectile.position += hostNPCDirection * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); + // Add the forwards offset, measured in pixels. + projectile.position += hostNPCDirection * beamStartForwardsOffset; + + projectile.rotation = ThingToAttachTo.velocity.ToRotation(); + + Time++; + + float scale = 1f; + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } + + projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; + if (projectile.scale > scale) + projectile.scale = scale; + + float num804 = projectile.velocity.ToRotation(); + num804 += projectile.ai[0]; + projectile.rotation = num804 - MathHelper.PiOver2; + projectile.velocity = num804.ToRotationVector2(); + + float arraySize = 3f; + Vector2 samplingPoint = projectile.Center; + float[] samples = new float[(int)arraySize]; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 2400f, samples); + float laserLength = 0f; + for (int i = 0; i < samples.Length; i++) + { + laserLength += samples[i]; + } + laserLength /= arraySize; + + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) + laserLength = 2400f; + + float amount = 0.5f; + LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); + + // Fire beams along the laser + float divisor = expertMode ? 80f : 160f; + if (ThingToAttachTo.Calamity().newAI[2] % divisor == 0f && projectile.owner == Main.myPlayer) + { + Vector2 velocity = projectile.velocity; + velocity.Normalize(); + float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f; + Vector2 fireFrom = ThingToAttachTo.Center + velocity * distanceBetweenProjectiles; + int projectileAmt = (int)(LengthOfLaser / distanceBetweenProjectiles); + int type = ModContent.ProjectileType(); + int damage = projectile.GetProjectileDamage(ThingToAttachTo.type); + for (int i = 0; i < projectileAmt; i++) + { + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int j = 0; j < totalProjectiles; j++) + { + Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); + Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); + } + fireFrom += velocity * distanceBetweenProjectiles; + } + } + + int dustType = (int)CalamityDusts.Brimstone; + + // Spawn dust at the start of the beam + Vector2 dustPos = projectile.Center + projectile.velocity * 14f; + for (int i = 0; i < 2; i++) + { + float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); + int dust = Dust.NewDust(dustPos, 0, 0, dustType, -dustVel.X, -dustVel.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } + + if (Main.rand.NextBool(5)) + { + Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y = Math.Abs(Main.dust[dust].velocity.Y); + } + + // Spawn dust at the end of the beam + dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f); + for (int i = 0; i < 2; i++) + { + float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); + int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } + + if (Main.rand.NextBool(5)) + { + Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); + } + + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; + + Texture2D beamStart = Main.projectileTexture[projectile.type]; + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamEnd"); + + float drawLength = LengthOfLaser; + Color color = new Color(250, 0, 0, 0); + + // Draw start of beam + Vector2 vector = projectile.Center - Main.screenPosition; + Rectangle? sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamStart.Width, 16); + spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, beamStart.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + // Draw middle of beam + drawLength -= (beamStart.Height / 2 + beamEnd.Height) * projectile.scale; + Vector2 center = projectile.Center; + center += projectile.velocity * projectile.scale * beamStart.Height / 2f; + if (drawLength > 0f) + { + float i = 0f; + Rectangle rectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamMiddle.Width, 16); + while (i + 1f < drawLength) + { + if (drawLength - i < rectangle.Height) + rectangle.Height = (int)(drawLength - i); + + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); + + i += rectangle.Height * projectile.scale; + center += projectile.velocity * rectangle.Height * projectile.scale; + + rectangle.Y += 16; + if (rectangle.Y + rectangle.Height > beamMiddle.Height) + rectangle.Y = 0; + } + } + + // Draw end of beam + Vector2 vector2 = center - Main.screenPosition; + sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamEnd.Width, 16); + spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, beamEnd.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + + float collisionPoint = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 22f * projectile.scale, ref collisionPoint)) + return true; + + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(BuffID.OnFire, 360); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.png b/Projectiles/Boss/ExoDestroyerBeamStart.png new file mode 100644 index 0000000000..a0c3da9735 Binary files /dev/null and b/Projectiles/Boss/ExoDestroyerBeamStart.png differ diff --git a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs b/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs new file mode 100644 index 0000000000..cd9d0560cf --- /dev/null +++ b/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ExoDestroyerBeamTelegraph : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; + public float ConvergenceRatio => MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(25f, 120f, Time, true)); + public ref float StartingRotationalOffset => ref projectile.ai[1]; + public ref float ConvergenceAngle => ref projectile.localAI[0]; + public ref float Time => ref projectile.localAI[1]; + public const int Lifetime = 180; + public const float TelegraphWidth = 3600f; + public const float BeamPosOffset = 16f; + public override void SetStaticDefaults() => DisplayName.SetDefault("Telegraph"); + + public override void SetDefaults() + { + projectile.width = projectile.height = 4; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = Lifetime; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(ConvergenceAngle); + writer.Write(Time); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + ConvergenceAngle = reader.ReadSingle(); + Time = reader.ReadSingle(); + } + + public override void AI() + { + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // The direction of the host NPC. + Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); + + // Offset to move the beam forward so that it starts inside the NPC's mouth. + float beamStartForwardsOffset = -18f; + + // Set the starting location of the beam to the center of the NPC. + projectile.Center = ThingToAttachTo.Center; + // Add a fixed offset to align with the NPC's spritesheet (?) + projectile.position += hostNPCDirection * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); + // Add the forwards offset, measured in pixels. + projectile.position += hostNPCDirection * beamStartForwardsOffset; + + projectile.rotation = StartingRotationalOffset.AngleLerp(ConvergenceAngle, ConvergenceRatio) + ThingToAttachTo.velocity.ToRotation(); + + Time++; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + + float verticalScale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(0f, 16f, projectile.timeLeft, true) * 4f; + + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, verticalScale); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + + Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, Time / Lifetime * 2f % 1f); // Iterate through crimson and red twice and then flash. + colorOuter = Color.Lerp(colorOuter, Color.White, Utils.InverseLerp(40f, 0f, projectile.timeLeft, true) * 0.8f); + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.5f); + + colorInner *= 0.85f; + colorOuter *= 0.7f; + + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, projectile.rotation, origin, scaleOuter, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, projectile.rotation, origin, scaleInner, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Boss/ExoDestroyerLaser.cs b/Projectiles/Boss/ExoDestroyerLaser.cs new file mode 100644 index 0000000000..f3456966c7 --- /dev/null +++ b/Projectiles/Boss/ExoDestroyerLaser.cs @@ -0,0 +1,276 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ExoDestroyerLaser : ModProjectile + { + public float TelegraphDelay + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + + public Vector2 Destination; + public Vector2 Velocity; + public const float TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; + public const float LaserVelocity = 12f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thanatos Beam"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 22; + projectile.height = 22; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(Destination); + writer.WriteVector2(Velocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Destination = reader.ReadVector2(); + Velocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + + // If there is no NPC to attach to, run this instead. + if (projectile.ai[1] == -1f) + { + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) + { + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + + // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (Velocity != Vector2.Zero) + { + projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); + Velocity = Vector2.Zero; + projectile.netUpdate = true; + } + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + else if (Velocity == Vector2.Zero) + { + Velocity = projectile.velocity; + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + + TelegraphDelay++; + + return; + } + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) + { + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + + // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (Velocity != Vector2.Zero) + { + projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); + Velocity = Vector2.Zero; + projectile.netUpdate = true; + } + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + else if (Destination == Vector2.Zero) + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + // Set destination of the laser, the target's center. + Destination = projectile.velocity; + + // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. + Vector2 projectileDestination = Destination - ThingToAttachTo.Center; + Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + + // Set velocity to zero. + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + else + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. + Vector2 projectileDestination = Destination - ThingToAttachTo.Center; + Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + + TelegraphDelay++; + } + + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (TelegraphDelay > TelegraphTotalTime) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.OnFire, 180); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + return true; + + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + + float yScale = 4f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 4f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(4f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + + Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.7f; + colorInner *= 0.7f; + + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Boss/ExoDestroyerLaser.png b/Projectiles/Boss/ExoDestroyerLaser.png new file mode 100644 index 0000000000..49cdca1d74 Binary files /dev/null and b/Projectiles/Boss/ExoDestroyerLaser.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 30c73a263f..0dac39f74e 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -362,31 +362,31 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) - { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, 0f, (255 - projectile.alpha) * 0.3f / 255f); + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.3f / 255f, 0f, (255 - projectile.alpha) * 0.3f / 255f); - if (projectile.alpha > 0) - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[1] = 1f; - } + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[1] = 1f; + } - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.0025f; + if (projectile.velocity.Length() < 18f) + projectile.velocity *= 1.0025f; - return false; - } + return false; + } - else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) - { + else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) + { if (defDamage == 0) { // Reduce mech boss projectile damage depending on the new ore progression changes @@ -403,250 +403,250 @@ namespace CalamityMod.Projectiles projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); - if (projectile.alpha > 0) - projectile.alpha -= 125; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[1] = 1f; - } + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[1] = 1f; + } - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.0025f; + if (projectile.velocity.Length() < 12f) + projectile.velocity *= 1.0025f; - return false; - } + return false; + } - else if (projectile.type == ProjectileID.PoisonSeedPlantera) - { - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frameCounter = 0; - projectile.frame++; + else if (projectile.type == ProjectileID.PoisonSeedPlantera) + { + projectile.frameCounter++; + if (projectile.frameCounter > 1) + { + projectile.frameCounter = 0; + projectile.frame++; - if (projectile.frame > 1) - projectile.frame = 0; - } + if (projectile.frame > 1) + projectile.frame = 0; + } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item17, projectile.position); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item17, projectile.position); + } - if (projectile.alpha > 0) - projectile.alpha -= 30; - if (projectile.alpha < 0) - projectile.alpha = 0; + if (projectile.alpha > 0) + projectile.alpha -= 30; + if (projectile.alpha < 0) + projectile.alpha = 0; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - projectile.ai[0] = 120f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + projectile.ai[0] = 120f; - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.01f; - } + if (projectile.velocity.Length() < 18f) + projectile.velocity *= 1.01f; + } - projectile.tileCollide = false; + projectile.tileCollide = false; - if (projectile.timeLeft > 600) - projectile.timeLeft = 600; + if (projectile.timeLeft > 600) + projectile.timeLeft = 600; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - return false; - } + return false; + } - else if (projectile.type == ProjectileID.ThornBall) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 30; - if (projectile.alpha < 0) - projectile.alpha = 0; - } + else if (projectile.type == ProjectileID.ThornBall) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 30; + if (projectile.alpha < 0) + projectile.alpha = 0; + } - int num147 = Player.FindClosest(projectile.Center, 1, 1); - float num146 = 7.5f * projectile.ai[1] + Vector2.Distance(Main.player[num147].Center, projectile.Center) * 0.01f; - Vector2 vector12 = Main.player[num147].Center - projectile.Center; - vector12.Normalize(); - vector12 *= num146; - int num148 = 200; - projectile.velocity.X = (projectile.velocity.X * (num148 - 1) + vector12.X) / num148; + int num147 = Player.FindClosest(projectile.Center, 1, 1); + float num146 = 7.5f * projectile.ai[1] + Vector2.Distance(Main.player[num147].Center, projectile.Center) * 0.01f; + Vector2 vector12 = Main.player[num147].Center - projectile.Center; + vector12.Normalize(); + vector12 *= num146; + int num148 = 200; + projectile.velocity.X = (projectile.velocity.X * (num148 - 1) + vector12.X) / num148; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) - { - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) - { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) - projectile.Kill(); - } - projectile.velocity.Y += 0.1f; - } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + projectile.Kill(); + } + projectile.velocity.Y += 0.1f; + } - projectile.rotation += projectile.velocity.X * 0.05f; + projectile.rotation += projectile.velocity.X * 0.05f; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; - return false; - } + return false; + } - // Phase 1 sharknado - else if (projectile.type == ProjectileID.SharknadoBolt) - { - if (projectile.ai[1] < 0f) - { - float num623 = 0.209439516f; - float num624 = -2f; - float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; + // Phase 1 sharknado + else if (projectile.type == ProjectileID.SharknadoBolt) + { + if (projectile.ai[1] < 0f) + { + float num623 = 0.209439516f; + float num624 = -2f; + float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; - projectile.velocity.Y -= num625; + projectile.velocity.Y -= num625; - projectile.ai[0] += 1f; + projectile.ai[0] += 1f; - num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; + num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; - projectile.velocity.Y += num625; + projectile.velocity.Y += num625; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - projectile.alpha = 100; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + projectile.alpha = 100; - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } - return false; - } - } + return false; + } + } - else if (projectile.type == ProjectileID.Sharknado) - { - projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); - } + else if (projectile.type == ProjectileID.Sharknado) + { + projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); + } - // Larger cthulhunadoes - else if (projectile.type == ProjectileID.Cthulunado) - { - projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); + // Larger cthulhunadoes + else if (projectile.type == ProjectileID.Cthulunado) + { + projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); - int num606 = 16; - int num607 = 16; - float num608 = 2f; - int num609 = 150; - int num610 = 42; + int num606 = 16; + int num607 = 16; + float num608 = 2f; + int num609 = 150; + int num610 = 42; - if (projectile.velocity.X != 0f) - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + if (projectile.velocity.X != 0f) + projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); - int num3 = projectile.frameCounter; - projectile.frameCounter = num3 + 1; - if (projectile.frameCounter > 2) - { - num3 = projectile.frame; - projectile.frame = num3 + 1; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - projectile.frame = 0; + int num3 = projectile.frameCounter; + projectile.frameCounter = num3 + 1; + if (projectile.frameCounter > 2) + { + num3 = projectile.frame; + projectile.frame = num3 + 1; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + projectile.frame = 0; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - projectile.netUpdate = true; - } + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); + projectile.width = (int)(num609 * projectile.scale); + projectile.height = (int)(num610 * projectile.scale); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + projectile.netUpdate = true; + } - if (projectile.ai[1] != -1f) - { - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); - } + if (projectile.ai[1] != -1f) + { + projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); + projectile.width = (int)(num609 * projectile.scale); + projectile.height = (int)(num610 * projectile.scale); + } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - projectile.alpha = 60; - if (projectile.alpha < 100) - projectile.alpha = 100; - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - projectile.alpha = 150; - } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + projectile.alpha = 60; + if (projectile.alpha < 100) + projectile.alpha = 100; + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + projectile.alpha = 150; + } - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; + if (projectile.ai[0] > 0f) + projectile.ai[0] -= 1f; - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= num610 * projectile.scale / 2f; + Vector2 center = projectile.Center; + center.Y -= num610 * projectile.scale / 2f; - float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); - center.Y -= num610 * num611 / 2f; - center.Y += 2f; + float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); + center.Y -= num610 * num611 / 2f; + center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) - { - int num614 = NPC.NewNPC((int)center.X, (int)center.Y, NPCID.Sharkron2); - Main.npc[num614].velocity = projectile.velocity; - Main.npc[num614].scale = 1.5f; - Main.npc[num614].netUpdate = true; - Main.npc[num614].ai[2] = projectile.width; - Main.npc[num614].ai[3] = -1.5f; - } - } + if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) + { + int num614 = NPC.NewNPC((int)center.X, (int)center.Y, NPCID.Sharkron2); + Main.npc[num614].velocity = projectile.velocity; + Main.npc[num614].scale = 1.5f; + Main.npc[num614].netUpdate = true; + Main.npc[num614].ai[2] = projectile.width; + Main.npc[num614].ai[3] = -1.5f; + } + } - if (projectile.ai[0] <= 0f) - { - float num615 = 0.104719758f; - float num616 = projectile.width / 5f * 2.5f; - float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + if (projectile.ai[0] <= 0f) + { + float num615 = 0.104719758f; + float num616 = projectile.width / 5f * 2.5f; + float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - projectile.position.X -= num617 * -projectile.direction; + projectile.position.X -= num617 * -projectile.direction; - projectile.ai[0] -= 1f; + projectile.ai[0] -= 1f; - num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - projectile.position.X += num617 * -projectile.direction; - } + num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + projectile.position.X += num617 * -projectile.direction; + } - return false; - } + return false; + } else if (projectile.type == ProjectileID.CultistBossLightningOrb) { @@ -762,318 +762,315 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.CultistBossIceMist) { - if (NPC.AnyNPCs(NPCID.CultistBoss)) + if (projectile.localAI[1] == 0f) { - if (projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item120, projectile.position); - } + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item120, projectile.position); + } - projectile.ai[0] += 1f; + projectile.ai[0] += 1f; - // Main projectile - float duration = 300f; - if (projectile.ai[1] == 1f) - { - if (projectile.ai[0] >= duration - 20f) - projectile.alpha += 10; - else - projectile.alpha -= 10; - - if (projectile.alpha < 0) - projectile.alpha = 0; - if (projectile.alpha > 255) - projectile.alpha = 255; - - if (projectile.ai[0] >= duration) - { - projectile.Kill(); - return false; - } - - int num103 = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - - if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector50 = projectile.rotation.ToRotationVector2(); - Projectile.NewProjectile(projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); - } - - projectile.rotation += (float)Math.PI / 30f; - - Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); - - return false; - } - - // Split projectiles - projectile.position -= projectile.velocity; - - if (projectile.ai[0] >= duration - 260f) - projectile.alpha += 3; + // Main projectile + float duration = 300f; + if (projectile.ai[1] == 1f) + { + if (projectile.ai[0] >= duration - 20f) + projectile.alpha += 10; else - projectile.alpha -= 40; + projectile.alpha -= 10; if (projectile.alpha < 0) projectile.alpha = 0; if (projectile.alpha > 255) projectile.alpha = 255; - if (projectile.ai[0] >= duration - 255f) + if (projectile.ai[0] >= duration) { projectile.Kill(); return false; } - Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); - float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); - Vector2 spinningpoint13 = value39 * scaleFactor3; + int num103 = Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; - for (int num724 = 0; num724 < 6; num724++) + if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * ((float)Math.PI * 2f) / 6f); - - Lighting.AddLight(vector51, 0.3f, 0.75f, 0.9f); - - for (int num725 = 0; num725 < 2; num725++) - { - int num726 = Dust.NewDust(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); - Main.dust[num726].noGravity = true; - } + Vector2 vector50 = projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); } + projectile.rotation += (float)Math.PI / 30f; + + Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + + return false; + } + + // Split projectiles + projectile.position -= projectile.velocity; + + if (projectile.ai[0] >= duration - 260f) + projectile.alpha += 3; + else + projectile.alpha -= 40; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + + if (projectile.ai[0] >= duration - 255f) + { + projectile.Kill(); + return false; + } + + Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); + float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); + Vector2 spinningpoint13 = value39 * scaleFactor3; + + for (int num724 = 0; num724 < 6; num724++) + { + Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * ((float)Math.PI * 2f) / 6f); + + Lighting.AddLight(vector51, 0.3f, 0.75f, 0.9f); + + for (int num725 = 0; num725 < 2; num725++) + { + int num726 = Dust.NewDust(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[num726].noGravity = true; + } + } + + return false; + } + + // Change the stupid homing eyes + else if (projectile.type == ProjectileID.PhantasmalEye) + { + projectile.alpha -= 40; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 45f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 1f; + projectile.ai[1] = 0f - projectile.ai[1]; + projectile.netUpdate = true; + } + + projectile.velocity.X = projectile.velocity.RotatedBy(projectile.ai[1]).X; + projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + projectile.velocity.Y -= 0.08f; + + if (projectile.velocity.Y > 0f) + projectile.velocity.Y -= 0.2f; + if (projectile.velocity.Y < -7f) + projectile.velocity.Y = -7f; + } + else if (projectile.ai[0] == 1f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 2f; + projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); + projectile.netUpdate = true; + } + + projectile.velocity.X = projectile.velocity.RotatedBy(projectile.ai[1]).X; + projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); + projectile.velocity.Y -= 0.08f; + + if (projectile.velocity.Y > 0f) + projectile.velocity.Y -= 0.2f; + if (projectile.velocity.Y < -7f) + projectile.velocity.Y = -7f; + } + else if (projectile.ai[0] == 2f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 45f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + + Vector2 value23 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + value23.Normalize(); + value23 *= 12f; + value23 = Vector2.Lerp(projectile.velocity, value23, 0.6f); + + float num675 = 0.4f; + if (projectile.velocity.X < value23.X) + { + projectile.velocity.X += num675; + if (projectile.velocity.X < 0f && value23.X > 0f) + projectile.velocity.X += num675; + } + else if (projectile.velocity.X > value23.X) + { + projectile.velocity.X -= num675; + if (projectile.velocity.X > 0f && value23.X < 0f) + projectile.velocity.X -= num675; + } + if (projectile.velocity.Y < value23.Y) + { + projectile.velocity.Y += num675; + if (projectile.velocity.Y < 0f && value23.Y > 0f) + projectile.velocity.Y += num675; + } + else if (projectile.velocity.Y > value23.Y) + { + projectile.velocity.Y -= num675; + if (projectile.velocity.Y > 0f && value23.Y < 0f) + projectile.velocity.Y -= num675; + } + } + else if (projectile.ai[0] == 3f) + { + Vector2 value23 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + if (value23.Length() < 30f) + { + projectile.Kill(); + return false; + } + + float velocityLimit = ((CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 28f : 24f) / MathHelper.Clamp(lineColor * 0.75f, 1f, 3f); + if (projectile.velocity.Length() < velocityLimit) + projectile.velocity *= 1.01f; + } + + if (projectile.alpha < 40) + { + int num676 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 229, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 1.2f); + Main.dust[num676].noGravity = true; + } + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + return false; + } + + // Moon Lord big eye spheres + else if (projectile.type == ProjectileID.PhantasmalSphere && Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHand) + { + float velocityLimit = (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 14f : 12f; + if (projectile.velocity.Length() < velocityLimit) + projectile.velocity *= 1.0075f; + + return true; + } + + // Moon Lord Deathray + else if (projectile.type == ProjectileID.PhantasmalDeathray) + { + if (Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHead) + { + Vector2? vector78 = null; + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + projectile.velocity = -Vector2.UnitY; + + if (Main.npc[(int)projectile.ai[1]].active) + { + Vector2 value21 = new Vector2(27f, 59f); + Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); + projectile.position = Main.npc[(int)projectile.ai[1]].Center + value22 - new Vector2(projectile.width, projectile.height) / 2f; + } + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + projectile.velocity = -Vector2.UnitY; + + if (projectile.localAI[0] == 0f) + Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); + + float num801 = 1f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 180f) + { + projectile.Kill(); + return false; + } + + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / 180f) * 10f * num801; + if (projectile.scale > num801) + projectile.scale = num801; + + float num804 = projectile.velocity.ToRotation(); + num804 += projectile.ai[0]; + projectile.rotation = num804 - MathHelper.PiOver2; + projectile.velocity = num804.ToRotationVector2(); + + float num805 = 3f; + float num806 = projectile.width; + + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + { + samplingPoint = vector78.Value; + } + + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + float num807 = 0f; + int num3; + for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) + { + num807 += array3[num808]; + num3 = num808; + } + num807 /= num805; + + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1) && + Main.npc[(int)projectile.ai[1]].Calamity().newAI[0] == 1f) + { + num807 = 2400f; + } + + float amount = 0.5f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); + + Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + for (int num809 = 0; num809 < 2; num809 = num3 + 1) + { + float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num811 = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); + int num812 = Dust.NewDust(vector79, 0, 0, 229, vector80.X, vector80.Y, 0, default, 1f); + Main.dust[num812].noGravity = true; + Main.dust[num812].scale = 1.7f; + num3 = num809; + } + + if (Main.rand.Next(5) == 0) + { + Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num813]; + dust.velocity *= 0.5f; + Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); + } + + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + return false; } } - - // Change the stupid homing eyes - else if (projectile.type == ProjectileID.PhantasmalEye) - { - projectile.alpha -= 40; - if (projectile.alpha < 0) - projectile.alpha = 0; - - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 45f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.ai[1] = 0f - projectile.ai[1]; - projectile.netUpdate = true; - } - - projectile.velocity.X = projectile.velocity.RotatedBy(projectile.ai[1]).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y -= 0.08f; - - if (projectile.velocity.Y > 0f) - projectile.velocity.Y -= 0.2f; - if (projectile.velocity.Y < -7f) - projectile.velocity.Y = -7f; - } - else if (projectile.ai[0] == 1f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 2f; - projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; - } - - projectile.velocity.X = projectile.velocity.RotatedBy(projectile.ai[1]).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y -= 0.08f; - - if (projectile.velocity.Y > 0f) - projectile.velocity.Y -= 0.2f; - if (projectile.velocity.Y < -7f) - projectile.velocity.Y = -7f; - } - else if (projectile.ai[0] == 2f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 45f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - - Vector2 value23 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - value23.Normalize(); - value23 *= 12f; - value23 = Vector2.Lerp(projectile.velocity, value23, 0.6f); - - float num675 = 0.4f; - if (projectile.velocity.X < value23.X) - { - projectile.velocity.X += num675; - if (projectile.velocity.X < 0f && value23.X > 0f) - projectile.velocity.X += num675; - } - else if (projectile.velocity.X > value23.X) - { - projectile.velocity.X -= num675; - if (projectile.velocity.X > 0f && value23.X < 0f) - projectile.velocity.X -= num675; - } - if (projectile.velocity.Y < value23.Y) - { - projectile.velocity.Y += num675; - if (projectile.velocity.Y < 0f && value23.Y > 0f) - projectile.velocity.Y += num675; - } - else if (projectile.velocity.Y > value23.Y) - { - projectile.velocity.Y -= num675; - if (projectile.velocity.Y > 0f && value23.Y < 0f) - projectile.velocity.Y -= num675; - } - } - else if (projectile.ai[0] == 3f) - { - Vector2 value23 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (value23.Length() < 30f) - { - projectile.Kill(); - return false; - } - - float velocityLimit = ((CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 28f : 24f) / MathHelper.Clamp(lineColor * 0.75f, 1f, 3f); - if (projectile.velocity.Length() < velocityLimit) - projectile.velocity *= 1.01f; - } - - if (projectile.alpha < 40) - { - int num676 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 229, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 1.2f); - Main.dust[num676].noGravity = true; - } - - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - - return false; - } - - // Moon Lord big eye spheres - else if (projectile.type == ProjectileID.PhantasmalSphere && Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHand) - { - float velocityLimit = (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 14f : 12f; - if (projectile.velocity.Length() < velocityLimit) - projectile.velocity *= 1.0075f; - - return true; - } - - // Moon Lord Deathray - else if (projectile.type == ProjectileID.PhantasmalDeathray) - { - if (Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHead) - { - Vector2? vector78 = null; - - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; - - if (Main.npc[(int)projectile.ai[1]].active) - { - Vector2 value21 = new Vector2(27f, 59f); - Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); - projectile.position = Main.npc[(int)projectile.ai[1]].Center + value22 - new Vector2(projectile.width, projectile.height) / 2f; - } - - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; - - if (projectile.localAI[0] == 0f) - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); - - float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) - { - projectile.Kill(); - return false; - } - - projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / 180f) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; - - float num804 = projectile.velocity.ToRotation(); - num804 += projectile.ai[0]; - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); - - float num805 = 3f; - float num806 = projectile.width; - - Vector2 samplingPoint = projectile.Center; - if (vector78.HasValue) - { - samplingPoint = vector78.Value; - } - - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); - float num807 = 0f; - int num3; - for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) - { - num807 += array3[num808]; - num3 = num808; - } - num807 /= num805; - - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1) && - Main.npc[(int)projectile.ai[1]].Calamity().newAI[0] == 1f) - { - num807 = 2400f; - } - - float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); - - Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int num809 = 0; num809 < 2; num809 = num3 + 1) - { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, 229, vector80.X, vector80.Y, 0, default, 1f); - Main.dust[num812].noGravity = true; - Main.dust[num812].scale = 1.7f; - num3 = num809; - } - - if (Main.rand.Next(5) == 0) - { - Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[num813]; - dust.velocity *= 0.5f; - Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); - } - - DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - - return false; - } - } } if (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses) diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index 68652f95cb..5b030cb318 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.localAI[0] >= 100) { Vector2 center = projectile.Center; - float homingRange = 200f; + float homingRange = 250f; bool homeIn = false; float inertia = 25f; float homingSpeed = 23f; diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 6ad7f332a8..cd10ef85a0 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.localAI[1]); diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index f3123d482c..6f943b40c1 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Melee public class DevilsSunriseProj : ModProjectile { private int red; - private int greenAndBlue = 100; + private const int greenAndBlue = 100; public override void SetStaticDefaults() { diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index 14a731eadc..e5b6761e92 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -138,6 +138,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // Only perform hit effects after reaching approximately 75% of the way out. + if (Main.player[projectile.owner].WithinRange(target.Center, 620f)) + return; + // Inflicts Daybroken, Abyssal Flames and Holy Flames for 8 seconds on-hit target.AddBuff(BuffID.Daybreak, 480); target.AddBuff(ModContent.BuffType(), 480); @@ -152,6 +156,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { + // Only perform hit effects after reaching approximately 75% of the way out. + if (projectile.WithinRange(Main.player[projectile.owner].Center, 1100f)) + return; + // Inflicts Abyssal Flames and Holy Flames for 8 seconds on-hit target.AddBuff(ModContent.BuffType(), 480); target.AddBuff(ModContent.BuffType(), 480); diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index accefa75a7..0a405eba6c 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,11 +11,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class OracleYoyo : ModProjectile { + public int AuraFrame; + // projectile.localAI[1] is the Aura Charge of the red lightning aura // Minimum value is zero. Maximum value is 200. // The aura turns on and begins damaging enemies at 20 charge. // The yoyo "supercharges" at 50 charge. // Its size caps out at 100 charge. + public ref float AuraCharge => ref projectile.localAI[1]; + private const float MaxCharge = 200f; private const float MinAuraRadius = 20f; private const float SuperchargeThreshold = 50f; @@ -26,7 +31,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private const int HitsPerOrbVolley = 3; // Ensures that the main AI only runs once per frame, despite the projectile's multiple updates - private int extraUpdateCounter = 0; private const int UpdatesPerFrame = 3; public override void SetStaticDefaults() @@ -40,6 +44,18 @@ namespace CalamityMod.Projectiles.Melee.Yoyos ProjectileID.Sets.TrailingMode[projectile.type] = 1; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AuraFrame); + writer.Write(AuraCharge); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + AuraFrame = reader.ReadInt32(); + AuraCharge = reader.ReadSingle(); + } + public override void SetDefaults() { projectile.aiStyle = 99; @@ -61,8 +77,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.Kill(); // Only do stuff once per frame, despite the yoyo's extra updates. - extraUpdateCounter = (extraUpdateCounter + 1) % UpdatesPerFrame; - if (extraUpdateCounter != UpdatesPerFrame - 1) + if (!projectile.FinalExtraUpdate()) return; // Produces golden dust constantly while in flight. This helps light the yoyo. @@ -80,21 +95,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Lighting.AddLight(projectile.Center, 0.6f, 0.42f, 0.1f); // The aura discharges over time based on its current charge. - float discharge = MinDischargeRate + DischargeRateScaleFactor * projectile.localAI[1]; + float discharge = MinDischargeRate + DischargeRateScaleFactor * AuraCharge; if (discharge > MaxDischargeRate) discharge = MaxDischargeRate; - projectile.localAI[1] -= discharge; + AuraCharge -= discharge; // Boundary checks on aura charge - if (projectile.localAI[1] < 0f) - projectile.localAI[1] = 0f; - if (projectile.localAI[1] > MaxCharge) - projectile.localAI[1] = MaxCharge; + if (AuraCharge < 0f) + AuraCharge = 0f; + if (AuraCharge > MaxCharge) + AuraCharge = MaxCharge; // If the aura is large enough to be considered "on", draw it, make sound and damage enemies - if (projectile.localAI[1] > MinAuraRadius) + if (AuraCharge > MinAuraRadius) { - float auraRadius = projectile.localAI[1] > MaxAuraRadius ? MaxAuraRadius : projectile.localAI[1]; + float auraRadius = AuraCharge > MaxAuraRadius ? MaxAuraRadius : AuraCharge; DrawRedLightningAura(auraRadius); if (projectile.soundDelay == 0) @@ -103,13 +118,17 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Main.PlaySound(SoundID.Item93, (int)projectile.Center.X, (int)projectile.Center.Y); } - // The aura's direct damage scales with its charge and with melee stats. - float chargeRatio = projectile.localAI[1] / MaxCharge; - int auraDamage = Oracle.AuraBaseDamage + (int)(chargeRatio * (Oracle.AuraMaxDamage - Oracle.AuraBaseDamage)); - DealAuraDamage(auraRadius, auraDamage); + if (AuraFrame % 5 == 4) + { + // The aura's direct damage scales with its charge and with melee stats. + float chargeRatio = AuraCharge / MaxCharge; + int auraDamage = Oracle.AuraBaseDamage + (int)(chargeRatio * (Oracle.AuraMaxDamage - Oracle.AuraBaseDamage)); + DealAuraDamage(auraRadius, auraDamage); + } } else projectile.soundDelay = 2; + AuraFrame++; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -121,10 +140,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // Charge up the red lightning aura with every hit - projectile.localAI[1] += ChargePerHit; + AuraCharge += ChargePerHit; // Fire Auric orbs every few hits while supercharged. - if (projectile.localAI[1] > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) + if (AuraCharge > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) FireAuricOrbs(); } diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index d64bf468aa..bdf140f83f 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged { float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); + Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 3, 0f, projectile.owner); } } } diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index ece363d5fb..cb05bd132e 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) @@ -36,21 +36,21 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item14, projectile.Center); for (int i = 0; i < 2; i++) { - int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); - Main.dust[dustInt].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[dustInt].scale = 0.5f; - Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } + int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); + Main.dust[dustInt].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dustInt].scale = 0.5f; + Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } } for (int j = 0; j < 3; j++) { - int moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); - Main.dust[moreDust].noGravity = true; - Main.dust[moreDust].velocity *= 5f; - moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); - Main.dust[moreDust].velocity *= 2f; + int moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); + Main.dust[moreDust].noGravity = true; + Main.dust[moreDust].velocity *= 5f; + moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); + Main.dust[moreDust].velocity *= 2f; } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 50c08293a2..257317e083 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,13 +8,15 @@ namespace CalamityMod.Projectiles.Rogue { public class EclipsesStealth : ModProjectile { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; + // For more consistent DPS, always alternates between spawning 1 and 2 spears instead of picking randomly + private bool spawnTwoSpears = true; private bool changedTimeLeft = false; public override void SetStaticDefaults() { - DisplayName.SetDefault("Eclipse's Stealth"); + DisplayName.SetDefault("Eclipse's Fall"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -34,44 +35,59 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } + // Uses localAI[1] to decide how many frames until the next spear drops. public override void AI() { - if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks + // Behavior when not sticking to anything + if (projectile.ai[0] == 0f) { - if (Main.rand.NextBool(2) && Main.myPlayer == projectile.owner) + // Keep the spear oriented in the correct direction + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + + // Spawn dust while flying + if (Main.rand.NextBool(8)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + // Behavior when having impaled a target + else + { + // Eclipse's Fall is guaranteed to impale for 10 seconds, no more, no less + if (!changedTimeLeft) { - float dmgKBMult = Main.rand.NextFloat(0.4f, 0.6f); - int spearAmt = Main.rand.Next(1, 3); //1 to 2 spears - for (int n = 0; n < spearAmt; n++) + projectile.timeLeft = 600; + changedTimeLeft = true; + } + + // Spawn spears. As this uses local AI, it's done client-side only. + if (projectile.owner == Main.myPlayer) + { + projectile.localAI[1] -= 1f; + + if (projectile.localAI[1] <= 0f) { - CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner); + // Set up the spear counter for next time. Used to be every 5 frames there was a 50% chance; now it's more reliable but slower. + projectile.localAI[1] = Main.rand.Next(8, 14); // 8 to 13 frames between each spearfall + + int type = ModContent.ProjectileType(); + int smolDamage = (int)(projectile.damage * 0.22f); + float smolKB = 3f; + // Used to be a 50% chance each spearfall for 1 or 2. Now is consistent. + int numSpears = spawnTwoSpears ? 2 : 1; + spawnTwoSpears = !spawnTwoSpears; + for (int i = 0; i < numSpears; ++i) + CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 29f, type, smolDamage, smolKB, projectile.owner); } } } - //Behavior when not sticking to anything - if (projectile.ai[0] == 0f) - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.rand.NextBool(8)) //dust - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - //Ensures that a spear will last 10 seconds after it hits something - if (projectile.ai[0] == 1f && !changedTimeLeft) - { - projectile.timeLeft = 600; - changedTimeLeft = true; - } - - //Sticky Behaviour + // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. projectile.StickyProjAI(10); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { + // Impale the enemy on contact ("sticky behavior"). projectile.ModifyHitNPCSticky(1, true); } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index c42ddc9cd5..a9392ef4b6 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -59,6 +59,8 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int laserDamage = (int)(projectile.damage * 0.5); + if (projectile.Calamity().stealthStrike) + laserDamage /= 4; Projectile laser = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), laserDamage, 0f, projectile.owner); if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) { diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index d03fd0e7e9..4efe2a4d1b 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -87,11 +87,9 @@ namespace CalamityMod.Projectiles.Rogue player.heldProj = projectile.whoAmI; player.bodyFrame.Y = player.bodyFrame.Height; player.immuneNoBlink = true; - player.immuneTime = 10; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } + player.immuneTime = 6; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; // This is to make sure the player doesn't get yeeted out of the world, which crashes the game pretty much all of the time bool worldEdge = projectile.Center.X < 1000 || projectile.Center.Y < 1000 || projectile.Center.X > Main.maxTilesX * 16 - 1000 || projectile.Center.Y > Main.maxTilesY * 16 - 1000; diff --git a/Projectiles/Rogue/GhoulishGougerBoomerang.cs b/Projectiles/Rogue/GhoulishGougerBoomerang.cs index c348bbf5cd..5a821088da 100644 --- a/Projectiles/Rogue/GhoulishGougerBoomerang.cs +++ b/Projectiles/Rogue/GhoulishGougerBoomerang.cs @@ -137,9 +137,9 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.numHits > 0) return; - int numSouls = 3; + int numSouls = 8; int projID = ModContent.ProjectileType(); - int soulDamage = (int)(projectile.damage * 0.85f); + int soulDamage = projectile.damage; float soulKB = 0f; float speed = 6f; Vector2 velocity = Main.rand.NextVector2CircularEdge(speed, speed); @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Rogue float ai1 = Main.rand.NextFloat() + 0.5f; Projectile.NewProjectile(projectile.Center, velocity, projID, soulDamage, soulKB, projectile.owner, 0f, ai1); - // Rotate direction for the next pair of souls. + // Rotate direction for the next soul velocity = velocity.RotatedBy(MathHelper.TwoPi / numSouls); } } diff --git a/Projectiles/Rogue/GodsParanoiaDart.cs b/Projectiles/Rogue/GodsParanoiaDart.cs index 9c3274131e..e7092419f6 100644 --- a/Projectiles/Rogue/GodsParanoiaDart.cs +++ b/Projectiles/Rogue/GodsParanoiaDart.cs @@ -44,11 +44,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = 12f; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; + if (Main.rand.NextBool(3)) + { + Dust flame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 1f); + flame.velocity *= 0.1f; + flame.scale = 1.3f; + flame.noGravity = true; + } } public override void Kill(int timeLeft) @@ -63,18 +65,17 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = -1; projectile.damage /= 2; projectile.Damage(); - for (int num621 = 0; num621 < 3; num621++) + for (int i = 0; i < 2; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + Dust flame = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f); + flame.velocity *= 3f; + if (Main.rand.NextBool(2)) + flame.scale = 0.5f; + if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - } - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale *= 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + flame.scale *= 0.5f; + flame.fadeIn = Main.rand.NextFloat(1f, 2f); } } } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index 0de494c4ea..21811f8cb8 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + Dust flame = Dust.NewDustDirect(projectile.position, 1, 1, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 0.5f); + flame.alpha = projectile.alpha; + flame.velocity = Vector2.Zero; + flame.noGravity = true; } projectile.StickyProjAI(50); diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index c7f38364e6..4c10079e84 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -6,14 +6,14 @@ using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Rogue { - public class HypothermiaChunk : ModProjectile + public class HypothermiaChunk : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Chunk"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Chunk"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 80; - projectile.extraUpdates = 3; + projectile.extraUpdates = 4; projectile.ignoreWater = true; projectile.Calamity().rogue = true; projectile.tileCollide = false; @@ -58,18 +58,24 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < Main.rand.Next(1,4); i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33f), projectile.knockBack * 0.75f, Main.myPlayer, Main.rand.Next(4), 1f); - } - } + int numSplits = Main.rand.NextBool() ? 4 : 3; + int type = ModContent.ProjectileType(); + int shardDamage = (int)(projectile.damage * 0.5f); + float shardKB = projectile.knockBack * 0.75f; + + for (int i = 0; i < numSplits; ++i) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int texID = Main.rand.Next(4); + Projectile.NewProjectile(projectile.Center, velocity, type, shardDamage, shardKB, Main.myPlayer, texID, 1f); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - } + } public override void OnHitPvp(Player target, int damage, bool crit) { diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 4512773d20..14c1f328a1 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue { public class HypothermiaShard : ModProjectile { - private float counter = 0f; + private float counter = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Shard"); @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 6; projectile.scale = 1f; projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 50; + projectile.ignoreWater = true; + projectile.alpha = 50; projectile.penetrate = 1; projectile.timeLeft = 600; projectile.Calamity().rogue = true; - projectile.extraUpdates = 3; + projectile.extraUpdates = 3; } public override void AI() @@ -55,14 +55,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } return false; } @@ -100,8 +100,8 @@ namespace CalamityMod.Projectiles.Rogue { texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard4"); } - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; } } } diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 726153072c..d989b40b4b 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame %= Main.projFrames[projectile.type]; Vector2 spawnPosition = projectile.Center; - float shootSpeed = MathHelper.Lerp(8f, 20f, Utils.InverseLerp(90f, 850f, target.Distance(spawnPosition), true)); + float shootSpeed = MathHelper.Lerp(8f, 29f, Utils.InverseLerp(90f, 850f, target.Distance(spawnPosition), true)); Vector2 shootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, target.Center, GammaCanister.Gravity, shootSpeed, projectile.SafeDirectionTo(target.Center)); float fireAngle = shootVelocity.ToRotation(); diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index e80e6b43e0..12c6f6f0ae 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 destination = potentialTarget.Center - new Vector2((float)Math.Cos(angle) * potentialTarget.width * 0.65f, 250f); projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 24f, 0.03f); - if (projectile.ai[0] % 3f == 2f && potentialTarget.Top.Y > projectile.Bottom.Y) + if (projectile.ai[0] % 4f == 3f && potentialTarget.Top.Y > projectile.Bottom.Y) { Vector2 laserVelocity = projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.15f) * 25f; Projectile.NewProjectile(projectile.Bottom, laserVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 103622aa46..ad025c0a84 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon (CalamityWorld.downedDoG ? 75f : 0f) + (CalamityWorld.downedYharon ? 75f : 0f) + (modPlayer.profanedCrystalBuffs ? 420f : 0f)); - projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); + projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage() * 0.7f); ai = type; if (baseDamage >= 420f) { diff --git a/Projectiles/Typeless/BobbitHead.cs b/Projectiles/Typeless/BobbitHead.cs index 9853d2c331..7ac1093342 100644 --- a/Projectiles/Typeless/BobbitHead.cs +++ b/Projectiles/Typeless/BobbitHead.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Projectiles.Typeless { public class BobbitHead : ModProjectile { + public const float PullSpeed = 24f; + public const float ReelbackSpeed = 28f; + public const float LaunchSpeed = 25f; + public const float GrappleRangInTiles = 40f; public override void SetStaticDefaults() { DisplayName.SetDefault("Bobbit Head"); @@ -38,10 +42,7 @@ namespace CalamityMod.Projectiles.Typeless } // Amethyst Hook is 300, Static Hook is 600, 16f = 1 tile - public override float GrappleRange() - { - return 640f; //40 tiles - } + public override float GrappleRange() => GrappleRangInTiles * 16f; public override void NumGrappleHooks(Player player, ref int numHooks) { @@ -51,12 +52,12 @@ namespace CalamityMod.Projectiles.Typeless // default is 11, Lunar is 24 public override void GrappleRetreatSpeed(Player player, ref float speed) { - speed = 28f; + speed = ReelbackSpeed; } public override void GrapplePullSpeed(Player player, ref float speed) { - speed = 24; + speed = PullSpeed; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index 395cc272fe..346fbfc9d2 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -4,6 +4,7 @@ using CalamityMod.Events; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using Microsoft.Xna.Framework; using System; using Terraria; @@ -20,7 +21,11 @@ namespace CalamityMod.Projectiles.Typeless bool validBoss = npc.boss && npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() - && npc.type != ModContent.NPCType(); + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType(); if (validBoss) return true; bool bossMinion = CalamityLists.bossMinionList.Contains(npc.type); diff --git a/Sounds/Custom/ThanatosVent.ogg b/Sounds/Custom/ThanatosVent.ogg new file mode 100644 index 0000000000..df12e263a2 Binary files /dev/null and b/Sounds/Custom/ThanatosVent.ogg differ diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs index d96b508ddd..70285acf2c 100644 --- a/Tiles/Astral/AstralBeacon.cs +++ b/Tiles/Astral/AstralBeacon.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Tiles.Astral ritualSpawnPosition += new Vector2(0f, -24f); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), ritualSpawnPosition); - Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, usingStarcore.ToInt()); if (!usingStarcore) Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 6d9ac5be59..5ac30a1d5f 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -6,6 +6,7 @@ using CalamityMod.NPCs.Calamitas; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Perforator; @@ -102,11 +103,6 @@ namespace CalamityMod.UI OneToMany[NPCID.BrainofCthulhu] = BoC; OneToMany[NPCID.Creeper] = BoC; - int[] PerfWorm = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = PerfWorm; - OneToMany[ModContent.NPCType()] = PerfWorm; - OneToMany[ModContent.NPCType()] = PerfWorm; - int[] Skele = new int[] { NPCID.SkeletronHead, NPCID.SkeletronHand }; OneToMany[NPCID.SkeletronHead] = Skele; OneToMany[NPCID.SkeletronHand] = Skele; @@ -192,8 +188,11 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() - }; + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; } private static void SetupMinibossHPBarList() @@ -385,10 +384,10 @@ namespace CalamityMod.UI break; } - // Sort out the eater of worlds or medium perf worm splitting into multiple segments and multiple of them being heads - if (type == NPCID.EaterofWorldsHead || type == ModContent.NPCType()) + // Sort out the eater of worlds splitting into multiple segments and multiple of them being heads + if (type == NPCID.EaterofWorldsHead) { - if (Main.npc[id].type == NPCID.EaterofWorldsHead || Main.npc[id].type == ModContent.NPCType()) + if (Main.npc[id].type == NPCID.EaterofWorldsHead) { hasBar = true; } @@ -465,6 +464,9 @@ namespace CalamityMod.UI private bool _inCombo = false; private int _comboStartHealth; private int _damageCountdown; + public int EnrageTimer; + public int AttachedNPCType = -1; + private NPC _npc { get @@ -528,6 +530,7 @@ namespace CalamityMod.UI _npcLocation = id; _maxHealth = Main.npc[id].lifeMax; + AttachedNPCType = Main.npc[id].type; if (OneToMany.ContainsKey(Main.npc[id].type)) { @@ -558,7 +561,10 @@ namespace CalamityMod.UI dead = true; int life = _npc.life; - if (life < 0 || !_npc.active || _npc.lifeMax < 800) + + // NPCs appear to be able to occasionally be replaced by a new NPC faster than the bar can register the death of the last NPC. + // To midigate this, a special type check is put in place to catch unusual NPCs occupying the space of a would-be dead bar. + if (life < 0 || !_npc.active || _npc.lifeMax < 100 || _npc.type != AttachedNPCType) dead = true; if (_oneToMany) @@ -586,6 +592,7 @@ namespace CalamityMod.UI return; int currentLife = _npc.life; + bool enraged = _npc.Calamity().CurrentlyEnraged; // Calculate current life based all types that are available and considered part of one boss if (_oneToMany) @@ -601,6 +608,9 @@ namespace CalamityMod.UI (Main.npc[i].type == NPCID.MoonLordCore && Main.npc[i].ai[0] == 2f)) continue; + if (Main.npc[i].Calamity().CurrentlyEnraged) + enraged = true; + currentLife += Main.npc[i].life; maxLife += Main.npc[i].lifeMax; } @@ -611,6 +621,9 @@ namespace CalamityMod.UI } } + // Make the enrage counter go up/down based on whether the boss is enraged or not. + EnrageTimer = Utils.Clamp(EnrageTimer + enraged.ToDirectionInt(), 0, 75); + // Damage countdown if (_damageCountdown > 0) { @@ -738,17 +751,29 @@ namespace CalamityMod.UI sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White); // DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255)); + Color separatorColor = Color.Lerp(new Color(240, 240, 255), Color.Red * 0.5f, EnrageTimer / 75f); + sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), separatorColor); // DRAW TEXT string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; if (_prevLife == _maxHealth) percentHealthText = "100%"; Vector2 textSize = HPBarFont.MeasureString(percentHealthText); + DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour, OrangeBorderColour * 0.25f); string name = _npc.FullName; Vector2 nameSize = Main.fontMouseText.MeasureString(name); + if (EnrageTimer > 0) + { + float pulse = (float)Math.Sin(Main.GlobalTime * 4.5f) * 0.5f + 0.5f; + float outwardness = EnrageTimer / 75f * 1.5f + pulse * 2f; + for (int i = 0; i < 4; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * outwardness; + DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y) + drawOffset, Color.Red * 0.6f, Color.Black * 0.2f); + } + } DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White, Color.Black * 0.2f); // TODO -- Make small text health a toggle in ModConfig. diff --git a/UI/RipperUI.cs b/UI/RipperUI.cs index aaa160648b..77531b44e3 100644 --- a/UI/RipperUI.cs +++ b/UI/RipperUI.cs @@ -258,7 +258,8 @@ namespace CalamityMod.UI if (rageHover && !adrenHover) { // Add hover text if the mouse is over Rage bar - Main.LocalPlayer.mouseInterface = true; + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; string rageStr = MakeRipperPercentString(modPlayer.rage, modPlayer.rageMax); Main.instance.MouseText($"Rage: {rageStr}"); @@ -273,7 +274,8 @@ namespace CalamityMod.UI else if (adrenHover) { // Add hover text if the mouse is over the bar - Main.LocalPlayer.mouseInterface = true; + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; string adrenStr = MakeRipperPercentString(modPlayer.adrenaline, modPlayer.adrenalineMax); Main.instance.MouseText($"Adrenaline: {adrenStr}"); diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 3bb3f425db..12b400734c 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -10,6 +10,7 @@ using System.Text; using Terraria; using Terraria.ID; using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod { @@ -221,34 +222,58 @@ namespace CalamityMod /// /// The spot to spawn the explosion clouds /// Number of times it loops to spawn gores - public static void ExplosionGores(Vector2 goreSource, int goreAmt) + public static void ExplosionGores(Vector2 goreSource, int goreAmt, bool thanatos = false, Vector2 thanatosVelocity = default) { Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) { float velocityMult = 0.33f; - if (goreIndex < (int)(goreAmt / 3)) + if (goreIndex < (goreAmt / 3)) { velocityMult = 0.66f; } - if (goreIndex >= (int)((2 * goreAmt) / 3)) + if (goreIndex >= (2 * goreAmt / 3)) { velocityMult = 1f; } - int smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + Mod mod = ModContent.GetInstance(); + int type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + int smoke = Gore.NewGore(source, default, type, 1f); Gore gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } gore.velocity *= velocityMult; gore.velocity.X += 1f; gore.velocity.Y += 1f; - smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + smoke = Gore.NewGore(source, default, type, 1f); + gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } gore.velocity *= velocityMult; gore.velocity.X -= 1f; gore.velocity.Y += 1f; - smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + smoke = Gore.NewGore(source, default, type, 1f); + gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } gore.velocity *= velocityMult; gore.velocity.X += 1f; gore.velocity.Y -= 1f; - smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + smoke = Gore.NewGore(source, default, type, 1f); + gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } gore.velocity *= velocityMult; gore.velocity.X -= 1f; gore.velocity.Y -= 1f; diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 5b71b20055..310a8bcd45 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -12,6 +12,7 @@ using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; @@ -194,6 +195,11 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(true, new int[] { }) }, { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, { ModContent.NPCType(), new Tuple(true, new int[] { }) }, { ModContent.NPCType(), new Tuple(true, new int[] { }) }, diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 5a0fc2ee07..5709e12e23 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -11,6 +11,7 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; @@ -283,6 +284,11 @@ namespace CalamityMod { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 } }; @@ -538,6 +544,11 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 350, 560, 592, 608, 768 } }, + { ModContent.NPCType(), new int[] { 400, 640, 680, 704, 864 } }, + { ModContent.NPCType(), new int[] { 330, 528, 560, 576, 690 } }, + { ModContent.NPCType(), new int[] { 330, 528, 560, 576, 690 } }, + { ModContent.NPCType(), new int[] { 260, 416, 446, 464, 570 } }, + { ModContent.NPCType(), new int[] { 400, 800, 850, 880, 1000 } } }; @@ -793,10 +804,16 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } }, { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1182 } }, { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 948 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 948 } } + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 948 } } }; } diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index eda8257d20..3fe5c8dd69 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -53,37 +53,37 @@ namespace CalamityMod.World public static int Reforges; public static Dictionary ScreenShakeSpots = new Dictionary(); - //Boss Rush + // Boss Rush public static int bossRushHostileProjKillCounter = 0; - //Death Mode natural boss spawns - public static int bossSpawnCountdown = 0; //Death Mode natural boss spawn countdown - public static int bossType = 0; //Death Mode natural boss spawn type - public static int deathBossSpawnCooldown = 0; //Cooldown between Death Mode natural boss spawns + // Death Mode natural boss spawns + public static int bossSpawnCountdown = 0; // Death Mode natural boss spawn countdown + public static int bossType = 0; // Death Mode natural boss spawn type + public static int deathBossSpawnCooldown = 0; // Cooldown between Death Mode natural boss spawns - //Modes - public static bool demonMode = false; //Spawn rate boost - public static bool onionMode = false; //Extra accessory from Moon Lord - public static bool revenge = false; //Revengeance Mode - public static bool death = false; //Death Mode - public static bool armageddon = false; //Armageddon Mode - public static bool ironHeart = false; //Iron Heart Mode + // Modes + public static bool demonMode = false; // Spawn rate boost + public static bool onionMode = false; // Extra accessory from Moon Lord + public static bool revenge = false; // Revengeance Mode + public static bool death = false; // Death Mode + public static bool armageddon = false; // Armageddon Mode + public static bool ironHeart = false; // Iron Heart Mode public static bool malice = false; // Malice Mode, enrages all bosses and makes them drop good shit // New Temple Altar public static int newAltarX = 0; public static int newAltarY = 0; - //Evil Islands + // Evil Islands public static int fehX = 0; public static int fehY = 0; - //Brimstone Crag + // Brimstone Crag public static int fuhX = 0; public static int fuhY = 0; public static int calamityTiles = 0; - //Abyss & Sulphur + // Abyss & Sulphur public static int numAbyssIslands = 0; public static int[] AbyssIslandX = new int[20]; public static int[] AbyssIslandY = new int[20]; @@ -110,14 +110,14 @@ namespace CalamityMod.World } } - //Astral + // Astral public static int astralTiles = 0; - //Sunken Sea + // Sunken Sea public static int sunkenSeaTiles = 0; public static Rectangle SunkenSeaLocation = Rectangle.Empty; - //Shrines + // Shrines public static int[] SChestX = new int[10]; public static int[] SChestY = new int[10]; public static bool roxShrinePlaced = false; @@ -216,6 +216,11 @@ namespace CalamityMod.World CalamityGlobalNPC.fireEye = -1; CalamityGlobalNPC.brimstoneElemental = -1; CalamityGlobalNPC.signus = -1; + CalamityGlobalNPC.draedonExoMechPrime = -1; + CalamityGlobalNPC.draedonExoMechTwinGreen = -1; + CalamityGlobalNPC.draedonExoMechTwinRed = -1; + CalamityGlobalNPC.draedonExoMechWorm = -1; + CalamityGlobalNPC.adultEidolonWyrmHead = -1; BossRushEvent.BossRushStage = 0; DoGSecondStageCountdown = 0; ArmoredDiggerSpawnCooldown = 0; @@ -1625,9 +1630,16 @@ namespace CalamityMod.World if (modPlayer.ZoneAbyss) { - if (player.chaosState) + if (player.chaosState && !player.dead) { - if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + if (!adultWyrmAlive && Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); } } diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 6b767a7003..48f76bfa7e 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -1102,7 +1102,6 @@ namespace CalamityMod.World Tile tile = Main.tile[x, y]; int type = tile.type; int wallType = tile.wall; - Mod mod = ModContent.GetInstance(); if (WorldGen.InWorld(x, y, 1)) {