diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7514022e28..8a121f20be 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -689,9 +689,10 @@ namespace CalamityMod.CalPlayer public int prismaticLasers = 0; public bool silvaSet = false; public bool silvaMage = false; - public bool silvaSummon = false; + public int silvaMageCooldown = 0; + public bool silvaSummon = false; public bool hasSilvaEffect = false; - public int silvaCountdown = 300; + public int silvaCountdown = 480; public bool auricSet = false; public bool omegaBlueChestplate = false; public bool omegaBlueSet = false; @@ -2045,7 +2046,8 @@ namespace CalamityMod.CalPlayer gSabatonFall = 0; gSabatonCooldown = 0; astralStarRainCooldown = 0; - bloodflareMageCooldown = 0; + silvaMageCooldown = 0; + bloodflareMageCooldown = 0; tarraRangedCooldown = 0; tarraMageHealCooldown = 0; bossRushImmunityFrameCurseTimer = 0; @@ -2267,7 +2269,7 @@ namespace CalamityMod.CalPlayer silvaMage = false; silvaSummon = false; hasSilvaEffect = false; - silvaCountdown = 300; + silvaCountdown = 480; auricSet = false; omegaBlueChestplate = false; omegaBlueSet = false; @@ -4243,7 +4245,7 @@ namespace CalamityMod.CalPlayer { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 480); if (draconicSurge && !draconicSurgeCooldown) { @@ -5273,16 +5275,9 @@ namespace CalamityMod.CalPlayer if (enraged) damageMult += 1.25; - if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) - damageMult += 0.1; - - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && isSummon) - damageMult += 0.1; - - else if (proj.type == ProjectileID.InfernoFriendlyBlast) - { + if (proj.type == ProjectileID.InfernoFriendlyBlast) damageMult += 0.33; - } + if (brimflameFrenzy && brimflameSet) { if (proj.magic) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 24ce396d25..8fdd8dea20 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1104,6 +1104,8 @@ namespace CalamityMod.CalPlayer modPlayer.tarraRangedCooldown--; if (modPlayer.bloodflareMageCooldown > 0) modPlayer.bloodflareMageCooldown--; + if (modPlayer.silvaMageCooldown > 0) + modPlayer.silvaMageCooldown--; if (modPlayer.tarraMageHealCooldown > 0) modPlayer.tarraMageHealCooldown--; if (modPlayer.featherCrownCooldown > 0) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 424dcd5334..2862148680 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -305,8 +305,9 @@ namespace CalamityMod.CalPlayer } } } - if (modPlayer.silvaMage && proj.penetrate == 1 && Main.rand.Next(0, 100) >= 97) + if (modPlayer.silvaMage && modPlayer.silvaMageCooldown <= 0 && (proj.penetrate == 1 || proj.timeLeft <= 5)) { + modPlayer.silvaMageCooldown = 300; Main.PlaySound(SoundID.Zombie, (int)proj.position.X, (int)proj.position.Y, 103); CalamityGlobalProjectile.ExpandHitboxBy(proj, 96); for (int d = 0; d < 3; d++) @@ -326,6 +327,7 @@ namespace CalamityMod.CalPlayer proj.localNPCHitCooldown = 10; proj.usesLocalNPCImmunity = true; proj.Damage(); + proj.Kill(); } } #endregion diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 4cb479af1c..a66460ba8c 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -103,7 +103,6 @@ namespace CalamityMod.ILEditing ApplyLifeBytesChanges(); AdjustChlorophyteBullets(); - AdjustCultistCloneFireballDust(); RemoveAerialBaneDamageBoost(); AdjustDamageVariance(); RemoveExpertHardmodeScaling(); @@ -151,19 +150,6 @@ namespace CalamityMod.ILEditing }; } - private static void AdjustCultistCloneFireballDust() - { - // Reduce dust from 10 to 5 and homing range. - IL.Terraria.Projectile.AI_001 += (il) => - { - var cursor = new ILCursor(il); - cursor.GotoNext(MoveType.Before, i => i.MatchLdcI4(468)); // The ID of Cultist Clone Fireballs. - cursor.GotoNext(MoveType.Before, i => i.MatchLdcR4(12f)); // The gate value for spawning dust circles. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 60f); // Increase to 60f. - }; - } - private static void RemoveAerialBaneDamageBoost() { IL.Terraria.Projectile.Damage += (il) => diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index fa9cf06b77..3935938937 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Accessories item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; - item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 708b6c4bbe..9f318c27bc 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -45,10 +45,9 @@ namespace CalamityMod.Items.Armor player.setBonus = "75% increased minion damage and +5 max minions\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 5 seconds\n" + + "If you are reduced to 1 HP you will not die from any further damage for 8 seconds\n" + "This effect only triggers once per life\n" + - "Summons an ancient leaf prism to blast your enemies with life energy\n" + - "After the silva invulnerability time your minions will deal 10% more damage"; + "Summons an ancient leaf prism to blast your enemies with life energy"; if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index fdd5a3f827..536bc0e960 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -44,10 +44,9 @@ namespace CalamityMod.Items.Armor modPlayer.silvaMage = true; player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 5 seconds\n" + + "If you are reduced to 1 HP you will not die from any further damage for 8 seconds\n" + "This effect only triggers once per life\n" + - "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits\n" + - "After the silva invulnerability time your magic weapons will do 10% more damage"; + "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits"; } public override void UpdateEquip(Player player) diff --git a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs index 6e947548cf..bee2fbc7da 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,6 +39,16 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() @@ -99,12 +110,12 @@ namespace CalamityMod.NPCs.Abyss { if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) { - npc.ai[3] += 1f; + npc.localAI[0] += 1f; float shootShadowFireballGateValue = 90f; float divisor = 5f; - if (npc.ai[3] % divisor == 0f && npc.ai[3] >= shootShadowFireballGateValue) + if (npc.ai[3] % divisor == 0f && npc.localAI[0] >= shootShadowFireballGateValue) { - npc.ai[3] = 0f; + npc.localAI[0] = 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; diff --git a/NPCs/Abyss/EidolonWyrmBodyHuge.cs b/NPCs/Abyss/EidolonWyrmBodyHuge.cs index fe9409cff3..c808772239 100644 --- a/NPCs/Abyss/EidolonWyrmBodyHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyHuge.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,6 +39,16 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() @@ -93,18 +104,18 @@ namespace CalamityMod.NPCs.Abyss npc.Opacity = 0f; } - bool shootShadowFireballs = (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || + bool spawnAncientLights = (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 (spawnAncientLights && Main.netMode != NetmodeID.MultiplayerClient) { if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) { - npc.ai[3] += 1f; + npc.localAI[0] += 1f; float spawnAncientLightGateValue = 180f; float divisor = 10f; - if (npc.ai[0] % divisor == 0f && npc.ai[3] >= spawnAncientLightGateValue) + if (npc.ai[3] % divisor == 0f && npc.localAI[0] >= spawnAncientLightGateValue) { - npc.ai[3] = 0f; + npc.localAI[0] = 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; diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 918af1f755..4ad0d6f145 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -187,12 +187,12 @@ namespace CalamityMod.NPCs.Abyss if (!TailSpawned && npc.ai[0] == 0f) { int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) + for (int i = 0; i < maxLength; i++) { int lol; - if (num36 >= 0 && num36 < minLength) + if (i >= 0 && i < minLength) { - if (num36 % 2 == 0) + if (i % 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); @@ -206,6 +206,7 @@ namespace CalamityMod.NPCs.Abyss Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; + Main.npc[Previous].ai[3] = i; } TailSpawned = true; } diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index a1b798e7cc..1493e67304 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -300,6 +300,7 @@ namespace CalamityMod.NPCs.NormalNPCs DropHelper.DropItem(npc, ItemID.Starfish, 1, 3); DropHelper.DropItem(npc, ItemID.Seashell, 1, 3); DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index d9a3d44f1b..2733c47632 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -76,6 +76,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } + float totalLifeRatio = npc.life / (float)npc.lifeMax; + if (CalamityGlobalNPC.SCalCatastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.SCalCatastrophe].active) + totalLifeRatio += Main.npc[CalamityGlobalNPC.SCalCatastrophe].life / (float)Main.npc[CalamityGlobalNPC.SCalCatastrophe].lifeMax; + } + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -94,8 +101,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas num677 *= 0.5f; } - bool deadBrother = !NPC.AnyNPCs(ModContent.NPCType()); - int scale = deadBrother ? 5 : 2; + int scale = (int)Math.Round(MathHelper.Lerp(2f, 6.5f, totalLifeRatio * 0.5f)); if (npc.ai[3] < distanceX) { npc.ai[3] += scale; @@ -155,11 +161,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[0] >= 120f) { - npc.ai[1] += 1f; - if (deadBrother || CalamityWorld.malice) - { - npc.ai[1] += 1f; - } + float fireRate = CalamityWorld.malice ? 2f : MathHelper.Lerp(1f, 2.5f, totalLifeRatio * 0.5f); + npc.ai[1] += fireRate; if (npc.ai[1] >= 60f) { npc.ai[1] = 0f; @@ -171,11 +174,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(npc.Center, new Vector2(-8f, 0f), type, damage, 0f, Main.myPlayer); } } - npc.ai[2] += 1f; - if (deadBrother || CalamityWorld.malice) - { - npc.ai[2] += 2f; - } + fireRate = CalamityWorld.malice ? 3f : MathHelper.Lerp(1f, 4f, totalLifeRatio * 0.5f); + npc.ai[2] += fireRate; if (npc.ai[2] >= 300f) { npc.ai[2] = 0f; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 238c64950e..03a6f65b55 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -76,6 +76,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } + float totalLifeRatio = npc.life / (float)npc.lifeMax; + if (CalamityGlobalNPC.SCalCataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.SCalCataclysm].active) + totalLifeRatio += Main.npc[CalamityGlobalNPC.SCalCataclysm].life / (float)Main.npc[CalamityGlobalNPC.SCalCataclysm].lifeMax; + } + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -94,9 +101,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num677 *= 0.5f; } - bool deadBrother = !NPC.AnyNPCs(ModContent.NPCType()); - int scale = deadBrother ? 5 : 2; - if (npc.ai[3] < distanceX) + int scale = (int)Math.Round(MathHelper.Lerp(2f, 6.5f, totalLifeRatio * 0.5f)); + if (npc.ai[3] < distanceX) { npc.ai[3] += scale; distanceY -= scale; @@ -155,11 +161,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[0] >= 120f) { - npc.ai[1] += 1f; - if (deadBrother || CalamityWorld.malice) - { - npc.ai[1] += 1f; - } + float fireRate = CalamityWorld.malice ? 2f : MathHelper.Lerp(1f, 2.5f, totalLifeRatio * 0.5f); + npc.ai[1] += fireRate; if (npc.ai[1] >= 45f) { npc.ai[1] = 0f; @@ -171,12 +174,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(npc.Center, new Vector2(4f, 0f), type, damage, 0f, Main.myPlayer); } } - npc.ai[2] += 1f; - if (deadBrother || CalamityWorld.malice) - { - npc.ai[2] += 2f; - } - if (npc.ai[2] >= 300f) + fireRate = CalamityWorld.malice ? 3f : MathHelper.Lerp(1f, 4f, totalLifeRatio * 0.5f); + npc.ai[2] += fireRate; + if (npc.ai[2] >= 300f) { npc.ai[2] = 0f; float speed = 7f; diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ExoDestroyerBeamStart.cs index 3d2c5ee560..1c88e0cb97 100644 --- a/Projectiles/Boss/ExoDestroyerBeamStart.cs +++ b/Projectiles/Boss/ExoDestroyerBeamStart.cs @@ -96,12 +96,10 @@ namespace CalamityMod.Projectiles.Boss 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(); + projectile.rotation = ThingToAttachTo.velocity.ToRotation(); + projectile.velocity = projectile.rotation.ToRotationVector2(); - float arraySize = 3f; + float arraySize = 3f; Vector2 samplingPoint = projectile.Center; float[] samples = new float[(int)arraySize]; Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 2400f, samples); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 0dac39f74e..481bdd871b 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; @@ -14,6 +15,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles @@ -332,7 +334,305 @@ namespace CalamityMod.Projectiles return false; } - if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + if (adultWyrmAlive) + { + if (projectile.type == ProjectileID.CultistBossFireBallClone) + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item34, projectile.position); + } + else if (projectile.ai[1] == 1f && Main.netMode != NetmodeID.MultiplayerClient) + { + int num13 = -1; + float num14 = 2000f; + for (int num15 = 0; num15 < Main.maxPlayers; num15++) + { + if (Main.player[num15].active && !Main.player[num15].dead) + { + Vector2 center2 = Main.player[num15].Center; + float num16 = Vector2.Distance(center2, projectile.Center); + if ((num16 < num14 || num13 == -1) && Collision.CanHit(projectile.Center, 1, 1, center2, 1, 1)) + { + num14 = num16; + num13 = num15; + } + } + } + + if (num14 < 20f) + { + projectile.Kill(); + return false; + } + + if (num13 != -1) + { + projectile.ai[1] = 21f; + projectile.ai[0] = num13; + projectile.netUpdate = true; + } + } + else if (projectile.ai[1] > 20f && projectile.ai[1] < 200f) + { + projectile.ai[1] += 1f; + int num17 = (int)projectile.ai[0]; + if (!Main.player[num17].active || Main.player[num17].dead) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + float num18 = projectile.velocity.ToRotation(); + Vector2 vector2 = Main.player[num17].Center - projectile.Center; + if (vector2.Length() < 20f) + { + projectile.Kill(); + return false; + } + + float targetAngle2 = vector2.ToRotation(); + if (vector2 == Vector2.Zero) + targetAngle2 = num18; + + float num19 = num18.AngleLerp(targetAngle2, 0.01f); + projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(num19); + } + } + + if (projectile.ai[1] >= 1f && projectile.ai[1] < 20f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == 20f) + projectile.ai[1] = 1f; + } + + projectile.alpha -= 40; + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.spriteDirection = projectile.direction; + + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame >= 4) + projectile.frame = 0; + } + + if (Main.rand.Next(4) == 0) + { + Vector2 value4 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(projectile.velocity.ToRotation()); + int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100); + Main.dust[num23].velocity *= 0.1f; + Main.dust[num23].position = projectile.Center + value4 * projectile.width / 2f; + Main.dust[num23].fadeIn = 0.9f; + } + + if (Main.rand.Next(32) == 0) + { + Vector2 value5 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(projectile.velocity.ToRotation()); + int num25 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 155, default, 0.8f); + Main.dust[num25].velocity *= 0.3f; + Main.dust[num25].position = projectile.Center + value5 * projectile.width / 2f; + if (Main.rand.Next(2) == 0) + Main.dust[num25].fadeIn = 1.4f; + } + + if (Main.rand.Next(2) == 0) + { + Vector2 value6 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy(projectile.velocity.ToRotation()); + int num27 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 0, default, 1.2f); + Main.dust[num27].velocity *= 0.3f; + Main.dust[num27].noGravity = true; + Main.dust[num27].position = projectile.Center + value6 * projectile.width / 2f; + if (Main.rand.Next(2) == 0) + Main.dust[num27].fadeIn = 1.4f; + } + + return false; + } + else if (projectile.type == ProjectileID.CultistBossIceMist) + { + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item120, projectile.position); + } + + 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; + + 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); + 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; + } + else if (projectile.type == ProjectileID.CultistBossLightningOrbArc) + { + projectile.frameCounter++; + if (projectile.velocity == Vector2.Zero) + { + if (projectile.frameCounter >= projectile.extraUpdates * 2) + { + projectile.frameCounter = 0; + bool flag30 = true; + for (int num742 = 1; num742 < projectile.oldPos.Length; num742++) + { + if (projectile.oldPos[num742] != projectile.oldPos[0]) + flag30 = false; + } + + if (flag30) + { + projectile.Kill(); + return false; + } + } + } + else + { + if (projectile.frameCounter < projectile.extraUpdates * 2) + return false; + + projectile.frameCounter = 0; + float num748 = projectile.velocity.Length(); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]); + int num749 = 0; + Vector2 spinningpoint14 = -Vector2.UnitY; + while (true) + { + int num750 = unifiedRandom.Next(); + projectile.ai[1] = num750; + num750 %= 100; + float f = (float)num750 / 100f * ((float)Math.PI * 2f); + Vector2 vector55 = f.ToRotationVector2(); + if (vector55.Y > 0f) + { + vector55.Y *= -1f; + } + + bool flag31 = false; + if (vector55.Y > -0.02f) + { + flag31 = true; + } + if (vector55.X * (float)(projectile.extraUpdates + 1) * 2f * num748 + projectile.localAI[0] > 40f) + { + flag31 = true; + } + if (vector55.X * (float)(projectile.extraUpdates + 1) * 2f * num748 + projectile.localAI[0] < -40f) + { + flag31 = true; + } + + if (flag31) + { + if (num749++ >= 100) + { + projectile.velocity = Vector2.Zero; + projectile.localAI[1] = 1f; + break; + } + continue; + } + + spinningpoint14 = vector55; + + break; + } + + if (projectile.velocity != Vector2.Zero) + { + projectile.localAI[0] += spinningpoint14.X * (float)(projectile.extraUpdates + 1) * 2f * num748; + projectile.velocity = spinningpoint14.RotatedBy(projectile.ai[0] + (float)Math.PI / 2f) * num748; + projectile.rotation = projectile.velocity.ToRotation() + (float)Math.PI / 2f; + } + } + + return false; + } + } + + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { if (projectile.type == ProjectileID.DemonSickle && CalamityPlayer.areThereAnyDamnBosses) { diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index 0f9e904df2..97f72d2132 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { projVec = projVec.RotatedBy(angleVariance); if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer, 0.0f, 0.0f); + Projectile.NewProjectile(projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/AtaraxiaSplit.cs b/Projectiles/Melee/AtaraxiaSplit.cs index f358d451b1..033acb4421 100644 --- a/Projectiles/Melee/AtaraxiaSplit.cs +++ b/Projectiles/Melee/AtaraxiaSplit.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 6; projectile.timeLeft = 50; projectile.tileCollide = false; projectile.ignoreWater = true; diff --git a/Projectiles/Ranged/ExoMark.cs b/Projectiles/Ranged/ExoMark.cs index c5fc26bde6..b73065b0fe 100644 --- a/Projectiles/Ranged/ExoMark.cs +++ b/Projectiles/Ranged/ExoMark.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 9; } public override void AI() diff --git a/Projectiles/Ranged/ExoTornado.cs b/Projectiles/Ranged/ExoTornado.cs index b3bd669ef0..45f0fa1cff 100644 --- a/Projectiles/Ranged/ExoTornado.cs +++ b/Projectiles/Ranged/ExoTornado.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.tileCollide = false; projectile.ranged = true; projectile.penetrate = -1; - projectile.timeLeft = 240; //1200 - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.timeLeft = 240; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI()