diff --git a/Buffs/DamageOverTime/ShellfishEating.png b/Buffs/DamageOverTime/ShellfishEating.png index 846f95f87e..8c319852eb 100644 Binary files a/Buffs/DamageOverTime/ShellfishEating.png and b/Buffs/DamageOverTime/ShellfishEating.png differ diff --git a/Buffs/Pets/RotomBuff.png b/Buffs/Pets/RotomBuff.png index 47ac01e1b0..8828953b3e 100644 Binary files a/Buffs/Pets/RotomBuff.png and b/Buffs/Pets/RotomBuff.png differ diff --git a/Buffs/Summon/ShellfishBuff.png b/Buffs/Summon/ShellfishBuff.png index 3c28db9c53..cb1948a207 100644 Binary files a/Buffs/Summon/ShellfishBuff.png and b/Buffs/Summon/ShellfishBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 0cde1342ab..bf3b8ea936 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -319,6 +319,9 @@ namespace CalamityMod.CalPlayer public bool eGauntlet = false; public bool eTalisman = false; public bool statisBeltOfCurses = false; + public int statisTimer = 0; + public bool nucleogenesis = false; + public bool nuclearRod = false; public bool elysianAegis = false; public bool elysianGuard = false; public bool nCore = false; @@ -403,6 +406,7 @@ namespace CalamityMod.CalPlayer public bool handWarmer = false; public bool oldDie = false; public bool ursaSergeant = false; + public bool scuttlersJewel = false; public bool thiefsDime = false; public bool dynamoStemCells = false; public bool etherealExtorter = false; @@ -1237,6 +1241,8 @@ namespace CalamityMod.CalPlayer eGauntlet = false; eTalisman = false; statisBeltOfCurses = false; + nucleogenesis = false; + nuclearRod = false; heartOfDarkness = false; shadowMinions = false; tearMinions = false; @@ -1284,6 +1290,7 @@ namespace CalamityMod.CalPlayer cTracers = false; oldDie = false; ursaSergeant = false; + scuttlersJewel = false; thiefsDime = false; dynamoStemCells = false; etherealExtorter = false; @@ -1653,6 +1660,7 @@ namespace CalamityMod.CalPlayer fleshTotemCooldown = false; sandCloakCooldown = false; icicleCooldown = 0; + statisTimer = 0; alcoholPoisoning = false; shadowflame = false; @@ -2994,7 +3002,7 @@ namespace CalamityMod.CalPlayer if (player.mount.Active || player.mount.Cart || (CalamityMod.CalamityConfig.BossRushDashCurse && CalamityWorld.bossRushActive)) { - player.dashDelay = 60; + player.dashDelay = 10; dashMod = 0; } @@ -3020,7 +3028,7 @@ namespace CalamityMod.CalPlayer if (player.mount.Active || player.mount.Cart || (CalamityMod.CalamityConfig.BossRushDashCurse && CalamityWorld.bossRushActive)) { - player.dashDelay = 60; + player.dashDelay = 10; dashMod = 0; } @@ -6794,8 +6802,10 @@ namespace CalamityMod.CalPlayer num18 = (float)num17 / num18; num15 *= num18; num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, 294, 3000, 7f, player.whoAmI, 0f, 0f); + int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.ShadowBeamFriendly, 3000, 7f, player.whoAmI, 0f, 0f); Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; } for (int l = 0; l < 5; l++) { @@ -6810,8 +6820,10 @@ namespace CalamityMod.CalPlayer num18 = (float)num17 / num18; num15 *= num18; num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, 45, 5000, 7f, player.whoAmI, 0f, 0f); + int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.DemonScythe, 5000, 7f, player.whoAmI, 0f, 0f); Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; } } } @@ -7243,7 +7255,7 @@ namespace CalamityMod.CalPlayer float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); float num10 = 0.94f; int num11 = 20; - if (dashMod == 1) //Counter Scarf + if (dashMod == 1) //Counter Scarf { for (int k = 0; k < 2; k++) { @@ -7340,6 +7352,33 @@ namespace CalamityMod.CalPlayer } num7 = 12.5f; //14 } + else if (dashMod == 7) //Statis' Belt of Curses + { + statisTimer++; + for (int k = 0; k < 2; k++) + { + int num12; + if (player.velocity.Y == 0f) + { + num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 70, 0f, 0f, 100, default, 1.4f); + } + else + { + num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 70, 0f, 0f, 100, default, 1.4f); + } + Main.dust[num12].velocity *= 0.1f; + Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + num7 = 14f; //14 + if (statisTimer % 5 == 0) + { + int scythe = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(500 * player.allDamage), 5f, player.whoAmI, 1f); + Main.projectile[scythe].Calamity().rogue = false; + Main.projectile[scythe].usesIDStaticNPCImmunity = true; + Main.projectile[scythe].idStaticNPCHitCooldown = 10 * Main.projectile[scythe].extraUpdates; + } + } if (dashMod > 0) { player.vortexStealthActive = false; @@ -7746,6 +7785,68 @@ namespace CalamityMod.CalPlayer } } } + else if (dashMod == 7) //Statis' Belt of Curses + { + dashDistance = 21.9f; + int direction = 0; + bool justDashed = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + direction = 1; + justDashed = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + direction = -1; + justDashed = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (justDashed) + { + player.velocity.X = dashDistance * (float)direction; //solar dash amount + Point point = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point2 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num17 = 0; num17 < 20; num17++) + { + int num18 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 70, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[num18]; + dust.position.X += (float)Main.rand.Next(-5, 6); + dust.position.Y += (float)Main.rand.Next(-5, 6); + dust.velocity *= 0.2f; + dust.scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + return; + } + } } } @@ -7795,7 +7896,7 @@ namespace CalamityMod.CalPlayer { num3 -= player.height; } - if (dashMod == 1) + if (dashMod == 1) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; @@ -7837,6 +7938,13 @@ namespace CalamityMod.CalPlayer Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } + else if (dashMod == 7) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 70, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } } } else if (player.controlRight && player.velocity.X < player.accRunSpeed && player.dashDelay >= 0) @@ -7848,7 +7956,7 @@ namespace CalamityMod.CalPlayer { num8 -= player.height; } - if (dashMod == 1) + if (dashMod == 1) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; @@ -7876,7 +7984,7 @@ namespace CalamityMod.CalPlayer Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } - else if (dashMod == 5) + else if (dashMod == 5) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; @@ -7890,6 +7998,13 @@ namespace CalamityMod.CalPlayer Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } + else if (dashMod == 7) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 70, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } } } @@ -10185,9 +10300,9 @@ namespace CalamityMod.CalPlayer #region Profaned Soul Crystal Stuffs - internal void rollBabSpears(int randAmt) + internal void rollBabSpears(int randAmt, bool chaseable) { - if (player.whoAmI == Main.myPlayer && randAmt > 0 && !endoCooper && !magicHat && Main.rand.NextBool(randAmt)) //disallow other dev summons due to damage being bonkers + if (player.whoAmI == Main.myPlayer && randAmt > 0 && !endoCooper && !magicHat && Main.rand.NextBool(randAmt) && chaseable) //disallow other dev summons due to damage being bonkers { int spearsFired = 0; for (int i = 0; i < Main.projectile.Length; i++) @@ -10351,15 +10466,11 @@ namespace CalamityMod.CalPlayer if (player.redFairy || player.greenFairy || player.blueFairy) light += 2; if (babyGhostBell) - light += 2; - else if (babyGhostBell && !underwater) //for Death caverns - light += 1; + light += underwater ? 2 : 1; if (player.petFlagDD2Ghost) light += 2; - if (sirenPet && underwater) - light += 3; - else if (sirenPet && !underwater) //for Death caverns - light += 1; + if (sirenPet) + light += underwater ? 3 : 1; if (player.wisp) light += 3; if (player.suspiciouslookingTentacle) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index e09c323ec6..0e1179b718 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -408,15 +408,17 @@ namespace CalamityMod.CalPlayer // Acid rain droplets if (player.whoAmI == Main.myPlayer) { - if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur && !CalamityPlayer.areThereAnyDamnBosses) + if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur && !CalamityPlayer.areThereAnyDamnBosses && player.Center.Y < Main.worldSurface * 16f + 800f) { int acidRainDropRate = (int)MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50); Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); + int acidDmg = CalamityWorld.downedPolterghast ? 35 : CalamityWorld.downedAquaticScourge ? 25 : 15; + if (player.miscCounter % acidRainDropRate == 0f && Main.rand.NextBool(2)) { Projectile.NewProjectile(spawnPoint, Vector2.UnitY * Main.rand.NextFloat(7f, 11f), - ModContent.ProjectileType(), 28, 0f); + ModContent.ProjectileType(), acidDmg, 0f); } } } @@ -887,6 +889,8 @@ namespace CalamityMod.CalPlayer modPlayer.hurtSoundTimer--; if (modPlayer.icicleCooldown > 0) modPlayer.icicleCooldown--; + if (modPlayer.statisTimer > 0 && player.dashDelay >= 0) + modPlayer.statisTimer = 0; // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) diff --git a/CalamityMod.cs b/CalamityMod.cs index ff94cb65e9..043e2501d0 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -54,6 +54,7 @@ using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; @@ -1964,7 +1965,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; javelinList = new List() @@ -2006,6 +2008,7 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), @@ -2120,7 +2123,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; flaskBombProjList = new List() @@ -2146,7 +2150,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; spikyBallList = new List() @@ -3015,6 +3020,19 @@ namespace CalamityMod AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); + + int invasionIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Diagnose Net"); + if (invasionIndex != -1) + { + layers.Insert(invasionIndex, new LegacyGameInterfaceLayer("Acid Rain Invasion UI", () => + { + if (CalamityWorld.rainingAcid) + { + AcidRainUI.Draw(Main.spriteBatch); + } + return true; + }, InterfaceScaleType.None)); + } } public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index ed261950bc..5fb252275c 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Events // Any other mods are changing the invasion ID as well. public const int InvasionID = 57; + public const int MinibossDeathValue = 5; + // A partially bright pale-ish cyan with a hint of yellow. public static readonly Color TextColor = new Color(115, 194, 147); @@ -25,7 +27,7 @@ namespace CalamityMod.Events // The first value is the NPC type, the second is the value they're worth in the event public static List<(int, int)> PossibleEnemiesPreHM = new List<(int, int)>() { - ( ModContent.NPCType(), 0 ), + ( ModContent.NPCType(), 1 ), ( ModContent.NPCType(), 1 ), ( ModContent.NPCType(), 1 ), ( ModContent.NPCType(), 1 ), @@ -48,6 +50,7 @@ namespace CalamityMod.Events public static List<(int, int)> PossibleEnemiesPolter = new List<(int, int)>() { + ( ModContent.NPCType(), 0 ), ( ModContent.NPCType(), 0 ), ( ModContent.NPCType(), 0 ), ( ModContent.NPCType(), 1 ), @@ -59,6 +62,31 @@ namespace CalamityMod.Events ( ModContent.NPCType(), 1 ) }; + public static List PossibleMinibossesAS = new List() + { + ModContent.NPCType() + }; + + public static List PossibleMinibossesPolter = new List() + { + ModContent.NPCType() + }; + + public static bool AnyRainMinibosses + { + get + { + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && (PossibleMinibossesAS.Contains(Main.npc[i].type)) || PossibleMinibossesPolter.Contains(Main.npc[i].type)) + { + return true; + } + } + return false; + } + } + /// /// Broadcasts some text from a given localization key. /// @@ -99,7 +127,6 @@ namespace CalamityMod.Events rectangleCheckSize, rectangleCheckSize); if (screen.Intersects(invasionCheckArea)) { - Main.invasionProgressDisplayLeft = 480; return true; } } @@ -124,23 +151,16 @@ namespace CalamityMod.Events } if (playerCount > 0) { - // So that vanilla doesn't shit itself - Main.invasionType = -1; - CalamityWorld.rainingAcid = true; // The E - 1 part is to ensure that we start at 1 as a multiple instead of 0 // At a maximum of 255 players, the max multiplier is 9.98, or 998 enemies that need to be killed. CalamityWorld.acidRainPoints = (int)(180 * Math.Log(playerCount + Math.E - 1)); - Main.invasionProgress = 0; - Main.invasionProgressIcon = -1; - Main.invasionProgressWave = 0; // Make it rain normally - Main.raining = true; - - // 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; + if (CalamityWorld.startAcidicDownpour) + { + Main.raining = true; + } CalamityWorld.triedToSummonOldDuke = false; } UpdateInvasion(); @@ -159,9 +179,6 @@ namespace CalamityMod.Events { CalamityWorld.rainingAcid = false; BroadcastEventText("Mods.CalamityMod.AcidRainEnd"); // The sulphuric skies begin to clear... - Main.invasionType = 0; - Main.invasionDelay = 0; - Main.invasionProgressNearInvasion = false; CalamityWorld.acidRainExtraDrawTime = 40; // Turn off the rain from the event diff --git a/Events/AcidRainT2_BossChecklist.png b/Events/AcidRainT2_BossChecklist.png new file mode 100644 index 0000000000..75fa9ae23d Binary files /dev/null and b/Events/AcidRainT2_BossChecklist.png differ diff --git a/ExtraTextures/Lasers/CragmawMireBeamBegin.png b/ExtraTextures/Lasers/CragmawMireBeamBegin.png new file mode 100644 index 0000000000..22974b0ee7 Binary files /dev/null and b/ExtraTextures/Lasers/CragmawMireBeamBegin.png differ diff --git a/ExtraTextures/Lasers/CragmawMireBeamEnd.png b/ExtraTextures/Lasers/CragmawMireBeamEnd.png new file mode 100644 index 0000000000..24a8abab24 Binary files /dev/null and b/ExtraTextures/Lasers/CragmawMireBeamEnd.png differ diff --git a/ExtraTextures/Lasers/CragmawMireBeamMid.png b/ExtraTextures/Lasers/CragmawMireBeamMid.png new file mode 100644 index 0000000000..a163b58a09 Binary files /dev/null and b/ExtraTextures/Lasers/CragmawMireBeamMid.png differ diff --git a/Gores/AcidRain/AnthozoanCrabGore.png b/Gores/AcidRain/AnthozoanCrabGore.png new file mode 100644 index 0000000000..da1a8451d0 Binary files /dev/null and b/Gores/AcidRain/AnthozoanCrabGore.png differ diff --git a/Gores/AcidRain/AnthozoanCrabGore2.png b/Gores/AcidRain/AnthozoanCrabGore2.png new file mode 100644 index 0000000000..eddfbc1079 Binary files /dev/null and b/Gores/AcidRain/AnthozoanCrabGore2.png differ diff --git a/Gores/AcidRain/AnthozoanCrabGore3.png b/Gores/AcidRain/AnthozoanCrabGore3.png new file mode 100644 index 0000000000..a8eb1fbe76 Binary files /dev/null and b/Gores/AcidRain/AnthozoanCrabGore3.png differ diff --git a/Gores/AcidRain/BelchingCoralGore.png b/Gores/AcidRain/BelchingCoralGore.png new file mode 100644 index 0000000000..21e8dd38fa Binary files /dev/null and b/Gores/AcidRain/BelchingCoralGore.png differ diff --git a/Gores/AcidRain/BelchingCoralGore2.png b/Gores/AcidRain/BelchingCoralGore2.png new file mode 100644 index 0000000000..7dfeba36fc Binary files /dev/null and b/Gores/AcidRain/BelchingCoralGore2.png differ diff --git a/Gores/AcidRain/CragmawMireP1Gore.png b/Gores/AcidRain/CragmawMireP1Gore.png new file mode 100644 index 0000000000..36bb309a1e Binary files /dev/null and b/Gores/AcidRain/CragmawMireP1Gore.png differ diff --git a/Gores/AcidRain/CragmawMireP1Gore2.png b/Gores/AcidRain/CragmawMireP1Gore2.png new file mode 100644 index 0000000000..5a57d219d9 Binary files /dev/null and b/Gores/AcidRain/CragmawMireP1Gore2.png differ diff --git a/Gores/AcidRain/CragmawMireP1Gore3.png b/Gores/AcidRain/CragmawMireP1Gore3.png new file mode 100644 index 0000000000..b3c07da3bd Binary files /dev/null and b/Gores/AcidRain/CragmawMireP1Gore3.png differ diff --git a/Gores/AcidRain/GammaSlimeGore.png b/Gores/AcidRain/GammaSlimeGore.png new file mode 100644 index 0000000000..71257990a0 Binary files /dev/null and b/Gores/AcidRain/GammaSlimeGore.png differ diff --git a/Gores/AcidRain/GammaSlimeGore2.png b/Gores/AcidRain/GammaSlimeGore2.png new file mode 100644 index 0000000000..78f0c403e6 Binary files /dev/null and b/Gores/AcidRain/GammaSlimeGore2.png differ diff --git a/Gores/DevilFishMask1.png b/Gores/DevilFishMask1.png index 9286f11f74..e58593c6b8 100644 Binary files a/Gores/DevilFishMask1.png and b/Gores/DevilFishMask1.png differ diff --git a/Gores/DevilFishMask2.png b/Gores/DevilFishMask2.png index 26db563d73..2beea2916d 100644 Binary files a/Gores/DevilFishMask2.png and b/Gores/DevilFishMask2.png differ diff --git a/Gores/DevilFishMask3.png b/Gores/DevilFishMask3.png index f75512e206..6a2ac9fe5b 100644 Binary files a/Gores/DevilFishMask3.png and b/Gores/DevilFishMask3.png differ diff --git a/Gores/DevilFishMask3Alt.png b/Gores/DevilFishMask3Alt.png new file mode 100644 index 0000000000..4947adacf6 Binary files /dev/null and b/Gores/DevilFishMask3Alt.png differ diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 2adb8dabb9..9eea624895 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -19,232 +19,6 @@ namespace CalamityMod.ILEditing /// public static void Initialize() { - IL.Terraria.Main.DrawInvasionProgress += (il) => - { - var cursor = new ILCursor(il) - { - Index = 1 - }; - cursor.EmitDelegate(() => - { - if (Main.invasionProgressMode == 2 && (Main.invasionProgressNearInvasion || AcidRainEvent.NearInvasionCheck(7500)) && Main.invasionProgressDisplayLeft < 160) - { - Main.invasionProgressDisplayLeft = 160; - } - if (!Main.gamePaused && Main.invasionProgressDisplayLeft > 0) - { - Main.invasionProgressDisplayLeft--; - } - if (Main.invasionProgressDisplayLeft > 0) - { - Main.invasionProgressAlpha += 0.05f; - } - else - { - Main.invasionProgressAlpha -= 0.05f; - } - if (Main.invasionProgressAlpha < 0f) - { - Main.invasionProgressAlpha = 0f; - } - if (Main.invasionProgressAlpha > 1f) - { - Main.invasionProgressAlpha = 1f; - } - if (CalamityWorld.rainingAcid) - { - Main.invasionProgressAlpha = 1f; - } - if (Main.invasionProgressAlpha <= 0f) - { - return; - } - bool draw = CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0; - if ((draw && !Main.LocalPlayer.Calamity().ZoneSulphur) || - (!draw && Main.LocalPlayer.Calamity().ZoneSulphur)) - return; - - float progressAlpha = 0.5f + Main.invasionProgressAlpha * 0.5f; - if (CalamityWorld.acidRainExtraDrawTime > 0) - { - progressAlpha = 0.5f + CalamityWorld.acidRainExtraDrawTime / 40f * 0.5f; - CalamityWorld.acidRainExtraDrawTime--; - } - Vector2 screenCoords = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40); - int sizeX = (int)(200f * progressAlpha); - int sizeY = (int)(45f * progressAlpha); - Rectangle screenCoordsRectangle = - new Rectangle((int)screenCoords.X - sizeX / 2, - (int)screenCoords.Y - sizeY / 2, sizeX, sizeY); - Texture2D barTexture = Main.colorBarTexture; - - // If you touch the netcode behind this without a good reason your life will come to an abrupt end -Dominic - if (CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0) - { - Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); - - float progressRatio = 1f - CalamityWorld.AcidRainCompletionRatio; - string progressText = $"{((int)(100 * progressRatio)).ToString()}%"; - progressText = Language.GetTextValue("Game.WaveCleared", progressText); - Main.spriteBatch.Draw(barTexture, screenCoords, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f); - Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText); - float adjustedAlpha = progressAlpha; - if (textMeasurement.Y > 22f) - { - adjustedAlpha *= 22f / textMeasurement.Y; - } - float barDrawOffsetX = 169f * progressAlpha; - float scaleY = 8f * progressAlpha; - Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f; - Utils.DrawBorderString(Main.spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White * Main.invasionProgressAlpha, adjustedAlpha, 0.5f, 1f, -1); - barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX; - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f); - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f); - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f); - - string invasionNameText = "Acid Rain"; - Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText); - float x = 120f; - if (textMeasurement2.X > 200f) - { - x += textMeasurement2.X - 200f; - } - Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon"); - Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha); - Utils.DrawInvBG(Main.spriteBatch, iconRectangle, AcidRainEvent.TextColor * 0.5f); - Main.spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f); - Utils.DrawBorderString(Main.spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White * Main.invasionProgressAlpha, progressAlpha * 0.9f, 1f, 0.4f, -1); - } - else - { - if (Main.invasionProgress == -1) - { - return; - } - Texture2D iconTexture = Main.extraTexture[9]; - string invasionNameText = ""; - Color drawColor = Color.White; - if (Main.invasionProgressIcon == 1) - { - iconTexture = Main.extraTexture[8]; - invasionNameText = Language.GetTextValue("LegacyInterface.83"); - drawColor = new Color(64, 109, 164) * 0.5f; - } - else if (Main.invasionProgressIcon == 2) - { - iconTexture = Main.extraTexture[12]; - invasionNameText = Language.GetTextValue("LegacyInterface.84"); - drawColor = new Color(112, 86, 114) * 0.5f; - } - else if (Main.invasionProgressIcon == 3) - { - iconTexture = Main.extraTexture[79]; - invasionNameText = Language.GetTextValue("DungeonDefenders2.InvasionProgressTitle"); - drawColor = new Color(88, 0, 160) * 0.5f; - } - else if (Main.invasionProgressIcon == 7) - { - iconTexture = Main.extraTexture[10]; - invasionNameText = Language.GetTextValue("LegacyInterface.85"); - drawColor = new Color(165, 160, 155) * 0.5f; - } - else if (Main.invasionProgressIcon == 6) - { - iconTexture = Main.extraTexture[11]; - invasionNameText = Language.GetTextValue("LegacyInterface.86"); - drawColor = new Color(148, 122, 72) * 0.5f; - } - else if (Main.invasionProgressIcon == 5) - { - iconTexture = Main.extraTexture[7]; - invasionNameText = Language.GetTextValue("LegacyInterface.87"); - drawColor = new Color(173, 135, 140) * 0.5f; - } - else if (Main.invasionProgressIcon == 4) - { - iconTexture = Main.extraTexture[9]; - invasionNameText = Language.GetTextValue("LegacyInterface.88"); - drawColor = new Color(94, 72, 131) * 0.5f; - } - else return; - if (Main.invasionProgressWave > 0) - { - Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); - string pointsText; - if (Main.invasionProgressMax == 0) - { - pointsText = Language.GetTextValue("Game.InvasionPoints", Main.invasionProgress); - } - else - { - pointsText = ((int)((float)Main.invasionProgress * 100f / (float)Main.invasionProgressMax)).ToString() + "%"; - } - pointsText = Language.GetTextValue("Game.WaveMessage", Main.invasionProgressWave, pointsText); - float progressRatio = MathHelper.Clamp(Main.invasionProgress / (float)Main.invasionProgressMax, 0f, 1f); - if (Main.invasionProgressMax == 0) - { - progressRatio = 1f; - } - float barDrawOffsetX = 169f * progressAlpha; - float scaleY = 8f * progressAlpha; - Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f; - Utils.DrawBorderString(Main.spriteBatch, pointsText, barDrawPosition, Color.White * Main.invasionProgressAlpha, progressAlpha, 0.5f, 1f, -1); - Main.spriteBatch.Draw(barTexture, screenCoords, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f); - barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX; - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f); - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f); - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f); - } - else - { - Vector2 vectorIconRectangle = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40); - Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); - string progressText; - if (Main.invasionProgressMax == 0) - { - progressText = Main.invasionProgress.ToString(); - } - else - { - progressText = ((int)(Main.invasionProgress * 100f / Main.invasionProgressMax)).ToString() + "%"; - } - progressText = Language.GetTextValue("Game.WaveCleared", progressText); - if (Main.invasionProgressMax != 0) - { - Main.spriteBatch.Draw(barTexture, vectorIconRectangle, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2((float)(barTexture.Width / 2), 0f), progressAlpha, SpriteEffects.None, 0f); - float progressRatio = MathHelper.Clamp(Main.invasionProgress / (float)Main.invasionProgressMax, 0f, 1f); - Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText); - float adjustedAlpha = progressAlpha; - if (textMeasurement.Y > 22f) - { - adjustedAlpha *= 22f / textMeasurement.Y; - } - float barDrawOffsetX = 169f * progressAlpha; - float scaleY = 8f * progressAlpha; - Vector2 barDrawPosition = vectorIconRectangle + Vector2.UnitY * scaleY + Vector2.UnitX * 1f; - Utils.DrawBorderString(Main.spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White * Main.invasionProgressAlpha, adjustedAlpha, 0.5f, 1f, -1); - barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX; - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f); - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f); - Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f); - } - } - Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText); - float x = 120f; - if (textMeasurement2.X > 200f) - { - x += textMeasurement2.X - 200f; - } - Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha); - Utils.DrawInvBG(Main.spriteBatch, iconRectangle, drawColor); - Main.spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f); - Utils.DrawBorderString(Main.spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White * Main.invasionProgressAlpha, progressAlpha * 0.9f, 1f, 0.4f, -1); - } - }); - cursor.Emit(Pop); - cursor.Emit(Ret); - }; - IL.Terraria.WorldGen.MakeDungeon += (il) => { var cursor = new ILCursor(il) diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 03179c9cae..a223c0cc0a 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -54,6 +54,8 @@ namespace CalamityMod.Items.Accessories int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), 60, 2f, player.whoAmI, 0f, 0f); Main.projectile[num19].ai[1] = player.position.Y; Main.projectile[num19].tileCollide = false; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; } } } diff --git a/Items/Accessories/NuclearRod.cs b/Items/Accessories/NuclearRod.cs new file mode 100644 index 0000000000..9686a101a4 --- /dev/null +++ b/Items/Accessories/NuclearRod.cs @@ -0,0 +1,34 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class NuclearRod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Rod"); + Tooltip.SetDefault("Minions release an irradiated aura on enemy hits\n" + + "+1 max minion"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.maxMinions++; + player.Calamity().nuclearRod = true; + } + } +} diff --git a/Items/Accessories/NuclearRod.png b/Items/Accessories/NuclearRod.png new file mode 100644 index 0000000000..8de9ac2928 Binary files /dev/null and b/Items/Accessories/NuclearRod.png differ diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs new file mode 100644 index 0000000000..b41b921c79 --- /dev/null +++ b/Items/Accessories/Nucleogenesis.cs @@ -0,0 +1,56 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class Nucleogenesis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nucleogenesis"); + Tooltip.SetDefault("Increased max minions by 4 and 15% increased minion damage\n" + + "Increased minion knockback\n" + + "Minions inflict a variety of debuffs\n" + + "Minions spawn damaging sparks on enemy hits\n" + //subject to change to be "cooler" + "Minion attacks have a chance to instantly kill normal enemies"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.nucleogenesis = true; + modPlayer.shadowMinions = true; //shadowflame + modPlayer.tearMinions = true; //temporal sadness + modPlayer.voltaicJelly = true; //electrified + modPlayer.starTaintedGenerator = true; //astral infection and irradiated + player.minionKB += 2.5f; + player.minionDamage += 0.15f; + player.maxMinions += 4; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/Nucleogenesis.png b/Items/Accessories/Nucleogenesis.png new file mode 100644 index 0000000000..1ba42b2a88 Binary files /dev/null and b/Items/Accessories/Nucleogenesis.png differ diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index ad45567257..d264ce98f3 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -50,6 +50,8 @@ namespace CalamityMod.Items.Accessories int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), 18, 2f, player.whoAmI, 0f, 0f); Main.projectile[num19].ai[1] = player.position.Y; Main.projectile[num19].tileCollide = false; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; } } } diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs new file mode 100644 index 0000000000..81a9bb69ff --- /dev/null +++ b/Items/Accessories/ScuttlersJewel.cs @@ -0,0 +1,30 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ScuttlersJewel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scuttler's Jewel"); + Tooltip.SetDefault("Javelin projectiles have a chance spawn a jewel spike when destroyed"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.scuttlersJewel = true; + } + } +} diff --git a/Items/Accessories/ScuttlersJewel.png b/Items/Accessories/ScuttlersJewel.png new file mode 100644 index 0000000000..7ba71ab0f4 Binary files /dev/null and b/Items/Accessories/ScuttlersJewel.png differ diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 4f22e35b01..a4aad05a5c 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -9,9 +9,9 @@ namespace CalamityMod.Items.Accessories { public override void SetStaticDefaults() { - DisplayName.SetDefault("Star Tainted Generator"); + DisplayName.SetDefault("Star-tainted Generator"); Tooltip.SetDefault("+2 max minions and 7% minion damage\n" + - "Minion attacks spawn astral explosions and inflict Astral Infection and Electrified"); + "Minion attacks spawn astral explosions and inflict several debuffs"); } public override void SetDefaults() @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Accessories { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.MythrilAnvil); diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index d1c602b8aa..6d31a41f8c 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -2,6 +2,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,17 +12,12 @@ namespace CalamityMod.Items.Accessories { public override void SetStaticDefaults() { - DisplayName.SetDefault("Statis' Belt of Curses"); + DisplayName.SetDefault("Statis' Void Sash"); Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + "Can climb walls, dash, and dodge attacks\n" + - "10% increased rogue damage and velocity\n" + - "5% increased rogue crit chance\n" + - "Increased max minions by 3 and 10% increased minion damage\n" + - "Increased minion knockback\n" + - "Grants shadowflame powers to all minions\n" + - "Minions make enemies cry on hit\n" + - "Minion attacks have a chance to instantly kill normal enemies\n" + + "Dashes leave homing scythes in your wake\n" + "Toggle visibility of this accessory to enable/disable the dash"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 3)); } public override void SetDefaults() @@ -29,38 +26,28 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 90, 0, 0); item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.statisBeltOfCurses = true; - modPlayer.shadowMinions = true; - modPlayer.tearMinions = true; - player.minionKB += 2.5f; - player.minionDamage += 0.1f; - player.maxMinions += 3; player.autoJump = true; player.jumpSpeedBoost += 1.2f; player.extraFall += 50; player.blackBelt = true; if (!hideVisual) - player.dash = 1; + modPlayer.dashMod = 7; player.spikedBoots = 2; - player.Calamity().throwingDamage += 0.1f; - player.Calamity().throwingCrit += 5; - player.Calamity().throwingVelocity += 0.1f; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 10); + //This is not a mistake. Only Nightmare Fuel is intentional for thematics. + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/StatisBeltOfCurses.png b/Items/Accessories/StatisBeltOfCurses.png index 1ff2d2136b..660a232983 100644 Binary files a/Items/Accessories/StatisBeltOfCurses.png and b/Items/Accessories/StatisBeltOfCurses.png differ diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 77fc7d318c..e9d8bc1c46 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -13,8 +13,6 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Statis' Ninja Belt"); Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + "Can climb walls, dash, and dodge attacks\n" + - "5% increased rogue damage and velocity\n" + - "5% increased rogue crit chance\n" + "Toggle visibility of this accessory to enable/disable the dash"); } @@ -37,9 +35,6 @@ namespace CalamityMod.Items.Accessories if (!hideVisual) player.dash = 1; player.spikedBoots = 2; - modPlayer.throwingDamage += 0.05f; - modPlayer.throwingCrit += 5; - modPlayer.throwingVelocity += 0.05f; } public override void AddRecipes() diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index f6a6845df5..e735d1ed2a 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1000f * (player.allDamage + player.minionDamage - 1f)), 1f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1000f * player.MinionDamage()), 1f, Main.myPlayer, 0f, 0f); } } player.allDamage += 0.15f; @@ -116,6 +116,8 @@ namespace CalamityMod.Items.Accessories int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); int num19 = Projectile.NewProjectile(x, y, num15, num16, type, 2000, 1f, player.whoAmI, 0f, 0f); Main.projectile[num19].tileCollide = false; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; } } } @@ -131,7 +133,7 @@ namespace CalamityMod.Items.Accessories { if (random == 0 && player.immune && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - 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) diff --git a/Items/Accessories/ThiefsDime.cs b/Items/Accessories/ThiefsDime.cs index 174e5187e8..543b54d9f9 100644 --- a/Items/Accessories/ThiefsDime.cs +++ b/Items/Accessories/ThiefsDime.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories { if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), 100, 6f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(100 * player.RogueDamage()), 6f, Main.myPlayer, 0f, 0f); } } } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 85cbc0c4ae..ce26fb4d85 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -66,9 +66,9 @@ namespace CalamityMod.Items.Accessories.Wings player.noFallDmg = true; if (modPlayer.icicleCooldown <= 0) { - if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f) + if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) { - int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), 25, 3f, player.whoAmI); + int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)(25 * player.allDamage), 3f, player.whoAmI); Main.projectile[p].minion = false; Main.projectile[p].Calamity().rogue = false; Main.projectile[p].frame = Main.rand.Next(5); diff --git a/Items/Armor/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmerBoots.cs index 4335ae6c1e..5a66ed8599 100644 --- a/Items/Armor/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmerBoots.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor if (player.wingTime <= 0) //ignore flippers while the player can fly player.accFlipper = true; } - + public override void UpdateVanity(Player player, EquipType type) { player.Calamity().fathomSwarmerTail = true; diff --git a/Items/Armor/FearmongerGreathelm.png b/Items/Armor/FearmongerGreathelm.png index 1d98c040ec..8e2f80165d 100644 Binary files a/Items/Armor/FearmongerGreathelm.png and b/Items/Armor/FearmongerGreathelm.png differ diff --git a/Items/Armor/FearmongerGreathelm_Head.png b/Items/Armor/FearmongerGreathelm_Head.png index 1429b823dc..2d1ae7b433 100644 Binary files a/Items/Armor/FearmongerGreathelm_Head.png and b/Items/Armor/FearmongerGreathelm_Head.png differ diff --git a/Items/Armor/FearmongerGreaves.png b/Items/Armor/FearmongerGreaves.png index e2c5e68301..212c9091ff 100644 Binary files a/Items/Armor/FearmongerGreaves.png and b/Items/Armor/FearmongerGreaves.png differ diff --git a/Items/Armor/FearmongerGreaves_Legs.png b/Items/Armor/FearmongerGreaves_Legs.png index 3ea1bf4af8..ef53e72836 100644 Binary files a/Items/Armor/FearmongerGreaves_Legs.png and b/Items/Armor/FearmongerGreaves_Legs.png differ diff --git a/Items/Armor/FearmongerHelmet_Head.png b/Items/Armor/FearmongerHelmet_Head.png deleted file mode 100644 index 1429b823dc..0000000000 Binary files a/Items/Armor/FearmongerHelmet_Head.png and /dev/null differ diff --git a/Items/Armor/FearmongerPlateMail.png b/Items/Armor/FearmongerPlateMail.png index e542e145fb..bc187741a3 100644 Binary files a/Items/Armor/FearmongerPlateMail.png and b/Items/Armor/FearmongerPlateMail.png differ diff --git a/Items/Armor/FearmongerPlateMail_Arms.png b/Items/Armor/FearmongerPlateMail_Arms.png index 8a91da0e5c..a1954cdc68 100644 Binary files a/Items/Armor/FearmongerPlateMail_Arms.png and b/Items/Armor/FearmongerPlateMail_Arms.png differ diff --git a/Items/Armor/FearmongerPlateMail_Body.png b/Items/Armor/FearmongerPlateMail_Body.png index df6e41ae80..58fb04e4c5 100644 Binary files a/Items/Armor/FearmongerPlateMail_Body.png and b/Items/Armor/FearmongerPlateMail_Body.png differ diff --git a/Items/Armor/FearmongerPlateMail_FemaleBody.png b/Items/Armor/FearmongerPlateMail_FemaleBody.png index df6e41ae80..58fb04e4c5 100644 Binary files a/Items/Armor/FearmongerPlateMail_FemaleBody.png and b/Items/Armor/FearmongerPlateMail_FemaleBody.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 70794fa5bb..7493c81760 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -84,36 +84,36 @@ namespace CalamityMod.Items if (CalamityMod.weaponAutoreuseList?.Contains(item.type) ?? false) item.autoReuse = true; - if (item.type == ItemID.PsychoKnife || item.type == ItemID.PearlwoodSword || item.type == ItemID.PearlwoodBow || item.type == ItemID.TaxCollectorsStickOfDoom) + if (item.type == ItemID.PsychoKnife || item.type == ItemID.TaxCollectorsStickOfDoom) item.damage *= 4; else if (item.type == ItemID.SpectreStaff) item.damage *= 3; else if (CalamityMod.doubleDamageBuffList?.Contains(item.type) ?? false) item.damage *= 2; else if (item.type == ItemID.RainbowRod) - item.damage = (int)((double)item.damage * 1.75); + item.damage = (int)(item.damage * 1.75); else if (CalamityMod.sixtySixDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)((double)item.damage * 1.66); + item.damage = (int)(item.damage * 1.66); else if (CalamityMod.fiftyDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)((double)item.damage * 1.5); + item.damage = (int)(item.damage * 1.5); else if (CalamityMod.thirtyThreeDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)((double)item.damage * 1.33); + item.damage = (int)(item.damage * 1.33); else if (CalamityMod.twentyFiveDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)((double)item.damage * 1.25); + item.damage = (int)(item.damage * 1.25); else if (CalamityMod.twentyDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)((double)item.damage * 1.2); + item.damage = (int)(item.damage * 1.2); else if (item.type == ItemID.Frostbrand || item.type == ItemID.MagnetSphere) - item.damage = (int)((double)item.damage * 1.1); + item.damage = (int)(item.damage * 1.1); else if (item.type == ItemID.Razorpine) - item.damage = (int)((double)item.damage * 0.95); + item.damage = (int)(item.damage * 0.95); else if (item.type == ItemID.Phantasm) - item.damage = (int)((double)item.damage * 0.9); + item.damage = (int)(item.damage * 0.9); else if (item.type == ItemID.LastPrism) - item.damage = (int)((double)item.damage * 0.85); + item.damage = (int)(item.damage * 0.85); else if (CalamityMod.quarterDamageNerfList?.Contains(item.type) ?? false) - item.damage = (int)((double)item.damage * 0.75); + item.damage = (int)(item.damage * 0.75); else if (item.type == ItemID.StardustDragonStaff) - item.damage = (int)((double)item.damage * 0.5); + item.damage = (int)(item.damage * 0.5); if (item.type == ItemID.BookStaff) item.mana = 10; @@ -164,15 +164,21 @@ namespace CalamityMod.Items item.useTime = 15; item.damage *= 4; item.tileBoost += 1; + item.rare = 4; } - 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; + item.rare = 4; + item.damage = (int)(item.damage * 2.5); + } + if (item.type == ItemID.PearlwoodSword) + { + item.damage *= 4; + item.rare = 4; } } #endregion @@ -361,7 +367,6 @@ namespace CalamityMod.Items 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) @@ -1866,7 +1871,8 @@ Provides heat and cold protection in Death Mode"; "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 170\n" + - "+50 max life"; + "+50 max life\n" + + "Ornaments rain down as you fly"; } } } @@ -2863,6 +2869,16 @@ Provides heat and cold protection in Death Mode"; { player.noFallDmg = true; player.statLifeMax2 += 50; + if (modPlayer.icicleCooldown <= 0) + { + if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) + { + int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ProjectileID.OrnamentFriendly, (int)(100 * player.allDamage), 5f, player.whoAmI); + Main.projectile[p].melee = false; + Main.projectile[p].Calamity().lineColor = 1; + modPlayer.icicleCooldown = 10; + } + } } else if (item.type == ItemID.SpookyWings) // Bonus to summon stats while wearing spooky armor { diff --git a/Items/Placeables/Banners/AnthozoanCrabBanner.cs b/Items/Placeables/Banners/AnthozoanCrabBanner.cs new file mode 100644 index 0000000000..3383565c03 --- /dev/null +++ b/Items/Placeables/Banners/AnthozoanCrabBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class AnthozoanCrabBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 120; + } + } +} diff --git a/Items/Placeables/Banners/AnthozoanCrabBanner.png b/Items/Placeables/Banners/AnthozoanCrabBanner.png new file mode 100644 index 0000000000..4d1323c82c Binary files /dev/null and b/Items/Placeables/Banners/AnthozoanCrabBanner.png differ diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index 1c4884a881..831347eb52 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Events; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -83,19 +84,33 @@ namespace CalamityMod.Items.Tools.ClimateChange num3 += 0.2f; } Main.rainTime = (int)((float)Main.rainTime * num3); - AdjustRainSeverity(false); - Main.raining = true; + AdjustRainSeverity(false); + Main.raining = true; + } + else if (CalamityWorld.death) + { + if (Main.rainTime > 3600) + { + Main.rainTime = 3600; + AdjustRainSeverity(true); + } + if (CalamityWorld.rainingAcid) + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } } - else if (CalamityWorld.death) - { - if (Main.rainTime > 3600) - { - Main.rainTime = 3600; - AdjustRainSeverity(true); - } - } else + { Main.raining = false; + if (CalamityWorld.rainingAcid) + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + } CalamityMod.UpdateServerBoolean(); return true; diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 8fedccc251..930d381eb3 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -38,14 +38,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.rare = 10; item.Calamity().customRarity = CalamityRarity.RareVariant; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.useAmmo = AmmoID.Bullet; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 8c01576cc4..1d34dd83ac 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 369; + item.damage = 420; item.magic = true; item.mana = 42; item.width = 30; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item92; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15; + item.shootSpeed = 15.69f; item.Calamity().customRarity = CalamityRarity.Developer; } diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs new file mode 100644 index 0000000000..5d4b521281 --- /dev/null +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -0,0 +1,88 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class BelchingSaxophone : ModItem + { + public const int BaseDamage = 30; + private int counter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Belching Saxophone"); + Tooltip.SetDefault("Doot\n" + + "Fires an array of dirty reeds, music notes, and sulphuric bubbles"); + } + + public override void SetDefaults() + { + item.damage = BaseDamage; + item.magic = true; + item.mana = 10; + item.width = 46; + item.height = 22; + item.useTime = 12; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + //If a saxophone actually fired reeds, I'd be concerned. + item.shootSpeed = 20f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + counter++; + if (counter > 1) + counter = 0; + + if (Main.rand.NextBool(2)) + { + Vector2 speed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-15, 16))); + speed.Normalize(); + speed *= 15f; + speed.Y -= Math.Abs(speed.X) * 0.2f; + Projectile.NewProjectile(position, speed, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + } + + speedX += Main.rand.Next(-40, 41) * 0.05f; + speedY += Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, counter == 1 ? 1f : 0f); + + if (Main.rand.NextBool(2)) + { + int noteProj = ProjectileID.QuarterNote; + switch (Main.rand.Next(3)) + { + case 0: + noteProj = ProjectileID.EighthNote; + break; + case 1: + noteProj = ProjectileID.TiedEighthNote; + break; + default: + break; + } + int note = Projectile.NewProjectile(position.X, position.Y, speedX * 0.75f, speedY * 0.75f, noteProj, (int)(damage * 0.75), knockBack, player.whoAmI); + Main.projectile[note].Calamity().forceMagic = true; //why are these notes also internally ranged + Main.projectile[note].usesLocalNPCImmunity = true; + Main.projectile[note].localNPCHitCooldown = 10; + } + return false; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(0, 18); + } + } +} diff --git a/Items/Weapons/Magic/BelchingSaxophone.png b/Items/Weapons/Magic/BelchingSaxophone.png new file mode 100644 index 0000000000..a14f18e697 Binary files /dev/null and b/Items/Weapons/Magic/BelchingSaxophone.png differ diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index 287c69df4d..c1d7c22130 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -40,18 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Dedicated; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 7be8425bc0..af47680ac2 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic { public class Eternity : ModItem { - public const int BaseDamage = 7200; + public const int BaseDamage = 6969; public const int ExplosionDamage = 50000; public const int MaxHomers = 40; public const int dustID = 16; diff --git a/Items/Weapons/Magic/Judgement.cs b/Items/Weapons/Magic/Judgement.cs index 766d394146..98db41677a 100644 --- a/Items/Weapons/Magic/Judgement.cs +++ b/Items/Weapons/Magic/Judgement.cs @@ -19,13 +19,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 600; + item.damage = 700; item.magic = true; item.mana = 9; item.width = 28; item.height = 30; - item.useTime = 12; - item.useAnimation = 12; + item.useTime = 10; + item.useAnimation = 10; item.useStyle = 5; item.noMelee = true; item.knockBack = 4f; @@ -91,8 +91,8 @@ namespace CalamityMod.Items.Weapons.Magic num80 = num72 / num80; num78 *= num80; num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedX4 = num78 + (float)Main.rand.Next(-20, 21) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-20, 21) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); } return false; diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 83ddfc839f..57c768e313 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 50; + item.damage = 35; item.magic = true; item.mana = 16; item.width = 50; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = 10f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -40,7 +40,7 @@ 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(25f); + float angle = Main.rand.NextFloat(-1f, 1f) * MathHelper.ToRadians(30f); Projectile.NewProjectile(position, velocity.RotatedBy(angle), type, damage, knockBack, player.whoAmI); } return false; diff --git a/Items/Weapons/Magic/Poseidon.png b/Items/Weapons/Magic/Poseidon.png index fb94e6f499..8898ece898 100644 Binary files a/Items/Weapons/Magic/Poseidon.png and b/Items/Weapons/Magic/Poseidon.png differ diff --git a/Items/Weapons/Magic/Purge.cs b/Items/Weapons/Magic/Purge.cs index e02b69d07b..fb62663478 100644 --- a/Items/Weapons/Magic/Purge.cs +++ b/Items/Weapons/Magic/Purge.cs @@ -34,18 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 24f; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void AddRecipes() { diff --git a/Items/Weapons/Magic/Serpentine.png b/Items/Weapons/Magic/Serpentine.png index e99f41c53c..eea0e89c88 100644 Binary files a/Items/Weapons/Magic/Serpentine.png and b/Items/Weapons/Magic/Serpentine.png differ diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 6ec8da673a..314379819f 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -36,18 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void AddRecipes() { diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index c08fa20126..32c3a87311 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 = 150; + item.damage = 175; item.magic = true; item.mana = 15; item.width = 60; @@ -32,24 +32,20 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item46; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; + item.shootSpeed = 20f; } 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(14f + Main.rand.NextFloat(-2f, 2f)); - float fangAngleMax = MathHelper.ToRadians(7f + Main.rand.NextFloat(-1f, 1f)); - for (int i = 0; i < 9; i++) + for (int i = -4; i <= 4; i += 1) { - float angle = MathHelper.Lerp(i / 9f, -spitAngleMax, spitAngleMax); - Projectile.NewProjectile(position, velocity.RotatedBy(angle) * 1.65f, type, (int)(damage * 0.7f), knockBack, player.whoAmI); + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X * 1.65f, perturbedSpeed.Y * 1.65f, type, (int)(damage * 0.7f), knockBack * 0.7f, player.whoAmI, 0f, 0f); } - for (int i = 0; i < 5; i++) + for (int j = -2; j <= 2; j += 1) { - float angle = MathHelper.Lerp(i / 5f, -fangAngleMax, fangAngleMax); - Projectile.NewProjectile(position, velocity.RotatedBy(angle), - ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Vector2 perturbedSpeed2 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(j)); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed2.X, perturbedSpeed2.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/WrathoftheAncients.png b/Items/Weapons/Magic/WrathoftheAncients.png index e8eb08a7df..ba43cf6134 100644 Binary files a/Items/Weapons/Magic/WrathoftheAncients.png and b/Items/Weapons/Magic/WrathoftheAncients.png differ diff --git a/Items/Weapons/Magic/Zapper.cs b/Items/Weapons/Magic/Zapper.cs index 2d6b8b3743..77dfe80b5f 100644 --- a/Items/Weapons/Magic/Zapper.cs +++ b/Items/Weapons/Magic/Zapper.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.rare = 5; item.UseSound = SoundID.Item12; item.autoReuse = true; - item.shoot = 88; + item.shoot = ProjectileID.PurpleLaser; item.shootSpeed = 20f; } diff --git a/Items/Weapons/Melee/AncientCrusher.cs b/Items/Weapons/Melee/AncientCrusher.cs index 6e9450bfe2..a93ddd3189 100644 --- a/Items/Weapons/Melee/AncientCrusher.cs +++ b/Items/Weapons/Melee/AncientCrusher.cs @@ -44,12 +44,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 28bdd84a7e..b442c7aa78 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 30; - item.height = 52; + item.width = 40; + item.height = 42; item.damage = 17; item.melee = true; item.useAnimation = item.useTime = 26; diff --git a/Items/Weapons/Melee/Basher.png b/Items/Weapons/Melee/Basher.png index 83c3c73eb9..f16271533b 100644 Binary files a/Items/Weapons/Melee/Basher.png and b/Items/Weapons/Melee/Basher.png differ diff --git a/Items/Weapons/Melee/EutrophicScimitar.cs b/Items/Weapons/Melee/EutrophicScimitar.cs index 4c84e25fce..e018ff715f 100644 --- a/Items/Weapons/Melee/EutrophicScimitar.cs +++ b/Items/Weapons/Melee/EutrophicScimitar.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 130; item.melee = true; - item.width = 46; - item.height = 76; + item.width = 64; + item.height = 78; item.useTime = 38; item.useAnimation = 38; item.useStyle = 1; diff --git a/Items/Weapons/Melee/EutrophicScimitar.png b/Items/Weapons/Melee/EutrophicScimitar.png index e1ea0cabc0..19e2e407c2 100644 Binary files a/Items/Weapons/Melee/EutrophicScimitar.png and b/Items/Weapons/Melee/EutrophicScimitar.png differ diff --git a/Items/Weapons/Melee/EutrophicShank.png b/Items/Weapons/Melee/EutrophicShank.png index b3cc388ab2..80385dbda9 100644 Binary files a/Items/Weapons/Melee/EutrophicShank.png and b/Items/Weapons/Melee/EutrophicShank.png differ diff --git a/Items/Weapons/Melee/FlameburstShortsword.png b/Items/Weapons/Melee/FlameburstShortsword.png index 1c6d747f39..8e988964c5 100644 Binary files a/Items/Weapons/Melee/FlameburstShortsword.png and b/Items/Weapons/Melee/FlameburstShortsword.png differ diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 5472f829f8..82ca44962d 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 = 400; + item.damage = 390; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index 02abe5e56d..9abe8467c3 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 1800; + item.damage = 2000; item.melee = true; item.noMelee = true; item.noUseGraphic = true; @@ -72,11 +72,11 @@ namespace CalamityMod.Items.Weapons.Melee { num146++; } - if (Main.rand.NextBool(8)) + if (Main.rand.NextBool(6)) { num146++; } - if (Main.rand.NextBool(16)) + if (Main.rand.NextBool(8)) { num146++; } diff --git a/Items/Weapons/Ranged/ClamorRifle.png b/Items/Weapons/Ranged/ClamorRifle.png index 8545e91138..b582e1741e 100644 Binary files a/Items/Weapons/Ranged/ClamorRifle.png and b/Items/Weapons/Ranged/ClamorRifle.png differ diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 645ba6085d..37fad3b6a0 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -37,18 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.Developer; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 65ec6f5800..c5e2504f85 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -38,18 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 318f9615ee..a8da8a5f06 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -67,14 +67,10 @@ Right click to fire two devastating barrages of five empowered fireballs. item.useTime = 9; item.reuseDelay = 0; item.noUseGraphic = true; - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } + if (player.ownedProjectileCounts[item.shoot] > 0) + { + return false; + } } return base.CanUseItem(player); } diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 611f09566a..cd034864dc 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 = 170; + item.damage = 200; item.ranged = true; item.width = 76; item.height = 46; diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index aba4566f01..633c0a71c1 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -36,18 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 30f; //30 } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index 4966c4dadc..98dea6a3bc 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -41,18 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 18f; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index e0b2e0c08c..475e69dd03 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -38,18 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.RareVariant; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/P90.png b/Items/Weapons/Ranged/P90.png index 0d799d8343..1235a193a8 100644 Binary files a/Items/Weapons/Ranged/P90.png and b/Items/Weapons/Ranged/P90.png differ diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 59667ebada..f18afe61dd 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -39,18 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index fdcf23884d..fcae1c8324 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SDMG); - recipe.AddIngredient(ItemID.ShrimpyTruffle); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 10); diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index 953de6b4f2..9cb2ab7352 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.rare = 10; item.UseSound = SoundID.Item10; item.autoReuse = true; - item.shootSpeed = 25f; + item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index 79df55f07f..f60078e36b 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -41,18 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index b74cb0bb84..62b679f2a1 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 175; item.ranged = true; item.width = 50; item.height = 30; - item.useTime = 30; - item.useAnimation = 30; + item.useTime = 40; + item.useAnimation = 40; item.useStyle = 5; item.noMelee = true; item.knockBack = 7f; diff --git a/Items/Weapons/Ranged/Toxibow.png b/Items/Weapons/Ranged/Toxibow.png index 5dd229fab9..ea00ae318e 100644 Binary files a/Items/Weapons/Ranged/Toxibow.png and b/Items/Weapons/Ranged/Toxibow.png differ diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index 62c8960e0a..ed97b542ef 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; + item.damage = 80; item.ranged = true; item.width = 46; item.height = 24; diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index ec28b21cf0..d310cb8223 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 74; - item.damage = 160; + item.damage = 110; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 12; diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index cf59053e0c..3eaf8da0eb 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 42; - item.damage = 465; + item.damage = 400; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 15; diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs index 299761cb15..491cb3d31e 100644 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ b/Items/Weapons/Rogue/RoyalKnives.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 18; - item.damage = 1800; + item.damage = 2000; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 12; @@ -72,11 +72,11 @@ namespace CalamityMod.Items.Weapons.Rogue { num146++; } - if (Main.rand.NextBool(8)) + if (Main.rand.NextBool(6)) { num146++; } - if (Main.rand.NextBool(16)) + if (Main.rand.NextBool(8)) { num146++; } diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs new file mode 100644 index 0000000000..5e7e7d6e61 --- /dev/null +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -0,0 +1,55 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class SkyfinBombers : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyfin Bombers"); + Tooltip.SetDefault("Fishy bombers inbound!\n" + + "Launches a skyfin nuke that homes in on enemies below it\n" + + "Stealth strikes throw three skyfin nukes that home in regardless of enemy position"); + } + + public override void SafeSetDefaults() + { + item.width = 28; + item.damage = 40; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 35; + item.useStyle = 1; + item.useTime = 35; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.height = 30; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + for (int i = -8; i <= 8; i += 8) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + int stealth = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + } + return false; + } + return true; + } + } +} diff --git a/Items/Weapons/Rogue/SkyfinBombers.png b/Items/Weapons/Rogue/SkyfinBombers.png new file mode 100644 index 0000000000..c0f0586af0 Binary files /dev/null and b/Items/Weapons/Rogue/SkyfinBombers.png differ diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index ecf0c0d655..2e7c0109e6 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -11,15 +11,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Toxicant Twister"); - Tooltip.SetDefault("Releases a fast boomerang\n" + - "Stealth strikes cause the boomerang to go much faster and release sand rapidly"); + Tooltip.SetDefault("Throws a speedy boomerang\n" + + "Stealth strikes fire two boomerangs that go much faster and release sand rapidly"); } public override void SafeSetDefaults() { item.width = 42; item.height = 46; - item.damage = 820; + item.damage = 950; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = item.useTime = 20; @@ -37,16 +37,39 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + int projType = item.shoot; + if (Main.rand.NextBool(2)) + { + projType = ModContent.ProjectileType(); + } - Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - if (Main.projectile[stealth].Calamity().stealthStrike) - { - Main.projectile[stealth].velocity *= 1.5f; - Main.projectile[stealth].timeLeft = 420; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].localNPCHitCooldown = 6; - } + if (player.Calamity().StealthStrikeAvailable()) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Main.projectile[stealth2].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (Main.projectile[stealth].Calamity().stealthStrike) + { + Main.projectile[stealth].velocity *= 1.5f; + Main.projectile[stealth].timeLeft = 420; + Main.projectile[stealth].penetrate = -1; + Main.projectile[stealth].localNPCHitCooldown = 6; + } + if (Main.projectile[stealth2].Calamity().stealthStrike) + { + Main.projectile[stealth2].penetrate += 2; + Main.projectile[stealth2].localNPCHitCooldown = 8; + } + } + else + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), projType, damage, knockBack, player.whoAmI, 0f, 0f); + } return false; } } diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index bdbd538339..f83c0ec086 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.mana = 99; - item.damage = 1003; + item.damage = 963; item.useStyle = 1; item.width = 74; item.height = 72; @@ -43,20 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; } - public override bool CanUseItem(Player player) - { - if (player.maxMinions < 5) - return false; - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 5; public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 3178baba4a..cf74b2e061 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 = 680; + item.damage = 640; item.mana = 32; item.summon = true; item.sentry = true; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 3eb9a6a2d1..0136f9bd61 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -42,12 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool CanUseItem(Player player) - { - if (player.maxMinions < 10) - return false; - return player.ownedProjectileCounts[item.shoot] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 10; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 1321b1ca0e..a99819178c 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -36,12 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) - { - if (player.maxMinions < 2) - return false; - return true; - } + public override bool CanUseItem(Player player) => player.maxMinions >= 2; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 9b210abe64..05e87d7b71 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 = 50; + item.damage = 40; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 15; diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 667ce31882..e0b19b0df9 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -44,12 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon return false; } - public override bool CanUseItem(Player player) - { - if (player.maxMinions < 5) - return false; - return player.ownedProjectileCounts[item.shoot] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 5; public override void AddRecipes() { diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 6c1712469e..af4814d224 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 20; + item.damage = 25; item.mana = 10; item.width = 52; item.height = 52; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index d69e947a43..f22e5764d3 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -38,12 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; } - public override bool CanUseItem(Player player) - { - if (player.maxMinions < 2) - return false; - return player.ownedProjectileCounts[item.shoot] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 2; public override void AddRecipes() { diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index fb206253f8..75abcd913e 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 35; + item.damage = 30; item.mana = 10; item.width = 48; item.height = 56; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; speedX = 0; speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/ShellfishStaff.png b/Items/Weapons/Summon/ShellfishStaff.png index e03d0fbb5f..f7ba32fcec 100644 Binary files a/Items/Weapons/Summon/ShellfishStaff.png and b/Items/Weapons/Summon/ShellfishStaff.png differ diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 38da32386b..d20160ce12 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; speedX = 0; speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, siriusSlots); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, siriusSlots, 30f); return false; } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index f3bfb2b9b2..e1d1971921 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -25,6 +25,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -107,7 +108,8 @@ namespace CalamityMod private static readonly Dictionary InvasionDifficulty = new Dictionary { { "Acid Rain Initial", 2.4f }, - { "Acid Rain Aquatic Scourge", 8.51f } + { "Acid Rain Aquatic Scourge", 8.51f }, + { "Acid Rain Polterghast", 16.49f } }; public static void Setup() @@ -557,15 +559,30 @@ namespace CalamityMod { InvasionDifficulty.TryGetValue("Acid Rain Aquatic Scourge", out float order); List enemies = AcidRainEvent.PossibleEnemiesAS.Select(enemy => enemy.Item1).ToList(); + enemies.Add(ModContent.NPCType()); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; 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/Events/AcidRainT1_BossChecklist"; + string bossLogTex = "CalamityMod/Events/AcidRainT2_BossChecklist"; string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; AddInvasion(bossChecklist, calamity, "Acid Rain (Post-AS)", order, enemies, DownedAcidRainHardmode, summon, loot, collection, instructions, despawn, bossLogTex, iconTexture); } + // Post-Polterghast Acid Rain + { + InvasionDifficulty.TryGetValue("Acid Rain Polterghast", out float order); + List enemies = AcidRainEvent.PossibleEnemiesPolter.Select(enemy => enemy.Item1).ToList(); + enemies.Add(ModContent.NPCType()); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType() }; + string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Polterghast 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/Events/AcidRainT2_BossChecklist"; + string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon"; + AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Polter)", order, enemies, DownedBoomerDuke, summon, loot, collection, instructions, despawn, bossLogTex, iconTexture); + } } private static void AddCalamityBossLoot(Mod bossChecklist) @@ -822,7 +839,7 @@ namespace CalamityMod sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); - sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/Abyss/AnthozoanCrab.cs b/NPCs/Abyss/AnthozoanCrab.cs new file mode 100644 index 0000000000..2fa3acd8d7 --- /dev/null +++ b/NPCs/Abyss/AnthozoanCrab.cs @@ -0,0 +1,215 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Abyss +{ + public class AnthozoanCrab : ModNPC + { + public int boulderIndex; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anthozoan Crab"); + Main.npcFrameCount[npc.type] = 16; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 45; + npc.width = 56; + npc.height = 42; + npc.defense = 22; + npc.lifeMax = 920; + npc.aiStyle = aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit38; + npc.DeathSound = SoundID.NPCDeath46; + npc.knockBackResist = 0.04f; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(boulderIndex); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + boulderIndex = reader.ReadInt32(); + } + public override void AI() + { + if (npc.ai[1]++ % 360f < 280f) + { + if (npc.ai[2] > 1f) + { + npc.ai[2]--; + } + npc.aiAction = 0; + if (npc.ai[2] == 0f) + { + npc.ai[0] = -90f; + npc.ai[2] = 1f; + npc.TargetClosest(true); + } + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + if (npc.velocity.Y == 0f && !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (npc.collideY && npc.oldVelocity.Y != 0f && Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.position.X -= npc.velocity.X + npc.direction; + } + if (npc.ai[3] == npc.position.X) + { + npc.direction *= -1; + npc.ai[2] = 200f; + } + npc.spriteDirection = npc.direction; + npc.ai[3] = 0f; + npc.velocity.X *= 0.8f; + if (Math.Abs(npc.velocity.X) < 0.1f) + { + npc.velocity.X = 0f; + } + + npc.ai[0] += 5f; + + int state = 0; + if (npc.ai[0] >= 0f) + { + state = 1; + } + if (npc.ai[0] >= -1000f && npc.ai[0] <= -500f) + { + state = 2; + } + if (npc.ai[0] >= -2000f && npc.ai[0] <= -1500f) + { + state = 3; + } + if (state > 0) + { + npc.netUpdate = true; + if (state == 3) + { + npc.velocity.Y -= 9f; + npc.velocity.X += 8f * npc.direction; + npc.ai[0] = -120f; + npc.ai[3] = npc.position.X; + } + else + { + npc.velocity.Y -= 8f; + npc.velocity.X += 11f * npc.direction; + npc.ai[0] = -80f; + if (state == 1) + { + npc.ai[0] -= 1000f; + } + else + { + npc.ai[0] -= 2000f; + } + } + } + else if (npc.ai[0] >= -30f) + { + npc.aiAction = 1; + return; + } + } + else if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.direction = npc.spriteDirection = (npc.DirectionTo(player.Center).X < 0).ToDirectionInt(); + if (Math.Abs(npc.velocity.X) < 14f && Math.Abs(player.Center.X - npc.Center.X) > 65f) + { + npc.velocity.X += npc.spriteDirection * -0.08f; + } + } + } + else + { + npc.velocity.X *= 0.9f; + if (npc.ai[1] % 360f == 300f) + { + npc.velocity.X = 0f; + Vector2 rockSpawnPosition = new Vector2(16f * -npc.spriteDirection + npc.Center.X, npc.Bottom.Y - 6f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + boulderIndex = Projectile.NewProjectile(rockSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 29, 6f); + npc.netUpdate = true; + } + } + if (npc.ai[1] % 360f == 330f) + { + Main.projectile[boulderIndex].velocity = new Vector2(0f, -11f).RotatedBy(-npc.spriteDirection * 0.8f); + boulderIndex = -1; + npc.netUpdate = true; + } + } + npc.velocity.Y += 0.25f; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.ai[1] % 360f < 280f) + { + if (npc.frameCounter % 6 == 5) + { + npc.frame.Y += frameHeight; + if (npc.frame.Y >= 4 * frameHeight) + { + npc.frame.Y = frameHeight; + } + } + } + else + { + npc.frame.Y = 3 * frameHeight + frameHeight * (int)MathHelper.Clamp(npc.ai[1] % 280f / 60f * 9, 0, 9); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + { + return 0f; + } + return 0.135f; + } + + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore2"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/AnthozoanCrabGore3"), npc.scale); + } + } + } +} diff --git a/NPCs/Abyss/AnthozoanCrab.png b/NPCs/Abyss/AnthozoanCrab.png new file mode 100644 index 0000000000..caded1ddc2 Binary files /dev/null and b/NPCs/Abyss/AnthozoanCrab.png differ diff --git a/NPCs/Abyss/BelchingCoral.cs b/NPCs/Abyss/BelchingCoral.cs new file mode 100644 index 0000000000..7b8b8de2b3 --- /dev/null +++ b/NPCs/Abyss/BelchingCoral.cs @@ -0,0 +1,87 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Abyss +{ + public class BelchingCoral : ModNPC + { + public const float CheckDistance = 480f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Belching Coral"); + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 45; + npc.width = 54; + npc.height = 42; + npc.defense = 25; + npc.lifeMax = 1000; + npc.aiStyle = aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 3, 50); + npc.HitSound = SoundID.NPCHit42; + npc.DeathSound = SoundID.NPCDeath5; + npc.knockBackResist = 0f; + // banner = npc.type; + // bannerItem = ModContent.ItemType(); + } + public override void AI() + { + npc.velocity.Y += 0.25f; + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + if (Math.Abs(player.Center.X - npc.Center.X) < CheckDistance && player.Bottom.Y < npc.Top.Y) + { + if (npc.ai[0]++ % 35f == 34f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 velocity = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-11f, -6f)); + Projectile.NewProjectile(npc.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType(), 27, 3f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + { + return 0f; + } + return 0.085f; + } + + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/BelchingCoralGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/BelchingCoralGore2"), npc.scale); + } + } + } +} diff --git a/NPCs/Abyss/BelchingCoral.png b/NPCs/Abyss/BelchingCoral.png new file mode 100644 index 0000000000..1e4d9b0c00 Binary files /dev/null and b/NPCs/Abyss/BelchingCoral.png differ diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 2d9392f00e..47f86a1bd4 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Abyss public override void SetStaticDefaults() { DisplayName.SetDefault("Devil Fish"); - Main.npcFrameCount[npc.type] = 8; + Main.npcFrameCount[npc.type] = 16; } public override void SetDefaults() @@ -76,9 +76,10 @@ namespace CalamityMod.NPCs.Abyss brokenMask = true; npc.HitSound = SoundID.NPCHit1; npc.defense = 15; - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask3"), 1f); + for(int i = 1; i < 4; i++) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask" + i), 1f); + } Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); } @@ -244,24 +245,20 @@ namespace CalamityMod.NPCs.Abyss if (npc.frameCounter > 6.0) { npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; + npc.frame.Y += frameHeight; } if (!brokenMask) { - if (npc.frame.Y > frameHeight * 3) + if (npc.frame.Y > frameHeight * 7) { npc.frame.Y = 0; } } else { - if (npc.frame.Y < frameHeight * 4) + if (npc.frame.Y < frameHeight * 8 || npc.frame.Y > frameHeight * 15) { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 4; + npc.frame.Y = frameHeight * 8; } } } @@ -297,11 +294,11 @@ namespace CalamityMod.NPCs.Abyss { if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; + return SpawnCondition.CaveJellyfish.Chance * 0.225f; } if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + return SpawnCondition.CaveJellyfish.Chance * 0.3f; } return 0f; } diff --git a/NPCs/Abyss/DevilFish.png b/NPCs/Abyss/DevilFish.png index cf7e7e2349..37c2569b1a 100644 Binary files a/NPCs/Abyss/DevilFish.png and b/NPCs/Abyss/DevilFish.png differ diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs new file mode 100644 index 0000000000..1acd7e7e22 --- /dev/null +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -0,0 +1,336 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.Abyss +{ + public class DevilFishAlt : ModNPC + { + public bool brokenMask = false; + public int hitCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil Fish"); + Main.npcFrameCount[npc.type] = 16; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 60; + npc.width = 126; + npc.height = 66; + npc.defense = 999999; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[ModContent.BuffType()] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(brokenMask); + writer.Write(hitCounter); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + brokenMask = reader.ReadBoolean(); + hitCounter = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Player player = Main.player[npc.target]; + float speedBoost = brokenMask ? 1.5f : 1; + npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + npc.chaseable = brokenMask; + + if (hitCounter >= 5 && !brokenMask) + { + brokenMask = true; + npc.HitSound = SoundID.NPCHit1; + npc.defense = 15; + for (int i = 1; i < 4; i++) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask" + i + (i == 3 ? "Alt" : "")), 1f); + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); + } + + if (npc.wet) + { + bool flag14 = brokenMask; + npc.TargetClosest(false); + if (player.statLife <= player.statLifeMax2 / 4) + { + flag14 = true; + } + if ((!player.wet || player.dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; + float velocity = CalamityWorld.death ? 12f : 6f; + if (npc.velocity.X > velocity * speedBoost) + { + npc.velocity.X = velocity * speedBoost; + } + if (npc.velocity.X < -velocity * speedBoost) + { + npc.velocity.X = -velocity * speedBoost; + } + if (npc.velocity.Y > velocity * speedBoost) + { + npc.velocity.Y = velocity * speedBoost; + } + if (npc.velocity.Y < -velocity * speedBoost) + { + npc.velocity.Y = -velocity * speedBoost; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid > 128) + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + { + return brokenMask; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y += frameHeight; + } + if (!brokenMask) + { + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 8 || npc.frame.Y > frameHeight * 15) + { + npc.frame.Y = frameHeight * 8; + } + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/DevilFishGlowAlt"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(ModContent.BuffType(), 120, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.Calamity().ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.225f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } + + public override void NPCLoot() + { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, 1000000, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 200, 1, 1); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + } + } + + if (hitCounter <= 5) + { + ++hitCounter; + } + } + } +} diff --git a/NPCs/Abyss/DevilFishAlt.png b/NPCs/Abyss/DevilFishAlt.png new file mode 100644 index 0000000000..270cc77c58 Binary files /dev/null and b/NPCs/Abyss/DevilFishAlt.png differ diff --git a/NPCs/Abyss/DevilFishGlow.png b/NPCs/Abyss/DevilFishGlow.png index 578db358d9..de41839ade 100644 Binary files a/NPCs/Abyss/DevilFishGlow.png and b/NPCs/Abyss/DevilFishGlow.png differ diff --git a/NPCs/Abyss/DevilFishGlowAlt.png b/NPCs/Abyss/DevilFishGlowAlt.png new file mode 100644 index 0000000000..de41839ade Binary files /dev/null and b/NPCs/Abyss/DevilFishGlowAlt.png differ diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index fbe8697660..269585c2a0 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 72; npc.height = 18; - npc.damage = 40; - npc.lifeMax = 260; + npc.damage = 20; + npc.lifeMax = 100; npc.defense = 4; if (CalamityWorld.downedPolterghast) diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs new file mode 100644 index 0000000000..987102202f --- /dev/null +++ b/NPCs/AcidRain/CragmawMire.cs @@ -0,0 +1,270 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +namespace CalamityMod.NPCs.AcidRain +{ + public class CragmawMire : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cragmaw Mire"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.width = 68; + npc.height = 54; + npc.aiStyle = aiType = -1; + + npc.damage = 66; + npc.lifeMax = 6000; + npc.defense = 25; + + if (CalamityWorld.downedPolterghast) + { + npc.damage = 160; + npc.lifeMax = 146600; + npc.defense = 80; + } + + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 3, 60, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + public bool Phase2 + { + get + { + float ratio = CalamityWorld.revenge ? 0.85f : 0.7f; + return npc.life / (float)npc.lifeMax < ratio && CalamityWorld.downedPolterghast; + } + } + public override void AI() + { + npc.TargetClosest(false); + Player player = Main.player[npc.target]; + + npc.ai[0]++; + + // Summons a spinning spiral of dust and a dust telegraph + if (npc.ai[0] % 420f > 240f && npc.ai[0] % 420f < 300f) + { + float vectorRotationAngle = (npc.ai[0] % 420f - 240f) / 60f * MathHelper.Pi * 4f; + for (int i = 0; i < 25; i++) + { + float angle = MathHelper.TwoPi * i / 25f; + float y = (float)Math.Sin(angle) * (float)Math.Log(Math.Abs(Math.Cos(angle))); + if (!float.IsNaN(y)) + { + Vector2 velocity = new Vector2((float)Math.Cos(angle), y) * MathHelper.Lerp(2.4f, 4.2f, (npc.ai[0] - 240f) / 60f); + Dust dust = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = velocity.RotatedBy(vectorRotationAngle); + dust.noGravity = true; + dust.scale = MathHelper.Lerp(1.2f, 2.5f, (npc.ai[0] - 240f) / 60f); + } + } + + float length = MathHelper.Lerp(20f, 1200f, (npc.ai[0] % 420f - 240f) / 60f); + float outwardness = 1f - (npc.ai[0] % 420f - 240f) / 60f; + for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - length; i -= 6f) + { + float angle = i / 32f; + vectorRotationAngle = -(i / 20f) % 0.4f - 0.2f; + Vector2 spawnPosition = new Vector2(npc.Center.X, i); + Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid); + dust.scale = 1.5f; + dust.velocity = (Vector2.UnitX * (float)Math.Cos(angle) * 4f * outwardness).RotatedBy(vectorRotationAngle); + dust.noGravity = true; + } + } + // Release a laser beam and create an explosion + if (npc.ai[0] % 420f == 300f) + { + npc.ai[1] = Main.rand.NextFloat(3f); + npc.ai[2] = 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 + int damage = CalamityWorld.downedPolterghast ? 120 : 40; + Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 4f, Main.myPlayer, 0f, npc.whoAmI); + } + Vector2 circlePointVector = -Vector2.UnitY; + float lerpStart = Main.rand.Next(12, 16); + float lerpEnd = Main.rand.Next(3, 6); + for (int h = 0; h < 4; h++) + { + for (float i = 0; i < 9f; ++i) + { + for (int j = 0; j < 2; ++j) + { + Vector2 randomCirclePointRotated = circlePointVector.RotatedBy((j == 0 ? 1 : -1) * MathHelper.TwoPi / 18f).RotatedBy(h / 4f * MathHelper.Pi); + for (float k = 0f; k < 20f; ++k) + { + Vector2 randomCirclePointLerped = Vector2.Lerp(circlePointVector, randomCirclePointRotated, k / 20f); + float lerpMultiplier = MathHelper.Lerp(lerpStart, lerpEnd, k / 20f) * 0.9f; + int dustIndex = Dust.NewDust(npc.Top + 6f * Vector2.UnitY, 0, 0, + (int)CalamityDusts.SulfurousSeaAcid, + 0f, 0f, 100, default, 1.3f); + Main.dust[dustIndex].noGravity = true; + Main.dust[dustIndex].scale = 2f; + Main.dust[dustIndex].velocity = randomCirclePointLerped * lerpMultiplier; + } + } + + circlePointVector = circlePointVector.RotatedBy(MathHelper.TwoPi / 9f); + } + } + } + + if (!Phase2) + { + npc.Calamity().DR = 0.5f; + if (!player.wet) + npc.Calamity().DR = 0.9f; + npc.HitSound = SoundID.NPCHit42; + if (npc.ai[0] % 420f < 240f) + { + float bubbleShootTimer = CalamityWorld.downedPolterghast ? 24f : 50f; + if (npc.ai[0] % bubbleShootTimer == bubbleShootTimer - 1f && Main.netMode != NetmodeID.MultiplayerClient) + { + int damage = CalamityWorld.downedPolterghast ? 47 : 30; + int idx = Projectile.NewProjectile(npc.Top + new Vector2(0f, 5f), -Vector2.UnitY.RotatedByRandom(0.25f) * 4f, ModContent.ProjectileType(), damage, 1f); + Main.projectile[idx].timeLeft = Main.rand.Next(120, 180); + Main.projectile[idx].netUpdate = true; + } + if (npc.ai[0] % 50f == 49f && Main.rand.NextBool(4)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List possibleEnemies = new List(); + if (CalamityWorld.downedPolterghast) + { + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + } + else + { + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + } + + Vector2 spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -360f, 360f); + int attempts = 0; + while (!WorldGen.InWorld((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)) + { + spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -360f, 360f); + attempts++; + if (attempts > 200) + return; + } + attempts = 0; + + while (CalamityUtils.TileSelectionSolidSquare((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16, 4, 4) || + CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16).liquid != 255) + { + spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -420f, 420f); + attempts++; + if (attempts > 300) + return; + } + + NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, Utils.SelectRandom(Main.rand, possibleEnemies.ToArray())); + } + } + } + } + else + { + if (npc.localAI[0] == 0f) + { + Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore"), npc.scale); + Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore2"), npc.scale); + Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore3"), npc.scale); + npc.localAI[0] = 1f; + } + npc.Calamity().DR = 0.125f; + npc.HitSound = SoundID.NPCHit1; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] % 600f == 20f) + { + Projectile.NewProjectile(npc.Center, Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, 0, npc.whoAmI, npc.target); + } + if (npc.ai[0] % 600f == 240f) + { + int damage = CalamityWorld.downedPolterghast ? 52 : 33; + for (int i = 0; i < 16; i++) + { + float angle = MathHelper.TwoPi / 16f * i; + float angleDelta = Main.rand.NextFloat(MathHelper.TwoPi / 16f) * 0.6f; + angle += angleDelta - angleDelta / 2f; + Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 6f, ModContent.ProjectileType(), damage, 4f); + } + } + } + } + } + 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 bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Phase2 ? ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire2") : ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire"); + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + return false; + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter % 6 == 5) + { + npc.frame.Y += frameHeight; + } + if (npc.frame.Y >= frameHeight * 2) + { + npc.frame.Y = 0; + } + } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); + } + } +} diff --git a/NPCs/AcidRain/CragmawMire.png b/NPCs/AcidRain/CragmawMire.png new file mode 100644 index 0000000000..7a90b8cc87 Binary files /dev/null and b/NPCs/AcidRain/CragmawMire.png differ diff --git a/NPCs/AcidRain/CragmawMire2.png b/NPCs/AcidRain/CragmawMire2.png new file mode 100644 index 0000000000..7ae8674bf1 Binary files /dev/null and b/NPCs/AcidRain/CragmawMire2.png differ diff --git a/NPCs/AcidRain/FlakBaby.cs b/NPCs/AcidRain/FlakBaby.cs index 93c8a3eda0..8260c49973 100644 --- a/NPCs/AcidRain/FlakBaby.cs +++ b/NPCs/AcidRain/FlakBaby.cs @@ -128,7 +128,7 @@ namespace CalamityMod.NPCs.AcidRain } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) + if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 526a7e8480..5c0bbcbd76 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Enemy; @@ -176,6 +177,8 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/GammaSlimeGore"), npc.scale); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/GammaSlimeGore2"), npc.scale); } } @@ -189,6 +192,11 @@ namespace CalamityMod.NPCs.AcidRain } } + public override void NPCLoot() + { + 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/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 0ac56d9050..3866837a48 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -24,8 +24,8 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 40; npc.height = 30; - npc.damage = 40; - npc.lifeMax = 300; + npc.damage = 75; + npc.lifeMax = 640; npc.defense = 5; if (CalamityWorld.downedPolterghast) @@ -34,11 +34,6 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 5995; npc.defense = 60; } - else if (CalamityWorld.downedAquaticScourge) - { - npc.damage = 75; - npc.lifeMax = 640; - } npc.knockBackResist = 0f; animationType = 81; @@ -64,7 +59,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.downedAquaticScourge && !Main.player[npc.target].dead && CalamityWorld.rainingAcid) + if (!Main.player[npc.target].dead) { npc.aiStyle = aiType = -1; diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index a8ef52ed3e..42b465bfa4 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -25,8 +25,8 @@ namespace CalamityMod.NPCs.AcidRain npc.aiStyle = aiType = -1; - npc.damage = 20; - npc.lifeMax = 250; + npc.damage = 15; + npc.lifeMax = 120; npc.defense = 3; if (CalamityWorld.downedPolterghast) @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.AcidRain { if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = CalamityWorld.downedAquaticScourge ? 27 : 17; + int damage = CalamityWorld.downedAquaticScourge ? 27 : 10; float speed = Main.rand.NextFloat(6f, 9f); if (CalamityWorld.downedPolterghast) { diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 0d8d9b5a5f..73b897fa45 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -24,11 +24,11 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { npc.aiStyle = 67; - npc.damage = 50; + npc.damage = 10; npc.width = 24; npc.height = 24; npc.defense = 5; - npc.lifeMax = 200; + npc.lifeMax = 100; if (CalamityWorld.downedPolterghast) { diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index c6d681a293..87fa304f56 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -27,8 +28,8 @@ namespace CalamityMod.NPCs.AcidRain npc.height = 22; npc.aiStyle = aiType = -1; - npc.damage = 40; - npc.lifeMax = 360; + npc.damage = 18; + npc.lifeMax = 150; npc.defense = 6; if (CalamityWorld.downedPolterghast) @@ -160,6 +161,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 2 * (CalamityWorld.downedAquaticScourge ? 6 : 1), 1, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index bbccc0ccc7..59faca8adb 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 26; npc.height = 14; - npc.damage = 56; - npc.lifeMax = 130; + npc.damage = 30; + npc.lifeMax = 80; npc.defense = 0; if (CalamityWorld.downedPolterghast) diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 16e414fa7a..3b067bfe73 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.AquaticScourge } // If Aquatic Scourge has not yet been killed, notify players of buffed Acid Rain - if (!CalamityWorld.downedAstrageldon) + if (!CalamityWorld.downedAquaticScourge) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index ee016f6451..f28a9e0604 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -1,8 +1,12 @@ +using Microsoft.Xna.Framework; +using MonoMod.Cil; +using System; using CalamityMod.Dusts; using CalamityMod.Items.Critters; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs.Astral { @@ -81,5 +85,76 @@ namespace CalamityMod.NPCs.Astral return; } } + + /// I don't think this works btw. Copying from ExampleCritter.cs failed me ~Ben =( + /// + private void HookStatue(ILContext il) + { + // obtain a cursor positioned before the first instruction of the method + // the cursor is used for navigating and modifying the il + var c = new ILCursor(il); + + // the exact location for this hook is very complex to search for due to the hook instructions not being unique, and buried deep in control flow + // switch statements are sometimes compiled to if-else chains, and debug builds litter the code with no-ops and redundant locals + + // in general you want to search using structure and function rather than numerical constants which may change across different versions or compile settings + // using local variable indices is almost always a bad idea + + // we can search for + // switch (*) + // case 54: + // Utils.SelectRandom * + + // in general you'd want to look for a specific switch variable, or perhaps the containing switch (type) { case 105: + // but the generated IL is really variable and hard to match in this case + + // we'll just use the fact that there are no other switch statements with case 54, followed by a SelectRandom + + ILLabel[] targets = null; + while (c.TryGotoNext(i => i.MatchSwitch(out targets))) + { + // some optimising compilers generate a sub so that all the switch cases start at 0 + // ldc.i4.s 51 + // sub + // switch + int offset = 0; + if (c.Prev.MatchSub() && c.Prev.Previous.MatchLdcI4(out offset)) + { + ; + } + + // not enough switch instructions + if (targets.Length < 54 - offset) + { + continue; + } + + var target = targets[54 - offset]; + if (target == null) + { + continue; + } + + // move the cursor to case 54: + c.GotoLabel(target); + // there's lots of extra checks we could add here to make sure we're at the right spot, such as not encountering any branching instructions + c.GotoNext(i => i.MatchCall(typeof(Utils), nameof(Utils.SelectRandom))); + + // goto next positions us before the instruction we searched for, so we can insert our array modifying code right here + c.EmitDelegate>(arr => + { + // resize the array and add our custom firefly + Array.Resize(ref arr, arr.Length+1); + arr[arr.Length-1] = (short)ModContent.NPCType(); + return arr; + }); + + // hook applied successfully + return; + } + + // couldn't find the right place to insert + throw new Exception("Hook location not found, switch(*) { case 54: ..."); + } } } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 83a636f6bf..af0f1fcfed 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -5511,5 +5511,172 @@ namespace CalamityMod.NPCs } } #endregion + + #region Gem Crawler AI + public static void GemCrawlerAI(NPC npc, Mod mod, float speedDetect, float speedAdditive) + { + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float xDist = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float yDist = Main.player[npc.target].position.Y - vector19.Y; + float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (targetDist < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = speedDetect; //5 + float num70 = speedAdditive; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + #endregion } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 8613bd9e5d..549575fb59 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3345,7 +3345,7 @@ namespace CalamityMod.NPCs projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; damage = (int)((double)damage * 0.75); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == (ModContent.ProjectileType() | ModContent.ProjectileType())) { damage = (int)((double)damage * 0.5); } @@ -3405,7 +3405,11 @@ namespace CalamityMod.NPCs } else if (npc.type == ModContent.NPCType()) { - if (projectile.type == (ModContent.ProjectileType() | ModContent.ProjectileType() | ModContent.ProjectileType() | ModContent.ProjectileType())) + if (projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.4); + } + if (projectile.type == (ModContent.ProjectileType() | ModContent.ProjectileType() | ModContent.ProjectileType())) { damage = (int)(damage * 0.6); } @@ -3415,64 +3419,67 @@ namespace CalamityMod.NPCs } } - if (modPlayer.eGauntlet) - { - if (projectile.melee && ShouldAffectNPC(npc) && !projectile.npcProj && Main.rand.NextBool(15)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - damage = npc.lifeMax * 3; - } - } - } - - if (modPlayer.eTalisman) - { - if (projectile.magic && ShouldAffectNPC(npc) && !projectile.npcProj && Main.rand.NextBool(15)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - damage = npc.lifeMax * 3; - } - } - } - - if (modPlayer.nanotech) - { - if (projectile.Calamity().rogue && ShouldAffectNPC(npc) && !projectile.npcProj && Main.rand.NextBool(15)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - damage = npc.lifeMax * 3; - } - } - } - - if (modPlayer.eQuiver) - { - if (projectile.ranged && ShouldAffectNPC(npc) && !projectile.npcProj && Main.rand.NextBool(15)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - damage = npc.lifeMax * 3; - } - } - } - - if (modPlayer.statisBeltOfCurses) - { - if ((projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && !projectile.npcProj && Main.rand.NextBool(15)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - damage = npc.lifeMax * 3; - } - } - } - - if (projectile.ranged && modPlayer.plagueReaper && pFlames > 0) + if (!projectile.npcProj && !projectile.trap) { - damage = (int)(damage * 1.1); + if (modPlayer.eGauntlet) + { + if (projectile.melee && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + damage = npc.lifeMax * 3; + } + } + } + + if (modPlayer.eTalisman) + { + if (projectile.magic && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + damage = npc.lifeMax * 3; + } + } + } + + if (modPlayer.nanotech) + { + if (projectile.Calamity().rogue && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + damage = npc.lifeMax * 3; + } + } + } + + if (modPlayer.eQuiver) + { + if (projectile.ranged && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + damage = npc.lifeMax * 3; + } + } + } + + if (modPlayer.nucleogenesis) + { + if ((projectile.minion || projectile.sentry || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type] || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + damage = npc.lifeMax * 3; + } + } + } + + if (projectile.ranged && modPlayer.plagueReaper && pFlames > 0) + { + damage = (int)(damage * 1.1); + } } } #endregion @@ -3770,6 +3777,11 @@ namespace CalamityMod.NPCs { spawnRate = Main.hardMode ? 36 : 33; maxSpawns = Main.hardMode ? 15 : 12; + if (AcidRainEvent.AnyRainMinibosses) + { + maxSpawns = 5; + spawnRate *= 2; + } } } } @@ -3906,15 +3918,29 @@ namespace CalamityMod.NPCs if (!(CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 2)) { List<(int, int)> PossibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; + List PossibleMinibosses = new List(); if (CalamityWorld.downedAquaticScourge) + { PossibleEnemies = AcidRainEvent.PossibleEnemiesAS; + PossibleMinibosses = AcidRainEvent.PossibleMinibossesAS; + } if (CalamityWorld.downedPolterghast) + { PossibleEnemies = AcidRainEvent.PossibleEnemiesPolter; + PossibleMinibosses = AcidRainEvent.PossibleMinibossesPolter; + } foreach (int enemy in PossibleEnemies.Select(enemyType => enemyType.Item1)) { pool.Add(enemy, 1f); } - pool.Add(ModContent.NPCType(), 0.02f); + if (PossibleMinibosses.Count > 0) + { + foreach (int enemy in PossibleMinibosses) + { + pool.Add(enemy, 0.05f); + } + } + pool.Add(ModContent.NPCType(), 0.08f); } } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 21afa5576f..8c176cb916 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1608,6 +1608,18 @@ namespace CalamityMod.NPCs CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. } } + if (AcidRainEvent.PossibleMinibossesAS.Contains(npc.type) || + AcidRainEvent.PossibleMinibossesPolter.Contains(npc.type)) + { + CalamityWorld.acidRainPoints -= AcidRainEvent.MinibossDeathValue; + if (CalamityWorld.downedPolterghast) + { + CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + } + } + + CalamityWorld.acidRainPoints = (int)MathHelper.Max(0, CalamityWorld.acidRainPoints); // To prevent negative completion ratios + if (CalamityWorld.rainingAcid && CalamityWorld.downedPolterghast && npc.type == ModContent.NPCType() && CalamityWorld.acidRainPoints <= 2f) diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 43297bd02a..8454328a1f 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5f; //5 - float num70 = 0.05f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 5f, 0.05f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amber, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Amber, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 3e908b875e..c9b3ba2135 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 4.5f; //5 - float num70 = 0.045f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 4.5f, 0.045f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amethyst, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Amethyst, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 0a379a8d59..f3f59d49ca 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using System; @@ -76,167 +77,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 7f; //5 - float num70 = 0.07f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 7f, 0.07f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -265,11 +106,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrystalShard, Main.rand.Next(2, 5)); - if (Main.rand.NextBool(5)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ItemID.CrystalShard, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 12a35e3572..81b21ec950 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; //5 - float num70 = 0.06f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 6f, 0.06f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Diamond, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Diamond, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 3d49c8ce90..636963f40f 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5.5f; //5 - float num70 = 0.055f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 5.5f, 0.055f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Emerald, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Emerald, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 56d8f20f74..35a8e21fe7 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; //5 - float num70 = 0.06f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 6f, 0.06f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ruby, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Ruby, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 799d8175d6..a4a83177f6 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5.5f; //5 - float num70 = 0.055f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 5.5f, 0.055f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sapphire, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Sapphire, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index c23e150fdf..f308b5f77a 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; using System.IO; @@ -75,167 +76,7 @@ namespace CalamityMod.NPCs.NormalNPCs detected = true; if (!detected) return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 4.5f; //5 - float num70 = 0.045f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } + CalamityAI.GemCrawlerAI(npc, mod, 4.5f, 0.045f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -264,7 +105,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Topaz, Main.rand.Next(2, 5)); + DropHelper.DropItem(npc, ItemID.Topaz, 2, 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 6fa1e52f2e..1def4f3bd5 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -42,16 +42,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) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 883a515f50..406c137e5a 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Boss; using System; using System.Collections.Generic; using System.IO; @@ -36,16 +37,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; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath11; npc.noGravity = true; @@ -217,8 +208,8 @@ namespace CalamityMod.NPCs.OldDuke double offsetAngleBoom; int iBoom; int damageBoom = Main.expertMode ? 55 : 70; - int projectileType = mod.ProjectileType("SandTooth"); - Projectile.NewProjectile(valueBoom.X, valueBoom.Y, 0f, 0f, mod.ProjectileType("SandPoisonCloud"), damageBoom, 0f, Main.myPlayer, 0f, 0f); + int projectileType = ModContent.ProjectileType(); + Projectile.NewProjectile(valueBoom.X, valueBoom.Y, 0f, 0f, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, 0f); for (iBoom = 0; iBoom < 2; iBoom++) { float velocity = (float)Main.rand.Next(7, 11); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 83c98f6663..4f3eaac42f 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1148,7 +1148,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode == NetmodeID.SinglePlayer) DropHelper.DropItemCondition(npc, ModContent.ItemType(), challenge); else if (Main.expertMode) - DropHelper.DropItemChance(npc, ModContent.ItemType(), true, 100); + DropHelper.DropItemChance(npc, ModContent.ItemType(), true, CalamityWorld.downedSCal ? 20 : 100); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 9915f75331..cf07748f4d 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Healing; @@ -14,6 +15,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -146,14 +148,14 @@ namespace CalamityMod.Projectiles projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (projectile.ai[1] == 1f || projectile.type == 92) + if (projectile.ai[1] == 1f) { projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - if (Main.rand.Next(20) == 0) + if (Main.rand.NextBool(20)) Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } return false; @@ -623,6 +625,39 @@ namespace CalamityMod.Projectiles } } + if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings + { + Vector2 center = projectile.Center; + float maxDistance = 460f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + bool canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 15f) / (21f); + } + } + if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) { if (modPlayer.eQuiver && projectile.ranged && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) @@ -746,7 +781,7 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; } @@ -1066,7 +1101,7 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.25); if (newDamage > 30) { - newDamage = 30; + newDamage = (int)(((double)projectile.damage * 0.25 - 30) * 0.1) + 30; } int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); Main.projectile[plague].melee = false; @@ -1077,7 +1112,7 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.2); if (newDamage > 30) { - newDamage = 30; + newDamage = (int)(((double)projectile.damage * 0.2 - 30) * 0.1) + 30; } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); } @@ -1174,6 +1209,8 @@ namespace CalamityMod.Projectiles Main.dust[num195].noGravity = true; } projectile.damage *= modPlayer.auricSet ? 7 : 4; + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; projectile.Damage(); } @@ -1223,7 +1260,7 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.15); if (newDamage > 15) { - newDamage = 15; + newDamage = (int)(((double)projectile.damage * 0.15 - 15) * 0.1) + 15; } int proj = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), newDamage, 0f, projectile.owner, 0f, 0f); Main.projectile[proj].usesLocalNPCImmunity = true; @@ -1232,52 +1269,9 @@ namespace CalamityMod.Projectiles } else if (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) { - int num = projectile.damage / 2; + SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 20f); + int num = (int)(projectile.damage * 0.5f); modPlayer.ataxiaDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 20f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); if (target.canGhostHeal) { if (Main.player[Main.myPlayer].lifeSteal <= 0f) @@ -1315,60 +1309,16 @@ namespace CalamityMod.Projectiles } else if (modPlayer.godSlayerMage && modPlayer.godSlayerDmg <= 0) { - int num = projectile.damage / 2; - modPlayer.godSlayerDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 20f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), - (int)((double)num * (modPlayer.auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); + SpawnOrb(projectile, modPlayer.auricSet ? 2f : 1.5f, ModContent.ProjectileType(), 800f, 20f); + int num = (int)(projectile.damage * 0.5f); + modPlayer.godSlayerDmg += (float)num; if (target.canGhostHeal) { if (Main.player[Main.myPlayer].lifeSteal <= 0f) { return; } - float num11 = Main.player[projectile.owner].Calamity().auricSet ? 0.03f : 0.06f; //0.2 + float num11 = modPlayer.auricSet ? 0.03f : 0.06f; //0.2 num11 -= (float)projectile.numHits * 0.015f; //0.05 if (num11 <= 0f) { @@ -1405,7 +1355,7 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.15); if (newDamage > 35) { - newDamage = 35; + newDamage = (int)(((double)projectile.damage * 0.15 - 35) * 0.1) + 35; } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); } @@ -1416,101 +1366,15 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(5)) { - int num = projectile.damage / 2; + SpawnOrb(projectile, 1.6f, ModContent.ProjectileType(), 800f, Main.rand.Next(15, 30)); + int num = (int)(projectile.damage * 0.5f); modPlayer.xerocDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = Main.rand.Next(15, 30); - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); } else if (Main.rand.NextBool(4)) { - int num = projectile.damage / 2; + SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 30f); + int num = (int)(projectile.damage * 0.5f); modPlayer.xerocDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 30f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); if (target.canGhostHeal) { if (Main.player[Main.myPlayer].lifeSteal <= 0f) @@ -1551,7 +1415,7 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.15); if (newDamage > 40) { - newDamage = 40; + newDamage = (int)(((double)projectile.damage * 0.15 - 40) * 0.1) + 40; } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); } @@ -1560,58 +1424,15 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.2); if (newDamage > 40) { - newDamage = 40; + newDamage = (int)(((double)projectile.damage * 0.2 - 40) * 0.1) + 40; } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); } else { - int num = projectile.damage / 2; + SpawnOrb(projectile, 1.2f, ModContent.ProjectileType(), 800f, 15f); + int num = (int)(projectile.damage * 0.5f); modPlayer.xerocDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); } } if (modPlayer.featherCrown && stealthStrike && modPlayer.featherCrownCooldown <= 0) @@ -1672,69 +1493,22 @@ namespace CalamityMod.Projectiles target.AddBuff(BuffID.ShadowFlame, 300); } - if (modPlayer.voltaicJelly && Main.rand.NextBool(5)) - { - target.AddBuff(BuffID.Electrified, 60); - } + if (modPlayer.voltaicJelly) + { + //100% chance for Star Tainted Generator or Conception Apparatus + //20% chance for Voltaic Jelly + if (Main.rand.NextBool(modPlayer.starTaintedGenerator ? 1 : 5)) + { + target.AddBuff(BuffID.Electrified, 60); + } + } if (modPlayer.starTaintedGenerator) { target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } - if (modPlayer.jellyChargedBattery) - { - if (modPlayer.jellyDmg <= 0) - { - int num = projectile.damage / 2; - modPlayer.jellyDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 1.05), 0f, projectile.owner, (float)num6, 0f); - } - } - // Fearmonger set's colossal life regeneration if(modPlayer.fearmongerSet) { @@ -1745,60 +1519,66 @@ namespace CalamityMod.Projectiles if (modPlayer.godSlayerSummon && modPlayer.godSlayerDmg <= 0) { - int num = projectile.damage / 2; - float ai1 = Main.rand.NextFloat() + 0.5f; - modPlayer.godSlayerDmg += (float)num; - int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1); + SpawnOrb(projectile, 2f, ModContent.ProjectileType(), 800f, 15f, true); + int num = (int)(projectile.damage * 0.5f); + modPlayer.godSlayerDmg += (float)num; } - if (modPlayer.starbusterCore && Main.rand.NextBool(3) && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) - { - int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), - (int)(projectile.damage * 0.5f), 3f, projectile.owner); - } + //Priorities: Creation Apparatus => Starbuster Core => Nuclear Rod => Jelly-Charged Battery + List summonExceptionList = new List() + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; + if (summonExceptionList.TrueForAll(x => projectile.type != x)) + { + if (modPlayer.nucleogenesis) + { + if (Main.rand.NextBool(4)) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + } + } + else if (modPlayer.starbusterCore) + { + if (Main.rand.NextBool(3)) + { + int cap = modPlayer.starTaintedGenerator ? 75 : 60; + int newDamage = (int)((double)projectile.damage * 0.5); + if (newDamage > cap) + { + newDamage = (int)(((double)projectile.damage * 0.5 - cap) * 0.1) + cap; + } + int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), + newDamage, 3f, projectile.owner); + } + } + else if (modPlayer.nuclearRod) + { + if (Main.rand.NextBool(3)) + { + int newDamage = (int)((double)projectile.damage * 0.25); + if (newDamage > 40) + { + newDamage = (int)(((double)projectile.damage * 0.25 - 40) * 0.1) + 40; + } + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), + newDamage, 0f, projectile.owner); + } + } + else if (modPlayer.jellyChargedBattery) + { + if (modPlayer.jellyDmg <= 0) + { + SpawnOrb(projectile, 1.05f, ModContent.ProjectileType(), 800f, 15f); + int num = (int)(projectile.damage * 0.5f); + modPlayer.jellyDmg += (float)num; + } + } + } } if (projectile.ranged) @@ -1818,7 +1598,7 @@ namespace CalamityMod.Projectiles int newDamage = (int)((double)projectile.damage * 0.33); if (newDamage > 65) { - newDamage = 65; + newDamage = (int)(((double)projectile.damage * 0.33 - 65) * 0.1) + 65; } Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); } @@ -1982,7 +1762,7 @@ namespace CalamityMod.Projectiles Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int i = 0; i < 3; i++) { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); Main.dust[dust].noGravity = true; } } @@ -2007,6 +1787,11 @@ namespace CalamityMod.Projectiles Main.projectile[soul].tileCollide = false; } } + if (modPlayer.scuttlersJewel && CalamityMod.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) + { + int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + Main.projectile[spike].frame = 4; + } } } } @@ -2023,7 +1808,60 @@ namespace CalamityMod.Projectiles } #endregion - #region Homing AI + #region AI Shortcuts + public void SpawnOrb(Projectile projectile, float dmgMult, int projType, float distanceRequired, float N, bool gsPhantom = false) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + int num = (int)(projectile.damage * 0.5f); + float ai1 = Main.rand.NextFloat() + 0.5f; + int[] array = new int[Main.maxNPCs]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < distanceRequired) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = N; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, projType, (int)(num * dmgMult), 0f, projectile.owner, gsPhantom ? 0f : (float)num6, gsPhantom ? ai1 : 0f); + } + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) { Vector2 center = projectile.Center; @@ -2122,9 +1960,7 @@ namespace CalamityMod.Projectiles } } } - #endregion - #region Floating Pet AI public static void FloatingPetAI(Projectile projectile, bool lightPet = false, bool faceRight = false, float tiltFloat = 0.05f) { Player player = Main.player[projectile.owner]; diff --git a/Projectiles/DraedonsArsenal/GatlingLaser.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs similarity index 98% rename from Projectiles/DraedonsArsenal/GatlingLaser.cs rename to Projectiles/DraedonsArsenal/GatlingLaserProj.cs index fda1c96e01..e75f7c98c1 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaser.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -7,7 +7,7 @@ using CalamityMod.Items; namespace CalamityMod.Projectiles.DraedonsArsenal { - public class GatlingLaser : ModProjectile + public class GatlingLaserProj : ModProjectile { private SoundEffectInstance gatlingLaserLoop; private bool fireLasers = false; @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Player player = Main.player[projectile.owner]; float num = 1.57079637f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType()) { if (projectile.ai[0] < 5f) projectile.ai[0] += 1f; diff --git a/Projectiles/DraedonsArsenal/GatlingLaser.png b/Projectiles/DraedonsArsenal/GatlingLaserProj.png similarity index 100% rename from Projectiles/DraedonsArsenal/GatlingLaser.png rename to Projectiles/DraedonsArsenal/GatlingLaserProj.png diff --git a/Projectiles/Enemy/BelchingCoralSpike.cs b/Projectiles/Enemy/BelchingCoralSpike.cs new file mode 100644 index 0000000000..470ee34328 --- /dev/null +++ b/Projectiles/Enemy/BelchingCoralSpike.cs @@ -0,0 +1,59 @@ +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 BelchingCoralSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 20; + projectile.hostile = true; + projectile.timeLeft = 480; + projectile.ignoreWater = true; + } + public override void AI() + { + if (projectile.ai[0]++ < 10f) + { + projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 10f); + } + else + { + if (projectile.velocity.Y < 12f) + projectile.velocity.Y += 0.1f; + } + projectile.tileCollide = projectile.ai[0] > 30f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Enemy/BelchingCoralSpike.png b/Projectiles/Enemy/BelchingCoralSpike.png new file mode 100644 index 0000000000..3f6c50dff4 Binary files /dev/null and b/Projectiles/Enemy/BelchingCoralSpike.png differ diff --git a/Projectiles/Enemy/CrabBoulder.cs b/Projectiles/Enemy/CrabBoulder.cs new file mode 100644 index 0000000000..b571513d75 --- /dev/null +++ b/Projectiles/Enemy/CrabBoulder.cs @@ -0,0 +1,50 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class CrabBoulder : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boulder"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 26; + projectile.hostile = true; + projectile.timeLeft = 480; + projectile.ignoreWater = true; + } + public override void AI() + { + if (projectile.ai[0]++ < 30f) + { + projectile.scale = MathHelper.Lerp(0.004f, 1f, projectile.ai[0] / 30f); + } + else + { + if (projectile.velocity.Y < 12f) + projectile.velocity.Y += 0.18f; + } + projectile.tileCollide = projectile.ai[0] > 70f; + projectile.rotation += Math.Sign(projectile.velocity.X) * 0.08f; + } + public override void Kill(int timeLeft) + { + Utils.PoofOfSmoke(projectile.Center); + } + + 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/CrabBoulder.png b/Projectiles/Enemy/CrabBoulder.png new file mode 100644 index 0000000000..f0ea0f894b Binary files /dev/null and b/Projectiles/Enemy/CrabBoulder.png differ diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs new file mode 100644 index 0000000000..04bb0aae89 --- /dev/null +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -0,0 +1,214 @@ +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 CragmawBeam : ModProjectile + { + // How long this laser can exist before it is deleted. + public const int TrueTimeLeft = 120; + + // Pretty self explanatory + private const float maximumLength = 1200f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gamma Ray"); + } + + 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; + } + + // 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, 4f); + } + + 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/CragmawMireBeamBegin"); + Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamMid"); + Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/CragmawMireBeamEnd"); + 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/CragmawBeam.png b/Projectiles/Enemy/CragmawBeam.png new file mode 100644 index 0000000000..1e24eea3ca Binary files /dev/null and b/Projectiles/Enemy/CragmawBeam.png differ diff --git a/Projectiles/Enemy/CragmawBubble.cs b/Projectiles/Enemy/CragmawBubble.cs new file mode 100644 index 0000000000..5ca8c64578 --- /dev/null +++ b/Projectiles/Enemy/CragmawBubble.cs @@ -0,0 +1,125 @@ +using CalamityMod.Dusts; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class CragmawBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 0.01f; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.timeLeft = 240; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 6) + { + projectile.frame = 0; + } + if (projectile.localAI[1] < 1f) + { + projectile.localAI[1] += 0.01f; + projectile.scale += 0.01f; + projectile.width = (int)(30f * projectile.scale); + projectile.height = (int)(30f * projectile.scale); + } + else + { + projectile.damage = 20; + projectile.width = 30; + projectile.height = 30; + projectile.tileCollide = true; + } + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 20; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[1] > 30f) + { + if (projectile.velocity.Y > -8f) + { + projectile.velocity.Y -= 0.125f; + } + } + else + { + projectile.ai[1] += 1f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + for (int i = 0; i < 36; i++) + { + float angle = MathHelper.TwoPi * i / 36f; + float y = (float)Math.Sin(angle) * (float)Math.Log(Math.Abs(Math.Cos(angle))); + if (!float.IsNaN(y)) + { + Vector2 velocity = new Vector2((float)Math.Cos(angle), y) * 3f; + Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = velocity; + dust.noGravity = true; + dust.scale = 2f; + + velocity = new Vector2(y, (float)Math.Cos(angle)) * 3f; + dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = velocity; + dust.noGravity = true; + dust.scale = 2f; + } + } + for (int i = 0; i < 4; i++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float angle = MathHelper.TwoPi / 4f * i + MathHelper.PiOver2; + Projectile.NewProjectileDirect(projectile.Center, angle.ToRotationVector2().RotatedByRandom(0.1f) * 8f, ModContent.ProjectileType(), + projectile.damage, 3f).tileCollide = true; + } + } + } + } +} diff --git a/Projectiles/Enemy/CragmawBubble.png b/Projectiles/Enemy/CragmawBubble.png new file mode 100644 index 0000000000..3bb08e0246 Binary files /dev/null and b/Projectiles/Enemy/CragmawBubble.png differ diff --git a/Projectiles/Enemy/CragmawSpike.cs b/Projectiles/Enemy/CragmawSpike.cs new file mode 100644 index 0000000000..696bbf3f0b --- /dev/null +++ b/Projectiles/Enemy/CragmawSpike.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class CragmawSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 28; + projectile.hostile = true; + projectile.timeLeft = 600; + projectile.tileCollide = true; + projectile.ignoreWater = false; + } + public override void AI() + { + if (projectile.velocity.Y < 6f) + projectile.velocity.Y += 0.075f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Enemy/CragmawSpike.png b/Projectiles/Enemy/CragmawSpike.png new file mode 100644 index 0000000000..1547f22da4 Binary files /dev/null and b/Projectiles/Enemy/CragmawSpike.png differ diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs new file mode 100644 index 0000000000..630a7e8b5b --- /dev/null +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -0,0 +1,117 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class CragmawVibeCheckChain : ModProjectile + { + public bool ReelingPlayer = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("You Think You're Safe"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 12; + projectile.alpha = 255; + projectile.timeLeft = 420; + projectile.ignoreWater = true; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(ReelingPlayer); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + ReelingPlayer = reader.ReadBoolean(); + } + public override void AI() + { + Vector2 offsetDrawVector = new Vector2(0f, 30f); + projectile.alpha -= 15; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int toTarget = (int)projectile.ai[1]; + if (!Main.npc[(int)projectile.ai[0]].active) + { + projectile.Kill(); + return; + } + projectile.rotation = (Main.npc[(int)projectile.ai[0]].Top - Main.player[toTarget].Center + offsetDrawVector).ToRotation() + MathHelper.PiOver2; + if (projectile.localAI[0] == 0f) + { + projectile.velocity = (projectile.velocity * 10f + projectile.DirectionTo(Main.player[toTarget].Center) * 9f) / 11f; + if (projectile.timeLeft <= 180f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + if (projectile.Distance(Main.player[toTarget].Center) < 16f) + { + projectile.localAI[0] = 1f; + ReelingPlayer = true; + projectile.netUpdate = true; + } + } + else + { + if (ReelingPlayer) + { + Main.player[toTarget].Center = projectile.Center; + } + if (Main.player[toTarget].dead) + { + ReelingPlayer = false; + } + if (projectile.Distance(Main.npc[(int)projectile.ai[0]].Center) > 6f) + { + projectile.velocity = (projectile.velocity * 16f + projectile.DirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 19f) / 17f; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D endTexture = ModContent.GetTexture(Texture); + Texture2D chainTexture = ModContent.GetTexture("CalamityMod/Projectiles/Enemy/CragmawVibeCheckMid"); + Vector2 distanceVectorToStart = Main.npc[(int)projectile.ai[0]].Top + Vector2.UnitY * 30f - projectile.Center; + float distanceToStart = distanceVectorToStart.Length(); + Vector2 directionToStart = Vector2.Normalize(distanceVectorToStart); + Rectangle frameRectangle = endTexture.Frame(1, 1, 0, 0); + frameRectangle.Height /= 4; + frameRectangle.Y += projectile.frame * frameRectangle.Height; + + spriteBatch.Draw(endTexture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(frameRectangle), projectile.GetAlpha(lightColor), projectile.rotation, frameRectangle.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + distanceToStart -= (frameRectangle.Height / 2 + chainTexture.Height) * projectile.scale; + Vector2 chainDrawPosition = projectile.Center; + chainDrawPosition += directionToStart * projectile.scale * frameRectangle.Height / 2f; + if (distanceToStart > 0f) + { + float distanceMoved = 0f; + Rectangle chainTextureFrameRectangle = new Rectangle(0, 0, chainTexture.Width, chainTexture.Height); + while (distanceMoved + 1f < distanceToStart) + { + if (distanceToStart - distanceMoved < chainTextureFrameRectangle.Height) + { + chainTextureFrameRectangle.Height = (int)(distanceToStart - distanceMoved); + } + Point chainPositionTileCoords = chainDrawPosition.ToTileCoordinates(); + Color colorAtChainPosition = Lighting.GetColor(chainPositionTileCoords.X, chainPositionTileCoords.Y); + colorAtChainPosition = Color.Lerp(colorAtChainPosition, Color.White, 0.3f); + spriteBatch.Draw(chainTexture, chainDrawPosition - Main.screenPosition, new Rectangle?(chainTextureFrameRectangle), projectile.GetAlpha(colorAtChainPosition), projectile.rotation, chainTextureFrameRectangle.Bottom(), projectile.scale, SpriteEffects.None, 0f); + distanceMoved += chainTextureFrameRectangle.Height * projectile.scale; + chainDrawPosition += directionToStart * chainTextureFrameRectangle.Height * projectile.scale; + } + } + return false; + } + } +} diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.png b/Projectiles/Enemy/CragmawVibeCheckChain.png new file mode 100644 index 0000000000..1043a2a38f Binary files /dev/null and b/Projectiles/Enemy/CragmawVibeCheckChain.png differ diff --git a/Projectiles/Enemy/CragmawVibeCheckMid.png b/Projectiles/Enemy/CragmawVibeCheckMid.png new file mode 100644 index 0000000000..ba9e0a9461 Binary files /dev/null and b/Projectiles/Enemy/CragmawVibeCheckMid.png differ diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index bf07125159..fd079e6dea 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Ray"); - ProjectileID.Sets.MinionShot[projectile.type] = true; } public override void SetDefaults() @@ -32,8 +31,6 @@ namespace CalamityMod.Projectiles.Enemy projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = TrueTimeLeft; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; } // Netcode for sending and receiving shit diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs index e9b64c31ee..dd3dc20e5f 100644 --- a/Projectiles/Enemy/TrilobiteSpike.cs +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { projectile.width = 10; - projectile.height = 22; + projectile.height = 10; projectile.hostile = true; projectile.timeLeft = 600; projectile.tileCollide = true; diff --git a/Projectiles/Magic/AcidicReed.cs b/Projectiles/Magic/AcidicReed.cs new file mode 100644 index 0000000000..1e894173ef --- /dev/null +++ b/Projectiles/Magic/AcidicReed.cs @@ -0,0 +1,71 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class AcidicReed : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reed"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.magic = true; + projectile.timeLeft = 600; + projectile.tileCollide = true; + projectile.ignoreWater = false; + projectile.penetrate = 1; + } + + public override void AI() + { + if (projectile.ai[0] == 1f) + { + Terraria.Audio.LegacySoundStyle saxSound = Utils.SelectRandom(Main.rand, new Terraria.Audio.LegacySoundStyle[] + { + mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Saxophone/Sax1"), + mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Saxophone/Sax2"), + mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Saxophone/Sax3"), + mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Saxophone/Sax4"), + mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Saxophone/Sax5"), + mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Saxophone/Sax6") + }); + Main.PlaySound(saxSound, projectile.position); + projectile.ai[0] = 0f; + } + if (projectile.velocity.Y < 10f) + projectile.velocity.Y += 0.25f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + int idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Magic/AcidicReed.png b/Projectiles/Magic/AcidicReed.png new file mode 100644 index 0000000000..d91935f3d4 Binary files /dev/null and b/Projectiles/Magic/AcidicReed.png differ diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs new file mode 100644 index 0000000000..7aa768043c --- /dev/null +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -0,0 +1,179 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Ranged; + +namespace CalamityMod.Projectiles.Magic +{ + public class AcidicSaxBubble : ModProjectile + { + public float counter = 0f; + public float counter2 = 0f; + public int killCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 6) + { + projectile.frame = 0; + } + if (projectile.owner == Main.myPlayer) + { + if (counter >= 120f) + { + counter = 0f; + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; + int mist = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(BelchingSaxophone.BaseDamage * Main.player[projectile.owner].MagicDamage()), 1f, projectile.owner, 0f, 0f); + Main.projectile[mist].Calamity().forceMagic = true; + Main.projectile[mist].localNPCHitCooldown = 10; + } + else + counter += 1f; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 6f) + { + int num982 = 20; + if (projectile.alpha > 0) + { + projectile.alpha -= num982; + } + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + if (projectile.ai[1] >= 45f) + { + projectile.ai[1] = 45f; + if (counter2 < 1f) + { + counter2 += 0.002f; + projectile.scale += 0.002f; + projectile.width = (int)(30f * projectile.scale); + projectile.height = (int)(30f * projectile.scale); + } + else + { + projectile.width = 60; + projectile.height = 60; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + else if (projectile.velocity.Y > -2f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + killCounter++; + if (killCounter >= 200) + { + projectile.Kill(); + } + } + CalamityUtils.StickyProjAI(projectile); + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 3, false); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Venom, 600); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Venom, 600); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 64; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(SoundID.Item54, projectile.Center); + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 0, default, 1f); + Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = projectile.alpha; + num3 = num246; + } + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + } + } +} diff --git a/Projectiles/Magic/AcidicSaxBubble.png b/Projectiles/Magic/AcidicSaxBubble.png new file mode 100644 index 0000000000..3bb08e0246 Binary files /dev/null and b/Projectiles/Magic/AcidicSaxBubble.png differ diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs index 64b0ac4405..b80efb3817 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 600; projectile.penetrate = -1; projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs index 69a3aeabac..82361e1c07 100644 --- a/Projectiles/Magic/EternityCrystal.cs +++ b/Projectiles/Magic/EternityCrystal.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Magic DegreesToSpin *= 1.035f; } } - if (projectile.Hitbox.Intersects(Main.npc[(int)projectile.ai[0]].Hitbox)) + if (projectile.Hitbox.Intersects(Main.npc[(int)projectile.ai[0]].Hitbox) && !Main.npc[(int)projectile.ai[0]].dontTakeDamage) { int damage = (int)(Eternity.ExplosionDamage * player.MagicDamage() * Main.rand.NextFloat(0.9f, 1.1f)); player.addDPS(damage); diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index 0e7097b232..81acb23a37 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Magic } else if (projectile.localAI[0] < trueTimeLeft * 2) { - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && !target.dontTakeDamage) { int damage = (int)(Eternity.BaseDamage * 0.5f * player.MagicDamage()); damage = (int)(damage * Main.rand.NextFloat(0.9f, 1.1f)); diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index 6971bf22c8..f5424a6bf5 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -22,13 +22,17 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + if (projectile.timeLeft % 2f == 0f) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].noGravity = true; + Main.dust[num448].noLight = true; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.1f; + } } } } diff --git a/Projectiles/Magic/FabOrb.cs b/Projectiles/Magic/FabOrb.cs index 2b2f09c52a..bf8c330a45 100644 --- a/Projectiles/Magic/FabOrb.cs +++ b/Projectiles/Magic/FabOrb.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 300; projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index ce713b8018..f8f454aa61 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); projectile.localAI[1] += 1f; if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) { @@ -41,6 +42,7 @@ namespace CalamityMod.Projectiles.Magic vector33 -= projectile.velocity * ((float)num447 * 0.25f); int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); Main.dust[num448].noGravity = true; + Main.dust[num448].noLight = true; Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.1f; diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index 28987aa30c..c59d30f062 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -58,15 +58,14 @@ namespace CalamityMod.Projectiles.Magic num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; num462++; } } diff --git a/Projectiles/Magic/HellfireExplosionFriendly2.cs b/Projectiles/Magic/HellfireExplosionFriendly2.cs index b9f7a3b10c..e5b7deb2ae 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly2.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly2.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 300; projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -56,15 +58,14 @@ namespace CalamityMod.Projectiles.Magic num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.75f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; num462++; } } diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index f650737925..3dbb75fdef 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Magic { public class MiasmaGas : ModProjectile @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 28; projectile.friendly = true; projectile.ignoreWater = true; - projectile.timeLeft = 600; + projectile.timeLeft = 300; projectile.penetrate = 10; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; @@ -45,10 +46,19 @@ namespace CalamityMod.Projectiles.Magic } projectile.rotation += projectile.velocity.X * 0.0003f; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); projectile.ai[1] = 1f; } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + projectile.ai[1] = 1f; + } + public override void Kill(int timeLeft) { for (int i = 0; i < 25; i++) @@ -58,6 +68,7 @@ namespace CalamityMod.Projectiles.Magic dust.alpha = 127; } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); diff --git a/Projectiles/Magic/SerpentineBody.png b/Projectiles/Magic/SerpentineBody.png index 0611fac64d..18b40d4b22 100644 Binary files a/Projectiles/Magic/SerpentineBody.png and b/Projectiles/Magic/SerpentineBody.png differ diff --git a/Projectiles/Magic/SerpentineHead.png b/Projectiles/Magic/SerpentineHead.png index eadae1c932..d8f7269271 100644 Binary files a/Projectiles/Magic/SerpentineHead.png and b/Projectiles/Magic/SerpentineHead.png differ diff --git a/Projectiles/Magic/SerpentineTail.png b/Projectiles/Magic/SerpentineTail.png index 2db39a20a5..9cf8f4de4c 100644 Binary files a/Projectiles/Magic/SerpentineTail.png and b/Projectiles/Magic/SerpentineTail.png differ diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index 84d21e24f6..a143fdf2fd 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -53,5 +54,15 @@ namespace CalamityMod.Projectiles.Magic CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); return false; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index a267716701..4f98f2e6ce 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -35,5 +36,15 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + } } } diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index d61c4dde48..cb88ed0ab0 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -97,6 +97,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(ModContent.BuffType(), 900); } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 900); + } + public override void Kill(int timeLeft) { if (projectile.owner != Main.myPlayer) diff --git a/Projectiles/Magic/WhiteFlame.cs b/Projectiles/Magic/WhiteFlame.cs index 9282e38e0c..2eb0e5920c 100644 --- a/Projectiles/Magic/WhiteFlame.cs +++ b/Projectiles/Magic/WhiteFlame.cs @@ -20,18 +20,21 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.timeLeft = 120; projectile.magic = true; + projectile.extraUpdates = 1; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + if (projectile.timeLeft % 2f == 0f) + { + for (int num457 = 0; num457 < Main.rand.Next(3,6); num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } } public override void Kill(int timeLeft) @@ -49,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), (int)(double)projectile.damage, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/WhiteFlame2.cs b/Projectiles/Magic/WhiteFlame2.cs index ab9f5a372d..7e58c62ae1 100644 --- a/Projectiles/Magic/WhiteFlame2.cs +++ b/Projectiles/Magic/WhiteFlame2.cs @@ -30,13 +30,14 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f); - Main.dust[num458].noGravity = true; - } + if (projectile.timeLeft % 2f == 0f) + { + for (int num457 = 0; num457 < Main.rand.Next(3,6); num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f); + Main.dust[num458].noGravity = true; + } + } homeTimer += 5f; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, homeTimer, 25f, 20f); diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index f47af2f126..67332b2145 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -85,13 +85,6 @@ namespace CalamityMod.Projectiles.Melee } } - 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)) diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index 13c9b7da0d..9ae8afc278 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -39,12 +39,6 @@ namespace CalamityMod.Projectiles.Melee public override int BodyType2SectionHeight => 18; public override int TailStartY => 108; public override int TailHeight => 50; - 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) { diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index cc65683541..b60d143f19 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; using CalamityMod.Projectiles.BaseProjectiles; @@ -32,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee.Spears } public override float InitialSpeed => 3f; - public override float ForwardSpeed => 2.4f; - public override float ReelbackSpeed => 3f; + public override float ForwardSpeed => 0.95f; + public override float ReelbackSpeed => 2.4f; public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -47,6 +48,11 @@ namespace CalamityMod.Projectiles.Melee.Spears SpriteEffects.None, 0f); } + public override Action EffectBeforeReelback => (proj) => + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, + ModContent.ProjectileType(), projectile.damage * 4, projectile.knockBack, projectile.owner, 0f, 0f); + }; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs index 6e5593525f..9994353091 100644 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ b/Projectiles/Melee/TumbleweedFlail.cs @@ -77,10 +77,7 @@ namespace CalamityMod.Projectiles.Melee return; } } - 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; + projectile.ai[1] += 1f; if (projectile.ai[1] > 5f) { projectile.alpha = 0; diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index 4fc2e0abe3..c57107ea88 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -2,6 +2,7 @@ using System.IO; using Terraria; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -76,5 +77,15 @@ namespace CalamityMod.Projectiles.Ranged } return null; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + } } } diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index c0a8b0b0e2..0f9481db41 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged { public class MagnomalyRocket : ModProjectile { + private bool spawnedAura = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Nuke"); @@ -55,9 +56,10 @@ namespace CalamityMod.Projectiles.Ranged { num297 = 269; } - if (projectile.owner == Main.myPlayer && projectile.timeLeft == 300) + if (projectile.owner == Main.myPlayer && !spawnedAura) { 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); + spawnedAura = true; } float num247 = projectile.velocity.X * 0.5f; float num248 = projectile.velocity.Y * 0.5f; diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 9fff537c57..e074128208 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -66,11 +66,11 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[0] == 0f) { - projectile.extraUpdates = 1; + projectile.extraUpdates = 2; } else { - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; } Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float xDist = player.position.X + (float)(player.width / 2) - vector14.X; @@ -82,10 +82,6 @@ namespace CalamityMod.Projectiles.Ranged { projectile.ai[0] = 1f; } - else if (playerDist > 1500f) - { - projectile.ai[0] = 1f; - } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.ai[1] += 1f; if (projectile.ai[1] > 5f) diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index 71a213050c..13e5d68faf 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = 5; projectile.aiStyle = 1; + projectile.arrow = true; } public override void AI() diff --git a/Projectiles/Ranged/SulphuricAcidBubble2.cs b/Projectiles/Ranged/SulphuricAcidBubble2.cs index 95199db0cb..2935ba33ea 100644 --- a/Projectiles/Ranged/SulphuricAcidBubble2.cs +++ b/Projectiles/Ranged/SulphuricAcidBubble2.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(250f * Main.player[projectile.owner].rangedDamage), 1f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(250f * Main.player[projectile.owner].RangedDamage()), 1f, projectile.owner, 0f, 0f); } else counter += 1f; @@ -106,108 +106,12 @@ namespace CalamityMod.Projectiles.Ranged projectile.Kill(); } } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - bool flag54 = false; - projectile.localAI[0] += 1f; - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= 360f) - { - 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; - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } + 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 = 3; - 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, 3, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index 17a62bab8e..fe491d45af 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + //projectile.ai[0] == 1f means spawned by Skyfin Bombers SS projectile.position = projectile.Center; - if (projectile.Calamity().stealthStrike) + if (projectile.Calamity().stealthStrike || projectile.ai[0] == 1f) projectile.width = projectile.height = 120; else projectile.width = projectile.height = 70; @@ -42,7 +43,10 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 9; + if (projectile.ai[0] != 1f) + { + target.immune[projectile.owner] = 9; + } target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 1a0de6a9c3..be26a10f56 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 600; projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/JewelSpike.cs b/Projectiles/Rogue/JewelSpike.cs new file mode 100644 index 0000000000..ae26e5a0c6 --- /dev/null +++ b/Projectiles/Rogue/JewelSpike.cs @@ -0,0 +1,61 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class JewelSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 44; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 40; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.velocity *= 0f; + if (Main.rand.NextBool(5) && projectile.frame < 3) + { + int crystalDust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Main.dust[crystalDust].noGravity = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4 && projectile.frame > 0) + { + projectile.frame--; + projectile.frameCounter = 0; + } + if (projectile.frame < 0) //just in case + { + projectile.frame = 0; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + for (int index = 0; index < 3; ++index) + { + float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + int shard = Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 4, 0f, projectile.owner); + Main.projectile[shard].Calamity().forceRogue = true; + } + } + } + } +} diff --git a/Projectiles/Rogue/JewelSpike.png b/Projectiles/Rogue/JewelSpike.png new file mode 100644 index 0000000000..d5808d0e78 Binary files /dev/null and b/Projectiles/Rogue/JewelSpike.png differ diff --git a/Projectiles/Rogue/SkyBomberGas.cs b/Projectiles/Rogue/SkyBomberGas.cs new file mode 100644 index 0000000000..929298a464 --- /dev/null +++ b/Projectiles/Rogue/SkyBomberGas.cs @@ -0,0 +1,60 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SkyBomberGas : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Irradiated Cloud"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 28; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft < 50) + projectile.alpha += 5; + if (projectile.timeLeft < 75) + { + projectile.velocity *= 0.95f; + projectile.scale += 0.002f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid); + } + } + } +} diff --git a/Projectiles/Rogue/SkyBomberGas.png b/Projectiles/Rogue/SkyBomberGas.png new file mode 100644 index 0000000000..8552d17a15 Binary files /dev/null and b/Projectiles/Rogue/SkyBomberGas.png differ diff --git a/Projectiles/Rogue/SkyfinNuke.cs b/Projectiles/Rogue/SkyfinNuke.cs new file mode 100644 index 0000000000..51a759dd6e --- /dev/null +++ b/Projectiles/Rogue/SkyfinNuke.cs @@ -0,0 +1,109 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SkyfinNuke : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyfin Nuke"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 720; + projectile.tileCollide = true; + projectile.alpha = 0; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + if (!projectile.Calamity().stealthStrike) //normal attack + { + projectile.ai[0]++; + if (projectile.ai[0] > 30f) //0.5 seconds + { + NPC target = projectile.Center.ClosestNPCAt(800f); + // Ignore targets below the nuke + if (target != null) + { + if (target.Bottom.Y < projectile.Top.Y) + { + target = null; + } + } + if (target != null) + { + const float turnSpeed = 40f; + const float speedMult = 40f; + Vector2 distNorm = (target.Center - projectile.Center).SafeNormalize(Vector2.UnitX); + projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; + } + } + } + else + { + //More range + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 40f, 40f); + } + } + + public override void Kill(int timeLeft) + { + //Dust + for (int i = 0; i < 30;i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); + Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, dspeed.X, dspeed.Y, 0, default, 1.1f); + } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + + int num220 = Main.rand.Next(2, 5); + if (projectile.owner == Main.myPlayer) + { + for (int num221 = 0; num221 < num220; num221++) + { + Vector2 value17 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 51) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 0f); + } + if (projectile.Calamity().stealthStrike) + { + int explode = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 1f); + Main.projectile[explode].usesLocalNPCImmunity = true; + Main.projectile[explode].localNPCHitCooldown = 20; + } + } + + Main.PlaySound(SoundID.Item14, projectile.Bottom); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Rogue/SkyfinNuke.png b/Projectiles/Rogue/SkyfinNuke.png new file mode 100644 index 0000000000..c0f0586af0 Binary files /dev/null and b/Projectiles/Rogue/SkyfinNuke.png differ diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index 307acddbb6..5efa178bac 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -39,57 +39,13 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] == 0f) { - float[] var0 = projectile.ai; - int var1 = 1; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - projectile.ai[1] = 45f; projectile.velocity.X = projectile.velocity.X * 0.99f; projectile.velocity.Y = projectile.velocity.Y + 0.15f; projectile.rotation += 0.4f * (float)projectile.direction; projectile.spriteDirection = projectile.direction; } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 6; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 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); if (openClam && !onEnemy) { projectile.frame = 1; @@ -105,76 +61,7 @@ namespace CalamityMod.Projectiles.Rogue if (openClam) { onEnemy = true; - 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); } } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index 6d37dd7f89..d5a0d84512 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -27,5 +28,10 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[idx].noGravity = true; Main.dust[idx].velocity *= 0f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + } } } diff --git a/Projectiles/Rogue/ToxicantTwisterProjectile.cs b/Projectiles/Rogue/ToxicantTwisterProjectile.cs index 523493255f..e9d2b1ed81 100644 --- a/Projectiles/Rogue/ToxicantTwisterProjectile.cs +++ b/Projectiles/Rogue/ToxicantTwisterProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -48,6 +49,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) { @@ -59,6 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) { diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs new file mode 100644 index 0000000000..1de61c3dd4 --- /dev/null +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -0,0 +1,145 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ToxicantTwisterTwoPointZero : ModProjectile + { + private int lifeTime = 300; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxicant Twister"); + } + + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 46; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.timeLeft = lifeTime; + projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 12; + } + + public override void AI() + { + if (projectile.Calamity().stealthStrike) + { + if (projectile.timeLeft % 50f == 0f) + { + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(projectile.Center, + (-1f * projectile.velocity).RotatedByRandom(0.1f) * 0.6f, + ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + } + } + projectile.rotation += 0.06f * (projectile.velocity.X > 0).ToDirectionInt(); + } + + // Boomerang rotation + projectile.rotation += 0.4f * (float)projectile.direction; + + // Boomerang sound + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + + // Returns after some number of frames in the air + if (projectile.timeLeft < lifeTime - 180) + projectile.ai[0] = 1f; + + if (projectile.ai[0] != 0f) + { + float returnSpeed = 18f * 1.6f; + float acceleration = 1.4f; + + Player owner = Main.player[projectile.owner]; + + // Delete the projectile if it's excessively far away. + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - projectile.Center.X; + float yDist = playerCenter.Y - projectile.Center.Y; + float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + } + + // Delete the projectile if it touches its owner. + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } + else + { + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, + projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, + projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, + projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, + projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.png b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.png new file mode 100644 index 0000000000..f54ead37b4 Binary files /dev/null and b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.png differ diff --git a/Projectiles/Summon/ApparatusExplosion.cs b/Projectiles/Summon/ApparatusExplosion.cs new file mode 100644 index 0000000000..1f5ffacb1d --- /dev/null +++ b/Projectiles/Summon/ApparatusExplosion.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class ApparatusExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 44; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + // Bluish cyan light + Lighting.AddLight(projectile.Center, 0.1f, 0.5f, 1f); + + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.Kill(); + } + } + } +} diff --git a/Projectiles/Summon/ApparatusExplosion.png b/Projectiles/Summon/ApparatusExplosion.png new file mode 100644 index 0000000000..763e666e65 Binary files /dev/null and b/Projectiles/Summon/ApparatusExplosion.png differ diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 5cc0e9f039..2d84e4dd2c 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon //on spawn effects && minion flexibility if (projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) @@ -62,11 +62,11 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } - 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; } diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index 8ea2d76bab..02123535bb 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -357,16 +357,16 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = attackCooldown; double num11 = 12.0; Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, (float) ((double) projectile.position.Y + (double) (projectile.height / 2) - 8.0)); - float num12 = num5 - vector2.X + (float) Main.rand.Next(-20, 21); + float num12 = num5 - vector2.X + (float) Main.rand.Next(-10, 11); float num14 = (float) ((double) (Math.Abs(num12) * 0.1f) * (double) Main.rand.Next(0, 100) * (1.0 / 1000.0)); - float num15 = num6 - vector2.Y + (float) Main.rand.Next(-20, 21) - num14; + float num15 = num6 - vector2.Y + (float) Main.rand.Next(-10, 11) - num14; double num16 = Math.Sqrt((double) num12 * (double) num12 + (double) num15 * (double) num15); float num17 = (float) (num11 / num16); float SpeedX = num12 * num17; float SpeedY = num15 * num17; int damage = projectile.damage; int Type = ModContent.ProjectileType(); - int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, damage, projectile.knockBack, projectile.owner, 0f, 0f); + int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX * 1.5f, SpeedY * 1.5f, Type, damage, projectile.knockBack, projectile.owner, 0f, 0f); if (SpeedX < 0f) projectile.direction = -1; if (SpeedX > 0f) @@ -507,7 +507,7 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[1] = 1f; projectile.frame = 9; } - if (projectile.frame >= 9 || projectile.frame <= 14) + if (projectile.frame >= 9 && projectile.frame <= 14) { projectile.frameCounter++; if (projectile.frameCounter > 8) diff --git a/Projectiles/Summon/IrradiatedAura.cs b/Projectiles/Summon/IrradiatedAura.cs new file mode 100644 index 0000000000..9d1d68a9ab --- /dev/null +++ b/Projectiles/Summon/IrradiatedAura.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; + +namespace CalamityMod.Projectiles.Summon +{ + public class IrradiatedAura : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Irradiated Aura"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.4f / 255f); + int randomDust = Main.rand.Next(4); + if (randomDust == 3) + { + randomDust = 89; + } + else if (randomDust == 2) + { + randomDust = (int)CalamityDusts.SulfurousSeaAcid; + } + else + { + randomDust = 33; + } + for (int num468 = 0; num468 < (Main.rand.NextBool(2) ? 1 : 2); num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1f); + if (randomDust == 89) + { + Main.dust[num469].scale *= 0.35f; + } + Main.dust[num469].velocity *= 0f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Summon/IrradiatedAura.png b/Projectiles/Summon/IrradiatedAura.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Summon/IrradiatedAura.png differ diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 2b15c86385..8e0bc1a0ff 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -12,11 +12,9 @@ namespace CalamityMod.Projectiles.Summon { public class MiniGuardianAttack : ModProjectile { - private int ai = -1; + private int ai = 3; private void updateDamage(int type) { - if (Main.myPlayer != projectile.owner) - return; Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (100f + @@ -34,13 +32,15 @@ namespace CalamityMod.Projectiles.Summon public override void ReceiveExtraAI(BinaryReader reader) { - ai = reader.ReadInt32(); + if (projectile.owner != Main.myPlayer) + ai = reader.ReadInt32(); } private void AI(int type, float num535, float num536, Player player) { - updateDamage(type); - switch (type) + if (Main.myPlayer == projectile.owner) + updateDamage(type); + switch (ai) { case 1: //offensive bab (profaned soul artifact) case 2: //Empowered bab WEEEEEEEEEE (profaned soul crystal) diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 06f8c103e4..ac47a33419 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -15,8 +15,6 @@ namespace CalamityMod.Projectiles.Summon private int ai = -1; private void updateDamage(int type) { - if (Main.myPlayer != projectile.owner) - return; Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (100f + @@ -34,13 +32,15 @@ namespace CalamityMod.Projectiles.Summon public override void ReceiveExtraAI(BinaryReader reader) { - ai = reader.ReadInt32(); + if (projectile.owner != Main.myPlayer) + ai = reader.ReadInt32(); } private void AI(int type, float num535, float num536, Player player) { - updateDamage(type); - switch (type) + if (Main.myPlayer == projectile.owner) + updateDamage(type); + switch (ai) { case 1: //defensive bab (profaned soul artifact) case 2: //Empowered bab WEEEEEEEEEE (profaned soul crystal) diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index f7e48f7755..3d74d06225 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon if (hasHomingTarget) { NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 15f; + Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 25f; float homingRatio = 20f; projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); } diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index e07952b103..6fe8502393 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Projectiles.Summon ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - private void Split(bool hit) + private void Split(bool hit, bool chaseable) { Player player = Main.player[projectile.owner]; bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); - player.Calamity().rollBabSpears(hit ? 1 : 0); + player.Calamity().rollBabSpears(hit ? 1 : 0, chaseable); int outerSplits = enrage ? 20 : 10; int innerSplits = enrage ? 16 : 8; float mult = enrage ? 0.4f : 0.6f; @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.myPlayer == projectile.owner) { - Split(true); + Split(true, target.chaseable); } projectile.active = false; } @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.myPlayer == projectile.owner) { - Split(true); + Split(true, true); } projectile.active = false; } @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.myPlayer == projectile.owner) { - Split(false); + Split(false, false); } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int num193 = 0; num193 < 6; num193++) @@ -300,12 +300,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(35); + Main.player[projectile.owner].Calamity().rollBabSpears(35, target.chaseable); } public override void OnHitPvp(Player target, int damage, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(35); + Main.player[projectile.owner].Calamity().rollBabSpears(35, true); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) @@ -437,7 +437,7 @@ namespace CalamityMod.Projectiles.Summon handleSpecialHit(target.Center); } int chance = projectile.ai[0] == 2f ? 20 : 10 * projectile.penetrate; - Main.player[projectile.owner].Calamity().rollBabSpears(chance); + Main.player[projectile.owner].Calamity().rollBabSpears(chance, target.chaseable); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) @@ -447,7 +447,7 @@ namespace CalamityMod.Projectiles.Summon handleSpecialHit(target.Center); } int chance = projectile.ai[0] == 2f ? 20 : 10 * projectile.penetrate; - Main.player[projectile.owner].Calamity().rollBabSpears(chance); + Main.player[projectile.owner].Calamity().rollBabSpears(chance, true); } private void handleSpecialHit(Vector2 targCenter) @@ -722,14 +722,14 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 1f ? 1 : 10); + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 1f ? 1 : 10, target.chaseable); if (projectile.scale == 1.5f && projectile.ai[0] != 2f) swarm(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.scale == 1.5f ? 1 : 10); + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.scale == 1.5f ? 1 : 10, true); if (projectile.scale == 1.5f && projectile.ai[0] != 2f) swarm(target.Center); } @@ -881,12 +881,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(50); + Main.player[projectile.owner].Calamity().rollBabSpears(50, target.chaseable); } public override void OnHitPvp(Player target, int damage, bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(50); + Main.player[projectile.owner].Calamity().rollBabSpears(50, true); } } @@ -1121,12 +1121,12 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10); + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10, target.chaseable); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10); + Main.player[projectile.owner].Calamity().rollBabSpears(projectile.ai[0] == 0f ? 0 : 10, true); } diff --git a/Projectiles/Summon/Shellfish.png b/Projectiles/Summon/Shellfish.png index 59218cfb99..e555cf2e8f 100644 Binary files a/Projectiles/Summon/Shellfish.png and b/Projectiles/Summon/Shellfish.png differ diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index c63268f587..5c369530e3 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon CalamityGlobalProjectile modProj = projectile.Calamity(); if (dust == 0f) { - modProj.spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; int dustAmt = 36; for (int num227 = 0; num227 < dustAmt; num227++) @@ -58,11 +58,11 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if ((player.allDamage + player.minionDamage - 1f) != modProj.spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / modProj.spawnedPlayerMinionDamageValue * - (player.allDamage + player.minionDamage - 1f)); + player.MinionDamage()); projectile.damage = damage2; } bool projTypeCheck = projectile.type == ModContent.ProjectileType(); @@ -245,7 +245,7 @@ namespace CalamityMod.Projectiles.Summon projectile.spriteDirection = 1; else if (projectile.velocity.X < -0.5f) projectile.spriteDirection = -1; - projectile.rotation = projectile.spriteDirection != 1 ? (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X) + 3.14f : (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X); + //projectile.rotation = projectile.spriteDirection != 1 ? (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X) + 3.14f : (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X); } else { @@ -508,7 +508,7 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[1] = 1f; projectile.frame = 8; } - if (projectile.frame >= 8 || projectile.frame <= 11) + if (projectile.frame >= 8 && projectile.frame <= 11) { projectile.frameCounter++; if (projectile.frameCounter > 8) diff --git a/Projectiles/Typeless/FabsolDust.cs b/Projectiles/Typeless/FabsolDust.cs index 127352a542..5a3967ae72 100644 --- a/Projectiles/Typeless/FabsolDust.cs +++ b/Projectiles/Typeless/FabsolDust.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/FlareExplosion.cs b/Projectiles/Typeless/FlareExplosion.cs index bd6f4bb55e..8f5636b1b3 100644 --- a/Projectiles/Typeless/FlareExplosion.cs +++ b/Projectiles/Typeless/FlareExplosion.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 3dba86d377..77d888034e 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void Kill(int timeLeft) diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 681e084116..619dcb6611 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -21,27 +21,21 @@ namespace CalamityMod.Projectiles.Typeless projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 6; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.4f / 255f); int randomDust = Main.rand.Next(4); - if (randomDust == 0) + if (randomDust == 3) { - randomDust = 33; - } - else if (randomDust == 1) - { - randomDust = 33; - } - else if (randomDust == 2) - { - randomDust = 33; + randomDust = 89; } else { - randomDust = 89; + randomDust = 33; } for (int num468 = 0; num468 < 2; num468++) { diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 2a242f2557..bd11ee8a89 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft = 240; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 7; } public override void AI() @@ -95,7 +97,6 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Sounds/Custom/Saxophone/Sax1.cs b/Sounds/Custom/Saxophone/Sax1.cs new file mode 100644 index 0000000000..41e673fb84 --- /dev/null +++ b/Sounds/Custom/Saxophone/Sax1.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.Saxophone +{ + public class Sax1 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/Saxophone/Sax1.ogg b/Sounds/Custom/Saxophone/Sax1.ogg new file mode 100644 index 0000000000..912a0b7e2a Binary files /dev/null and b/Sounds/Custom/Saxophone/Sax1.ogg differ diff --git a/Sounds/Custom/Saxophone/Sax2.cs b/Sounds/Custom/Saxophone/Sax2.cs new file mode 100644 index 0000000000..ec10108cd3 --- /dev/null +++ b/Sounds/Custom/Saxophone/Sax2.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.Saxophone +{ + public class Sax2 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/Saxophone/Sax2.ogg b/Sounds/Custom/Saxophone/Sax2.ogg new file mode 100644 index 0000000000..ae8b95e5a9 Binary files /dev/null and b/Sounds/Custom/Saxophone/Sax2.ogg differ diff --git a/Sounds/Custom/Saxophone/Sax3.cs b/Sounds/Custom/Saxophone/Sax3.cs new file mode 100644 index 0000000000..f1e5a6cd4a --- /dev/null +++ b/Sounds/Custom/Saxophone/Sax3.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.Saxophone +{ + public class Sax3 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/Saxophone/Sax3.ogg b/Sounds/Custom/Saxophone/Sax3.ogg new file mode 100644 index 0000000000..1b81d54827 Binary files /dev/null and b/Sounds/Custom/Saxophone/Sax3.ogg differ diff --git a/Sounds/Custom/Saxophone/Sax4.cs b/Sounds/Custom/Saxophone/Sax4.cs new file mode 100644 index 0000000000..4380e8e456 --- /dev/null +++ b/Sounds/Custom/Saxophone/Sax4.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.Saxophone +{ + public class Sax4 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/Saxophone/Sax4.ogg b/Sounds/Custom/Saxophone/Sax4.ogg new file mode 100644 index 0000000000..e74ea217c0 Binary files /dev/null and b/Sounds/Custom/Saxophone/Sax4.ogg differ diff --git a/Sounds/Custom/Saxophone/Sax5.cs b/Sounds/Custom/Saxophone/Sax5.cs new file mode 100644 index 0000000000..0b6826e597 --- /dev/null +++ b/Sounds/Custom/Saxophone/Sax5.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.Saxophone +{ + public class Sax5 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/Saxophone/Sax5.ogg b/Sounds/Custom/Saxophone/Sax5.ogg new file mode 100644 index 0000000000..018c88bac9 Binary files /dev/null and b/Sounds/Custom/Saxophone/Sax5.ogg differ diff --git a/Sounds/Custom/Saxophone/Sax6.cs b/Sounds/Custom/Saxophone/Sax6.cs new file mode 100644 index 0000000000..cac0771ee1 --- /dev/null +++ b/Sounds/Custom/Saxophone/Sax6.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.Saxophone +{ + public class Sax6 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/Saxophone/Sax6.ogg b/Sounds/Custom/Saxophone/Sax6.ogg new file mode 100644 index 0000000000..321a00ef31 Binary files /dev/null and b/Sounds/Custom/Saxophone/Sax6.ogg differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index c8a2558fcf..53310503c1 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -395,6 +395,9 @@ namespace CalamityMod.Tiles case 119: item = "FlakBabyBanner"; break; + case 120: + item = "AnthozoanCrabBanner"; + break; default: return; } @@ -773,6 +776,9 @@ namespace CalamityMod.Tiles case 119: type = "FlakBaby"; break; + case 120: + type = "AnthozoanCrab"; + break; default: return; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 62da579113..13ba27ed05 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/UI/AcidRainUI.cs b/UI/AcidRainUI.cs new file mode 100644 index 0000000000..9882b36085 --- /dev/null +++ b/UI/AcidRainUI.cs @@ -0,0 +1,68 @@ +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public static class AcidRainUI + { + public static void Draw(SpriteBatch spriteBatch) + { + bool draw = CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0; + if ((draw && !Main.LocalPlayer.Calamity().ZoneSulphur) || + (!draw && Main.LocalPlayer.Calamity().ZoneSulphur)) + return; + + float progressAlpha = 1f; + Vector2 screenCoords = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40); + int sizeX = (int)(200f * progressAlpha); + int sizeY = (int)(45f * progressAlpha); + Rectangle screenCoordsRectangle = + new Rectangle((int)screenCoords.X - sizeX / 2, + (int)screenCoords.Y - sizeY / 2, sizeX, sizeY); + Texture2D barTexture = Main.colorBarTexture; + + // If you touch the netcode behind this without a good reason your life will come to an abrupt end -Dominic + if (CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0) + { + Utils.DrawInvBG(spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); + + float progressRatio = 1f - CalamityWorld.AcidRainCompletionRatio; + string progressText = $"{((int)(100 * progressRatio)).ToString()}%"; + progressText = Language.GetTextValue("Game.WaveCleared", progressText); + spriteBatch.Draw(barTexture, screenCoords, null, Color.White, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f); + Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText); + float adjustedAlpha = progressAlpha; + if (textMeasurement.Y > 22f) + { + adjustedAlpha *= 22f / textMeasurement.Y; + } + float barDrawOffsetX = 169f * progressAlpha; + float scaleY = 8f * progressAlpha; + Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f; + Utils.DrawBorderString(spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White, adjustedAlpha, 0.5f, 1f, -1); + barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX; + spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51), 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f); + spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127), 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f); + spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f); + + string invasionNameText = "Acid Rain"; + Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText); + float x = 120f; + if (textMeasurement2.X > 200f) + { + x += textMeasurement2.X - 200f; + } + Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon"); + Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha); + Utils.DrawInvBG(spriteBatch, iconRectangle, AcidRainEvent.TextColor * 0.5f); + spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f); + Utils.DrawBorderString(spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White, progressAlpha * 0.9f, 1f, 0.4f, -1); + } + } + } +} diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 917ab68d27..4e68f54324 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -680,6 +680,20 @@ namespace CalamityMod } return true; } + public static bool TileSelectionSolidSquare(int x, int y, int width, int height) + { + for (int i = x - width; i != x + width; i += Math.Sign(width)) + { + for (int j = y - height; y != y + height; j += Math.Sign(height)) + { + if (!WorldGen.InWorld(i, j)) + return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) + return false; + } + } + return true; + } public static bool TileActiveAndOfType(int x, int y, int type) { return ParanoidTileRetrieval(x, y).active() && ParanoidTileRetrieval(x, y).type == type; diff --git a/World/Abyss.cs b/World/Abyss.cs index 9f4328e1de..0c8a22e252 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -304,8 +304,8 @@ namespace CalamityMod.World } for (int y = yStart + 35; y < yStart + 180; y++) { - if (Main.tile[trueX, y].type != (ushort)ModContent.TileType() || - !Main.tile[trueX, y].active()) + if (CalamityUtils.ParanoidTileRetrieval(trueX, y).type != (ushort)ModContent.TileType() || + !CalamityUtils.ParanoidTileRetrieval(trueX, y).active()) { Main.tile[trueX, y] = new Tile() { diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 6f489ffd9c..f3593ba3e0 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -952,27 +952,34 @@ namespace CalamityMod.World Main.invasionProgressNearInvasion = true; // Summon Old Duke tornado post-Polter as needed - if (downedPolterghast && acidRainPoints == 2f && - !NPC.AnyNPCs(ModContent.NPCType()) && - CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) + if (downedPolterghast && acidRainPoints == 2f) { - if (triedToSummonOldDuke) + if (!NPC.AnyNPCs(ModContent.NPCType()) && + CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) { - 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) + if (triedToSummonOldDuke) { - Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, - ModContent.ProjectileType(), 120, 8f, Main.myPlayer); + 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); + } } } } + if (Main.invasionProgress != -1) + { + Main.invasionType = 0; + Main.invasionProgress = -1; + } } else {