diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index 71263054f0..c56852b016 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Buffs.StatDebuffs { DisplayName.SetDefault("Irradiated"); Description.SetDefault("Your skin is burning off"); - Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7021207576..2663f55afb 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1921,7 +1921,7 @@ namespace CalamityMod.CalPlayer netMessage.Write(CalamityWorld.bossRushStage); netMessage.Send(); } - for (int doom = 0; doom < 200; doom++) + for (int doom = 0; doom < Main.maxNPCs; doom++) { if (Main.npc[doom].active && Main.npc[doom].boss) { @@ -2352,7 +2352,7 @@ namespace CalamityMod.CalPlayer for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + player.Center; Vector2 vector7 = vector6 - player.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; @@ -2365,7 +2365,7 @@ namespace CalamityMod.CalPlayer } if (Main.netMode != NetmodeID.MultiplayerClient) { - for (int l = 0; l < 200; l++) + for (int l = 0; l < Main.maxNPCs; l++) { NPC nPC = Main.npc[l]; if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= 3000f) @@ -2506,7 +2506,7 @@ namespace CalamityMod.CalPlayer } if (sulfurSet && player.controlJump && player.justJumped && player.jumpAgainSandstorm) { - int bubble = Projectile.NewProjectile(new Vector2(Main.LocalPlayer.position.X, Main.LocalPlayer.position.Y + (Main.LocalPlayer.gravDir == -1f ? 20 : -20)), new Vector2(0f, 0f), ModContent.ProjectileType(), (int)(20f * (player.allDamage + throwingDamage - 1f)), 0f, Main.LocalPlayer.whoAmI, 1f, 0f); + int bubble = Projectile.NewProjectile(new Vector2(Main.LocalPlayer.position.X, Main.LocalPlayer.position.Y + (Main.LocalPlayer.gravDir == -1f ? 20 : -20)), new Vector2(0f, 0f), ModContent.ProjectileType(), (int)(20f * player.RogueDamage()), 0f, Main.LocalPlayer.whoAmI, 1f, 0f); Main.projectile[bubble].Calamity().forceRogue = true; } } @@ -2751,7 +2751,7 @@ namespace CalamityMod.CalPlayer } player.grappling[0] = -1; player.grapCount = 0; - for (int index = 0; index < 1000; ++index) + for (int index = 0; index < Main.maxProjectiles; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) { @@ -3257,7 +3257,7 @@ namespace CalamityMod.CalPlayer } if (hInferno) { - for (int x = 0; x < 200; x++) + for (int x = 0; x < Main.maxNPCs; x++) { if (Main.npc[x].active && Main.npc[x].type == ModContent.NPCType()) { @@ -6353,7 +6353,7 @@ namespace CalamityMod.CalPlayer if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) { Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); - for (int m = 0; m < 200; m++) + for (int m = 0; m < Main.maxNPCs; m++) { if (Main.npc[m].active && !Main.npc[m].friendly) { @@ -6381,7 +6381,7 @@ namespace CalamityMod.CalPlayer } if (aBrain) { - for (int m = 0; m < 200; m++) + for (int m = 0; m < Main.maxNPCs; m++) { if (Main.npc[m].active && !Main.npc[m].friendly) { @@ -7015,7 +7015,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 50f * (player.allDamage + player.meleeDamage - 1f); + float num = 50f * player.MeleeDamage(); float num2 = 3f; bool crit = false; if (player.kbGlove) @@ -7063,7 +7063,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 1500f * (player.allDamage + player.meleeDamage - 1f); + float num = 1500f * player.MeleeDamage(); float num2 = 15f; bool crit = false; if (player.kbGlove) @@ -7114,7 +7114,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 500f * (player.allDamage + player.meleeDamage - 1f); + float num = 500f * player.MeleeDamage(); float num2 = 12f; bool crit = false; if (player.kbGlove) @@ -7164,7 +7164,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 100f * (player.allDamage + player.meleeDamage - 1f); + float num = 100f * player.MeleeDamage(); float num2 = 9f; bool crit = false; if (player.kbGlove) @@ -7902,7 +7902,7 @@ namespace CalamityMod.CalPlayer rect.Width = 2; rect.Inflate(6, 12); - float damage = 800f * (player.allDamage + player.minionDamage - 1f); + float damage = 800f * player.MinionDamage(); float knockback = 10f; int nPCImmuneTime = 30; int playerImmuneTime = 6; @@ -7918,7 +7918,7 @@ namespace CalamityMod.CalPlayer rect2.Width = 2; rect2.Inflate(6, 12); - float damage2 = 50f * (player.allDamage + player.minionDamage - 1f); + float damage2 = 50f * player.MinionDamage(); float knockback2 = 8f; int nPCImmuneTime2 = 30; int playerImmuneTime2 = 6; @@ -7934,7 +7934,7 @@ namespace CalamityMod.CalPlayer rect2.Width = 2; rect2.Inflate(6, 12); - float damage2 = 25f * (player.allDamage + player.minionDamage - 1f); + float damage2 = 25f * player.MinionDamage(); float knockback2 = 5f; int nPCImmuneTime2 = 30; int playerImmuneTime2 = 6; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 81add82dc7..e09c323ec6 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -751,7 +751,7 @@ namespace CalamityMod.CalPlayer if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 6) { bool[] tentaclesPresent = new bool[6]; - for (int i = 0; i < 1000; i++) + for (int i = 0; i < Main.maxProjectiles; i++) { Projectile projectile = Main.projectile[i]; if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f) @@ -1191,7 +1191,7 @@ namespace CalamityMod.CalPlayer { if (random == 0) { - for (int l = 0; l < 200; l++) + for (int l = 0; l < Main.maxNPCs; l++) { NPC nPC = Main.npc[l]; if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) @@ -1274,7 +1274,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(15)) { int num = 0; - for (int i = 0; i < 1000; i++) + for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType()) num++; @@ -1321,7 +1321,7 @@ namespace CalamityMod.CalPlayer if (flag) { - for (int k = 0; k < 1000; k++) + for (int k = 0; k < Main.maxProjectiles; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) { @@ -1481,7 +1481,7 @@ namespace CalamityMod.CalPlayer // Ceaseless Hunger Potion buff if (modPlayer.ceaselessHunger) { - for (int j = 0; j < 400; j++) + for (int j = 0; j < Main.maxItems; j++) { if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI) { @@ -1547,7 +1547,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.spectralVeil && modPlayer.spectralVeilImmunity > 0) { Rectangle sVeilRectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) { @@ -1585,7 +1585,7 @@ namespace CalamityMod.CalPlayer } } - for (int i = 0; i < 1000; i++) + for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) { @@ -2453,7 +2453,7 @@ namespace CalamityMod.CalPlayer { if (Main.netMode != NetmodeID.MultiplayerClient) { - for (int m = 0; m < 200; m++) + for (int m = 0; m < Main.maxNPCs; m++) { if (Main.npc[m].active && !Main.npc[m].friendly) { @@ -3187,13 +3187,18 @@ namespace CalamityMod.CalPlayer player.buffImmune[BuffID.Venom] = true; if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) { - player.allDamage += 0.03f; + player.allDamage += 0.06f; modPlayer.AllCritBoost(3); } if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) { - player.allDamage += 0.05f; - modPlayer.AllCritBoost(5); + player.allDamage += 0.06f; + modPlayer.AllCritBoost(3); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) + { + player.allDamage += 0.06f; + modPlayer.AllCritBoost(3); } if (player.lifeRegen < 0) { @@ -3314,7 +3319,7 @@ namespace CalamityMod.CalPlayer player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1) { - for (int projIndex = 0; projIndex < 1000; projIndex++) + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) { diff --git a/CalamityMod.cs b/CalamityMod.cs index 89d4196cde..ff94cb65e9 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -591,6 +591,7 @@ namespace CalamityMod ProjectileID.DD2PhoenixBow, ProjectileID.IchorDart, ProjectileID.PhantasmArrow, + ProjectileID.RainbowBack, ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), @@ -1308,7 +1309,11 @@ namespace CalamityMod ItemID.MagicDagger, ItemID.BeamSword, ItemID.MonkStaffT2, - ItemID.PaladinsHammer + ItemID.PaladinsHammer, + ItemID.PearlwoodSword, + ItemID.PearlwoodBow, + ItemID.TaxCollectorsStickOfDoom, + ItemID.StylistKilLaKillScissorsIWish }; quarterDamageNerfList = new List() @@ -3619,8 +3624,6 @@ namespace CalamityMod CalamityWorld.revenge = revActive; break; case CalamityModMessageType.DeathBoolSync: - bool revActive2 = reader.ReadBoolean(); - CalamityWorld.revenge = revActive2; bool deathActive = reader.ReadBoolean(); CalamityWorld.death = deathActive; break; @@ -3651,11 +3654,15 @@ namespace CalamityMod case CalamityModMessageType.AcidRainUIDrawFadeSync: CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32(); break; + case CalamityModMessageType.AcidRainOldDukeSummonSync: + CalamityWorld.triedToSummonOldDuke = reader.ReadBoolean(); + break; default: Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); break; } - } catch(Exception e) + } + catch(Exception e) { if (e is EndOfStreamException eose) Logger.Error("Failed to parse Calamity packet: Packet was too short, missing data, or otherwise corrupt.", eose); @@ -3729,6 +3736,7 @@ namespace CalamityMod DeathModeBlizzardTimeSync, DeathBossSpawnCountdownSync, AcidRainSync, - AcidRainUIDrawFadeSync + AcidRainUIDrawFadeSync, + AcidRainOldDukeSummonSync } } diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 801dba3bab..ed261950bc 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -32,8 +32,6 @@ namespace CalamityMod.Events ( ModContent.NPCType(), 1 ) }; - // Not readonly so that if anyone else wants to add stuff in here with their own mod, they can. - // The first value is the NPC type, the second is the value they're worth in the event public static List<(int, int)> PossibleEnemiesAS = new List<(int, int)>() { ( ModContent.NPCType(), 0 ), @@ -48,6 +46,19 @@ namespace CalamityMod.Events ( ModContent.NPCType(), 1 ) }; + public static List<(int, int)> PossibleEnemiesPolter = new List<(int, int)>() + { + ( ModContent.NPCType(), 0 ), + ( ModContent.NPCType(), 0 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ), + ( ModContent.NPCType(), 1 ) + }; + /// /// Broadcasts some text from a given localization key. /// @@ -77,7 +88,11 @@ namespace CalamityMod.Events if (Main.npc[i].active) { int type = Main.npc[i].type; - List<(int, int)> PossibleEnemies = CalamityWorld.downedAquaticScourge ? PossibleEnemiesAS : PossibleEnemiesPreHM; + List<(int, int)> PossibleEnemies = PossibleEnemiesPreHM; + if (CalamityWorld.downedAquaticScourge) + PossibleEnemies = PossibleEnemiesAS; + if (CalamityWorld.downedPolterghast) + PossibleEnemies = PossibleEnemiesPolter; if (PossibleEnemies.Select(enemy => enemy.Item2).Contains(type)) { Rectangle invasionCheckArea = new Rectangle((int)Main.npc[i].Center.X - rectangleCheckSize / 2, (int)Main.npc[i].Center.Y - rectangleCheckSize / 2, @@ -97,7 +112,7 @@ namespace CalamityMod.Events /// public static void TryStartEvent() { - if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode)) + if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode) || CalamityWorld.bossRushActive) return; int playerCount = 0; for (int i = 0; i < Main.player.Length; i++) @@ -126,6 +141,7 @@ namespace CalamityMod.Events // If abyssSide is true, then the abyss was generated on the left side of the world. // If false, the right. Main.invasionX = CalamityWorld.abyssSide ? 0 : Main.maxTilesX; + CalamityWorld.triedToSummonOldDuke = false; } UpdateInvasion(); BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas! @@ -159,10 +175,15 @@ namespace CalamityMod.Events CalamityWorld.downedEoCAcidRain = true; CalamityWorld.downedAquaticScourgeAcidRain = CalamityWorld.downedAquaticScourge; } + CalamityWorld.triedToSummonOldDuke = false; CalamityMod.StopRain(); } CalamityMod.UpdateServerBoolean(); + // You will be tempted to turn this into a single if conditional. + // Don't do this. Doing so has caused so much misery, with various things being read instead + // of the correct thing, look booleans being mixed up in the sending and receiving process. + // In short, leave this alone. if (Main.netMode == NetmodeID.Server) { var netMessage = CalamityMod.instance.GetPacket(); @@ -178,6 +199,13 @@ namespace CalamityMod.Events netMessage.Write(CalamityWorld.acidRainExtraDrawTime); netMessage.Send(); } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync); + netMessage.Write(CalamityWorld.triedToSummonOldDuke); + netMessage.Send(); + } } } } diff --git a/Events/AcidRainT1_BossChecklist.png b/Events/AcidRainT1_BossChecklist.png new file mode 100644 index 0000000000..ad2416a302 Binary files /dev/null and b/Events/AcidRainT1_BossChecklist.png differ diff --git a/ExtraTextures/Lasers/GammaBeamBegin.png b/ExtraTextures/Lasers/GammaBeamBegin.png new file mode 100644 index 0000000000..575dcdb076 Binary files /dev/null and b/ExtraTextures/Lasers/GammaBeamBegin.png differ diff --git a/ExtraTextures/Lasers/GammaBeamEnd.png b/ExtraTextures/Lasers/GammaBeamEnd.png new file mode 100644 index 0000000000..f4c7cf13c0 Binary files /dev/null and b/ExtraTextures/Lasers/GammaBeamEnd.png differ diff --git a/ExtraTextures/Lasers/GammaBeamMid.png b/ExtraTextures/Lasers/GammaBeamMid.png new file mode 100644 index 0000000000..5e4fce8b82 Binary files /dev/null and b/ExtraTextures/Lasers/GammaBeamMid.png differ diff --git a/Gores/AcidRain/SulfurousSkaterGore.png b/Gores/AcidRain/SulfurousSkaterGore.png new file mode 100644 index 0000000000..0ee87b600a Binary files /dev/null and b/Gores/AcidRain/SulfurousSkaterGore.png differ diff --git a/Gores/AcidRain/SulfurousSkaterGore2.png b/Gores/AcidRain/SulfurousSkaterGore2.png new file mode 100644 index 0000000000..5073d05d07 Binary files /dev/null and b/Gores/AcidRain/SulfurousSkaterGore2.png differ diff --git a/Gores/AcidRain/SulfurousSkaterGore3.png b/Gores/AcidRain/SulfurousSkaterGore3.png new file mode 100644 index 0000000000..9104cf8c7f Binary files /dev/null and b/Gores/AcidRain/SulfurousSkaterGore3.png differ diff --git a/Gores/BumbleHead.png b/Gores/BumbleHead.png index 35dd05ffdb..f57033b292 100644 Binary files a/Gores/BumbleHead.png and b/Gores/BumbleHead.png differ diff --git a/Gores/BumbleLeg.png b/Gores/BumbleLeg.png index 0893d07660..5c919ca8b2 100644 Binary files a/Gores/BumbleLeg.png and b/Gores/BumbleLeg.png differ diff --git a/Gores/BumbleWing.png b/Gores/BumbleWing.png index ad84e202e3..e3bd52dca9 100644 Binary files a/Gores/BumbleWing.png and b/Gores/BumbleWing.png differ diff --git a/Items/Accessories/DukeScales.cs b/Items/Accessories/DukeScales.cs index 8962086219..37afd9fa6d 100644 --- a/Items/Accessories/DukeScales.cs +++ b/Items/Accessories/DukeScales.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Old Duke's Scales"); Tooltip.SetDefault("While under the effects of a damaging debuff, you gain 10% increased damage and 5% crit\n" + - "When below 75% life, you gain 3% increased damage and crit\n" + - "When below 50% life, you gain an additional 5% increased damage and crit\n" + + "For every 25% of lost life, you gain an additional 6% increased damage and 3% crit\n" + + "This will max out at 18% increased damage and 9% crit when under 25% life\n" + "Provides immunity to poisoned, venom, and sulphruic poisoning"); } @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 26; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = Item.buyPrice(0, 80, 0, 0); item.accessory = true; item.rare = 10; - item.Calamity().customRarity = (CalamityRarity)12; + item.Calamity().postMoonLordRarity = 13; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index 32eadb71c3..d6bf9d527b 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Dynamo Stem Cells"); Tooltip.SetDefault(@"15% increased movement speed Ranged weapons have a chance to fire miniature birbs"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 4)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); } public override void SetDefaults() diff --git a/Items/Accessories/DynamoStemCells.png b/Items/Accessories/DynamoStemCells.png index 656d88f962..9102672219 100644 Binary files a/Items/Accessories/DynamoStemCells.png and b/Items/Accessories/DynamoStemCells.png differ diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index 10382756db..62f7b7c671 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 26; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 10; item.expert = true; item.accessory = true; @@ -35,12 +35,12 @@ namespace CalamityMod.Items.Accessories { player.AddBuff(ModContent.BuffType(), 3600, true); } - const int damage = 1800; + const int damage = 2000; if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), - (int)(damage * (player.allDamage + player.minionDamage - 1f)), + (int)(damage * player.MinionDamage()), 6.5f, Main.myPlayer, 0f, 0f); } } diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 8027d6d89a..3c4a8e325c 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Blessing"); - Tooltip.SetDefault("Increased max minions by 3 and 10% increased minion damage\n" + + Tooltip.SetDefault("Increased max minions by 2 and 10% increased minion damage\n" + "Increased minion knockback\n" + "Minions cause enemies to cry on hit"); } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories modPlayer.tearMinions = true; player.minionKB += 2.5f; player.minionDamage += 0.1f; - player.maxMinions += 3; + player.maxMinions += 2; } public override void AddRecipes() diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index d742dc7a53..85cbc0c4ae 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 6.25\n" + "Acceleration multiplier: 1\n" + "Average vertical speed\n" + - "Flight time: 100\n" + + "Flight time: 120\n" + "7% increase to all damage\n" + "All melee attacks and projectiles inflict frostburn\n" + "Icicles rain down as you fly\n" + @@ -62,11 +62,11 @@ namespace CalamityMod.Items.Accessories.Wings CalamityPlayer modPlayer = player.Calamity(); modPlayer.cryogenSoul = true; player.allDamage += 0.07f; - player.wingTimeMax = 100; + player.wingTimeMax = 120; player.noFallDmg = true; if (modPlayer.icicleCooldown <= 0) { - if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f) + if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f) { int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), 25, 3f, player.whoAmI); Main.projectile[p].minion = false; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index be5cf518a4..70794fa5bb 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Items if (CalamityMod.weaponAutoreuseList?.Contains(item.type) ?? false) item.autoReuse = true; - if (item.type == ItemID.PsychoKnife) + if (item.type == ItemID.PsychoKnife || item.type == ItemID.PearlwoodSword || item.type == ItemID.PearlwoodBow || item.type == ItemID.TaxCollectorsStickOfDoom) item.damage *= 4; else if (item.type == ItemID.SpectreStaff) item.damage *= 3; @@ -154,8 +154,26 @@ namespace CalamityMod.Items item.rare = 10; } - if(item.type == ItemID.SuspiciousLookingTentacle) + if (item.type == ItemID.SuspiciousLookingTentacle) item.expert = true; + + if (item.type == ItemID.PearlwoodHammer) + { + item.hammer += 35; //80% hammer power + item.useAnimation = 20; + item.useTime = 15; + item.damage *= 4; + item.tileBoost += 1; + } + + if (item.type == ItemID.PearlwoodBow) + { + item.useAnimation += 8; //35 + item.useTime += 8; //35 + item.shootSpeed += 3.4f; //10f + item.knockBack += 1f; //1f + item.shoot = ProjectileID.RainbowFront; + } } #endregion @@ -336,6 +354,23 @@ namespace CalamityMod.Items Main.PlaySound(SoundID.Item11.WithPitchVariance(0.05f), position); // <--- This is optional; if using, add "item.UseSound = null" to GlobalItem.SetDefaults when checking for the Star Cannon's ID return false; } + if (item.type == ItemID.PearlwoodBow) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && (Main.projectile[i].type == ProjectileID.RainbowFront || Main.projectile[i].type == ProjectileID.RainbowBack) && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + break; + } + } + for (int i = -8; i <= 8; i += 8) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + int rainbow = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.RainbowFront, damage, 0f, player.whoAmI, 0f, 0f); + Main.projectile[rainbow].Calamity().forceRanged = true; + } + } return true; } #endregion @@ -465,7 +500,7 @@ namespace CalamityMod.Items { Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 500 : 1750) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 1000 : 1750) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); spread -= Main.rand.Next(2, 4); Main.PlaySound(SoundID.Item20, player.Center); } @@ -473,7 +508,7 @@ namespace CalamityMod.Items } else { - Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 250 : 1250) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 500 : 1250) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); Main.PlaySound(SoundID.Item20, player.Center); } @@ -491,7 +526,7 @@ namespace CalamityMod.Items bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; - int dam = (int)((shouldNerf ? 250 : 1000) * (player.allDamage + player.minionDamage - 1f)); + int dam = (int)((shouldNerf ? 500 : 1000) * player.MinionDamage()); switch (projType) { case 1: //big boomer @@ -530,7 +565,7 @@ namespace CalamityMod.Items player.statMana -= manaCost; correctedVelocity *= 25f; Main.PlaySound(SoundID.Item20, player.Center); - int dam = (int)((shouldNerf ? 900 : 4500) * (player.allDamage + player.minionDamage - 1f)); + int dam = (int)((shouldNerf ? 1800 : 4500) * player.MinionDamage()); if (player.HasBuff(BuffID.ManaSickness)) { int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); @@ -555,7 +590,7 @@ namespace CalamityMod.Items for (float i = 0; i < crystalCount; i++) { float angle = MathHelper.TwoPi / crystalCount * i; - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 169 : 880) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 300 : 880) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); Main.projectile[proj].Calamity().forceMinion = true; Main.PlaySound(SoundID.Item20, player.Center); } @@ -564,7 +599,7 @@ namespace CalamityMod.Items else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) { float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 1100) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, 1f, 0f); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 400 : 1100) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); Main.projectile[proj].Calamity().forceMinion = true; Main.PlaySound(SoundID.Item20, player.Center); } @@ -649,7 +684,7 @@ namespace CalamityMod.Items } if (item.type == ItemID.MonkStaffT1) { - for (int i = 0; i < 1000; ++i) + for (int i = 0; i < Main.maxProjectiles; ++i) { if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) { @@ -2247,7 +2282,7 @@ Provides heat and cold protection in Death Mode"; } if (item.accessory) { - if (item.prefix == 67) + if (item.prefix == PrefixID.Precise) { foreach (TooltipLine line2 in tooltips) { @@ -2257,7 +2292,7 @@ Provides heat and cold protection in Death Mode"; } } } - if (item.prefix == 68) + if (item.prefix == PrefixID.Lucky) { foreach (TooltipLine line2 in tooltips) { @@ -2267,7 +2302,7 @@ Provides heat and cold protection in Death Mode"; } } } - if (item.prefix == 62) + if (item.prefix == PrefixID.Hard) { string defenseBoost = "+1 defense\n"; if (NPC.downedMoonlord) @@ -2286,7 +2321,7 @@ Provides heat and cold protection in Death Mode"; } } } - if (item.prefix == 63) + if (item.prefix == PrefixID.Guarding) { string defenseBoost = "+2 defense\n"; if (NPC.downedMoonlord) @@ -2305,7 +2340,7 @@ Provides heat and cold protection in Death Mode"; } } } - if (item.prefix == 64) + if (item.prefix == PrefixID.Armored) { string defenseBoost = "+3 defense\n"; if (NPC.downedMoonlord) @@ -2324,7 +2359,7 @@ Provides heat and cold protection in Death Mode"; } } } - if (item.prefix == 65) + if (item.prefix == PrefixID.Warding) { string defenseBoost = "+4 defense\n"; if (NPC.downedMoonlord) @@ -2520,6 +2555,8 @@ Provides heat and cold protection in Death Mode"; return "Eskimo"; if (head.type == ItemID.MeteorHelmet && body.type == ItemID.MeteorSuit && legs.type == ItemID.MeteorLeggings) return "Meteor"; + if (head.type == ItemID.PearlwoodHelmet && body.type == ItemID.PearlwoodBreastplate && legs.type == ItemID.PearlwoodGreaves) + return "Pearlwood"; return ""; } @@ -3048,7 +3085,7 @@ Provides heat and cold protection in Death Mode"; bool flag = false; bool canShoot = false; - for (int i = 54; i < 58; i++) + for (int i = 54; i < Main.maxInventory; i++) { if (player.inventory[i].ammo == item.useAmmo && (player.inventory[i].stack >= ammoConsumed || !player.inventory[i].consumable)) { @@ -3078,7 +3115,7 @@ Provides heat and cold protection in Death Mode"; bool flag = false; bool dontConsumeAmmo = false; - for (int i = 54; i < 58; i++) + for (int i = 54; i < Main.maxInventory; i++) { if (player.inventory[i].ammo == item.useAmmo && player.inventory[i].stack >= ammoConsumed) { diff --git a/Items/DifficultyItems/Armageddon.cs b/Items/DifficultyItems/Armageddon.cs index 0ab6ca1bb6..f022838ebf 100644 --- a/Items/DifficultyItems/Armageddon.cs +++ b/Items/DifficultyItems/Armageddon.cs @@ -78,10 +78,8 @@ namespace CalamityMod.Items.DifficultyItems if (Main.netMode == NetmodeID.Server) { var netMessage = mod.GetPacket(); - netMessage.Write((uint)CalamityModMessageType.ArmageddonBoolSync); + netMessage.Write((byte)CalamityModMessageType.ArmageddonBoolSync); netMessage.Write(CalamityWorld.armageddon); - netMessage.Write((uint)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } return true; diff --git a/Items/DifficultyItems/Death.cs b/Items/DifficultyItems/Death.cs index c86df4520d..41cc8234d4 100644 --- a/Items/DifficultyItems/Death.cs +++ b/Items/DifficultyItems/Death.cs @@ -93,12 +93,24 @@ namespace CalamityMod.Items.DifficultyItems CalamityMod.UpdateServerBoolean(); + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); + netMessage.Write(CalamityWorld.revenge); + netMessage.Send(); + } if (Main.netMode == NetmodeID.Server) { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.DeathBoolSync); netMessage.Write(CalamityWorld.death); - netMessage.Write((uint)CalamityModMessageType.DoGCountdownSync); + netMessage.Send(); + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } diff --git a/Items/DifficultyItems/DefiledRune.cs b/Items/DifficultyItems/DefiledRune.cs index 1de6ef424f..0edea71292 100644 --- a/Items/DifficultyItems/DefiledRune.cs +++ b/Items/DifficultyItems/DefiledRune.cs @@ -88,11 +88,21 @@ namespace CalamityMod.Items.DifficultyItems if (Main.netMode == NetmodeID.Server) { var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); - netMessage.Write(CalamityWorld.revenge); netMessage.Write((byte)CalamityModMessageType.DefiledBoolSync); netMessage.Write(CalamityWorld.defiled); - netMessage.Write((uint)CalamityModMessageType.DoGCountdownSync); + netMessage.Send(); + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); + netMessage.Write(CalamityWorld.revenge); + netMessage.Send(); + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index 8616f446b5..af185ba0a3 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -87,7 +87,12 @@ namespace CalamityMod.Items.DifficultyItems var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.IronHeartBoolSync); netMessage.Write(CalamityWorld.ironHeart); - netMessage.Write((uint)CalamityModMessageType.DoGCountdownSync); + netMessage.Send(); + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index f6c4a75afa..536cf77c49 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -133,7 +133,12 @@ namespace CalamityMod.Items.DifficultyItems var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); netMessage.Write(CalamityWorld.revenge); - netMessage.Write((uint)CalamityModMessageType.DoGCountdownSync); + netMessage.Send(); + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } diff --git a/Items/Materials/EffulgentFeather.cs b/Items/Materials/EffulgentFeather.cs index 9b119c3217..4ef9391a84 100644 --- a/Items/Materials/EffulgentFeather.cs +++ b/Items/Materials/EffulgentFeather.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Effulgent Feather"); Tooltip.SetDefault("It vibrates with fluffy golden energy"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 12)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 11)); } public override void SetDefaults() diff --git a/Items/Materials/EffulgentFeather.png b/Items/Materials/EffulgentFeather.png index ba8e7f88dc..f1852af7e9 100644 Binary files a/Items/Materials/EffulgentFeather.png and b/Items/Materials/EffulgentFeather.png differ diff --git a/Items/PermanentBoosters/RedLightningContainer.png b/Items/PermanentBoosters/RedLightningContainer.png index 2aba920004..c859aca470 100644 Binary files a/Items/PermanentBoosters/RedLightningContainer.png and b/Items/PermanentBoosters/RedLightningContainer.png differ diff --git a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.png b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.png index ea1665c31d..2b2adfccb0 100644 Binary files a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.png and b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.png differ diff --git a/Items/SummonItems/BirbPheromones.png b/Items/SummonItems/BirbPheromones.png index 5aad15004d..5f104bdc6b 100644 Binary files a/Items/SummonItems/BirbPheromones.png and b/Items/SummonItems/BirbPheromones.png differ diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 3a225dc91c..46476b5ef8 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.SummonItems.Invasion else { CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; AcidRainEvent.UpdateInvasion(false); } return true; diff --git a/Items/Tools/AbyssalWarhammer.cs b/Items/Tools/AbyssalWarhammer.cs index 2deddd7be9..d4c1aeaa15 100644 --- a/Items/Tools/AbyssalWarhammer.cs +++ b/Items/Tools/AbyssalWarhammer.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 70; item.height = 70; - item.useTime = 38; + item.useTime = 14; item.useAnimation = 38; item.useTurn = true; item.hammer = 110; diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index 0e3a24a63c..bea7a7c633 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 44; item.height = 44; - item.useTime = 26; + item.useTime = 18; item.useAnimation = 26; item.useTurn = true; item.axe = 25; diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index 1f232037e6..6a5220743f 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 60; item.height = 70; - item.useTime = 10; + item.useTime = 8; item.useAnimation = 20; item.useTurn = true; item.axe = 30; diff --git a/Items/Tools/BerserkerWaraxe.cs b/Items/Tools/BerserkerWaraxe.cs index 1fd1ee5150..7f3fa6aab9 100644 --- a/Items/Tools/BerserkerWaraxe.cs +++ b/Items/Tools/BerserkerWaraxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 66; item.height = 56; - item.useTime = 27; + item.useTime = 7; item.useAnimation = 27; item.useTurn = true; item.axe = 30; diff --git a/Items/Tools/ChaoswarpedSlashaxe.cs b/Items/Tools/ChaoswarpedSlashaxe.cs index fd97cd1255..eeae95d6b2 100644 --- a/Items/Tools/ChaoswarpedSlashaxe.cs +++ b/Items/Tools/ChaoswarpedSlashaxe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 50; item.height = 50; - item.useTime = 31; + item.useTime = 6; item.useAnimation = 31; item.useTurn = true; item.axe = 40; diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 63f21fc1ac..decfb2160c 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 36; item.height = 36; - item.useTime = 25; + item.useTime = 18; item.useAnimation = 25; item.useTurn = true; item.axe = 15; diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 4c32101cea..f932133e2b 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 60; item.height = 46; - item.useTime = 16; + item.useTime = 8; item.useAnimation = 16; item.useTurn = true; item.axe = 27; diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index 7c7691b61c..3b9b35487e 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Tools item.melee = true; item.width = 44; item.height = 44; - item.useTime = 29; + item.useTime = 21; item.useAnimation = 29; item.useTurn = true; item.axe = 13; diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs index 8981292c97..435f431a43 100644 --- a/Items/Tools/WulfrumAxe.cs +++ b/Items/Tools/WulfrumAxe.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Tools item.rare = 1; item.UseSound = SoundID.Item1; item.autoReuse = true; + item.tileBoost += 1; } public override void AddRecipes() diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs index c1172c256a..d7dd1364ed 100644 --- a/Items/Tools/WulfrumHammer.cs +++ b/Items/Tools/WulfrumHammer.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Tools item.rare = 1; item.UseSound = SoundID.Item1; item.autoReuse = true; + item.tileBoost += 1; } public override void AddRecipes() diff --git a/Items/TreasureBags/BumblebirbBag.png b/Items/TreasureBags/BumblebirbBag.png index 58e88f3e17..960db62a53 100644 Binary files a/Items/TreasureBags/BumblebirbBag.png and b/Items/TreasureBags/BumblebirbBag.png differ diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 89c97a2a01..43b12adeda 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index 603744546d..c3b1f1ccb9 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic item.rare = 9; item.UseSound = SoundID.Item67; item.autoReuse = true; - item.shoot = 250; + item.shoot = ProjectileID.RainbowFront; item.shootSpeed = 18f; } @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.RainbowGun); + recipe.AddIngredient(ItemID.PearlwoodBow); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 0b53edf37a..83ddfc839f 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 135; + item.damage = 50; item.magic = true; item.mana = 16; item.width = 50; @@ -26,9 +27,8 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -40,10 +40,21 @@ namespace CalamityMod.Items.Weapons.Magic for (int i = 0; i < Main.rand.Next(5, 8 + 1); i++) { Vector2 velocity = new Vector2(speedX, speedY) * Main.rand.NextFloat(0.9f, 1.1f); - float angle = Main.rand.NextFloat(-1f, 1f) * MathHelper.ToRadians(23f); + float angle = Main.rand.NextFloat(-1f, 1f) * MathHelper.ToRadians(25f); Projectile.NewProjectile(position, velocity.RotatedBy(angle), type, damage, knockBack, player.whoAmI); } return false; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NimbusRod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/Magic/RougeSlash.png b/Items/Weapons/Magic/RougeSlash.png index a21c4f7f6b..8a8812597d 100644 Binary files a/Items/Weapons/Magic/RougeSlash.png and b/Items/Weapons/Magic/RougeSlash.png differ diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index a26d3380ac..c08fa20126 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 121; + item.damage = 150; item.magic = true; item.mana = 15; item.width = 60; @@ -32,14 +32,14 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item46; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; + item.shootSpeed = 15f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 velocity = new Vector2(speedX, speedY); - float spitAngleMax = MathHelper.ToRadians(20f + Main.rand.NextFloat(-2f, 2f)); - float fangAngleMax = MathHelper.ToRadians(10f + Main.rand.NextFloat(-1f, 1f)); + float spitAngleMax = MathHelper.ToRadians(14f + Main.rand.NextFloat(-2f, 2f)); + float fangAngleMax = MathHelper.ToRadians(7f + Main.rand.NextFloat(-1f, 1f)); for (int i = 0; i < 9; i++) { float angle = MathHelper.Lerp(i / 9f, -spitAngleMax, spitAngleMax); diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index 859961c964..aea4ceeb2f 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class Bonebreaker : ModItem { - public const int BaseDamage = 70; + public const int BaseDamage = 60; public override void SetStaticDefaults() { @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.useStyle = 1; - item.useAnimation = 10; - item.useTime = 10; + item.useAnimation = 15; + item.useTime = 15; item.width = 32; item.height = 32; item.damage = BaseDamage; diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index 39fc2f0643..1f80a37c3c 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - for (int i = 0; i < 1000; ++i) + for (int i = 0; i < Main.maxProjectiles; ++i) { if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) { diff --git a/Items/Weapons/Melee/GildedProboscis.png b/Items/Weapons/Melee/GildedProboscis.png index c8a092a8e6..67f0197271 100644 Binary files a/Items/Weapons/Melee/GildedProboscis.png and b/Items/Weapons/Melee/GildedProboscis.png differ diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 7ddbc0d98a..5472f829f8 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 66; - item.damage = 649; + item.damage = 400; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 16374a913d..611f09566a 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 108; + item.damage = 170; item.ranged = true; item.width = 76; item.height = 46; diff --git a/Items/Weapons/Ranged/GoldenEagle.png b/Items/Weapons/Ranged/GoldenEagle.png index 34fa33e3a3..fe794a903a 100644 Binary files a/Items/Weapons/Ranged/GoldenEagle.png and b/Items/Weapons/Ranged/GoldenEagle.png differ diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index ec8ebc8525..953de6b4f2 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 472; + item.damage = 501; item.ranged = true; item.width = 46; item.height = 24; diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index e032f10b9a..72e58d750e 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 14; + item.damage = 9; item.width = item.height = 24; item.useAnimation = item.useTime = 31; item.noMelee = true; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 32d688eb82..ecf0c0d655 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -19,10 +19,10 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 42; item.height = 46; - item.damage = 540; + item.damage = 820; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = item.useTime = 30; + item.useAnimation = item.useTime = 20; item.useStyle = 1; item.knockBack = 5f; item.UseSound = SoundID.Item1; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().postMoonLordRarity = 13; item.rare = 10; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = 18f; item.Calamity().rogue = true; } @@ -45,7 +45,6 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[stealth].velocity *= 1.5f; Main.projectile[stealth].timeLeft = 420; Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].usesLocalNPCImmunity = true; Main.projectile[stealth].localNPCHitCooldown = 6; } return false; diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index e3554cfc63..3178baba4a 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 540; + item.damage = 680; item.mana = 32; item.summon = true; item.sentry = true; diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 1ee2024bba..e7bc6ba0ae 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 20; + item.damage = 8; item.mana = 10; item.width = 10; item.height = 32; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 725981d110..9b210abe64 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_DarkMageHealImpact; item.summon = true; item.mana = 12; - item.damage = 80; + item.damage = 50; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 15; diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index fb6d7bad64..72bb2bb63c 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 97; + item.damage = 50; item.mana = 12; item.width = item.height = 32; item.useTime = item.useAnimation = 25; diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 09448c1887..3520ec36a4 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 70; + item.damage = 75; item.mana = 10; item.width = 46; item.height = 28; @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Summon projectile2.Kill(); } } - float damageMult = ((float)Math.Log(viruliSlots, 8f)) + 1f; + float damageMult = ((float)Math.Log(viruliSlots, 10f)) + 1f; position = Main.MouseWorld; speedX = 0; speedY = 0; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 3cf68898f2..19eeb8272e 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 330; + item.damage = 260; item.mana = 12; item.width = item.height = 32; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index bbd18921cb..e64092f3fc 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 100; + item.damage = 54; item.mana = 10; item.width = 28; item.height = 20; diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index a8b3d02f74..f3bfb2b9b2 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -106,8 +106,8 @@ namespace CalamityMod private static readonly Dictionary InvasionDifficulty = new Dictionary { - { "Acid Rain Initial", 2.5f }, - { "Acid Rain Aquatic Scourge", 8.8f } + { "Acid Rain Initial", 2.4f }, + { "Acid Rain Aquatic Scourge", 8.51f } }; public static void Setup() @@ -490,7 +490,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("OldDuke", out float order); List bosses = new List() { NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Defeat the Acid Rain event post-Polterghast or fish using a [i:{summon}] in the Sulphurous Sea"; string despawn = CalamityUtils.ColorMessage("The old duke disappears amidst the acidic downpour.", new Color(0xF0, 0xE6, 0x8C)); @@ -549,7 +549,7 @@ namespace CalamityMod List collection = new List() { ItemType() }; string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Eye of Cthulhu is defeated."; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the ocean.", new Color(146, 183, 116)); - string bossLogTex = "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist"; + string bossLogTex = "CalamityMod/Events/AcidRainT1_BossChecklist"; string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; AddInvasion(bossChecklist, calamity, "Acid Rain", order, enemies, DownedAcidRainInitial, summon, loot, collection, instructions, despawn, bossLogTex, iconTexture); } @@ -562,9 +562,9 @@ namespace CalamityMod List collection = new List() { ItemType() }; string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Aquatic Scourge is defeated"; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); - string bossLogTex = "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist"; + string bossLogTex = "CalamityMod/Events/AcidRainT1_BossChecklist"; string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; - AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Aquatic Scourge)", order, enemies, DownedAcidRainHardmode, summon, loot, collection, instructions, despawn, bossLogTex, iconTexture); + AddInvasion(bossChecklist, calamity, "Acid Rain (Post-AS)", order, enemies, DownedAcidRainHardmode, summon, loot, collection, instructions, despawn, bossLogTex, iconTexture); } } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 4125fbcc77..fbe8697660 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 260; + npc.damage = 160; npc.lifeMax = 6650; npc.defense = 45; } diff --git a/NPCs/AcidRain/FlakBaby.cs b/NPCs/AcidRain/FlakBaby.cs index 247aa74733..93c8a3eda0 100644 --- a/NPCs/AcidRain/FlakBaby.cs +++ b/NPCs/AcidRain/FlakBaby.cs @@ -124,8 +124,6 @@ namespace CalamityMod.NPCs.AcidRain { npc.frame.Y = 0; } - if (npc.ai[1] <= 8) - npc.frame.Y = frameHeight; } } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 251e9bb487..e286726d54 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,12 +27,10 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 0; npc.lifeMax = 700; - npc.defense = 10; if (CalamityWorld.downedPolterghast) { npc.lifeMax = 7500; - npc.defense = 80; } npc.knockBackResist = 0f; @@ -48,6 +47,16 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); @@ -57,9 +66,14 @@ namespace CalamityMod.NPCs.AcidRain { Player closest = Main.player[Player.FindClosest(npc.Top, 0, 0)]; + npc.defense = npc.localAI[1] < 10f ? 999999 : 20; + if (npc.justHit) + { npc.localAI[0] = 240; - if (npc.localAI[0] == 0f) + npc.netUpdate = true; + } + if (npc.localAI[0] == 0f || npc.localAI[1] < 10f) { npc.chaseable = false; if (Math.Abs(closest.Center.X - npc.Center.X) < 320f && @@ -104,6 +118,7 @@ namespace CalamityMod.NPCs.AcidRain npc.ai[2] = 0f; npc.velocity.Y -= jumpSpeed; npc.velocity.X = lungeForwardSpeed * -npc.direction; + npc.netUpdate = true; } } else @@ -116,7 +131,7 @@ namespace CalamityMod.NPCs.AcidRain public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { // Don't draw the bar if in stealth mode - if (npc.localAI[0] == 0f) + if (npc.localAI[0] == 0f || npc.localAI[1] < 10f) return false; return null; } @@ -127,6 +142,11 @@ namespace CalamityMod.NPCs.AcidRain } public override void FindFrame(int frameHeight) { + if (npc.localAI[1] < 10f) + { + npc.frame.Y = 0; + return; + } if (npc.localAI[0] > 0f) { if (npc.ai[0]++ % 6 == 5) @@ -137,6 +157,8 @@ namespace CalamityMod.NPCs.AcidRain { npc.frame.Y = frameHeight * 3; // Frames 1 and 2 are for transitioning. Frame 0 is sitting still, and the rest are walking frames } + if (npc.localAI[0] <= 8) + npc.frame.Y = frameHeight; } else { @@ -159,6 +181,7 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab3"), 1f); } + npc.localAI[1]++; } } } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs new file mode 100644 index 0000000000..526a7e8480 --- /dev/null +++ b/NPCs/AcidRain/GammaSlime.cs @@ -0,0 +1,197 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Enemy; +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.AcidRain +{ + public class GammaSlime : ModNPC + { + public float angularMultiplier1; + public float angularMultiplier2; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gamma Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.width = 40; + npc.height = 30; + + npc.damage = 145; + npc.lifeMax = 6410; + npc.defense = 50; + + npc.aiStyle = aiType = -1; + + npc.knockBackResist = 0f; + animationType = 81; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 8, 30); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + // banner = npc.type; + // bannerItem = ModContent.ItemType(); + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(angularMultiplier1); + writer.Write(angularMultiplier2); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + angularMultiplier1 = reader.ReadSingle(); + angularMultiplier2 = reader.ReadSingle(); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + if (npc.velocity.Y == 0f && npc.ai[3] <= 0f) + { + npc.velocity.X *= 0.8f; + if (npc.ai[0]++ >= 30f) + { + npc.velocity.Y -= MathHelper.Clamp(Math.Abs(player.Center.Y - npc.Center.Y) / 16f, 5f, 15f); + npc.velocity.X = npc.DirectionTo(player.Center).X * 16f; + npc.ai[0] = 0f; + npc.ai[1]++; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 5; i++) + { + float angle = MathHelper.TwoPi / 5f * i + (npc.ai[1] % 2) * MathHelper.PiOver2; + Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType(), + 45, 3f); + } + } + npc.netUpdate = true; + } + } + else + { + npc.velocity.X *= 0.9935f; + } + if (npc.ai[3] > 0f) + npc.ai[3]--; + if (npc.ai[3] > 240f) + { + npc.velocity.X *= 0.95f; + npc.velocity.Y += 0.2f; + } + // Hold energy for laser + if (npc.ai[3] > 480f) + { + float scale = npc.ai[3] < 530 ? 2.25f : 1.65f; + Vector2 destination = npc.Top + new Vector2(0f, 6f); + Dust dust = Dust.NewDustPerfect(destination + new Vector2(0f, 12f).RotatedByRandom(MathHelper.TwoPi), (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Vector2.Normalize(destination - dust.position) * 3f; + dust.scale = scale; + dust.noGravity = true; + if (npc.ai[3] <= 540f) + { + float length = MathHelper.Lerp(20f, 550f, (npc.ai[3] - 480f) / 60f); + float outwardness = MathHelper.Lerp(1f, 0f, (npc.ai[3] - 480f) / 60f); + for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - length; i -= 8f) + { + float angle = i / 24f; + Vector2 spawnPosition = new Vector2(npc.Center.X, i); + dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid); + dust.scale = 1.5f; + dust.velocity = Vector2.UnitX * (float)Math.Cos(angle) * 4f * outwardness; + dust.noGravity = true; + } + } + } + // Release laser + if (npc.ai[3] == 480f) + { + angularMultiplier1 = Main.rand.NextFloat(3f); + angularMultiplier2 = Main.rand.NextFloat(4f); + npc.netUpdate = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); // Moon lord beam sound + Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType(), 120, 4f, Main.myPlayer, 0f, npc.whoAmI); + } + } + // Very complex particle effects while releasing the beam + else if (npc.ai[3] >= 300f) + { + float angle = (npc.ai[3] / 30f) % MathHelper.TwoPi; + float x = (float)Math.Sin(angle * angularMultiplier1) * (float)Math.Cos(angle); + float y = (float)Math.Cos(angle * angularMultiplier1) * (float)Math.Sin(angle); + Vector2 velocity = new Vector2(x * 4.5f, y * 2f); + Dust dust = Dust.NewDustPerfect(npc.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = velocity; + dust.scale = (float)Math.Cos(angle) + 2f; + dust.noGravity = true; + + dust = Dust.NewDustPerfect(npc.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = -velocity; + dust.scale = (float)Math.Cos(angle) + 2f; + dust.noGravity = true; + } + if (Math.Abs(player.Center.X - npc.Center.X) < 250f && + player.Center.X - npc.Center.X < 0f && + npc.ai[3] == 0f && + Main.rand.NextBool(110)) + { + npc.ai[3] = 600f; + npc.netUpdate = true; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.ai[3] >= 480f && npc.ai[3] <= 540f) + { + float length = MathHelper.Lerp(20f, 550f, (npc.ai[3] - 480f) / 60f); + float opacity = MathHelper.Lerp(0.3f, 0.9f, (npc.ai[3] - 480f) / 60f); + Utils.DrawLine(spriteBatch, npc.Top + new Vector2(0f, 4f), npc.Top + new Vector2(0f, 4f) - Vector2.UnitY * length, Color.Lerp(Color.Lime, Color.Transparent, opacity)); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } +} diff --git a/NPCs/AcidRain/GammaSlime.png b/NPCs/AcidRain/GammaSlime.png new file mode 100644 index 0000000000..e4c1f2c5fe Binary files /dev/null and b/NPCs/AcidRain/GammaSlime.png differ diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 56f84b0d31..0ac56d9050 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Enemy; @@ -63,7 +64,7 @@ namespace CalamityMod.NPCs.AcidRain public override void AI() { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); - if (CalamityWorld.downedPolterghast && !Main.player[npc.target].dead && CalamityWorld.rainingAcid) + if (CalamityWorld.downedAquaticScourge && !Main.player[npc.target].dead && CalamityWorld.rainingAcid) { npc.aiStyle = aiType = -1; @@ -338,5 +339,10 @@ namespace CalamityMod.NPCs.AcidRain { DropHelper.DropItemChance(npc, ModContent.ItemType(), 100); } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } } } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 957679679e..104b279fc0 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 300; + npc.damage = 180; npc.lifeMax = 5700; npc.defense = 65; } diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 4a3c88f04b..c6d681a293 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 285; + npc.damage = 175; npc.lifeMax = 6300; npc.defense = 58; } diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index c12ffc7fb1..32b2cc119c 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 210; + npc.damage = 140; npc.lifeMax = 6600; npc.defense = 33; } @@ -89,7 +89,10 @@ namespace CalamityMod.NPCs.AcidRain if (npc.wet) { if (npc.velocity.Y >= 0f) + { npc.velocity.Y = -3f; + npc.netUpdate = true; + } } if (closestBubble != null && minimumDistance < 200f) @@ -99,8 +102,8 @@ namespace CalamityMod.NPCs.AcidRain if (closestBubble.Hitbox.Intersects(npc.Hitbox)) { npc.ai[0] = 1f; - npc.netUpdate = true; closestBubble.Kill(); + npc.netUpdate = true; } } if (npc.velocity.Y == 0f || npc.wet) @@ -108,18 +111,19 @@ namespace CalamityMod.NPCs.AcidRain npc.TargetClosest(false); npc.velocity.X *= 0.85f; npc.ai[1]++; - float lungeForwardSpeed = 13f; - float jumpSpeed = 3f; + float lungeForwardSpeed = 15f; + float jumpSpeed = 4f; if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { lungeForwardSpeed *= 1.2f; } - if (npc.ai[1] >= 10) + if (npc.ai[1] >= 17) { npc.ai[1] = 0f; npc.velocity.Y -= jumpSpeed; npc.velocity.X = lungeForwardSpeed * (npc.Center.X - destination.X < 0).ToDirectionInt(); npc.spriteDirection = (npc.Center.X - destination.X < 0).ToDirectionInt(); + npc.netUpdate = true; } } else @@ -135,40 +139,21 @@ namespace CalamityMod.NPCs.AcidRain if (npc.Distance(player.Center) < 200f) inertia *= 0.667f; npc.velocity = (npc.velocity * inertia + npc.DirectionTo(player.Center) * speed) / (inertia + 1f); - - float SAImovement = 0.5f; - for (int index = 0; index < Main.npc.Length; index++) - { - NPC other = Main.npc[index]; - if (index != npc.whoAmI && - other.active && - other.type == npc.type && Math.Abs(npc.position.X - other.position.X) + Math.Abs(npc.position.Y - other.position.Y) < npc.width) - { - if (npc.position.X < other.position.X) - { - npc.velocity.X -= SAImovement; - } - else - { - npc.velocity.X += SAImovement; - } - if (npc.position.Y < other.position.Y) - { - npc.velocity.Y -= SAImovement; - } - else - { - npc.velocity.Y += SAImovement; - } - } - } npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + if (player.dead && npc.Distance(player.Center) < 20f) + { + npc.ai[0] = 0f; + npc.netUpdate = true; + } } } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { if (npc.ai[0] != 0f) + { npc.ai[0] = 0f; + npc.netUpdate = true; + } } public override void FindFrame(int frameHeight) { @@ -196,10 +181,16 @@ namespace CalamityMod.NPCs.AcidRain public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 8; k++) + for (int k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore2"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/SulfurousSkaterGore3"), npc.scale); + } } public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index d7906039c5..be3833c619 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 233; + npc.damage = 160; npc.lifeMax = 7200; npc.defense = 78; } diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index fc10202c9b..bbccc0ccc7 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 315; + npc.damage = 172; npc.lifeMax = 4000; npc.defense = 30; } @@ -72,6 +72,7 @@ namespace CalamityMod.NPCs.AcidRain { // Revert back to swimming around after successfully devouring the player npc.ai[0] = 0f; + npc.netUpdate = true; return; } // Stick to player and make them bleed @@ -122,6 +123,7 @@ namespace CalamityMod.NPCs.AcidRain { npc.ai[0] = 1f; npc.ai[1] = 300f; + npc.netUpdate = true; } npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(player.Center) * speed) / swimIntertia; } diff --git a/NPCs/Bumblebirb/Birb.png b/NPCs/Bumblebirb/Birb.png new file mode 100644 index 0000000000..afd119a6d9 Binary files /dev/null and b/NPCs/Bumblebirb/Birb.png differ diff --git a/NPCs/Bumblebirb/Birb_Head_Boss.png b/NPCs/Bumblebirb/Birb_Head_Boss.png new file mode 100644 index 0000000000..53a1b47d21 Binary files /dev/null and b/NPCs/Bumblebirb/Birb_Head_Boss.png differ diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index dcba3bd782..e5ab1c5d06 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -8,15 +8,11 @@ using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Bumblebirb { @@ -26,17 +22,20 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetStaticDefaults() { DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[npc.type] = 6; } + public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; + public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss"; + public override void SetDefaults() { npc.npcSlots = 32f; npc.aiStyle = -1; aiType = -1; npc.damage = 160; - npc.width = 80; - npc.height = 80; + npc.width = 130; + npc.height = 100; npc.defense = 40; npc.LifeMaxNERB(227500, 252500, 3000000); double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; @@ -79,6 +78,7 @@ namespace CalamityMod.NPCs.Bumblebirb public override void AI() { + npc.visualOffset = new Vector2(20f, 50f); CalamityAI.BumblebirbAI(npc, mod); } @@ -90,32 +90,27 @@ namespace CalamityMod.NPCs.Bumblebirb public override void FindFrame(int frameHeight) { - npc.frameCounter += (double)(npc.velocity.Length() / 4f); - npc.frameCounter += 1.0; - if (npc.ai[0] < 4f) + bool lightningBreathAttack = false; //leaving this for fabbo to sort + if (lightningBreathAttack) { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 4) - { - npc.frame.Y = 0; - } + npc.frame.Y = npc.frame.Height * 5; } else { - if (npc.frameCounter >= 6.0) + if (npc.frameCounter >= 5) //iban said the time between frames was 5 so using that as a base { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 9) - { - npc.frame.Y = frameHeight * 5; + if (npc.frame.Y >= npc.frame.Height * 4) //frame 5 or 6 for transitioning from open jaw + { + npc.frame.Y = 0; + } + else + { + npc.frame.Y += npc.frame.Height; + } + npc.frameCounter = -1; //set to -1 to account for the framecounter increment shortly after } } + npc.frameCounter++; } public override void BossLoot(ref string name, ref int potionType) @@ -171,17 +166,12 @@ namespace CalamityMod.NPCs.Bumblebirb { Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleHead"), 1f); - for (int wing = 0; wing < 2; wing++) + for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleWing"), 1f); - } - for (int leg = 0; leg < 4; leg++) - { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleLeg"), 1f); + string gore = "Gores/Bumble"; + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot(gore), 1f); } } } diff --git a/NPCs/Bumblebirb/Bumblefuck.png b/NPCs/Bumblebirb/Bumblefuck.png deleted file mode 100644 index 4b1e72a257..0000000000 Binary files a/NPCs/Bumblebirb/Bumblefuck.png and /dev/null differ diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index d1aceee50e..94eaf22d14 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -12,16 +12,18 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetStaticDefaults() { DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; + Main.npcFrameCount[npc.type] = 6; } + public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; + public override void SetDefaults() { npc.npcSlots = 1f; npc.aiStyle = -1; aiType = -1; npc.damage = 110; - npc.width = 80; + npc.width = 120; npc.height = 80; npc.scale = 0.66f; npc.defense = 20; @@ -57,6 +59,7 @@ namespace CalamityMod.NPCs.Bumblebirb public override void AI() { + npc.visualOffset = new Vector2(10, 40); Player player = Main.player[npc.target]; Vector2 vector = npc.Center; npc.damage = npc.defDamage; @@ -309,32 +312,27 @@ namespace CalamityMod.NPCs.Bumblebirb public override void FindFrame(int frameHeight) { - npc.frameCounter += (double)(npc.velocity.Length() / 4f); - npc.frameCounter += 1.0; - if (npc.ai[0] < 4f) + bool lightningBreathAttack = false; //leaving this for fabbo to sort + if (lightningBreathAttack) { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 4) - { - npc.frame.Y = 0; - } - } + npc.frame.Y = npc.frame.Height * 5; + } else { - if (npc.frameCounter >= 6.0) + if (npc.frameCounter >= 5) //iban said the time between frames was 5 so using that as a base { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 9) - { - npc.frame.Y = frameHeight * 5; + if (npc.frame.Y >= npc.frame.Height * 4) //frame 5 or 6 for transitioning from open jaw + { + npc.frame.Y = 0; + } + else + { + npc.frame.Y += npc.frame.Height; + } + npc.frameCounter = -1; //set to -1 to account for the framecounter increment shortly after } } + npc.frameCounter++; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Bumblebirb/Bumblefuck2.png b/NPCs/Bumblebirb/Bumblefuck2.png deleted file mode 100644 index 4b1e72a257..0000000000 Binary files a/NPCs/Bumblebirb/Bumblefuck2.png and /dev/null differ diff --git a/NPCs/Bumblebirb/Bumblefuck_Head_Boss.png b/NPCs/Bumblebirb/Bumblefuck_Head_Boss.png deleted file mode 100644 index f12a5f35cf..0000000000 Binary files a/NPCs/Bumblebirb/Bumblefuck_Head_Boss.png and /dev/null differ diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 56c61a070b..c255833660 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -3195,7 +3195,7 @@ namespace CalamityMod.NPCs bool flag95 = true; if (npc.position.Y > player.position.Y) { - for (int num955 = 0; num955 < 255; num955++) + for (int num955 = 0; num955 < Main.maxPlayers; num955++) { if (Main.player[num955].active) { @@ -3482,7 +3482,7 @@ namespace CalamityMod.NPCs Main.dust[dust].scale = 0.5f; } - for (int num475 = 0; num475 < 255; num475++) + for (int num475 = 0; num475 < Main.maxPlayers; num475++) { if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) { @@ -4301,6 +4301,7 @@ namespace CalamityMod.NPCs if (npc.timeLeft == 1) { CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; AcidRainEvent.UpdateInvasion(false); npc.timeLeft = 0; } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 83cf30babd..31bf5be3f6 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1595,7 +1595,7 @@ namespace CalamityMod.NPCs num35 /= 2; bool flag3 = true; - for (int num36 = 0; num36 < 255; num36++) + for (int num36 = 0; num36 < Main.maxPlayers; num36++) { if (Main.player[num36].active) { @@ -1730,7 +1730,7 @@ namespace CalamityMod.NPCs if (flag4 && !CalamityWorld.bossRushActive) { bool flag5 = true; - for (int num58 = 0; num58 < 255; num58++) + for (int num58 = 0; num58 < Main.maxPlayers; num58++) { if (Main.player[num58].active && !Main.player[num58].dead && Main.player[num58].ZoneCorrupt) flag5 = false; @@ -2513,7 +2513,7 @@ namespace CalamityMod.NPCs // Increase bee spawn rate during bee spawning phase based on number of players near the boss int playerNearBoss = 0; int num; - for (int num593 = 0; num593 < 255; num593 = num + 1) + for (int num593 = 0; num593 < Main.maxPlayers; num593 = num + 1) { if (Main.player[num593].active && !Main.player[num593].dead && (npc.Center - Main.player[num593].Center).Length() < 1000f) playerNearBoss++; @@ -4559,7 +4559,7 @@ namespace CalamityMod.NPCs if (npc.position.Y > player.position.Y) { - for (int m = 0; m < 255; m++) + for (int m = 0; m < Main.maxPlayers; m++) { if (Main.player[m].active) { @@ -8284,7 +8284,7 @@ namespace CalamityMod.NPCs else if ((lifeRatio < 0.8f || death) && Main.rand.NextBool(4)) { int thornBallCount = 0; - for (int i = 0; i < 1000; i++) + for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) thornBallCount++; @@ -12247,7 +12247,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 60f) { - for (int num1161 = 0; num1161 < 1000; num1161++) + for (int num1161 = 0; num1161 < Main.maxProjectiles; num1161++) { Projectile projectile = Main.projectile[num1161]; if (projectile.active && (projectile.type == ProjectileID.MoonLeech || projectile.type == ProjectileID.PhantasmalBolt || @@ -12411,7 +12411,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 40f) { - for (int num1171 = 0; num1171 < 1000; num1171++) + for (int num1171 = 0; num1171 < Main.maxProjectiles; num1171++) { Projectile projectile2 = Main.projectile[num1171]; if (projectile2.active && (projectile2.type == ProjectileID.MoonLeech || projectile2.type == ProjectileID.PhantasmalBolt || @@ -12435,10 +12435,10 @@ namespace CalamityMod.NPCs } } - for (int num1173 = 0; num1173 < 500; num1173++) + for (int num1173 = 0; num1173 < Main.maxGore; num1173++) { Gore gore2 = Main.gore[num1173]; - if (gore2.active && gore2.type >= 619 && gore2.type <= 622) + if (gore2.active && gore2.type >= GoreID.MoonLordHeart1 && gore2.type <= GoreID.MoonLordHeart4) gore2.active = false; } } @@ -12477,7 +12477,7 @@ namespace CalamityMod.NPCs if (!flag89) { - for (int num1175 = 0; num1175 < 255; num1175++) + for (int num1175 = 0; num1175 < Main.maxPlayers; num1175++) { if (Main.player[num1175].active && !Main.player[num1175].dead) { @@ -12795,7 +12795,7 @@ namespace CalamityMod.NPCs if (num1207 == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector201 = npc.Center + value21; - for (int num1228 = 0; num1228 < 255; num1228++) + for (int num1228 = 0; num1228 < Main.maxPlayers; num1228++) { Player player6 = Main.player[num1228]; if (player6.active && !player6.dead && Vector2.Distance(player6.Center, vector201) <= 3000f) @@ -12811,7 +12811,7 @@ namespace CalamityMod.NPCs if ((num1207 == 120f || num1207 == 180f || num1207 == 240f) && Main.netMode != NetmodeID.MultiplayerClient) { - for (int num1229 = 0; num1229 < 1000; num1229++) + for (int num1229 = 0; num1229 < Main.maxProjectiles; num1229++) { Projectile projectile6 = Main.projectile[num1229]; if (projectile6.active && projectile6.type == ProjectileID.MoonLeech && Main.player[(int)projectile6.ai[1]].FindBuffIndex(145) != -1) @@ -13300,7 +13300,7 @@ namespace CalamityMod.NPCs } vector176 *= velocity; - for (int num1194 = 0; num1194 < 1000; num1194++) + for (int num1194 = 0; num1194 < Main.maxProjectiles; num1194++) { Projectile projectile3 = Main.projectile[num1194]; if (projectile3.active && projectile3.type == ProjectileID.PhantasmalSphere && projectile3.ai[1] == (float)npc.whoAmI && projectile3.ai[0] != -1f) @@ -13781,7 +13781,7 @@ namespace CalamityMod.NPCs npc.velocity = Vector2.UnitY * -7f; - for (int num1255 = 0; num1255 < 1000; num1255++) + for (int num1255 = 0; num1255 < Main.maxProjectiles; num1255++) { Projectile projectile7 = Main.projectile[num1255]; if (projectile7.active && projectile7.type == ProjectileID.PhantasmalSphere && projectile7.ai[1] == (float)npc.whoAmI && projectile7.ai[0] != -1f) @@ -13813,7 +13813,7 @@ namespace CalamityMod.NPCs Vector2 velocity6 = (npc.ai[2] - 1.57079637f).ToRotationVector2() * velocity; npc.velocity = velocity6 * 2f; - for (int num1256 = 0; num1256 < 1000; num1256++) + for (int num1256 = 0; num1256 < Main.maxProjectiles; num1256++) { Projectile projectile9 = Main.projectile[num1256]; if (projectile9.active && projectile9.type == ProjectileID.PhantasmalSphere && projectile9.ai[1] == (float)npc.whoAmI && projectile9.ai[0] != -1f) @@ -16878,7 +16878,7 @@ namespace CalamityMod.NPCs { int solarFlareCount = 0; int maxFlareCount = 6; - for (int k = 0; k < 200; k++) + for (int k = 0; k < Main.maxNPCs; k++) { if (Main.npc[k].active && Main.npc[k].type == NPCID.SolarFlare) { @@ -20226,7 +20226,7 @@ namespace CalamityMod.NPCs Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int num35 = 1000; bool flag3 = true; - for (int num36 = 0; num36 < 255; num36++) + for (int num36 = 0; num36 < Main.maxPlayers; num36++) { if (Main.player[num36].active) { @@ -20427,7 +20427,7 @@ namespace CalamityMod.NPCs } if (num41 > 0) { - for (int num50 = 0; num50 < 200; num50++) + for (int num50 = 0; num50 < Main.maxNPCs; num50++) { if (Main.npc[num50].active && Main.npc[num50].type == npc.type && num50 != npc.whoAmI) { @@ -20444,7 +20444,7 @@ namespace CalamityMod.NPCs } else { - for (int num51 = 0; num51 < 200; num51++) + for (int num51 = 0; num51 < Main.maxNPCs; num51++) { if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) { @@ -20593,7 +20593,7 @@ namespace CalamityMod.NPCs if (flag4) { bool flag5 = true; - for (int num58 = 0; num58 < 255; num58++) + for (int num58 = 0; num58 < Main.maxPlayers; num58++) { if (Main.player[num58].active && !Main.player[num58].dead && Main.player[num58].ZoneCorrupt) { @@ -20606,7 +20606,7 @@ namespace CalamityMod.NPCs { npc.active = false; int num59 = (int)npc.ai[0]; - while (num59 > 0 && num59 < 200 && Main.npc[num59].active && Main.npc[num59].aiStyle == npc.aiStyle) + while (num59 > 0 && num59 < Main.maxNPCs && Main.npc[num59].active && Main.npc[num59].aiStyle == npc.aiStyle) { int arg_2853_0 = (int)Main.npc[num59].ai[0]; Main.npc[num59].active = false; @@ -20777,7 +20777,7 @@ namespace CalamityMod.NPCs int num; for (int num68 = 0; num68 < 50; num68 = num + 1) { - if (npc.type == 29 || npc.type == 45) + if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { int num69 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); Dust dust = Main.dust[num69]; @@ -20787,42 +20787,42 @@ namespace CalamityMod.NPCs Main.dust[num69].noGravity = true; } } - else if (npc.type == 32) + else if (npc.type == NPCID.DarkCaster) { int num70 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num70]; dust.velocity *= 3f; Main.dust[num70].noGravity = true; } - else if (npc.type == 283 || npc.type == 284) + else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { int num71 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[num71]; dust.velocity *= 2f; Main.dust[num71].scale = 1.4f; } - else if (npc.type == 285 || npc.type == 286) + else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { int num72 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num72]; dust.velocity *= 3f; Main.dust[num72].noGravity = true; } - else if (npc.type == 281 || npc.type == 282) + else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { int num73 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num73]; dust.velocity *= 3f; Main.dust[num73].noGravity = true; } - else if (npc.type == 172) + else if (npc.type == NPCID.RuneWizard) { int num74 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num74]; dust.velocity *= 3f; Main.dust[num74].noGravity = true; } - else if (npc.type == 533) + else if (npc.type == NPCID.DesertDjinn) { int num75 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num75]; @@ -20847,7 +20847,7 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Item8, npc.position); for (int num77 = 0; num77 < 50; num77 = num + 1) { - if (npc.type == 29 || npc.type == 45) + if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { int num78 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); Dust dust = Main.dust[num78]; @@ -20857,42 +20857,42 @@ namespace CalamityMod.NPCs Main.dust[num78].noGravity = true; } } - else if (npc.type == 32) + else if (npc.type == NPCID.DarkCaster) { int num79 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num79]; dust.velocity *= 3f; Main.dust[num79].noGravity = true; } - else if (npc.type == 172) + else if (npc.type == NPCID.RuneWizard) { int num80 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num80]; dust.velocity *= 3f; Main.dust[num80].noGravity = true; } - else if (npc.type == 283 || npc.type == 284) + else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { int num81 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[num81]; dust.velocity *= 2f; Main.dust[num81].scale = 1.4f; } - else if (npc.type == 285 || npc.type == 286) + else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { int num82 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num82]; dust.velocity *= 3f; Main.dust[num82].noGravity = true; } - else if (npc.type == 281 || npc.type == 282) + else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { int num83 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num83]; dust.velocity *= 3f; Main.dust[num83].noGravity = true; } - else if (npc.type == 533) + else if (npc.type == NPCID.DesertDjinn) { int num84 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num84]; @@ -20910,7 +20910,7 @@ namespace CalamityMod.NPCs } } npc.ai[0] += 2f; - if (npc.type == 283 || npc.type == 284) + if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { if (npc.ai[0] % 50f == 0f && npc.ai[0] <= 250f) { @@ -20922,7 +20922,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 700f; } } - else if (npc.type == 172) + else if (npc.type == NPCID.RuneWizard) { if (npc.ai[0] == 80f || npc.ai[0] == 150f || npc.ai[0] == 230f || npc.ai[0] == 300f || npc.ai[0] == 380f || npc.ai[0] == 450f) { @@ -20930,7 +20930,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } - else if (npc.type == 533) + else if (npc.type == NPCID.DesertDjinn) { if (npc.ai[0] == 180f) { @@ -20938,7 +20938,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } - else if (npc.type == 281 || npc.type == 282) + else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { if (npc.ai[0] == 20f || npc.ai[0] == 40f || npc.ai[0] == 60f || npc.ai[0] == 120f || npc.ai[0] == 140f || npc.ai[0] == 160f || npc.ai[0] == 220f || npc.ai[0] == 240f || npc.ai[0] == 260f) { @@ -20955,11 +20955,11 @@ namespace CalamityMod.NPCs npc.ai[1] = 30f; npc.netUpdate = true; } - if ((npc.type == 285 || npc.type == 286) && npc.ai[0] > 400f) + if ((npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) && npc.ai[0] > 400f) { npc.ai[0] = 650f; } - if (npc.type == 533 && npc.ai[0] >= 360f) + if (npc.type == NPCID.DesertDjinn && npc.ai[0] >= 360f) { npc.ai[0] = 650f; } @@ -20989,7 +20989,7 @@ namespace CalamityMod.NPCs if ((num94 < num87 - 4 || num94 > num87 + 4 || num92 < num86 - 4 || num92 > num86 + 4) && (num94 < num89 - 1 || num94 > num89 + 1 || num92 < num88 - 1 || num92 > num88 + 1) && Main.tile[num92, num94].nactive()) { bool flag5 = true; - if ((npc.type == 32 || (npc.type >= 281 && npc.type <= 286)) && !Main.wallDungeon[(int)Main.tile[num92, num94 - 1].wall]) + if ((npc.type == NPCID.DarkCaster || (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[num92, num94 - 1].wall]) { flag5 = false; } @@ -21014,7 +21014,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] > 0f) { npc.ai[1] -= 1f; - if (npc.type == 533) + if (npc.type == NPCID.DesertDjinn) { if (npc.ai[1] % 30f == 0f && npc.ai[1] / 30f < 5f) { @@ -21066,16 +21066,16 @@ namespace CalamityMod.NPCs } else if (npc.ai[1] == 25f) { - if (npc.type >= 281 && npc.type <= 286) + if (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite) { if (Main.netMode != 1) { float num102 = 6f; - if (npc.type == 285 || npc.type == 286) + if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { num102 = 8f; } - if (npc.type == 281 || npc.type == 282) + if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { num102 = 4f; } @@ -21088,12 +21088,12 @@ namespace CalamityMod.NPCs num104 *= num105; int num106 = 16; int num107 = 290; - if (npc.type == 285 || npc.type == 286) + if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { num107 = 291; num106 = 32; } - if (npc.type == 281 || npc.type == 282) + if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { num107 = 293; num106 = 32; @@ -21111,21 +21111,21 @@ namespace CalamityMod.NPCs } else { - if (npc.type != 172) + if (npc.type != NPCID.RuneWizard) { Main.PlaySound(SoundID.Item8, npc.position); } if (Main.netMode != 1) { - if (npc.type == 29 || npc.type == 45) + if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { - NPC.NewNPC((int)npc.position.X + npc.width / 2, (int)npc.position.Y - 8, 30, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.position.X + npc.width / 2, (int)npc.position.Y - 8, NPCID.ChaosBall, 0, 0f, 0f, 0f, 0f, 255); } - else if (npc.type == 32) + else if (npc.type == NPCID.DarkCaster) { - NPC.NewNPC((int)npc.position.X + npc.width / 2, (int)npc.position.Y - 8, 33, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.position.X + npc.width / 2, (int)npc.position.Y - 8, NPCID.WaterSphere, 0, 0f, 0f, 0f, 0f, 255); } - else if (npc.type == 172) + else if (npc.type == NPCID.RuneWizard) { float num109 = 10f; Vector2 vector14 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -21136,7 +21136,7 @@ namespace CalamityMod.NPCs num110 *= num112; num111 *= num112; int num113 = 40; - int num114 = 129; + int num114 = ProjectileID.RuneBlast; int num115 = Projectile.NewProjectile(vector14.X, vector14.Y, num110, num111, num114, num113, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num115].timeLeft = 300; npc.localAI[0] = 0f; @@ -21149,15 +21149,15 @@ namespace CalamityMod.NPCs } } } - if (npc.type == 29 || npc.type == 45) + if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { if (Main.rand.Next(5) == 0) { int num116 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 27, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1.5f); - Main.dust[num116].noGravity = true; - Dust var_9_43F8_cp_0_cp_0 = Main.dust[num116]; - var_9_43F8_cp_0_cp_0.velocity.X = var_9_43F8_cp_0_cp_0.velocity.X * 0.5f; - Main.dust[num116].velocity.Y = -2f; + Dust dust = Main.dust[num116]; + dust.noGravity = true; + dust.velocity.X *= 0.5f; + dust.velocity.Y = -2f; } } else if (npc.type == 32) @@ -21165,18 +21165,16 @@ namespace CalamityMod.NPCs if (Main.rand.Next(3) != 0) { int num117 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 172, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 0.9f); - Main.dust[num117].noGravity = true; - Dust var_9_44C7_cp_0_cp_0 = Main.dust[num117]; - var_9_44C7_cp_0_cp_0.velocity.X = var_9_44C7_cp_0_cp_0.velocity.X * 0.3f; - Dust var_9_44E7_cp_0_cp_0 = Main.dust[num117]; - var_9_44E7_cp_0_cp_0.velocity.Y = var_9_44E7_cp_0_cp_0.velocity.Y * 0.2f; - Dust var_9_4507_cp_0_cp_0 = Main.dust[num117]; - var_9_4507_cp_0_cp_0.velocity.Y = var_9_4507_cp_0_cp_0.velocity.Y - 1f; + Dust dust = Main.dust[num117]; + dust.noGravity = true; + dust.velocity.X *= 0.3f; + dust.velocity.Y *= 0.2f; + dust.velocity.Y -= 1f; } } else { - if (npc.type == 172) + if (npc.type == NPCID.RuneWizard) { int num118 = 1; if (npc.alpha == 255) @@ -21189,68 +21187,63 @@ namespace CalamityMod.NPCs if (Main.rand.Next(255) > 255 - npc.alpha) { int num120 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 106, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1.2f); - Main.dust[num120].noGravity = true; - Dust var_9_45EA_cp_0_cp_0 = Main.dust[num120]; - var_9_45EA_cp_0_cp_0.velocity.X = var_9_45EA_cp_0_cp_0.velocity.X * (0.1f + (float)Main.rand.Next(30) * 0.01f); - Dust var_9_461E_cp_0_cp_0 = Main.dust[num120]; - var_9_461E_cp_0_cp_0.velocity.Y = var_9_461E_cp_0_cp_0.velocity.Y * (0.1f + (float)Main.rand.Next(30) * 0.01f); Dust dust = Main.dust[num120]; + dust.noGravity = true; + dust.velocity.X *= (0.1f + (float)Main.rand.Next(30) * 0.01f); + dust.velocity.Y *= (0.1f + (float)Main.rand.Next(30) * 0.01f); dust.scale *= 1f + (float)Main.rand.Next(6) * 0.1f; } num = num119; } return false; } - if (npc.type == 283 || npc.type == 284) + if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { int num121 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); - Dust var_9_4715_cp_0_cp_0 = Main.dust[num121]; - var_9_4715_cp_0_cp_0.velocity.X = var_9_4715_cp_0_cp_0.velocity.X * 0.5f; - Dust var_9_4735_cp_0_cp_0 = Main.dust[num121]; - var_9_4735_cp_0_cp_0.velocity.Y = var_9_4735_cp_0_cp_0.velocity.Y * 0.5f; + Dust dust = Main.dust[num121]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.5f; } } - else if (npc.type == 285 || npc.type == 286) + else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { int num122 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 174, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1f); - Main.dust[num122].noGravity = true; Dust dust = Main.dust[num122]; + dust.noGravity = true; dust.velocity *= 0.4f; - Dust var_9_481F_cp_0_cp_0 = Main.dust[num122]; - var_9_481F_cp_0_cp_0.velocity.Y = var_9_481F_cp_0_cp_0.velocity.Y - 0.7f; + dust.velocity.Y -= 0.7f; return false; } } - else if (npc.type == 281 || npc.type == 282) + else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { int num123 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 175, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 0.1f); - Main.dust[num123].noGravity = true; Dust dust = Main.dust[num123]; + dust.noGravity = true; dust.velocity *= 0.5f; - Main.dust[num123].fadeIn = 1.2f; + dust.fadeIn = 1.2f; } } else { - if (npc.type == 533) + if (npc.type == NPCID.DesertDjinn) { Lighting.AddLight(npc.Top, 0.6f, 0.6f, 0.3f); return false; } - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { int num124 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); - Main.dust[num124].noGravity = true; - Dust var_9_49CA_cp_0_cp_0 = Main.dust[num124]; - var_9_49CA_cp_0_cp_0.velocity.X = var_9_49CA_cp_0_cp_0.velocity.X * 1f; - Dust var_9_49EA_cp_0_cp_0 = Main.dust[num124]; - var_9_49EA_cp_0_cp_0.velocity.Y = var_9_49EA_cp_0_cp_0.velocity.Y * 1f; + Dust dust = Main.dust[num124]; + dust.noGravity = true; + dust.velocity.X *= 1f; + dust.velocity.Y *= 1f; } } } @@ -23251,7 +23244,7 @@ namespace CalamityMod.NPCs { num2 = 3; bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) { @@ -23320,7 +23313,7 @@ namespace CalamityMod.NPCs bool flag5 = npc.ai[1] >= 120f; if (!flag5 && npc.velocity.Y == 0f) { - for (int j = 0; j < 255; j++) + for (int j = 0; j < Main.maxPlayers; j++) { if (Main.player[j].active && !Main.player[j].dead && Main.player[j].Distance(npc.Center) < 800f && Main.player[j].Center.Y < npc.Center.Y && Math.Abs(Main.player[j].Center.X - npc.Center.X) < 20f) { @@ -24182,10 +24175,10 @@ namespace CalamityMod.NPCs if (Main.rand.Next(3) < 2) { int num555 = Dust.NewDust(npc.Center - new Vector2(30f), 60, 60, 6, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[num555].noGravity = true; Dust dust = Main.dust[num555]; + dust.noGravity = true; dust.velocity *= 0.2f; - Main.dust[num555].fadeIn = 1f; + dust.fadeIn = 1f; } npc.ai[1] += 1f; @@ -24197,13 +24190,12 @@ namespace CalamityMod.NPCs for (int num556 = 0; num556 < 32; num556++) { int num557 = Dust.NewDust(vector68, 100, 100, 6, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[num557].noGravity = true; Dust dust = Main.dust[num557]; + dust.noGravity = true; dust.velocity *= 3f; num557 = Dust.NewDust(vector68, 100, 100, 6, 0f, 0f, 100, default(Color), 1.5f); - dust = Main.dust[num557]; dust.velocity *= 2f; - Main.dust[num557].noGravity = true; + dust.noGravity = true; } for (int num558 = 0; num558 < 4; num558++) @@ -24211,17 +24203,15 @@ namespace CalamityMod.NPCs int num559 = Gore.NewGore(vector68 + new Vector2((float)(50 * Main.rand.Next(100)) / 100f, (float)(50 * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[num559]; gore.velocity *= 0.3f; - Gore var_9_1E2CE_cp_0_cp_0 = Main.gore[num559]; - var_9_1E2CE_cp_0_cp_0.velocity.X = var_9_1E2CE_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; - Gore var_9_1E302_cp_0_cp_0 = Main.gore[num559]; - var_9_1E302_cp_0_cp_0.velocity.Y = var_9_1E302_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; + gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } } for (int num560 = 0; num560 < 5; num560++) { int num561 = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num561].velocity = Main.dust[num561].velocity * Main.rand.NextFloat(); + Main.dust[num561].velocity *= Main.rand.NextFloat(); } npc.ai[3] += 1f; @@ -24536,27 +24526,27 @@ namespace CalamityMod.NPCs } if (!flag36) { - if (npc.type == 237) + if (npc.type == NPCID.JungleCreeperWall) { - npc.Transform(236); + npc.Transform(NPCID.JungleCreeper); return false; } - if (npc.type == 238) + if (npc.type == NPCID.BlackRecluseWall) { - npc.Transform(163); + npc.Transform(NPCID.BlackRecluse); return false; } - if (npc.type == 240) + if (npc.type == NPCID.BloodCrawlerWall) { - npc.Transform(239); + npc.Transform(NPCID.BloodCrawler); return false; } - if (npc.type == 531) + if (npc.type == NPCID.DesertScorpionWall) { - npc.Transform(530); + npc.Transform(NPCID.DesertScorpionWalk); return false; } - npc.Transform(164); + npc.Transform(NPCID.WallCreeper); } } return false; @@ -24836,7 +24826,7 @@ namespace CalamityMod.NPCs num639 = Main.player[npc.target].Center.Y - (float)(npc.height / 2); npc.rotation = npc.velocity.X * 0.1f; int num; - for (int num640 = 0; num640 < 200; num640 = num + 1) + for (int num640 = 0; num640 < Main.maxNPCs; num640 = num + 1) { if (num640 != npc.whoAmI && Main.npc[num640].active && Main.npc[num640].type == npc.type && Math.Abs(npc.position.X - Main.npc[num640].position.X) + Math.Abs(npc.position.Y - Main.npc[num640].position.Y) < (float)npc.width) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e3c4a3b61b..8613bd9e5d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3905,7 +3905,11 @@ namespace CalamityMod.NPCs if (!(CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 2)) { - List<(int, int)> PossibleEnemies = CalamityWorld.downedAquaticScourge ? AcidRainEvent.PossibleEnemiesAS : AcidRainEvent.PossibleEnemiesPreHM; + List<(int, int)> PossibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; + if (CalamityWorld.downedAquaticScourge) + PossibleEnemies = AcidRainEvent.PossibleEnemiesAS; + if (CalamityWorld.downedPolterghast) + PossibleEnemies = AcidRainEvent.PossibleEnemiesPolter; foreach (int enemy in PossibleEnemies.Select(enemyType => enemyType.Item1)) { pool.Add(enemy, 1f); @@ -4822,7 +4826,7 @@ namespace CalamityMod.NPCs case NPCID.Steampunker: bool hasPortalGun = false; - for (int k = 0; k < 255; k++) + for (int k = 0; k < Main.maxPlayers; k++) { Player player = Main.player[k]; if (player.active && player.HasItem(ItemID.PortalGun)) @@ -4868,7 +4872,7 @@ namespace CalamityMod.NPCs case NPCID.TaxCollector: int platinumCoins = 0; - for (int k = 0; k < 255; k++) + for (int k = 0; k < Main.maxPlayers; k++) { Player player = Main.player[k]; if (player.active) @@ -5073,7 +5077,7 @@ namespace CalamityMod.NPCs #region Any Boss NPCs public static bool AnyBossNPCS() { - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && Main.npc[i].type != NPCID.MartianSaucerCore && (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == ModContent.NPCType() || @@ -5089,7 +5093,7 @@ namespace CalamityMod.NPCs #region Any Living Players public static bool AnyLivingPlayers() { - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index a6e94f1f33..21afa5576f 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1595,7 +1595,11 @@ namespace CalamityMod.NPCs #region Acid Rain private void AcidRainProgression(NPC npc) { - List<(int, int)> PossibleEnemies = CalamityWorld.downedAquaticScourge ? AcidRainEvent.PossibleEnemiesAS : AcidRainEvent.PossibleEnemiesPreHM; + List<(int, int)> PossibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; + if (CalamityWorld.downedAquaticScourge) + PossibleEnemies = AcidRainEvent.PossibleEnemiesAS; + if (CalamityWorld.downedPolterghast) + PossibleEnemies = AcidRainEvent.PossibleEnemiesPolter; if (PossibleEnemies.Select(enemy => enemy.Item1).Contains(npc.type) && CalamityWorld.rainingAcid) { CalamityWorld.acidRainPoints -= PossibleEnemies.Find(enemy => enemy.Item1 == npc.type).Item2; @@ -1608,6 +1612,7 @@ namespace CalamityMod.NPCs npc.type == ModContent.NPCType() && CalamityWorld.acidRainPoints <= 2f) { + CalamityWorld.triedToSummonOldDuke = false; CalamityWorld.acidRainPoints = 0; } AcidRainEvent.UpdateInvasion(); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 823c0558b8..f54ad7ff2e 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -45,8 +45,6 @@ namespace CalamityMod.NPCs.OldDuke CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.6f; global.customDR = true; - //global.multDRReductions.Add(BuffID.Ichor, 0.88f); - //global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); npc.lifeMax = CalamityWorld.revenge ? 1000000 : 750000; npc.knockBackResist = 0f; npc.noTileCollide = true; @@ -68,16 +66,6 @@ namespace CalamityMod.NPCs.OldDuke { npc.buffImmune[k] = true; } - /*npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false;*/ } public override void SendExtraAI(BinaryWriter writer) @@ -387,7 +375,7 @@ namespace CalamityMod.NPCs.OldDuke DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBoomerDuke); - DropHelper.DropResidentEvilAmmo(npc, !CalamityWorld.downedBoomerDuke, 6, 3, 2); + DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBoomerDuke, 6, 3, 2); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -396,7 +384,6 @@ namespace CalamityMod.NPCs.OldDuke DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 1832df7399..b198568b15 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.TownNPCs if (CalamityWorld.downedDoG) { - dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse… but I would not lower my guard if I were you."); + dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse... but I would not lower my guard if I were you."); } /*if (CalamityWorld.downedYharon) diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index c7736c876f..f3772d6502 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -151,35 +151,7 @@ namespace CalamityMod.Projectiles.Boss num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 3614a6bcb4..981e2a4bf9 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -80,35 +80,7 @@ namespace CalamityMod.Projectiles.Boss num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); projectile.damage = Main.expertMode ? 75 : 90; projectile.Damage(); } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index f0c415b89b..1ca8c24acd 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -95,35 +95,7 @@ namespace CalamityMod.Projectiles.Boss num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 2711e32c98..48e0f5f16d 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -113,35 +113,7 @@ namespace CalamityMod.Projectiles.Boss num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index c5ff4a0b6b..f6f350c300 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -127,7 +127,6 @@ namespace CalamityMod.Projectiles.Boss } if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar").SoundId, (int)projectile.Top.X, (int)projectile.Top.Y, volumeScale: 1.45f); int boomer = NPC.NewNPC((int)projectile.Top.X, (int)projectile.Top.Y + 100, ModContent.NPCType()); string boomerName = Main.npc[boomer].TypeName; @@ -149,11 +148,14 @@ namespace CalamityMod.Projectiles.Boss Main.npc[boomer].alpha = 255; Main.npc[boomer].Calamity().newAI[3] = 1f; // To signal that Old Duke should not deccelerate as it normally would Main.npc[boomer].netUpdate = true; + CalamityWorld.triedToSummonOldDuke = true; + AcidRainEvent.UpdateInvasion(false); } } else { CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; AcidRainEvent.UpdateInvasion(false); } } diff --git a/Projectiles/Boss/RedLightningFeather.png b/Projectiles/Boss/RedLightningFeather.png index 5171b52bd0..c640f42cc8 100644 Binary files a/Projectiles/Boss/RedLightningFeather.png and b/Projectiles/Boss/RedLightningFeather.png differ diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 3473fc21c0..102b2ec433 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -119,42 +119,7 @@ namespace CalamityMod.Projectiles.Boss num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index b610fc7611..bed8a96238 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.ai[1] > 0f) { int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) + if (num625 < Main.maxPlayers) { Vector2 value16 = Main.player[num625].Center - projectile.Center; if (value16.Length() < 200f || counter > 0) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 5d0426e7fa..66b406308b 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -492,13 +492,13 @@ namespace CalamityMod.Projectiles { if (setDamageValues) { - spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + spawnedPlayerMinionDamageValue = player.MinionDamage(); spawnedPlayerMinionProjectileDamageValue = projectile.damage; setDamageValues = false; } - if ((player.allDamage + player.minionDamage - 1f) != spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * (player.allDamage + player.minionDamage - 1f)); + int damage2 = (int)((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } } @@ -598,6 +598,14 @@ namespace CalamityMod.Projectiles } } } + else if (projectile.type == ProjectileID.RainbowBack) + { + if (player.inventory[player.selectedItem].type == ItemID.PearlwoodBow) + { + projectile.magic = false; + projectile.ranged = true; + } + } else if (projectile.type == ProjectileID.SoulDrain) projectile.magic = true; @@ -1094,7 +1102,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; float num13 = 0f; int num14 = projectile.owner; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) { @@ -1128,7 +1136,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; float num13 = 0f; int num14 = projectile.owner; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) { @@ -1226,10 +1234,10 @@ namespace CalamityMod.Projectiles { int num = projectile.damage / 2; modPlayer.ataxiaDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1290,7 +1298,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; float num13 = 0f; int num14 = projectile.owner; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) { @@ -1309,10 +1317,10 @@ namespace CalamityMod.Projectiles { int num = projectile.damage / 2; modPlayer.godSlayerDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1374,7 +1382,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; float num13 = 0f; int num14 = projectile.owner; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) { @@ -1410,10 +1418,10 @@ namespace CalamityMod.Projectiles { int num = projectile.damage / 2; modPlayer.xerocDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1459,10 +1467,10 @@ namespace CalamityMod.Projectiles { int num = projectile.damage / 2; modPlayer.xerocDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1523,7 +1531,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; float num13 = 0f; int num14 = projectile.owner; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) { @@ -1560,10 +1568,10 @@ namespace CalamityMod.Projectiles { int num = projectile.damage / 2; modPlayer.xerocDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1680,10 +1688,10 @@ namespace CalamityMod.Projectiles { int num = projectile.damage / 2; modPlayer.jellyDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1740,10 +1748,10 @@ namespace CalamityMod.Projectiles int num = projectile.damage / 2; float ai1 = Main.rand.NextFloat() + 0.5f; modPlayer.godSlayerDmg += (float)num; - int[] array = new int[200]; + int[] array = new int[Main.maxNPCs]; int num3 = 0; int num4 = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -1790,11 +1798,6 @@ namespace CalamityMod.Projectiles { int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), 3f, projectile.owner); - if (modPlayer.starTaintedGenerator) - { - Main.projectile[boom].localNPCHitCooldown = 15; - Main.projectile[boom].penetrate = 3; - } } } diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 15adca9009..9cad47333e 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -76,35 +76,7 @@ namespace CalamityMod.Projectiles.Enemy num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 5e5c5b46ad..ee4b128017 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -55,35 +55,7 @@ namespace CalamityMod.Projectiles.Enemy num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs new file mode 100644 index 0000000000..607a89dbdf --- /dev/null +++ b/Projectiles/Enemy/GammaAcid.cs @@ -0,0 +1,68 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class GammaAcid : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 50; + projectile.hostile = true; + projectile.timeLeft = 480; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + public override void AI() + { + if (projectile.ai[0]++ <= 30f) + { + projectile.alpha = (int)MathHelper.Lerp(255f, 127f, projectile.ai[0] / 30f); + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 80; + projectile.position -= projectile.Size / 2f; + projectile.Damage(); + for (int i = 0; i <= 40; i++) + { + int idx = Dust.NewDust(projectile.position, 100, 100, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - projectile.Center).Length() / 30f; + Main.dust[idx].scale = 2.5f; + } + for (int i = 0; i <= 90; i++) + { + int idx = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid); + Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f; + Main.dust[idx].scale = 3f; + Main.dust[idx].noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Enemy/GammaAcid.png b/Projectiles/Enemy/GammaAcid.png new file mode 100644 index 0000000000..80d124f58d Binary files /dev/null and b/Projectiles/Enemy/GammaAcid.png differ diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs new file mode 100644 index 0000000000..bf07125159 --- /dev/null +++ b/Projectiles/Enemy/GammaBeam.cs @@ -0,0 +1,217 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class GammaBeam : ModProjectile + { + // How long this laser can exist before it is deleted. + public const int TrueTimeLeft = 180; + + // Pretty self explanatory + private const float maximumLength = 1200f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gamma Ray"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = TrueTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + // Netcode for sending and receiving shit + // localAI[0] is the timer, localAI[1] is the laser length + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + NPC body = Main.npc[(int)projectile.ai[1]]; + if (!body.active) + projectile.Kill(); + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + + if (Main.npc[(int)projectile.ai[1]].active) + { + projectile.Center = Main.npc[(int)projectile.ai[1]].Top + new Vector2(0f, 6f); + } + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + + // How fat the laser is + float laserSize = 1f; + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= TrueTimeLeft) + { + projectile.Kill(); + return; + } + + // Causes the effect where the laser appears to expand/contract at the beginning and end of its life + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 10f * laserSize; + if (projectile.scale > laserSize) + { + projectile.scale = laserSize; + } + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + + Vector2 samplingPoint = projectile.Center; + + float[] samples = new float[3]; + + float determinedLength = 0f; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + for (int i = 0; i < samples.Length; i++) + { + determinedLength += samples[i]; + } + determinedLength /= samples.Length; + + determinedLength = MathHelper.Clamp(determinedLength, maximumLength * 0.5f, maximumLength); + + float lerpDelta = 0.5f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); + + if (WorldGen.SolidTile((int)(beamEndPosiiton.X / 16), (int)(beamEndPosiiton.Y / 16))) + { + for (int i = 0; i < 4; i++) + { + float theta = projectile.velocity.ToRotation() + Main.rand.NextBool(2).ToDirectionInt() * MathHelper.PiOver2; + float speed = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 velocity = theta.ToRotationVector2() * speed; + Dust dust = Dust.NewDustDirect(beamEndPosiiton, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, velocity.X, velocity.Y, 0, default, 1f); + dust.noGravity = true; + dust.scale = 2.1f; + } + + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(55f)).RotatedBy(projectile.rotation); + dust.noGravity = true; + dust.scale = 1.8f; + } + for (int i = 0; i < 16; i++) + { + Dust dust = Dust.NewDustPerfect(beamEndPosiiton, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = (i / 16f * MathHelper.TwoPi).ToRotationVector2() * 3f; + dust.noGravity = true; + dust.scale = 2.4f; + } + } + // Draw acid green light across the laser + DelegateMethods.v3_1 = new Vector3(0.62f, 0.94f, 0.38f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 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 laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/GammaBeamBegin"); + Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/GammaBeamMid"); + Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/GammaBeamEnd"); + float laserLength = projectile.localAI[1]; + Color drawColor = new Color(1f, 1f, 1f) * 0.9f; + + // Laser tail logic + + Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + // Laser body logic + + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; + Vector2 centerDelta = projectile.Center; + centerDelta += projectile.velocity * projectile.scale * (float)laserTailTexture.Height / 2f; + if (laserLength > 0f) + { + float laserLengthDelta = 0f; + Rectangle sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), laserBodyTexture.Width, 16); + while (laserLengthDelta + 1f < laserLength) + { + if (laserLength - laserLengthDelta < sourceRectangle.Height) + { + sourceRectangle.Height = (int)(laserLength - laserLengthDelta); + } + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * projectile.scale; + centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + sourceRectangle.Y += 16; + if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) + { + sourceRectangle.Y = 0; + } + } + } + + // Laser head logic + + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.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 * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float value = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + { + return true; + } + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + } + } +} diff --git a/Projectiles/Enemy/GammaBeam.png b/Projectiles/Enemy/GammaBeam.png new file mode 100644 index 0000000000..1e24eea3ca Binary files /dev/null and b/Projectiles/Enemy/GammaBeam.png differ diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 2f7234f604..2322acee60 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -85,11 +85,10 @@ namespace CalamityMod.Projectiles.Magic for (int num339 = 0; num339 < 2; num339++) { int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Main.gore[num340].velocity *= 0.3f; - Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; - Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; + Gore gore = Main.gore[num340]; + gore.velocity *= 0.3f; + gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; + gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index bf605f128b..b08eb0328b 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -85,11 +85,10 @@ namespace CalamityMod.Projectiles.Magic for (int num339 = 0; num339 < 2; num339++) { int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Main.gore[num340].velocity *= 0.3f; - Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; - Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; + Gore gore = Main.gore[num340]; + gore.velocity *= 0.3f; + gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; + gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; } if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index 18cde801de..f650737925 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 600; projectile.penetrate = 10; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; + projectile.localNPCHitCooldown = 15; projectile.magic = true; } diff --git a/Projectiles/Melee/DragonRageProj.cs b/Projectiles/Melee/DragonRageProj.cs index 30d9d1412c..7b7f2b4d73 100644 --- a/Projectiles/Melee/DragonRageProj.cs +++ b/Projectiles/Melee/DragonRageProj.cs @@ -88,42 +88,7 @@ namespace CalamityMod.Projectiles.Melee num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 2; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index abcd52d0a5..2976363774 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -110,42 +110,7 @@ namespace CalamityMod.Projectiles.Melee num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index ea67a3b486..96142e5aa2 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -130,35 +130,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num21].velocity *= 2; } } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 35290aa93e..139cda7b39 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -18,21 +18,29 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 20; + projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 3; + projectile.penetrate = 8; projectile.alpha = 255; projectile.melee = true; - projectile.aiStyle = 93; - aiType = 514; - projectile.extraUpdates = 1; + //projectile.aiStyle = 93; + //aiType = 514; + projectile.extraUpdates = 2; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 20 * projectile.extraUpdates; + projectile.tileCollide = true; } public override void AI() { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + projectile.alpha = 0; + int num297 = 171; if (Main.rand.Next(3) == 0) { @@ -42,8 +50,30 @@ namespace CalamityMod.Projectiles.Melee { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, num297, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (MathHelper.Pi / 4) + (projectile.spriteDirection == 1 ? 0f : (MathHelper.Pi / 2)); + if (projectile.ai[0] == 0f) + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); + if (projectile.ai[0] == 2f) + { + projectile.velocity *= 0f; + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 20, true); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[0] = 2f; + projectile.timeLeft = 300; + return false; } public override void Kill(int timeLeft) @@ -60,6 +90,7 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 50; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); for (int num621 = 0; num621 < 15; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, 0f, 0f, 100, default, 1.2f); diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index d2d503c163..eaa5abb38e 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee.Yoyos; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -17,14 +18,49 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.SoulDrain); - aiType = 476; - projectile.magic = false; projectile.melee = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.timeLeft = 300; } + public override void AI() + { + Projectile parent = Main.projectile[0]; + bool active = false; + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile p = Main.projectile[i]; + if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) + { + parent = p; + active = true; + } + } + + if (active) + { + projectile.Center = parent.Center; + projectile.timeLeft = 2; + } + else + { + projectile.Kill(); + } + + if (!parent.active) + { + projectile.Kill(); + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.png b/Projectiles/Melee/Spears/GildedProboscisProj.png index 9e150e8847..6a2ff34917 100644 Binary files a/Projectiles/Melee/Spears/GildedProboscisProj.png and b/Projectiles/Melee/Spears/GildedProboscisProj.png differ diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index df3f071316..f817f70b8d 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override Action EffectBeforeReelback => (proj) => { Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 3.5f, projectile.velocity.Y * 3.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + projectile.velocity.X * 3.5f, projectile.velocity.Y * 3.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); }; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 30d988e892..9d885753b9 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { private const float Radius = 100f; private SoundEffectInstance mmmmmm = null; + private bool spawnedAura = false; public override void SetStaticDefaults() { @@ -54,9 +55,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center); // Spawn invisible but damaging aura projectile - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer && !spawnedAura) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, projectile.identity, 0f); + spawnedAura = true; } // Dust circle appears for all players, even though the aura projectile is only spawned by the owner diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 345a42853f..f09210617c 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -138,42 +138,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 2; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index 8753bee568..d969e30998 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -85,35 +85,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 9; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 9); } } } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index a13744c7ea..ea208d6e08 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -79,35 +79,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 30, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 10; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 04a8a55fb6..9327f43d30 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -73,35 +73,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); float x = projectile.position.X + (float)Main.rand.Next(-400, 400); float y = projectile.position.Y - (float)Main.rand.Next(500, 800); Vector2 vector = new Vector2(x, y); diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index a89296a262..4bc571ed3d 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -155,35 +155,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/HandheldTankShell.cs b/Projectiles/Ranged/HandheldTankShell.cs index 9181d81ba5..0f266c680b 100644 --- a/Projectiles/Ranged/HandheldTankShell.cs +++ b/Projectiles/Ranged/HandheldTankShell.cs @@ -127,38 +127,7 @@ namespace CalamityMod.Projectiles.Ranged } // Smoke, which counts as a Gore - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); - for (int i = 0; i < 3; i++) - { - float smokeScale = 0.33f; - if (i == 1) - { - smokeScale = 0.66f; - } - if (i == 2) - { - smokeScale = 1f; - } - int idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y += 1f; - - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y += 1f; - - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y -= 1f; - - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 7e85e42d49..723dbb9681 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -155,35 +155,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 3238e57621..280144d831 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -155,35 +155,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Ranged/MagnomalyAura.cs b/Projectiles/Ranged/MagnomalyAura.cs index d1d36497f1..ec45ddee96 100644 --- a/Projectiles/Ranged/MagnomalyAura.cs +++ b/Projectiles/Ranged/MagnomalyAura.cs @@ -16,14 +16,48 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.SoulDrain); - aiType = 476; - projectile.magic = false; projectile.ranged = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.timeLeft = 300; } + public override void AI() + { + Projectile parent = Main.projectile[0]; + bool active = false; + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile p = Main.projectile[i]; + if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType()) + { + parent = p; + active = true; + } + } + + if (active) + { + projectile.Center = parent.Center; + } + else + { + projectile.Kill(); + } + + if (!parent.active) + { + projectile.Kill(); + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); diff --git a/Projectiles/Ranged/MagnomalyBeam.cs b/Projectiles/Ranged/MagnomalyBeam.cs index 1b9e4a27b7..7c742eba48 100644 --- a/Projectiles/Ranged/MagnomalyBeam.cs +++ b/Projectiles/Ranged/MagnomalyBeam.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged { projectile.alpha = 0; } - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); float num55 = 100f; float num56 = 2f; //3 if (projectile.ai[1] == 0f) diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index bd743770ff..c0a8b0b0e2 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -31,6 +31,9 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + //Lighting + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.25f / 255f, Main.DiscoG * 0.25f / 255f, Main.DiscoB * 0.25f / 255f); + //Animation projectile.frameCounter++; if (projectile.frameCounter > 7) @@ -52,107 +55,71 @@ namespace CalamityMod.Projectiles.Ranged { num297 = 269; } - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer && projectile.timeLeft == 300) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), (int)((double)projectile.knockBack * 0.5f), projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), (int)((double)projectile.knockBack * 0.5f), projectile.owner, projectile.identity, 0f); + } + float num247 = projectile.velocity.X * 0.5f; + float num248 = projectile.velocity.Y * 0.5f; + if (Main.rand.NextBool(2)) + { + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num297, 0f, 0f, 100, default, 0.5f); + Main.dust[num249].scale *= (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + Main.dust[num249].noLight = true; + } + else + { + int dust2 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num297, 0f, 0f, 100, default, 0.25f); + Main.dust[dust2].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[dust2].velocity *= 0.05f; + Main.dust[dust2].noGravity = true; + Main.dust[dust2].noLight = true; } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 1000; - projectile.height = 1000; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 30f; - } - else - { - float num247 = projectile.velocity.X * 0.5f; - float num248 = projectile.velocity.Y * 0.5f; - if (Main.rand.NextBool(2)) - { - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num297, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - } - else - { - int dust2 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num297, 0f, 0f, 100, default, 0.25f); - Main.dust[dust2].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].velocity *= 0.05f; - Main.dust[dust2].noGravity = true; - } - } CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 16f, 20f); } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - //DO NOT REMOVE THIS PROJECTILE - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - - int num298 = Main.rand.NextBool(2) ? 107 : 234; - if (Main.rand.NextBool(4)) + if (projectile.owner == Main.myPlayer) { - num298 = 269; + projectile.position = projectile.Center; + projectile.width = projectile.height = 192; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + //DO NOT REMOVE THIS PROJECTILE + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + + int num298 = Main.rand.NextBool(2) ? 107 : 234; + if (Main.rand.NextBool(4)) + { + num298 = 269; + } + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + Main.dust[num622].noLight = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.5f); + Main.dust[num624].noGravity = true; + Main.dust[num624].noLight = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.75f); + Main.dust[num624].velocity *= 2f; + } + CalamityUtils.ExplosionGores(projectile, 10); } - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.75f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 10; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -163,15 +130,18 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - for (int i = 0; i < 4; i++) + if (projectile.owner == Main.myPlayer) { - double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); + float random = Main.rand.Next(30, 90); + float spread = random * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + for (int i = 0; i < 4; i++) + { + double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); + int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); + } } target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 44960fb596..9b45fe6716 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -93,35 +93,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Ranged/Minibirb.cs b/Projectiles/Ranged/Minibirb.cs index e8018455a0..d5f7f05a7b 100644 --- a/Projectiles/Ranged/Minibirb.cs +++ b/Projectiles/Ranged/Minibirb.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; + projectile.width = 24; projectile.height = 8; projectile.friendly = true; projectile.ranged = true; diff --git a/Projectiles/Ranged/Minibirb.png b/Projectiles/Ranged/Minibirb.png index 274cf8ce26..0cfd804a6c 100644 Binary files a/Projectiles/Ranged/Minibirb.png and b/Projectiles/Ranged/Minibirb.png differ diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index d6b6798f9f..e6e0fdffcc 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -105,35 +105,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); if (projectile.owner == Main.myPlayer) { int num814 = 5; diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index 4eb8674d5c..aa0306fab5 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -58,35 +58,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); if (projectile.owner == Main.myPlayer) { for (int num252 = 0; num252 < 3; num252++) diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 5e2501598c..7d4ceb49e0 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -119,35 +119,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 10; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 10); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index 0ffb7898b3..ae81fbb23e 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -105,35 +105,7 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); if (projectile.owner == Main.myPlayer) { int num814 = 5; diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index a7d56b4656..9fff537c57 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -21,23 +21,21 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.alpha = 255; projectile.ranged = true; - projectile.extraUpdates = 0; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 9; - projectile.timeLeft = 600; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8 * projectile.extraUpdates; + projectile.timeLeft = 900; } public override void AI() { - if (Main.rand.Next(5) == 0) + Player player = Main.player[projectile.owner]; + if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 171, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + Vector2 vector62 = player.Center - projectile.Center; + projectile.ai[1] += 1f; if (projectile.ai[1] > 5f) { projectile.alpha = 0; @@ -47,44 +45,44 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector63 = vector62 * -1f; vector63.Normalize(); vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; - vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); + vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2, default); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); } - if (Main.player[projectile.owner].dead) + if (player.dead) { projectile.Kill(); return; } if (projectile.alpha == 0) { - if (projectile.position.X + (float)(projectile.width / 2) > Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2)) + if (projectile.position.X + (float)(projectile.width / 2) > player.position.X + (float)(player.width / 2)) { - Main.player[projectile.owner].ChangeDir(1); + player.ChangeDir(1); } else { - Main.player[projectile.owner].ChangeDir(-1); + player.ChangeDir(-1); } } if (projectile.ai[0] == 0f) - { - projectile.extraUpdates = 0; - } - else { projectile.extraUpdates = 1; } + else + { + projectile.extraUpdates = 2; + } Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num166 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector14.X; - float num167 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector14.Y; - float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); + float xDist = player.position.X + (float)(player.width / 2) - vector14.X; + float yDist = player.position.Y + (float)(player.height / 2) - vector14.Y; + float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (projectile.ai[0] == 0f) { - if (num168 > 2000f) + if (playerDist > 2000f) { projectile.ai[0] = 1f; } - else if (num168 > 1000f) + else if (playerDist > 1500f) { projectile.ai[0] = 1f; } @@ -107,20 +105,26 @@ namespace CalamityMod.Projectiles.Ranged else if (projectile.ai[0] == 1f) { projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; - float num169 = 20f; - if (num168 < 50f) + projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - 1.57f; + float returnSpeed = 20f; + if (playerDist < 50f) { projectile.Kill(); } - num168 = num169 / num168; - num166 *= num168; - num167 *= num168; - projectile.velocity.X = num166; - projectile.velocity.Y = num167; + playerDist = returnSpeed / playerDist; + xDist *= playerDist; + yDist *= playerDist; + projectile.velocity.X = xDist; + projectile.velocity.Y = yDist; } } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[0] = 1f; + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index eca2c6479b..dfe929ff3e 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -152,35 +152,7 @@ namespace CalamityMod.Projectiles.Rogue num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/BettyExplosion.cs b/Projectiles/Rogue/BettyExplosion.cs index dc3b929959..896472bd27 100644 --- a/Projectiles/Rogue/BettyExplosion.cs +++ b/Projectiles/Rogue/BettyExplosion.cs @@ -57,38 +57,7 @@ namespace CalamityMod.Projectiles.Rogue } // Smoke, which counts as a Gore - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); - for (int i = 0; i < 3; i++) - { - float smokeScale = 0.33f; - if (i == 1) - { - smokeScale = 0.66f; - } - if (i == 2) - { - smokeScale = 1f; - } - int idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y += 1f; - - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y += 1f; - - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y -= 1f; - - idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index e4f669d686..17a62bab8e 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 9; target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/ContaminatedBileFlask.cs b/Projectiles/Rogue/ContaminatedBileFlask.cs index 4c01bfd82c..e436a24213 100644 --- a/Projectiles/Rogue/ContaminatedBileFlask.cs +++ b/Projectiles/Rogue/ContaminatedBileFlask.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item107, projectile.Bottom); - Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); explosion.Calamity().stealthStrike = projectile.Calamity().stealthStrike; explosion.timeLeft = explosion.Calamity().stealthStrike ? 60 : 20; } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 6dfa64e1a3..f6810bff89 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -46,31 +46,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); for (int num194 = 0; num194 < 25; num194++) { int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index b5e2ed4139..8b075bdbf1 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -167,39 +167,7 @@ namespace CalamityMod.Projectiles.Rogue num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 9; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 9); } } } diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 6161435a3f..2289c1ac84 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -26,8 +26,6 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = 1; projectile.timeLeft = 420; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; } @@ -104,35 +102,9 @@ namespace CalamityMod.Projectiles.Rogue num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; projectile.Damage(); } } diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 6f8f70497d..1a0de6a9c3 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -59,118 +59,13 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dust].noGravity = true; } } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 25ce54030a..389d0eb799 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -43,118 +43,13 @@ namespace CalamityMod.Projectiles.Rogue } } } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/LeviathanTooth2.cs b/Projectiles/Rogue/LeviathanTooth2.cs index b1ebd9a939..9e4106f8e3 100644 --- a/Projectiles/Rogue/LeviathanTooth2.cs +++ b/Projectiles/Rogue/LeviathanTooth2.cs @@ -43,118 +43,13 @@ namespace CalamityMod.Projectiles.Rogue } } } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/LeviathanTooth3.cs b/Projectiles/Rogue/LeviathanTooth3.cs index e3852843e7..55f4c67822 100644 --- a/Projectiles/Rogue/LeviathanTooth3.cs +++ b/Projectiles/Rogue/LeviathanTooth3.cs @@ -43,118 +43,13 @@ namespace CalamityMod.Projectiles.Rogue } } } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 2086610be3..91f6e9f84b 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -30,44 +30,9 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 157, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - if (projectile.localAI[1] == 1f) - { - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - else + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); + if (projectile.ai[0] != 1f) { try { @@ -111,10 +76,10 @@ namespace CalamityMod.Projectiles.Rogue } catch { } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f) { - projectile.ai[0] = 10f; + projectile.localAI[1] = 10f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { projectile.velocity.X = projectile.velocity.X * 0.97f; @@ -132,74 +97,7 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && (projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].townNPC) || (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1))) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.localAI[1] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.damage = 0; - projectile.StatusNPC(i); - int num28 = 20; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 20, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index 17a9ec5815..c57af6db44 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -109,35 +109,7 @@ namespace CalamityMod.Projectiles.Rogue num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index f62ae6ce8d..f34983bc94 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -47,31 +47,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); } - for (int num625 = 0; num625 < (projectile.Calamity().stealthStrike ? 6 : 3); num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, (projectile.Calamity().stealthStrike ? 6 : 3)); } } } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index dfb1422fc9..688957ea94 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -209,35 +209,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs index 6d4862eec9..b354f70f6a 100644 --- a/Projectiles/Rogue/StickyBol.cs +++ b/Projectiles/Rogue/StickyBol.cs @@ -36,44 +36,9 @@ namespace CalamityMod.Projectiles.Rogue int num = 6; Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - num * 2, projectile.height - num * 2, 4, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, Alpha, newColor, 1.2f); } - if (projectile.localAI[1] == 1f) - { - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - else + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile); + if (projectile.ai[0] != 1f) { try { @@ -117,10 +82,10 @@ namespace CalamityMod.Projectiles.Rogue } catch { } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f) { - projectile.ai[0] = 10f; + projectile.localAI[1] = 10f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { projectile.velocity.X = projectile.velocity.X * 0.97f; @@ -133,80 +98,12 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = projectile.velocity.Y + 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; - } + } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.localAI[1] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - int num28 = 5; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 5, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 557c7b2300..27ecf14550 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -143,35 +143,7 @@ namespace CalamityMod.Projectiles.Rogue } //gore cloud effects - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/ToxicantTwisterProjectile.cs b/Projectiles/Rogue/ToxicantTwisterProjectile.cs index a1a85be682..523493255f 100644 --- a/Projectiles/Rogue/ToxicantTwisterProjectile.cs +++ b/Projectiles/Rogue/ToxicantTwisterProjectile.cs @@ -25,12 +25,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; aiType = ProjectileID.WoodenBoomerang; projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 12; } public override void AI() { if (projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 25f == 0f) + if (projectile.timeLeft % 50f == 0f) { for (int i = 0; i < 2; i++) { @@ -39,13 +42,12 @@ namespace CalamityMod.Projectiles.Rogue ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); } } - projectile.rotation += 0.125f * (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation += 0.06f * (projectile.velocity.X > 0).ToDirectionInt(); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) { diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index ed921ae9c9..385a1963e8 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -202,35 +202,7 @@ namespace CalamityMod.Projectiles.Summon num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Projectiles/Summon/GigaFlareFriendly.cs b/Projectiles/Summon/GigaFlareFriendly.cs index 20368424ec..24b3c68232 100644 --- a/Projectiles/Summon/GigaFlareFriendly.cs +++ b/Projectiles/Summon/GigaFlareFriendly.cs @@ -127,35 +127,7 @@ namespace CalamityMod.Projectiles.Summon num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/MidnightSunBeaconProj.cs b/Projectiles/Summon/MidnightSunBeaconProj.cs index 30275b3835..159907aa45 100644 --- a/Projectiles/Summon/MidnightSunBeaconProj.cs +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon { for (int i = 1; i <= 4; i++) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 150, 0f, projectile.owner, + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 4, 0f, projectile.owner, projectile.whoAmI, i - 2); } projectile.ai[1] = MidnightSunSkyBeam.TrueTimeLeft + 60f; diff --git a/Projectiles/Summon/MidnightSunSkyBeam.cs b/Projectiles/Summon/MidnightSunSkyBeam.cs index a616eba1d7..12f930e0dd 100644 --- a/Projectiles/Summon/MidnightSunSkyBeam.cs +++ b/Projectiles/Summon/MidnightSunSkyBeam.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = TrueTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 30; } // Netcode for sending and receiving shit diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 60ccb99494..2b15c86385 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -19,10 +19,10 @@ namespace CalamityMod.Projectiles.Summon return; Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : 100f + + float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (100f + (CalamityWorld.downedDoG ? 100f : 0f) + (CalamityWorld.downedYharon ? 100f : 0f) + - (modPlayer.profanedCrystalBuffs ? 700f : 0f); + (modPlayer.profanedCrystalBuffs ? 700f : 0f)); projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); ai = type; } @@ -39,8 +39,7 @@ namespace CalamityMod.Projectiles.Summon private void AI(int type, float num535, float num536, Player player) { - if (ai != type) - updateDamage(type); + updateDamage(type); switch (type) { case 1: //offensive bab (profaned soul artifact) diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index b8a722256a..06f8c103e4 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -19,10 +19,10 @@ namespace CalamityMod.Projectiles.Summon return; Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : 100f + + float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (100f + (CalamityWorld.downedDoG ? 100f : 0f) + (CalamityWorld.downedYharon ? 100f : 0f) + - (modPlayer.profanedCrystalBuffs ? 700f : 0f); + (modPlayer.profanedCrystalBuffs ? 700f : 0f)); projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); ai = type; } @@ -39,8 +39,7 @@ namespace CalamityMod.Projectiles.Summon private void AI(int type, float num535, float num536, Player player) { - if (ai != type) - updateDamage(type); + updateDamage(type); switch (type) { case 1: //defensive bab (profaned soul artifact) diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index ef269b7f5f..0cc1569751 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -31,15 +31,15 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[projectile.owner]; if (projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] = 1; } - if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * - (player.allDamage + player.minionDamage - 1f)); + player.MinionDamage()); projectile.damage = trueDamage; } NPC target = projectile.Center.MinionHoming(845f, player); diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index 6f4bb7d7ab..f7e48f7755 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,62 @@ namespace CalamityMod.Projectiles.Summon } projectile.velocity.Y += 0.2f; projectile.rotation = projectile.velocity.ToRotation(); + //Homing + if (projectile.ai[0] > 20f) + HomingAI(); } + + private void HomingAI() + { + Player player = Main.player[projectile.owner]; + int targetIdx = -1; + float maxHomingRange = 600f; + bool hasHomingTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = player.MinionAttackTargetNPC; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + else + { + for (int i = 0; i < Main.npc.Length; ++i) + { + NPC npc = Main.npc[i]; + if (npc == null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = i; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + } + + // Home in on said closest NPC. + if (hasHomingTarget) + { + NPC target = Main.npc[targetIdx]; + Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 15f; + float homingRatio = 20f; + projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); + } + } + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(28, 41); i++) diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index 65d392cf3f..5a6f188cbe 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.localNPCHitCooldown = 10; projectile.tileCollide = false; } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Summon //dust and flexible damage if (dust) { - projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) @@ -78,11 +78,11 @@ namespace CalamityMod.Projectiles.Summon } dust = false; } - if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * - (player.allDamage + player.minionDamage - 1f)); + player.MinionDamage()); projectile.damage = damage2; } @@ -339,7 +339,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 projVect = targetLocation - projectile.Center; projVect.Normalize(); projVect *= scaleFactor4; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projVect.X, projVect.Y, projType, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projVect.X, projVect.Y, projType, (int)(projectile.damage * 0.6f), 0f, Main.myPlayer, 0f, 0f); projectile.netUpdate = true; } } @@ -362,7 +362,7 @@ namespace CalamityMod.Projectiles.Summon projVect2.Normalize(); float SpeedX = projVect2.X + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = projVect2.Y + (float)Main.rand.Next(-30, 31) * 0.05f; - int bee = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, projType, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + int bee = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, projType, (int)(projectile.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f); if (projType == bigBee) { Main.projectile[bee].frame = 2; @@ -399,5 +399,10 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(ModContent.BuffType(), 120); } + + public override bool CanDamage() + { + return mode == 2; + } } } diff --git a/Projectiles/Summon/PrincessMissile.cs b/Projectiles/Summon/PrincessMissile.cs index 6d05ac55bf..df6199ac5e 100644 --- a/Projectiles/Summon/PrincessMissile.cs +++ b/Projectiles/Summon/PrincessMissile.cs @@ -114,35 +114,7 @@ namespace CalamityMod.Projectiles.Summon num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 3b7ddd7e6c..e87da2163b 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -77,35 +77,7 @@ namespace CalamityMod.Projectiles.Typeless num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[num626]; - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(projectile, 3); } } } diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index f53322750f..315b0de6e4 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -31,7 +31,9 @@ namespace CalamityMod.Tiles.Abyss } public override void NearbyEffects(int i, int j, bool closer) { - if (WorldGen.genRand.NextBool(60)) + bool noTilesBetweenPlayer = Collision.CanHit(new Vector2(i, j) * 16, 1, 1, new Vector2(i * 16f, Main.LocalPlayer.Center.Y), 1, 1); + + if (WorldGen.genRand.NextBool(60) && !Main.gamePaused && noTilesBetweenPlayer) { if (Math.Abs(Main.LocalPlayer.Center.X - i * 16) < 80 && Main.LocalPlayer.Bottom.Y < j * 16 && diff --git a/Tiles/Furniture/BossTrophy.png b/Tiles/Furniture/BossTrophy.png index ca34f6e080..11cffcca9c 100644 Binary files a/Tiles/Furniture/BossTrophy.png and b/Tiles/Furniture/BossTrophy.png differ diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 844d625246..917ab68d27 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -127,6 +127,7 @@ namespace CalamityMod /// /// The position where we wish to check for nearby NPCs /// Maximum amount of pixels to check around the origin + /// Whether bosses should be prioritized in targetting or not public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool bossPriority = false) { NPC closestTarget = null; @@ -358,6 +359,46 @@ namespace CalamityMod proj = x; } } + + /// + /// Call this function in the Kill function of your projectile to spawn cloud-like gores. Used primarily for explosions + /// + /// The projectile you're adding explosion clouds to + /// Number of times it loops to spawn gores + public static void ExplosionGores (Projectile projectile, int goreAmt) + { + Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + { + float scaleFactor10 = 0.33f; + if (goreIndex < (int)(goreAmt/3)) + { + scaleFactor10 = 0.66f; + } + if (goreIndex >= (int)((2*goreAmt)/3)) + { + scaleFactor10 = 1f; + } + int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + /// /// Call this function in the ai of your projectile so it can stick to enemies, also requires ModifyHitNPCSticky to be called in ModifyHitNPC /// @@ -418,13 +459,13 @@ namespace CalamityMod for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || + ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == ProjectileID.RottenEgg || (Main.npc[i].type == NPCID.Guide && projectile.owner < Main.maxPlayers && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < Main.maxPlayers && Main.player[projectile.owner].killClothier))) || (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) { if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) { bool flag3; - if (Main.npc[i].type == 414) + if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) { Rectangle rect = Main.npc[i].getRect(); int num5 = 8; diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index e2557dc2cd..7a8b7c3179 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,13 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneSulphur; + bool inXZone = Main.LocalPlayer.Center.X < 10400f; + if (!CalamityWorld.abyssSide) + inXZone = Main.LocalPlayer.Center.X > Main.maxTilesX * 16f - 10400f; + + bool inYZone = Main.LocalPlayer.Center.Y < Main.rockLayer * 16f - 320 && Main.LocalPlayer.Center.Y >= 5800f; + + return (inXZone && inYZone) || Main.LocalPlayer.Calamity().ZoneSulphur; } public override int ChooseWaterfallStyle() diff --git a/World/Abyss.cs b/World/Abyss.cs index e761856ba1..9f4328e1de 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -525,7 +525,14 @@ namespace CalamityMod.World { Main.tile[trueX, y].slope(0); Main.tile[trueX, y].halfBrick(false); - Tile.SmoothSlope(trueX, y); + try + { + Tile.SmoothSlope(trueX, y); + } + catch + { + continue; + } } } } diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index f0e170be53..6f489ffd9c 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -107,6 +107,8 @@ namespace CalamityMod.World public static bool rainingAcid; public static int acidRainPoints = 0; public static int acidRainExtraDrawTime = 0; + public static bool triedToSummonOldDuke = false; + public static bool startAcidicDownpour = false; public static float AcidRainCompletionRatio { get @@ -364,6 +366,10 @@ namespace CalamityMod.World downed.Add("eocRain"); if (downedAquaticScourgeAcidRain) downed.Add("hmRain"); + if (triedToSummonOldDuke) + downed.Add("spawnedBoomer"); + if (startAcidicDownpour) + downed.Add("startDownpour"); return new TagCompound { @@ -431,6 +437,8 @@ namespace CalamityMod.World spawnedCirrus = downed.Contains("drunkPrincess"); downedEoCAcidRain = downed.Contains("eocRain"); downedAquaticScourgeAcidRain = downed.Contains("hmRain"); + triedToSummonOldDuke = downed.Contains("spawnedBoomer"); + startAcidicDownpour = downed.Contains("startDownpour"); abyssChasmBottom = tag.GetInt("abyssChasmBottom"); acidRainPoints = tag.GetInt("acidRainPoints"); @@ -487,12 +495,11 @@ namespace CalamityMod.World onionMode = flags4[6]; revenge = flags4[7]; - // 1 bit is currently unused, it used to be astral meteor drops BitsByte flags5 = reader.ReadByte(); downedStarGod = flags5[0]; spawnedBandit = flags5[1]; spawnedCirrus = flags5[2]; - _ = flags5[3]; + startAcidicDownpour = flags5[3]; spawnedHardBoss = flags5[4]; downedPolterghast = flags5[5]; death = flags5[6]; @@ -514,8 +521,9 @@ namespace CalamityMod.World downedCLAM = flags7[2]; dragonScalesBought = flags7[3]; rainingAcid = flags7[4]; - downedEoCAcidRain = flags[5]; - downedAquaticScourgeAcidRain = flags[6]; + downedEoCAcidRain = flags7[5]; + downedAquaticScourgeAcidRain = flags7[6]; + triedToSummonOldDuke = flags7[7]; } else { @@ -568,12 +576,11 @@ namespace CalamityMod.World flags4[6] = onionMode; flags4[7] = revenge; - // 1 bits is currently unused, it used to be astral meteor drops BitsByte flags5 = new BitsByte(); flags5[0] = downedStarGod; flags5[1] = spawnedBandit; flags5[2] = spawnedCirrus; - flags5[3] = false; + flags5[3] = startAcidicDownpour; flags5[4] = spawnedHardBoss; flags5[5] = downedPolterghast; flags5[6] = death; @@ -597,6 +604,7 @@ namespace CalamityMod.World flags7[4] = rainingAcid; flags7[5] = downedEoCAcidRain; flags7[6] = downedAquaticScourgeAcidRain; + flags7[7] = triedToSummonOldDuke; writer.Write(flags); writer.Write(flags2); @@ -654,12 +662,11 @@ namespace CalamityMod.World onionMode = flags4[6]; revenge = flags4[7]; - // 1 bits is currently unused, it used to be astral meteor drops BitsByte flags5 = reader.ReadByte(); downedStarGod = flags5[0]; spawnedBandit = flags5[1]; spawnedCirrus = flags5[2]; - _ = flags5[3]; + startAcidicDownpour = flags5[3]; spawnedHardBoss = flags5[4]; downedPolterghast = flags5[5]; death = flags5[6]; @@ -681,8 +688,9 @@ namespace CalamityMod.World downedCLAM = flags7[2]; dragonScalesBought = flags7[3]; rainingAcid = flags7[4]; - downedEoCAcidRain = flags[5]; - downedAquaticScourgeAcidRain = flags[6]; + downedEoCAcidRain = flags7[5]; + downedAquaticScourgeAcidRain = flags7[6]; + triedToSummonOldDuke = flags7[7]; abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); @@ -893,25 +901,54 @@ namespace CalamityMod.World CalamityMod.UpdateServerBoolean(); } - // Attempt to start the acid rain - if (Main.rand.NextBool(360000)) + // Attempt to start the acid rain at the 4:29AM + bool moreRain = !downedEoCAcidRain || (!downedAquaticScourgeAcidRain && downedAquaticScourge) || (!downedBoomerDuke && downedPolterghast); + if (Main.time == 32399 && !Main.dayTime && Main.rand.NextBool(moreRain ? 3 : 300)) { AcidRainEvent.TryStartEvent(); CalamityMod.UpdateServerBoolean(); } + if (NPC.downedBoss1 && !downedEoCAcidRain) + { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + if (Main.player[playerIndex].active) + { + if (Main.player[playerIndex].Calamity().ZoneSulphur) + { + AcidRainEvent.TryStartEvent(); + CalamityMod.UpdateServerBoolean(); + } + } + } + } if (rainingAcid) { - // Makes rain pour at its maximum intensity + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + if (Main.player[playerIndex].active) + { + if (Main.player[playerIndex].Calamity().ZoneSulphur) + { + startAcidicDownpour = true; + CalamityMod.UpdateServerBoolean(); + } + } + } + // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! - Main.raining = true; - Main.cloudBGActive = 1f; - Main.numCloudsTemp = Main.cloudLimit; - Main.numClouds = Main.numCloudsTemp; - Main.windSpeedTemp = 0.72f; - Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; - Main.maxRaining = 0.89f; + if (startAcidicDownpour) + { + Main.raining = true; + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = 0.72f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = 600; + Main.maxRaining = 0.89f; + } Main.invasionProgressNearInvasion = true; // Summon Old Duke tornado post-Polter as needed @@ -919,15 +956,28 @@ namespace CalamityMod.World !NPC.AnyNPCs(ModContent.NPCType()) && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) { - int playerClosestToAbyss = Player.FindClosest(new Vector2(abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0); - Player closestToAbyss = Main.player[playerClosestToAbyss]; - if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (abyssSide ? 0 : Main.maxTilesX * 16)) <= 12000f) + if (triedToSummonOldDuke) { - Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, - ModContent.ProjectileType(), 120, 8f); + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + else + { + int playerClosestToAbyss = Player.FindClosest(new Vector2(abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0); + Player closestToAbyss = Main.player[playerClosestToAbyss]; + if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (abyssSide ? 0 : Main.maxTilesX * 16)) <= 12000f) + { + Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, + ModContent.ProjectileType(), 120, 8f, Main.myPlayer); + } } } } + else + { + startAcidicDownpour = false; + } // Boss Rush shit if (bossRushActive) @@ -1016,7 +1066,7 @@ namespace CalamityMod.World // Post-Wall of Flesh teleport back to spawn if (bossRushStage == 13) { - for (int playerIndex = 0; playerIndex < 255; playerIndex++) + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { if (Main.player[playerIndex].active) { @@ -1029,7 +1079,7 @@ namespace CalamityMod.World // Remove Providence debuff for next boss fight else if (bossRushStage == 36) { - for (int playerIndex = 0; playerIndex < 255; playerIndex++) + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { if (Main.player[playerIndex].active) { @@ -1124,7 +1174,7 @@ namespace CalamityMod.World Main.npc[num1302].direction = Main.npc[num1302].spriteDirection = Math.Sign(player.Center.X - (float)player.Center.X - 90f); break; case 19: - for (int doom = 0; doom < 200; doom++) + for (int doom = 0; doom < Main.maxNPCs; doom++) { if (Main.npc[doom].active && (Main.npc[doom].type == 493 || Main.npc[doom].type == 422 || Main.npc[doom].type == 507 || Main.npc[doom].type == 517)) diff --git a/build.txt b/build.txt index d73c8983d4..a28b740534 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 1.4.3.002 +version = 1.4.4.001 displayName = Calamity Mod (No Calamity Music) homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes