From 354eb54b008dfebb79e4ce1f5a860576c6b0f98d Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 17 Oct 2022 18:17:27 -0500 Subject: [PATCH 01/13] Rusty Medallion buff --- CalPlayer/CalamityPlayer.cs | 28 ++++++++++++-------------- CalPlayer/CalamityPlayerMiscEffects.cs | 2 ++ Items/Accessories/RustyMedallion.cs | 9 +++++++-- Projectiles/Ranged/ToxicannonDrop.cs | 16 +++++++++++---- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a08c46c1d0..b8ca15ac67 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -225,6 +225,7 @@ namespace CalamityMod.CalPlayer public int aBulwarkRareTimer = 0; public int spiritOriginBullseyeShootCountdown = 0; public int spiritOriginConvertedCrit = 0; + public int RustyMedallionCooldown = 0; private const int DashDisableCooldown = 12; @@ -570,7 +571,7 @@ namespace CalamityMod.CalPlayer public int phantomicHeartRegen = 0; // 0 = can spawn, 720 = regen applied, 600 = regen stops and 10 sec cd before it can spawn again public bool silvaWings = false; public int icicleCooldown = 0; - public bool rustyMedal = false; + public bool RustyMedallionDroplets = false; public bool noStupidNaturalARSpawns = false; public bool roverDrive = false; public int roverDriveTimer = 0; @@ -1643,7 +1644,7 @@ namespace CalamityMod.CalPlayer camper = false; silvaWings = false; corrosiveSpine = false; - rustyMedal = false; + RustyMedallionDroplets = false; noStupidNaturalARSpawns = false; roverDrive = false; rottenDogTooth = false; @@ -2120,6 +2121,7 @@ namespace CalamityMod.CalPlayer auralisAurora = 0; fungalSymbioteTimer = 0; aBulwarkRareTimer = 0; + RustyMedallionCooldown = 0; spiritOriginConvertedCrit = 0; rage = 0f; adrenaline = 0f; @@ -5258,24 +5260,20 @@ namespace CalamityMod.CalPlayer } } - if (rustyMedal) + if (RustyMedallionDroplets && RustyMedallionCooldown <= 0) { if (item.CountsAsClass()) { - if (Main.rand.NextBool(5)) + int d = (int)Player.GetTotalDamage().ApplyTo(Items.Accessories.RustyMedallion.AcidDropBaseDamage); + Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; + Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); + int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType(), d, 0f, Player.whoAmI); + if (drop.WithinBounds(Main.maxProjectiles)) { - for (int i = 0; i < 3; i++) - { - Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; - Vector2 directionToMouse = (startingPosition - Main.MouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3), 0f, Player.whoAmI); - if (drop.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[drop].penetrate = 2; - Main.projectile[drop].DamageType = DamageClass.Generic; - } - } + Main.projectile[drop].penetrate = 2; + Main.projectile[drop].DamageType = DamageClass.Generic; } + RustyMedallionCooldown = RustyMedallion.AcidCreationCooldown; } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index fb29d51169..07eae50cc3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1221,6 +1221,8 @@ namespace CalamityMod.CalPlayer monolithAccursedShader--; if (miningSetCooldown > 0) miningSetCooldown--; + if (RustyMedallionCooldown > 0) + RustyMedallionCooldown--; // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index e521f228eb..355fcbe2f1 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -9,11 +9,16 @@ namespace CalamityMod.Items.Accessories { public class RustyMedallion : ModItem { + public const int AcidDropBaseDamage = 9; + + // BAD Minishark! You will NOT become stupid sleeper agent item! + public const int AcidCreationCooldown = 25; + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Rusty Medallion"); - Tooltip.SetDefault("Causes most ranged weapons to sometimes release acid droplets from the sky\n" + + Tooltip.SetDefault("Causes most ranged weapons to release acid droplets from the sky\n" + "Grants immunity to Irradiated"); } @@ -29,7 +34,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rustyMedal = true; + modPlayer.RustyMedallionDroplets = true; player.buffImmune[ModContent.BuffType()] = true; } diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index 46f43511a3..4b36ad7a24 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,14 +26,22 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = false; Projectile.timeLeft = 420; Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 17; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.velocity.Y <= 8f) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, !Projectile.tileCollide); + if (potentialTarget is not null) { - Projectile.velocity.Y += 0.15f; + float flySpeed = Projectile.velocity.Length(); + if (flySpeed < 5f) + flySpeed = 5f; + + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * flySpeed, 0.085f); } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.tileCollide = Projectile.timeLeft <= 300; } public override bool OnTileCollide(Vector2 oldVelocity) From b61d250b5fdd146349a7adc6a09f1cdf53103759 Mon Sep 17 00:00:00 2001 From: "Phuc Nguyen (Brav)" Date: Mon, 17 Oct 2022 22:24:19 -0400 Subject: [PATCH 02/13] Renamed The Reaper to The Old Reaper. --- Items/TreasureBags/OldDukeBag.cs | 2 +- .../Weapons/Rogue/{TheReaper.cs => TheOldReaper.cs} | 4 ++-- .../Rogue/{TheReaper.png => TheOldReaper.png} | Bin NPCs/OldDuke/OldDuke.cs | 2 +- Projectiles/Rogue/ReaperProjectile.cs | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) rename Items/Weapons/Rogue/{TheReaper.cs => TheOldReaper.cs} (95%) rename Items/Weapons/Rogue/{TheReaper.png => TheOldReaper.png} (100%) diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 9de17755d5..e3d56a692b 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType() })); - itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); diff --git a/Items/Weapons/Rogue/TheReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs similarity index 95% rename from Items/Weapons/Rogue/TheReaper.cs rename to Items/Weapons/Rogue/TheOldReaper.cs index 2172bff473..44d421101c 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -8,11 +8,11 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TheReaper : RogueWeapon + public class TheOldReaper : RogueWeapon { public override void SetStaticDefaults() { - DisplayName.SetDefault("The Reaper"); + DisplayName.SetDefault("The Old Reaper"); Tooltip.SetDefault("Slice 'n dice\n" + "Stealth strikes throw four at once"); SacrificeTotal = 1; diff --git a/Items/Weapons/Rogue/TheReaper.png b/Items/Weapons/Rogue/TheOldReaper.png similarity index 100% rename from Items/Weapons/Rogue/TheReaper.png rename to Items/Weapons/Rogue/TheOldReaper.png diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index b67e64aba4..bacd6c58e1 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -435,7 +435,7 @@ namespace CalamityMod.NPCs.OldDuke ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); - normalOnly.Add(ModContent.ItemType(), 10); + normalOnly.Add(ModContent.ItemType(), 10); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 09aeeaa58e..ffa7c2e940 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,11 +9,11 @@ namespace CalamityMod.Projectiles.Rogue { public class ReaperProjectile : ModProjectile { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheReaper"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheOldReaper"; public override void SetStaticDefaults() { - DisplayName.SetDefault("The Reaper"); + DisplayName.SetDefault("The Old Reaper"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } From 7bb0c7dbfa4622b4e27b417c95d81c9db80f6355 Mon Sep 17 00:00:00 2001 From: GinYuH <> Date: Tue, 18 Oct 2022 02:14:29 -0700 Subject: [PATCH 03/13] reaper legacy name --- Items/Weapons/Rogue/TheOldReaper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Items/Weapons/Rogue/TheOldReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs index 44d421101c..8843fe2591 100644 --- a/Items/Weapons/Rogue/TheOldReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { + [LegacyName("TheReaper")] public class TheOldReaper : RogueWeapon { public override void SetStaticDefaults() From 5bcfbe762bd0f754b44f63d312d41fe6b378fd22 Mon Sep 17 00:00:00 2001 From: GinYuH <> Date: Tue, 18 Oct 2022 06:50:32 -0700 Subject: [PATCH 04/13] Afflicted resprite --- Buffs/StatBuffs/Afflicted.png | Bin 459 -> 479 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Buffs/StatBuffs/Afflicted.png b/Buffs/StatBuffs/Afflicted.png index a18eba6244c593a8404e2d349b7c465b3ba556ee..cbabb0498f82c47c82e9c2e443fa00d74edf591e 100644 GIT binary patch delta 453 zcmV;$0XqK61K$IXB!2;OQb$4nuFf3k0004*NklvBl3x5EVZa*U*w9&373i$Ef z_6qJ<2TU*!6#SXD9$o=xKEDA_O6MXUkatfK1+uc^0A!{oly-9r$h$tO9RuAFvu>+B zPFS6s+BlC4Bu33O;NDz+dqbg82Ef@WdJSSkGf|ygQR;C<1al08@$}LHx+VlC zyA;_^jKrBR-+zE0CZ;Ac>V=Rs5w!mq146JHbhPtAUo&C+9s||lwpUnQR4-gyDOH)d zteH5>H6W`!Y$nZ|cMe$6pqYs4FPLjU=-KxgVgmoy@z+Sig^Yk7rbjcMm~1T@9g#!D9AB2%rPKeERwbA v*{dMgv*eIc7s7H&J&rJR11Tx|+ppsWaY@!#86KTxpo97Xm@%~p^jh`&-KJmXHS5mqHww1 zJuq9W90aQXeVhI90s7e|$F4x#9Xe=$5V}3w@xR%xM{@_Faj)C=bL|Vzz@QL(I^XdE zdh`gW2)BYdyMF={BoCbrOhC+|0?b1|A4aYl>{IFx({BY zboAud6VQ(dgTi1H0O|@b4~ie7zYFk!pa5P90Cggu^NKGbGXi`xXb8h{p*ci^Id6ZA z%n0yz2_g*6g~s?g`j}&1fCiuexLy>I;8H)>6VM~)s47at!#=4e$CLmozW580l`Hxt bw^dbFMT{awtP{ss00000NkvXXu0mjfr2(?q From 6107def4adefb919729fe3f8d014bc2054d1296b Mon Sep 17 00:00:00 2001 From: GinYuH <> Date: Tue, 18 Oct 2022 07:16:04 -0700 Subject: [PATCH 05/13] martian beacon resprite & rename --- .../Invasion/MartianDistressBeacon.cs | 43 ------------ .../Invasion/MartianDistressBeacon.png | Bin 985 -> 0 bytes .../Invasion/MartianDistressRemote.cs | 62 ++++++++++++++++++ .../Invasion/MartianDistressRemote.png | Bin 0 -> 743 bytes .../MartianDistressRemote_Animated.png | Bin 0 -> 2701 bytes NPCs/CalamityGlobalTownNPC.cs | 2 +- 6 files changed, 63 insertions(+), 44 deletions(-) delete mode 100644 Items/SummonItems/Invasion/MartianDistressBeacon.cs delete mode 100644 Items/SummonItems/Invasion/MartianDistressBeacon.png create mode 100644 Items/SummonItems/Invasion/MartianDistressRemote.cs create mode 100644 Items/SummonItems/Invasion/MartianDistressRemote.png create mode 100644 Items/SummonItems/Invasion/MartianDistressRemote_Animated.png diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.cs b/Items/SummonItems/Invasion/MartianDistressBeacon.cs deleted file mode 100644 index 896dea699e..0000000000 --- a/Items/SummonItems/Invasion/MartianDistressBeacon.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.SummonItems.Invasion -{ - public class MartianDistressBeacon : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Martian Distress Beacon"); - Tooltip.SetDefault("Summons the Martian Madness\n" + - "Not consumable"); - ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear - } - - public override void SetDefaults() - { - Item.width = 30; - Item.height = 60; - Item.maxStack = 1; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 10; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.consumable = false; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } - - public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; - - public override bool? UseItem(Player player) - { - Main.StartInvasion(InvasionID.MartianMadness); - return true; - } - } -} diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.png b/Items/SummonItems/Invasion/MartianDistressBeacon.png deleted file mode 100644 index 32afb9a520d69aed56680343a65bb10f412e2c44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 985 zcmV;~119{5P)Px&lSxEDR9J=0nQv%KVI0Rl$IQKkZi~4ljMg$^tj$DNlrTlgUMUnsdpTKYNqZqL zY*7@=3z3pyFX-uRb+y(4z(aAj9_%Im){JufUQ z1Rx%dD@R@J?d^b<#ABDNFaSC#%&1%pmG+UkTEHUrj#z#;kvr+!r6;!Mby8hI?)^NL`4tG5RchMw90Q=g?^^<(x3?Ft zyxqKU5nz!^TU1qDn{r_9iABL+5U@xkYQ-BN4`-Y8x~j4Qu-=4RfAz9mdG6eKxk}qV z#7@$^?Cvykw2%ffLQ4Ox&Q<`XWX}PHz5)LbOI4BF>!zGpc>qM7KLe~cpzHRHvr5~4 z#CnyHjI_FZi*jDP6iHNzw?e8%z4y6VBsm*UabX9K=j-ZW?|TXg3e+17^VUEhVD7z= zUfXzVJBELWi;IiRV`&)xEl-G-DHK296^%wtxv?dEO#r}?GOdty;n=Lcn9e7eE>D%;a%|A4Hm!}E6B z_z4EU_kn)E55!Kp#KE2Xp@YECc`I`BR!IG`=E~1Eb8I{wPr%TsA``TtbxhyC|!&xn5mIg(%^1Tmxa00000NkvXX Hu0mjf!rkTU diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs new file mode 100644 index 0000000000..d3dbfe6ba4 --- /dev/null +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.Invasion +{ + [LegacyName("MartianDistressBeacon")] + public class MartianDistressRemote : ModItem + { + public int frameCounter = 0; + public int frame = 0; + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Martian Distress Remote"); + Tooltip.SetDefault("Summons the Martian Madness\n" + + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 52; + Item.maxStack = 1; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 10; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + + public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; + + public override bool? UseItem(Player player) + { + Main.StartInvasion(InvasionID.MartianMadness); + return true; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Invasion/MartianDistressRemote_Animated").Value; + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Invasion/MartianDistressRemote_Animated").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.png b/Items/SummonItems/Invasion/MartianDistressRemote.png new file mode 100644 index 0000000000000000000000000000000000000000..d54d3ecba22e749197df46609bd6f325f00401d1 GIT binary patch literal 743 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 literal 0 HcmV?d00001 diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 6b96c7d8e5..09cef6a4b8 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1585,7 +1585,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Cyborg) { SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25)); - SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); + SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedPolterghast); } From 91600bd55031b5752b49a7a4c8a79fb01eeaf5d5 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 18 Oct 2022 13:38:51 -0500 Subject: [PATCH 06/13] Dormant Brimseekers are more consistent now --- Projectiles/Summon/DormantBrimseekerBab.cs | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index 018368fb1b..7d76ad10f1 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Projectiles.Summon public class DormantBrimseekerBab : ModProjectile { public const float DistanceToCheck = 1600f; - public const float TurnTime = 25f; + public const int TurnTime = 7; public bool SeekingTarget = false; public float MaxChargeTime { get { - return (Projectile.localAI[1] == 1f) ? 21 : 38; + return (Projectile.localAI[1] == 1f) ? 16 : 25; } } public override void SetStaticDefaults() @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.timeLeft *= 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 15; Projectile.DamageType = DamageClass.Summon; } @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.ai[0] = 0f; // Disable charge animation when not attacking } - Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.2f); Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X < 0).ToDirectionInt(); Projectile.ai[1] += MathHelper.ToRadians(3f); if (Projectile.ai[1] >= MathHelper.Pi * 4f) @@ -109,13 +109,13 @@ namespace CalamityMod.Projectiles.Summon } else { - if (Projectile.Distance(potentialTarget.Center) < 1100f && Projectile.ai[0] == 0f) + if (Projectile.Distance(potentialTarget.Center) < 400f && Projectile.ai[0] == 0f) { SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Projectile.Center); Projectile.ai[0]++; - float acceleration = (Projectile.localAI[1] == 1f) ? 1.6f : 0.8f; - float minSpeed = (Projectile.localAI[1] == 1f) ? 13f : 8f; - float maxSpeed = (Projectile.localAI[1] == 1f) ? 21f : 18f; + float acceleration = (Projectile.localAI[1] == 1f) ? 1.85f : 1.1f; + float minSpeed = (Projectile.localAI[1] == 1f) ? 21.5f : 15f; + float maxSpeed = (Projectile.localAI[1] == 1f) ? 32f : 24f; Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); Projectile.rotation = Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi; } @@ -124,17 +124,17 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0]++; SeekingTarget = false; } - else if (Projectile.Distance(potentialTarget.Center) >= 1100f) + else if (Projectile.Distance(potentialTarget.Center) >= 400f) { - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); - Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + 2f, 6f, 15f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.3f); + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + 2f, 10f, 32f); SeekingTarget = true; Projectile.ai[0] = 0f; } if (Projectile.ai[0] >= MaxChargeTime) { - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.3f); } Projectile.frameCounter++; From e39784f546da07fc77149c1105ecc190012137f9 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 18 Oct 2022 19:16:20 -0500 Subject: [PATCH 07/13] Sulphurous Skaters aren't as jumpy anymore --- NPCs/AcidRain/SulphurousSkater.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index c18ec8c856..5bfa84165b 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -20,9 +20,13 @@ namespace CalamityMod.NPCs.AcidRain public class SulphurousSkater : ModNPC { public bool Flying = false; + public Player Target => Main.player[NPC.target]; + public ref float JumpTimer => ref NPC.ai[0]; + public const int JumpDelay = 64; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Skater"); @@ -31,10 +35,6 @@ namespace CalamityMod.NPCs.AcidRain NPCID.Sets.TrailCacheLength[NPC.type] = 6; } - public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); - - public override void ReceiveExtraAI(BinaryReader reader) => Flying = reader.ReadBoolean(); - public override void SetDefaults() { NPC.width = 48; @@ -69,6 +69,10 @@ namespace CalamityMod.NPCs.AcidRain SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); + + public override void ReceiveExtraAI(BinaryReader reader) => Flying = reader.ReadBoolean(); + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { @@ -127,13 +131,13 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.X *= 0.85f; JumpTimer++; - float lungeForwardSpeed = 15f; + float lungeForwardSpeed = 12f; float jumpSpeed = 4f; if (Collision.CanHit(NPC.Center, 1, 1, Target.Center, 1, 1)) lungeForwardSpeed *= 1.2f; // Jump after a short amount of time. - if (JumpTimer >= 17) + if (JumpTimer >= JumpDelay) { JumpTimer = 0f; NPC.velocity.Y -= jumpSpeed; From d7f0499bea0c4cccd04ac155728de19f5e5a7f3f Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 18 Oct 2022 19:55:28 -0500 Subject: [PATCH 08/13] Skyfins rise a bit slower --- NPCs/AcidRain/Skyfin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 9a928ed6c8..b8b5f5b100 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.AcidRain // Rise upward. case 0: Vector2 flyDestination = Target.Center + new Vector2((Target.Center.X < NPC.Center.X).ToDirectionInt() * 400f, -240f); - Vector2 idealVelocity = NPC.SafeDirectionTo(flyDestination) * 12f; + Vector2 idealVelocity = NPC.SafeDirectionTo(flyDestination) * 10f; NPC.velocity = (NPC.velocity * 29f + idealVelocity) / 29f; NPC.velocity = NPC.velocity.MoveTowards(idealVelocity, 1.5f); From c404dc9b2c7356c6d0da455bb4bd3c2adab0ab66 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 18 Oct 2022 19:55:37 -0500 Subject: [PATCH 09/13] Acid Eels have less max HP --- NPCs/AcidRain/AcidEel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 8681a07131..06041b249f 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.height = 18; NPC.damage = 20; - NPC.lifeMax = 80; + NPC.lifeMax = 72; NPC.defense = 4; NPC.knockBackResist = 0.9f; @@ -47,14 +47,14 @@ namespace CalamityMod.NPCs.AcidRain { NPC.DR_NERD(0.05f); NPC.damage = 100; - NPC.lifeMax = 3300; + NPC.lifeMax = 3000; NPC.defense = 20; NPC.knockBackResist = 0.7f; } else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 50; - NPC.lifeMax = 240; + NPC.lifeMax = 216; } NPC.value = Item.buyPrice(0, 0, 3, 32); From 1e836b28d789f4c63c608e0dd286cc50ed249ac7 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 18 Oct 2022 20:08:19 -0500 Subject: [PATCH 10/13] Removed Water Leeches --- Buffs/DamageOverTime/HeavyBleeding.cs | 19 -- Buffs/DamageOverTime/HeavyBleeding.png | Bin 740 -> 0 bytes CalPlayer/CalamityPlayer.cs | 9 - CalPlayer/CalamityPlayerLifeRegen.cs | 13 - Events/AcidRainEvent.cs | 5 +- Items/Placeables/Banners/WaterLeechBanner.cs | 32 --- Items/Placeables/Banners/WaterLeechBanner.png | Bin 494 -> 0 bytes Items/Weapons/Magic/ParasiticSceptor.cs | 13 +- NPCs/AcidRain/WaterLeech.cs | 228 ------------------ .../Magic}/WaterLeechGlow.png | Bin Projectiles/Magic/WaterLeechProj.cs | 8 +- .../Magic/WaterLeechProj.png | Bin Utilities/MiscUtils.cs | 6 - Utilities/NPCDebuffs.cs | 1 - 14 files changed, 17 insertions(+), 317 deletions(-) delete mode 100644 Buffs/DamageOverTime/HeavyBleeding.cs delete mode 100644 Buffs/DamageOverTime/HeavyBleeding.png delete mode 100644 Items/Placeables/Banners/WaterLeechBanner.cs delete mode 100644 Items/Placeables/Banners/WaterLeechBanner.png delete mode 100644 NPCs/AcidRain/WaterLeech.cs rename {NPCs/AcidRain => Projectiles/Magic}/WaterLeechGlow.png (100%) rename NPCs/AcidRain/WaterLeech.png => Projectiles/Magic/WaterLeechProj.png (100%) diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs deleted file mode 100644 index 40f8c46216..0000000000 --- a/Buffs/DamageOverTime/HeavyBleeding.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class HeavyBleeding : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavy Bleeding"); - Description.SetDefault("You're losing a lot of blood"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) => player.Calamity().waterLeechBleeding = true; - } -} diff --git a/Buffs/DamageOverTime/HeavyBleeding.png b/Buffs/DamageOverTime/HeavyBleeding.png deleted file mode 100644 index 26ea11ef6b33be0a4d82af8b95034cce1400865a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 740 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvmUKs7M+SzC{oH>NSwWJ?9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fgArasc;tHgJ;Q!K&|3%@? zfedNZ|I6n6|NnpWvgtWM3C5BjzhDN3XE)M7oFs2|7k074j@LjAdx@v7EBg};VL@&E z&oewfgXHsz{6ZMdFDjn}k z5hW>!C8<`)MX5lF!N|bKK-a)R*U&P=(A>(z*viCQ+rYrez+mb8g@z~^a`RI%(<*Um zxN=Cc7pOr2WJ7U&T1k0gQ7S`5Nl8JmmA-yvZen^W5N9T5>*W`v?>R3!7pPVOq&6g@ zG&jl0$|XO!G&eP`#L6lFsI-{DaQXk;`am_}NNPMmrdU~dq-LgPlrR_@X?*$d1*k*} zQ%QJcN=XJ##f4~#N}vi!Bo)4yxv3?U1*r^RH|ZDTrQ2@`^Fy=AHw37P!O+yw+``n- zz{p&r`SMnv5K3@l6x3@i+cjV+7}xBXXm2Q-1f)78&qol`;+02~hS5C8xG diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index b8ca15ac67..91a467b237 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -90,7 +90,6 @@ namespace CalamityMod.CalPlayer public static int chaosStateDuration_NR = 1200; public bool killSpikyBalls = false; public double acidRoundMultiplier = 1D; - public int waterLeechTarget = -1; public float KameiTrailXScale = 0.1f; public int KameiBladeUseDelay = 0; public Vector2[] OldPositions = new Vector2[4]; @@ -773,7 +772,6 @@ namespace CalamityMod.CalPlayer public bool iCantBreathe = false; //Frozen Lungs debuff public bool cragsLava = false; public bool vaporfied = false; - public bool waterLeechBleeding = false; public bool banishingFire = false; public bool wither = false; public bool ManaBurn = false; @@ -1804,7 +1802,6 @@ namespace CalamityMod.CalPlayer iCantBreathe = false; cragsLava = false; vaporfied = false; - waterLeechBleeding = false; banishingFire = false; wither = false; ManaBurn = false; @@ -2192,7 +2189,6 @@ namespace CalamityMod.CalPlayer iCantBreathe = false; cragsLava = false; vaporfied = false; - waterLeechBleeding = false; banishingFire = false; wither = false; #endregion @@ -3977,10 +3973,6 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(Player.name + " fell prey to their sins."); } - if (waterLeechBleeding) - { - damageSource = PlayerDeathReason.ByCustomReason(Player.name + " lost too much blood."); - } if (shadowflame) { damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s spirit was turned to ash."); @@ -6815,7 +6807,6 @@ namespace CalamityMod.CalPlayer int frame = HandlePSCAnimationFrames(animType); Player.legFrame.Y = Player.legFrame.Height * frame; } - waterLeechTarget = -1; } #endregion diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 7ce319a4a4..08e23f7e7a 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -225,19 +225,6 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 60; } - if (waterLeechBleeding) - { - if (Player.lifeRegen > 0) - Player.lifeRegen = 0; - - Player.lifeRegenTime = 0; - lifeRegenLost += 6; - if (DownedBossSystem.downedAquaticScourge) - lifeRegenLost += 6; - if (DownedBossSystem.downedPolterghast) - lifeRegenLost += 12; - } - if (pFlames) { if (Player.lifeRegen > 0) diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index dce85d6dcc..a8ae4cf92f 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -132,8 +132,7 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 0.75f, AcidRainSpawnRequirement.Anywhere) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) } + { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) } }; PossibleEnemiesAS = new() { @@ -144,7 +143,6 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) } }; PossibleEnemiesPolter = new() @@ -156,7 +154,6 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) } }; diff --git a/Items/Placeables/Banners/WaterLeechBanner.cs b/Items/Placeables/Banners/WaterLeechBanner.cs deleted file mode 100644 index feaeeaf974..0000000000 --- a/Items/Placeables/Banners/WaterLeechBanner.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Banners -{ - public class WaterLeechBanner : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Water Leech"); - } - - 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 = ItemUseStyleID.Swing; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 114; - } - } -} diff --git a/Items/Placeables/Banners/WaterLeechBanner.png b/Items/Placeables/Banners/WaterLeechBanner.png deleted file mode 100644 index 7774a58ccf5873ae31c18712b323abff7cabe020..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 494 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eN!3HEl7su5ADVB6cUq=Rpjs4tz5?O(K#^NA% zCx&(BWL^R}3dtTpz6=aiY77hwEes65fI|H(?Xp)Vmi(`nz>9tcfdNDf+wC%S|TI6_CfYZZbhfIcnluB!>tH6;s z`2*qt(%JF{ZXLUH?vh$9*GI0)Q7;t59M1`GST;!s8M0>=?o4{fwfSVo|8sBN9k<`S zW`nP{knrl$k&GAqeww=LV9Ue~m(tGxnihGnOjFL-FzCm5_bX@}(10). + AddIngredient(35). + AddTile(TileID.Anvils). + Register(); + } } } diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs deleted file mode 100644 index 0592722621..0000000000 --- a/NPCs/AcidRain/WaterLeech.cs +++ /dev/null @@ -1,228 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.AcidRain -{ - public class WaterLeech : ModNPC - { - public Player Target => Main.player[NPC.target]; - public bool LatchingOntoTarget - { - get => NPC.ai[0] == 1f; - set => NPC.ai[0] = value.ToInt(); - } - public ref float LackOfWaterDeathTimer => ref NPC.ai[2]; - public const float ChasePromptDistance = 55f; - public const float ChaseMaxDistance = 140f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Leech"); - Main.npcFrameCount[NPC.type] = 4; - } - - public override void SetDefaults() - { - NPC.width = 26; - NPC.height = 14; - - NPC.lifeMax = 30; - NPC.damage = 0; - - if (DownedBossSystem.downedPolterghast) - { - NPC.lifeMax = 1235; - NPC.defense = 10; - } - else if (DownedBossSystem.downedAquaticScourge) - NPC.lifeMax = 90; - - NPC.value = Item.buyPrice(0, 0, 2, 5); - NPC.lavaImmune = false; - NPC.noGravity = true; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit33; - NPC.DeathSound = SoundID.NPCDeath1; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("It can smell the scent of flesh from far distances and will eagerly squirm its way to the source. Once attached to the host, they rapidly intake blood and discharge venom, both of which heavily disadvantage its prey.") - }); - } - - public override void SendExtraAI(BinaryWriter writer) => writer.Write(NPC.dontTakeDamage); - - public override void ReceiveExtraAI(BinaryReader reader) => NPC.dontTakeDamage = reader.ReadBoolean(); - - public override void AI() - { - if (NPC.localAI[0] == 0f) - { - NPC.TargetClosest(); - NPC.localAI[0] = 1f; - } - - bool playerAlreadyTargeted = false; - float antiStickyAcceleration = 0.25f; - - // Repel other leeches from this one. Also determine if one is already targeting a player. - // Only one leech is allowed to target one player at a time. - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type != NPC.type || !Main.npc[i].active || Main.npc[i].whoAmI == NPC.whoAmI) - continue; - - if (Main.npc[i].target == NPC.target && !playerAlreadyTargeted) - playerAlreadyTargeted = true; - if (Main.npc[i].Hitbox.Intersects(NPC.Hitbox)) - NPC.velocity += NPC.DirectionFrom(Main.npc[i].Center) * antiStickyAcceleration; - } - - if (!playerAlreadyTargeted || Target.Calamity().waterLeechTarget == -1) - Target.Calamity().waterLeechTarget = NPC.whoAmI; - - if (LatchingOntoTarget) - { - LatchOntoTarget(); - return; - } - - NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); - - // If the leech is not in water, fall and quickly cease horizontal movement. - // After some time, if still not in water, die due to a lack of water. - if (!NPC.wet) - { - NPC.velocity.X *= 0.97f; - NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.4f, -4f, 16f); - LackOfWaterDeathTimer++; - if (LackOfWaterDeathTimer >= 300f) - { - NPC.life = 0; - NPC.HitEffect(); - NPC.active = false; - NPC.netUpdate = true; - } - } - - // Swim towards the target if they are in water. - else if (Target.wet && Target.Calamity().waterLeechTarget == NPC.whoAmI) - { - float swimSpeed = Target.wet ? 23f : 17f; - float swimIntertia = 24f; - if (DownedBossSystem.downedPolterghast) - { - swimSpeed *= 1.6f; - swimIntertia = 17f; - } - NPC.velocity = (NPC.velocity * (swimIntertia - 1f) + NPC.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia; - } - - // Rapidly slow down if the target is not in water. - else if (!Target.wet) - NPC.velocity *= 0.9f; - - if (NPC.WithinRange(Target.Top, ChasePromptDistance) && Target.active && !Target.dead) - { - LatchingOntoTarget = true; - NPC.netUpdate = true; - } - - // If the target is not in water, become invincible. - bool shouldNotTakeDamage = !Target.wet; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.dontTakeDamage != shouldNotTakeDamage) - { - NPC.dontTakeDamage = shouldNotTakeDamage; - NPC.netUpdate = true; - } - } - - public void LatchOntoTarget() - { - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.dontTakeDamage) - { - NPC.dontTakeDamage = false; - NPC.netUpdate = true; - } - - // If the target moved far enough away, stop attempting to attach to them. - if (!NPC.WithinRange(Target.Center, ChaseMaxDistance)) - { - LatchingOntoTarget = false; - NPC.netUpdate = true; - return; - } - - Vector2 destination = (Target.gravDir == 1f ? Target.Top : Target.Bottom) + Target.direction * Vector2.UnitX * 4f; - float speed = MathHelper.Lerp(7f, 23f, Utils.GetLerpValue(10f, ChaseMaxDistance, NPC.Distance(destination), true)); - NPC.velocity = NPC.SafeDirectionTo(destination) * speed; - - if (NPC.WithinRange(destination, 45f)) - { - Target.AddBuff(BuffID.Bleeding, 180, true); - Target.AddBuff(ModContent.BuffType(), 30, true); - } - - // Stop searching if the target is not in water anymore and they're not close. - else if (!NPC.wet && !NPC.WithinRange(destination, 85f)) - { - LatchingOntoTarget = false; - NPC.netUpdate = true; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter >= 4) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) - NPC.frame.Y = 0; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.PlayerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !Main.raining) - return 0f; - - return 0.115f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 8; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourge); - postAS.Add(ModContent.ItemType(), 100, hideLootReport: !DownedBossSystem.downedAquaticScourge); - postAS.AddFail(ModContent.ItemType(), 20, hideLootReport: DownedBossSystem.downedAquaticScourge); - } - } -} diff --git a/NPCs/AcidRain/WaterLeechGlow.png b/Projectiles/Magic/WaterLeechGlow.png similarity index 100% rename from NPCs/AcidRain/WaterLeechGlow.png rename to Projectiles/Magic/WaterLeechGlow.png diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 92d9d8a7db..faeccebd46 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -12,8 +12,6 @@ namespace CalamityMod.Projectiles.Magic { public class WaterLeechProj : ModProjectile { - public override string Texture => "CalamityMod/NPCs/AcidRain/WaterLeech"; - public override void SetStaticDefaults() { DisplayName.SetDefault("Leech"); @@ -82,7 +80,8 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Color color = Projectile.GetAlpha(lightColor); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), color, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } @@ -96,7 +95,8 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/NPCs/AcidRain/WaterLeechGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Color color = Projectile.GetAlpha(Color.White); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Magic/WaterLeechGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); } public override void Kill(int timeLeft) diff --git a/NPCs/AcidRain/WaterLeech.png b/Projectiles/Magic/WaterLeechProj.png similarity index 100% rename from NPCs/AcidRain/WaterLeech.png rename to Projectiles/Magic/WaterLeechProj.png diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 5e1d1d60d8..500fff2930 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -688,9 +688,6 @@ namespace CalamityMod case 113: item = ModContent.ItemType(); break; - case 114: - item = ModContent.ItemType(); - break; case 115: item = ModContent.ItemType(); break; @@ -1047,9 +1044,6 @@ namespace CalamityMod case 113: npc = ModContent.NPCType(); break; - case 114: - npc = ModContent.NPCType(); - break; case 115: npc = ModContent.NPCType(); break; diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 4189f4264d..428e46b063 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -220,7 +220,6 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, From e91f1df888af2df3b6263de79220702da095d6ee Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Tue, 18 Oct 2022 22:15:33 -0400 Subject: [PATCH 11/13] fixed boss rush teleports, astral arcanum shits in multiplayer? idc honestly lost cause, make it like shellphone fr --- CalPlayer/CalamityPlayer.cs | 220 +++++------------- CalamityNetcode.cs | 4 - Events/BossRushEvent.cs | 63 ++++- NPCs/CalamityGlobalNPC.cs | 15 -- .../Typeless/BossRushEndEffectThing.cs | 17 +- UI/AstralArcanumUI.cs | 77 +++--- 6 files changed, 166 insertions(+), 230 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a08c46c1d0..814483cbd2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -124,6 +124,7 @@ namespace CalamityMod.CalPlayer public DoGCartSegment[] DoGCartSegments = new DoGCartSegment[DoGCartMount.SegmentCount]; public float SmoothenedMinecartRotation; public bool LungingDown = false; + public Vector2? BossRushReturnPosition = null; public float moveSpeedBonus = 0f; public int momentumCapacitorTime = 0; @@ -3054,166 +3055,77 @@ namespace CalamityMod.CalPlayer #endregion #region TeleportMethods - public void HandleTeleport(int teleportType, bool forceHandle = false, int whoAmI = 0) - { - bool syncData = forceHandle || Main.netMode == NetmodeID.SinglePlayer; - if (syncData) - { - TeleportPlayer(teleportType, forceHandle, whoAmI); - } - else - { - SyncTeleport(teleportType); - } - } - - public static void TeleportPlayer(int teleportType, bool syncData = false, int whoAmI = 0) - { - Player player; - if (!syncData) - { - player = Main.LocalPlayer; - } - else - { - player = Main.player[whoAmI]; - } - switch (teleportType) - { - case 0: - UnderworldTeleport(player, syncData); - break; - case 1: - DungeonTeleport(player, syncData); - break; - case 2: - JungleTeleport(player, syncData); - break; - default: - break; - } - } - - public void SyncTeleport(int teleportType) - { - ModPacket netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); - netMessage.Write(teleportType); - netMessage.Send(); - } - - public static void UnderworldTeleport(Player player, bool syncData = false) - { - if (Main.netMode == NetmodeID.SinglePlayer) - player.DemonConch(); - else if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) - NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 2); - } - - public static void DungeonTeleport(Player player, bool syncData = false) - { - ModTeleport(player, new Vector2(Main.dungeonX, Main.dungeonY), syncData, true); - } - - public static void JungleTeleport(Player player, bool syncData = false) + public static Vector2? GetJunglePosition(Player player) { + bool canSpawn = false; int teleportStartX = Abyss.AtLeftSideOfWorld ? (int)(Main.maxTilesX * 0.65) : (int)(Main.maxTilesX * 0.2); int teleportRangeX = (int)(Main.maxTilesX * 0.15); - int teleportStartY = (int)Main.worldSurface - 75; int teleportRangeY = 50; - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - int width = player.width; - Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height); - while (!flag && num < 1000) - { - num++; - num2 = teleportStartX + Main.rand.Next(teleportRangeX); - num3 = teleportStartY + Main.rand.Next(teleportRangeY); - vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height); - if (!Collision.SolidCollision(vector, width, player.height)) - { - int i = 0; - while (i < 100) - { - Tile tile = Main.tile[num2, num3 + i]; - vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height); - Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); - if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) - { - bool arg_1FE_0 = vector2.Y == vector.Y; - } - if (arg_1FF_0) - { - i++; - } - else - { - if (tile.HasTile && !tile.HasUnactuatedTile && Main.tileSolid[(int)tile.TileType]) - { - break; - } - i++; - } - } - if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) - { - Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - if (Collision.SolidCollision(vector, width, player.height) && i < 99) - { - Vector2 vector3 = Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - flag = true; - break; - } - } - } - } - } - } - } - } - if (!flag) - { - return; - } + Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + { + mostlySolidFloor = true, + avoidAnyLiquid = true, + avoidLava = true, + avoidHurtTiles = true, + avoidWalls = true, + attemptsBeforeGivingUp = 1000, + maximumFallDistanceFromOrignalPoint = 30 + }; - ModTeleport(player, vector, syncData, false); + Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY, settings); + + if (canSpawn) + { + return (Vector2?)vector; + } + return null; } - public static void ModTeleport(Player player, Vector2 pos, bool syncData = false, bool convertFromTiles = false) + public static Vector2? GetUnderworldPosition(Player player) + { + bool canSpawn = false; + int num = Main.maxTilesX / 2; + int num2 = 100; + int num3 = num2 / 2; + int teleportStartY = Main.UnderworldLayer + 20; + int teleportRangeY = 80; + Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + { + mostlySolidFloor = true, + avoidAnyLiquid = true, + avoidLava = true, + avoidHurtTiles = true, + avoidWalls = true, + attemptsBeforeGivingUp = 1000, + maximumFallDistanceFromOrignalPoint = 30 + }; + + Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num3, num2, teleportStartY, teleportRangeY, settings); + if (!canSpawn) + vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num2, num3, teleportStartY, teleportRangeY, settings); + + if (!canSpawn) + vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num + num3, num3, teleportStartY, teleportRangeY, settings); + + if (canSpawn) + { + return (Vector2?)vector; + } + return null; + } + + public static void ModTeleport(Player player, Vector2 pos, bool playSound = true, int style = TeleportationStyleID.RecallPotion) { bool postImmune = player.immune; int postImmuneTime = player.immuneTime; - if (convertFromTiles) - { - pos = new Vector2(pos.X * 16 + 8 - player.width / 2, pos.Y * 16 - player.height); - } - player.grappling[0] = -1; - player.grapCount = 0; - for (int index = 0; index < Main.maxProjectiles; ++index) - { - if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) - { - Main.projectile[index].Kill(); - } - } - player.Teleport(pos, 2, 0); + player.StopVanityActions(false); + player.RemoveAllGrapplingHooks(); + player.Teleport(pos, style); + if (Main.netMode == NetmodeID.Server) + RemoteClient.CheckSection(player.whoAmI, player.Center); + NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, style, 0, 0); player.velocity = Vector2.Zero; player.immune = postImmune; player.immuneTime = postImmuneTime; @@ -3223,16 +3135,8 @@ namespace CalamityMod.CalPlayer } Main.TeleportEffect(player.getRect(), 1); Main.TeleportEffect(player.getRect(), 3); - SoundEngine.PlaySound(SoundID.Item6, player.position); - if (Main.netMode != NetmodeID.Server) - { - return; - } - if (syncData) - { - RemoteClient.CheckSection(player.whoAmI, player.position, 1); - NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, 3, 0, 0); - } + if (playSound) + SoundEngine.PlaySound(SoundID.Item6, player.Center); } #endregion diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index c0ec0cd579..89ddf81c54 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -193,9 +193,6 @@ namespace CalamityMod int countdown3 = reader.ReadInt32(); BossRushEvent.HostileProjectileKillCounter = countdown3; break; - case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); - break; // // Acid Rain @@ -357,7 +354,6 @@ namespace CalamityMod BossRushEndTimer, EndBossRush, BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames". - TeleportPlayer, // also used by Astral Arcanum. // Acid Rain AcidRainSync, diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index c60f91356e..dbb5a592ef 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -225,7 +225,7 @@ namespace CalamityMod.Events new Boss(NPCID.Golem, TimeChangeContext.Day, type => { - int shittyStatueBoss = NPC.NewNPC(Source, (int)(Main.player[ClosestPlayerToWorldCenter].position.X + Main.rand.Next(-100, 101)), (int)(Main.player[ClosestPlayerToWorldCenter].position.Y - 400f), type, 1); + int shittyStatueBoss = NPC.NewNPC(Source, (int)(Main.player[ClosestPlayerToWorldCenter].position.X + Main.rand.Next(-100, 101)), (int)(Main.player[ClosestPlayerToWorldCenter].position.Y - 600f), type, 1); Main.npc[shittyStatueBoss].timeLeft *= 20; CalamityUtils.BossAwakenMessage(shittyStatueBoss); }, permittedNPCs: new int[] { NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead, NPCID.GolemHeadFree }), @@ -313,6 +313,16 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), spawnContext: type => { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + if (p.FindBuffIndex(ModContent.BuffType()) > -1) + p.ClearBuff(ModContent.BuffType()); + } + } + Player player = Main.player[ClosestPlayerToWorldCenter]; SoundEngine.PlaySound(RuneofKos.CVSound, player.Center); @@ -384,18 +394,9 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), spawnContext: type => { - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player = Main.player[playerIndex]; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); - } - } SoundEngine.PlaySound(SupremeCalamitas.SpawnSound, Main.player[ClosestPlayerToWorldCenter].Center); CalamityUtils.SpawnBossBetter(Main.player[ClosestPlayerToWorldCenter].Top - new Vector2(42f, 84f), type); - }, specialSpawnCountdown: 420, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + }, specialSpawnCountdown: 840, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), // new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -407,6 +408,22 @@ namespace CalamityMod.Events { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierOneEndText", XerocTextColor); CreateTierAnimation(2); + + // Teleport players to where they came from + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + if (p.Calamity().BossRushReturnPosition.HasValue) + { + CalamityPlayer.ModTeleport(p, p.Calamity().BossRushReturnPosition.Value, false); + p.Calamity().BossRushReturnPosition = null; + } + p.Calamity().BossRushReturnPosition = null; + SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center); + } + } }, [NPCID.Plantera] = npc => { @@ -593,6 +610,16 @@ namespace CalamityMod.Events public static void End() { + // Reset BossRushReturnPosition + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + p.Calamity().BossRushReturnPosition = null; + } + } + if (Main.netMode == NetmodeID.SinglePlayer) { EndEffects(); @@ -678,6 +705,20 @@ namespace CalamityMod.Events BossRushStage++; CalamityUtils.KillAllHostileProjectiles(); HostileProjectileKillCounter = 3; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + p.Calamity().BossRushReturnPosition = p.Center; + Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p); + if (!underworld.HasValue) + break; + CalamityPlayer.ModTeleport(p, underworld.Value, false); + SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center); + } + } } // This is the generic form of "Are there any remaining NPCs on the boss list for this boss rush stage?" check. diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index dc75cf8428..46b6aaf9d0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4596,21 +4596,6 @@ namespace CalamityMod.NPCs } } - if (npc.life <= 0 && BossRushEvent.BossRushActive && npc.type == NPCID.WallofFlesh && BossRushEvent.CurrentlyFoughtBoss == npc.type) - { - // Post-Wall of Flesh teleport back to spawn. - // This appears to only work correctly client-side in MP. - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - bool appropriatePlayer = Main.myPlayer == playerIndex; - if (Main.player[playerIndex].active && appropriatePlayer) - { - Main.player[playerIndex].Spawn(PlayerSpawnContext.RecallFromItem); - SoundEngine.PlaySound(BossRushEvent.TeleportSound with { Volume = 1.6f }, Main.player[playerIndex].Center); - } - } - } - if (pFlames > 0 && npc.life <= 0) { Rectangle hitbox = npc.Hitbox; diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index 4f2b289538..a97ab6baa3 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -2,9 +2,10 @@ using CalamityMod.Items; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.GameContent.Events; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -43,8 +44,18 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { BossRushEvent.End(); - Player p = Main.LocalPlayer; - p.QuickSpawnItemDirect(p.GetSource_Misc("CalamityMod_BossRushRock"), ModContent.ItemType()); + for (int i = Main.maxPlayers - 1; i >= 0; i--) + { + Player p = Main.player[i]; + if (p is null || !p.active) + continue; + int rock = Item.NewItem(p.GetSource_Misc("CalamityMod_BossRushRock"), (int)p.position.X, (int)p.position.Y, p.width, p.height, ModContent.ItemType()); + if (Main.netMode == NetmodeID.Server) + { + Main.timeItemSlotCannotBeReusedFor[rock] = 54000; + NetMessage.SendData(MessageID.InstancedItem, i, -1, null, rock); + } + } CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFiveEndText", BossRushEvent.XerocTextColor); } } diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 6d06e990e3..d7724172a8 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -1,12 +1,13 @@ -using CalamityMod.Events; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent; -using ReLogic.Content; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.UI { @@ -69,14 +70,6 @@ namespace CalamityMod.UI public static void UpdateAndDraw(SpriteBatch sb) { //Don't do anything if not open - bool forceOpenAndTeleport = BossRushEvent.BossRushStage < BossRushEvent.Bosses.Count - 1 && BossRushEvent.CurrentlyFoughtBoss == NPCID.WallofFlesh && - !CalamityUtils.AnyBossNPCS() && !Main.player[Main.myPlayer].ZoneUnderworldHeight; - if (forceOpenAndTeleport) - { - Open = true; - } - else if (BossRushEvent.BossRushActive) - Open = false; if (!Open) return; @@ -104,26 +97,21 @@ namespace CalamityMod.UI CircleStyle style = CircleStyle.Normal; //If the mouse is in the circle - if (c.Contains(Main.MouseScreen) || forceOpenAndTeleport) + if (c.Contains(Main.MouseScreen)) { style = CircleStyle.Selected; Main.LocalPlayer.mouseInterface = true; - if (forceOpenAndTeleport) - { - current = 0; - } - selectedCircle = current; //If left clicked - if ((Main.mouseLeft && Main.mouseLeftRelease) || forceOpenAndTeleport) + if ((Main.mouseLeft && Main.mouseLeftRelease)) { Main.mouseLeftRelease = false; Main.mouseLeft = false; - DoTeleportation(current, forceOpenAndTeleport); + DoTeleportation(current); } } @@ -151,31 +139,42 @@ namespace CalamityMod.UI Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.Value, text, CenterPoint.X - size.X / 2f, CenterPoint.Y + CircleOffset + CircleTextureSize / 2 + 4, Color.White, Color.Black, default); } - public static void DoTeleportation(int circle, bool forcedByBossRush) + public static void DoTeleportation(int circle) { Open = false; Player p = Main.LocalPlayer; - if (forcedByBossRush) - SoundEngine.PlaySound(BossRushEvent.TeleportSound with { Volume = 1.6f }, p.position); - - if (circle == 3) + switch (circle) { - if (Main.netMode == NetmodeID.SinglePlayer) - { - p.TeleportationPotion(); - if (!forcedByBossRush) - SoundEngine.PlaySound(SoundID.Item6, p.position); - } - else if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else - { - Main.LocalPlayer.Calamity().HandleTeleport(circle, false, 0); + case 0: + Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p); + if (!underworld.HasValue) + return; + CalamityPlayer.ModTeleport(p, underworld.Value, true, TeleportationStyleID.DemonConch); + break; + case 1: + CalamityPlayer.ModTeleport(p, new Vector2(Main.dungeonX * 16, Main.dungeonY * 16 - 8)); + break; + case 2: + Vector2? jungle = CalamityPlayer.GetJunglePosition(p); + if (!jungle.HasValue) + return; + CalamityPlayer.ModTeleport(p, jungle.Value); + break; + case 3: + if (Main.netMode == NetmodeID.SinglePlayer) + { + p.TeleportationPotion(); + SoundEngine.PlaySound(SoundID.Item6, p.position); + } + else if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + break; + default: + break; } } From 72671bf26a5ac88f5df8f1193acf098ef1f0ac65 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 18 Oct 2022 21:30:42 -0500 Subject: [PATCH 12/13] Acid Eels are a bit more worm-like now --- Effects/CalamityShaders.cs | 3 + Effects/PrimTextureOverlayShader.fx | 66 ++++++++++++++++++++ Effects/PrimTextureOverlayShader.xnb | Bin 0 -> 2796 bytes NPCs/AcidRain/AcidEel.cs | 87 ++++++++++++++++++++++----- NPCs/AcidRain/AcidEel.png | Bin 2828 -> 492 bytes NPCs/AcidRain/AcidEelBody.png | Bin 0 -> 325 bytes NPCs/AcidRain/AcidEelGlow.png | Bin 1340 -> 0 bytes NPCs/AcidRain/AcidEelTail.png | Bin 0 -> 681 bytes 8 files changed, 140 insertions(+), 16 deletions(-) create mode 100644 Effects/PrimTextureOverlayShader.fx create mode 100644 Effects/PrimTextureOverlayShader.xnb create mode 100644 NPCs/AcidRain/AcidEelBody.png delete mode 100644 NPCs/AcidRain/AcidEelGlow.png create mode 100644 NPCs/AcidRain/AcidEelTail.png diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index a2830d2e3c..40ec339aae 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Effects public static Effect SideStreakTrailShader; public static Effect HeavenlyGaleTrailShader; public static Effect HeavenlyGaleLightningShader; + public static Effect PrimTextureOverlayShader; public static Effect BaseFusableParticleEdgeShader; public static Effect AdditiveFusableParticleEdgeShader; @@ -87,6 +88,7 @@ namespace CalamityMod.Effects SideStreakTrailShader = CalamityMod.Instance.Assets.Request("Effects/SideStreakTrail", AssetRequestMode.ImmediateLoad).Value; HeavenlyGaleTrailShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleTrailShader", AssetRequestMode.ImmediateLoad).Value; HeavenlyGaleLightningShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleLightningShader", AssetRequestMode.ImmediateLoad).Value; + PrimTextureOverlayShader = CalamityMod.Instance.Assets.Request("Effects/PrimTextureOverlayShader", AssetRequestMode.ImmediateLoad).Value; BaseFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/BaseFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; AdditiveFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; @@ -129,6 +131,7 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:SideStreakTrail"] = new MiscShaderData(new Ref(SideStreakTrailShader), "TrailPass"); GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"] = new MiscShaderData(new Ref(HeavenlyGaleTrailShader), "PiercePass"); GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"] = new MiscShaderData(new Ref(HeavenlyGaleLightningShader), "TrailPass"); + GameShaders.Misc["CalamityMod:PrimitiveTexture"] = new MiscShaderData(new Ref(PrimTextureOverlayShader), "TrailPass"); GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"] = new MiscShaderData(new Ref(BaseFusableParticleEdgeShader), "ParticlePass"); GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"] = new MiscShaderData(new Ref(AdditiveFusableParticleEdgeShader), "ParticlePass"); diff --git a/Effects/PrimTextureOverlayShader.fx b/Effects/PrimTextureOverlayShader.fx new file mode 100644 index 0000000000..d4b7a4abed --- /dev/null +++ b/Effects/PrimTextureOverlayShader.fx @@ -0,0 +1,66 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; +float2 uPrimitiveSize; +bool flipVertically; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates * uPrimitiveSize / uImageSize1; + coords.x = 1 - frac(coords.x); + coords.y = saturate(input.TextureCoordinates.y); + if (flipVertically) + coords.y = 1 - coords.y; + + float4 texColor = tex2D(uImage1, coords); + return texColor * input.Color; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/PrimTextureOverlayShader.xnb b/Effects/PrimTextureOverlayShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..f139435fc66aa33089ebb6a3b87bd80e3c07fecc GIT binary patch literal 2796 zcmb_eO>7%Q6rQ!y;I>AtN|Abq#9oks6j_dmkt-!C#A#@R0TY|zL#1fD8P`iUUU$9Q zB&Y{-jb-yNbs+RhK7bs4> zO}D<@<+jsu>?JF(k{ClR#(0gyIo5n<17~=LQ=QmjwZ`v(m_g8fv(`>-==L$Ie{mo;34-PZ6H?C&-F5cU%d@59b$eKiHUtl=i? zK*L|dzOUgu*v~Xv#-e0J zSp-qr`j-NvqG%LdW|hW!i&KD)iHI>;nlQxN!=njJ;l#+7&S4As6*MizCfNWs$q-6m ziMIT+{ZhHSe>$x((SDk*9t88yJ$|YzGYsm)~lwx zJZ8n)=sGU<%}e>>JNZkcV!l|On`5JBnblUW)Qwbgc@({w)M5=`X^i5FS{Tf{4!ZzV zdz^<&y(x31`!$Pvs453}Vfv5+TPMjeiyZ4Kw5}4hZ^C4&oYed%O0i0Hr9pTUW!ZAG zS|Ogn3g?us9*^231API>L86GUPjE%kEH`AVe;HGWydjtCvwi`(nx;-KZ@~x$ek1Rd3-i~b!PZRqlWVQa8@{j+yMXc&^hc;&7ebxQvw?ao)9>d Y;Ecd&U{Pn5!>2Q@IZOWu-hit75~quL7XSbN literal 0 HcmV?d00001 diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 06041b249f..9f5c7d614d 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -13,18 +13,23 @@ using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using System.Linq; namespace CalamityMod.NPCs.AcidRain { public class AcidEel : ModNPC { public Player Target => Main.player[NPC.target]; + + public PrimitiveTrail SegmentDrawer = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Eel"); Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.TrailCacheLength[NPC.type] = 7; + NPCID.Sets.TrailCacheLength[NPC.type] = 12; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { PortraitPositionXOverride = 0 @@ -35,11 +40,11 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - NPC.width = 72; - NPC.height = 18; + NPC.width = 20; + NPC.height = 20; NPC.damage = 20; - NPC.lifeMax = 72; + NPC.lifeMax = 42; NPC.defense = 4; NPC.knockBackResist = 0.9f; @@ -47,14 +52,14 @@ namespace CalamityMod.NPCs.AcidRain { NPC.DR_NERD(0.05f); NPC.damage = 100; - NPC.lifeMax = 3000; + NPC.lifeMax = 2000; NPC.defense = 20; NPC.knockBackResist = 0.7f; } else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 50; - NPC.lifeMax = 216; + NPC.lifeMax = 176; } NPC.value = Item.buyPrice(0, 0, 3, 32); @@ -77,8 +82,8 @@ namespace CalamityMod.NPCs.AcidRain { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Along its spine runs an undulating dorsal fin which they can put to great use for their streamlined form, as they rush at prey underwater.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("Along its spine runs an undulating dorsal fin which they can put to great use for their streamlined form, as they rush at prey underwater.") }); } @@ -104,6 +109,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.X *= 0.95f; if (NPC.velocity.Y < 14f) NPC.velocity.Y += 0.15f; + NPC.spriteDirection = NPC.direction; } public void SwimTowardsTarget() @@ -115,17 +121,17 @@ namespace CalamityMod.NPCs.AcidRain swimSpeed += 4f; // Swim upwards if sufficiently under water. - bool waterAbove = false; + bool airAbove = false; for (int dy = -160; dy < 0; dy += 8) { - if (Collision.WetCollision(NPC.position + Vector2.UnitY * dy, NPC.width, 16)) + if (!Collision.WetCollision(NPC.position + Vector2.UnitY * dy, NPC.width, 16)) { - waterAbove = true; + airAbove = true; break; } } - if (waterAbove) + if (!airAbove) NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y - 0.25f, -14f, 14f); else NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.4f, -4f, 8f); @@ -170,11 +176,60 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public float SegmentWidthFunction(float completionRatio) => NPC.width * NPC.scale * 0.5f; + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); - if (NPC.velocity.Length() > 1.5f) - CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true); + // Initialize the segment drawer. + SegmentDrawer ??= new(SegmentWidthFunction, _ => NPC.GetAlpha(Color.White), null, GameShaders.Misc["CalamityMod:PrimitiveTexture"]); + + Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelTail").Value; + Vector2 headDrawPosition = NPC.Center - screenPos; + Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); + + Vector2 segmentAreaTopLeft = Vector2.One * 999999f; + Vector2 segmentAreaTopRight = Vector2.Zero; + if (NPC.IsABestiaryIconDummy) + { + for (int i = 0; i < segmentPositions.Length; i++) + segmentPositions[i] = NPC.TopLeft + Vector2.UnitX * i * 5f; + } + segmentPositions = segmentPositions.Where(p => p != Vector2.Zero).ToArray(); + + for (int i = 0; i < segmentPositions.Length; i++) + { + segmentPositions[i] += NPC.Size * 0.5f - screenPos - NPC.rotation.ToRotationVector2() * Math.Sign(NPC.velocity.X) * 8f; + if (segmentAreaTopLeft.X > segmentPositions[i].X) + segmentAreaTopLeft.X = segmentPositions[i].X; + if (segmentAreaTopLeft.Y > segmentPositions[i].Y) + segmentAreaTopLeft.Y = segmentPositions[i].Y; + + if (segmentAreaTopRight.X < segmentPositions[i].X) + segmentAreaTopRight.X = segmentPositions[i].X; + if (segmentAreaTopRight.Y < segmentPositions[i].Y) + segmentAreaTopRight.Y = segmentPositions[i].Y; + } + + // Set shader parameters. + float offsetAngle = (NPC.position - NPC.oldPos[1]).ToRotation(); + Vector2 primitiveArea = (segmentAreaTopRight - segmentAreaTopLeft).RotatedBy(offsetAngle); + Rectangle tailArea = NPC.frame with { Width = 28 }; + GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBody")); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(primitiveArea); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["flipVertically"].SetValue(NPC.velocity.X > 0f); + + SpriteEffects direction = NPC.velocity.X < 0f ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.EntitySpriteDraw(headTexture, headDrawPosition, NPC.frame, NPC.GetAlpha(Color.White), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); + + if (segmentPositions.Length >= 2) + { + float tailRotation = (segmentPositions[0] - segmentPositions[1]).ToRotation() + MathHelper.Pi; + Main.EntitySpriteDraw(tailTexture, segmentPositions[^1], tailArea, NPC.GetAlpha(Color.White), tailRotation, tailArea.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0); + SegmentDrawer.Draw(segmentPositions, Vector2.Zero, 36); + } + + return false; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/AcidEel.png b/NPCs/AcidRain/AcidEel.png index 1f913c9b1ecfa541f23a6db758b73b5452ecc9ec..2c5316c349249a6fdf96171f68cbfbf81c59ba55 100644 GIT binary patch literal 492 zcmeAS@N?(olHy`uVBq!ia0vp^LO|TY!3-o<>33TLDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(ehe>H$6>u1c~BmIlG4@vZ5O4l5>w^j7+w-Pv0h<=*ouoRN)xLea8#w-lh- z+ZQFL11a8;Aiv=MNPxlig;E<(g0sLQvY3H^?+^$xifVW@04+E5ba4#v@P0e>VqUWW zkLzSf=j|W=-?zRWv*6%H%~{_Je0K+h)~vGoA*VW}^h9=u*V^kGk7uj8Z|(BYT_t(Q z;yjC_&_U;|EA+g3vW{NgbmdpYgXJ=vI$}K)eF2&hl53K=Svg)Sy?0M~@;Ug$yoLPU zeG8mRxA_FO1@vj9lw6WgDrl2&y4Z19P+|Gwa4D%>`~jNF-wC#_Sp0Qsx`Rm5;|a>s z?n-h^;7DP3B&^Ic;o$yf9aa*T1s83eu=aQEwj7QRnn#wg%q?cWYg`f&RxPurZ{2Uk z#L^WGMn{xg3rgM#9Qd#MT=3LBw<{lCO-sHQ-uB~?qwU(?3?DB9y0`61_9!*Da^b#V zOZIumB97PPRudRIKWuHOGICk_dts+wt3t>mWi7_M@Ti6=#re}D3Lh??z%$o)LFr$n Y|94$W)g0z;1BNPtr>mdKI;Vst06XH!Q2+n{ literal 2828 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 V%M+}=F%XopJzf1=);T3K0RRM-cP0P; diff --git a/NPCs/AcidRain/AcidEelTail.png b/NPCs/AcidRain/AcidEelTail.png new file mode 100644 index 0000000000000000000000000000000000000000..0abf7dc4b91bb7dfc06ef061862ca1743792c066 GIT binary patch literal 681 zcmeAS@N?(olHy`uVBq!ia0vp^Qb63o!3-pK{y2ReNHG=%xjQkeJ16rJ$YDu$^mSxl z*x1kgCy^D%*9!0nakVrER+3dHjc<*2ODT+U@2&J@WaD2kDdgPqx5`X^RziVQA*i>%Swr%n*%YqFp*iSIGJ-qC=a=x3F^I>gmucdDB+EYJo zZfr@Ea5vwcH7jm?W*4L4RxQ=%neHA-@4bKYgl)31X^`f6eTC-2kgli8Ov(aI@#%c) z395VZ;s2=@M}0N*B-cf0cK5QrTd{T1xBOoZ#Y>hi`Y32I*=uUh>uY~Hc!O4QM0=?< zp3Yw>$#Y_6W^O~!`|{i=n@$G36HQz_RVbiusm9cxwK}s8$Tlw!S>AYEX6c_Bjw>I> z?{Z&R`ARJ$S<(AjNHxrW-ExeWreB?;ZQgOW6 zbwWao@ur+hTz8`nZ?{1(=Z$udDF$$d8rgxWt<7hXNQ~vfzL1GM1 ziOhPlm#({&U+wc*XlHO-{vo@G%g+Y6Z+wva`)%O0D9tOEUd2|(Wvfg{n)$D`H7c4- zJ}xry%>DU+-yYZPb6#25_-y{xAfMy&k2Wk0>GCbfS^V5mbv@AQj9d8Uo!=Xxb*L@r zRj#3z>kXgH3!>gn<-GlC# Date: Tue, 18 Oct 2022 23:07:27 -0400 Subject: [PATCH 13/13] fixed an issue with profaned soul artifact --- Projectiles/Summon/MiniGuardianAttack.cs | 2 +- Projectiles/Summon/MiniGuardianDefense.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index e4431c6c90..8a1ba16b6b 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.timeLeft = 2; } - if (!modPlayer.pArtifact || (!modPlayer.profanedCrystal && !modPlayer.WearingPostMLSummonerSet)) + if (!modPlayer.pArtifact && !modPlayer.profanedCrystal) { modPlayer.gOffense = false; Projectile.active = false; diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 47271f0f04..84894a6a14 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.timeLeft = 2; } - if (!modPlayer.pArtifact || (player.maxMinions < 10 && !modPlayer.profanedCrystal)) + if (!modPlayer.pArtifact && !modPlayer.profanedCrystal) { modPlayer.gDefense = false; Projectile.active = false;