diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs
index 01ce558fe5..0f191eb2f6 100644
--- a/Events/AcidRainEvent.cs
+++ b/Events/AcidRainEvent.cs
@@ -131,7 +131,7 @@ namespace CalamityMod.Events
///
/// Updates the invasion, checking to see if it has ended.
///
- public static void UpdateInvasion()
+ public static void UpdateInvasion(bool win = true)
{
// If the custom invasion is up
if (CalamityWorld.rainingAcid)
@@ -152,6 +152,11 @@ namespace CalamityMod.Events
Main.windSpeedTemp = Main.rand.NextFloat(0.04f, 0.25f);
Main.windSpeedSet = Main.windSpeedTemp;
Main.maxRaining = 0f;
+ if (win)
+ {
+ CalamityWorld.downedEoCAcidRain = true;
+ CalamityWorld.downedAquaticScourgeAcidRain = CalamityWorld.downedAquaticScourge;
+ }
CalamityMod.StopRain();
}
CalamityMod.UpdateServerBoolean();
diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs
index 8a442590f9..3a225dc91c 100644
--- a/Items/SummonItems/Invasion/CausticTear.cs
+++ b/Items/SummonItems/Invasion/CausticTear.cs
@@ -18,12 +18,12 @@ namespace CalamityMod.Items.SummonItems.Invasion
{
item.width = 28;
item.height = 18;
- item.maxStack = 20;
+ item.maxStack = 1;
item.rare = 6;
item.useAnimation = 45;
item.useTime = 45;
item.useStyle = 4;
- item.consumable = true;
+ item.consumable = false;
}
public override bool UseItem(Player player)
@@ -35,7 +35,7 @@ namespace CalamityMod.Items.SummonItems.Invasion
else
{
CalamityWorld.acidRainPoints = 0;
- AcidRainEvent.UpdateInvasion();
+ AcidRainEvent.UpdateInvasion(false);
}
return true;
}
diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs
index a241fa3e62..ec46d9bf95 100644
--- a/ModSupport/ModCalls.cs
+++ b/ModSupport/ModCalls.cs
@@ -22,6 +22,18 @@ namespace CalamityMod
default:
return false;
+ // Because this value will always be true if Acid Rain at any point in the game is beaten.
+ case "acid rain":
+ case "acidrain":
+
+ case "acid rain initial":
+ case "acid rain eoc":
+ case "acidrain eoc":
+ case "acidrain initial":
+ case "acidraininitial":
+ case "acidraineoc":
+ return CalamityWorld.downedEoCAcidRain;
+
case "desertscourge":
case "desert scourge":
return CalamityWorld.downedDesertScourge;
@@ -56,6 +68,16 @@ namespace CalamityMod
case "the slime god":
return CalamityWorld.downedSlimeGod;
+ case "acid rain aquatic":
+ case "acidrain aquatic":
+ case "acidrainaquatic":
+ case "acid rain scourge":
+ case "acidrain scourge":
+ case "acidrainscourge":
+ case "acid rain as":
+ case "acidrain as":
+ return CalamityWorld.downedAquaticScourgeAcidRain;
+
case "cryogen":
return CalamityWorld.downedCryogen;
diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs
index 566e9861f0..1ba5edd67e 100644
--- a/ModSupport/WeakReferenceSupport.cs
+++ b/ModSupport/WeakReferenceSupport.cs
@@ -1,4 +1,5 @@
using CalamityMod.Buffs.Summon;
+using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Wings;
using CalamityMod.Items.Armor.Vanity;
@@ -15,6 +16,7 @@ using CalamityMod.Items.Placeables.FurnitureCosmilite;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.SummonItems;
+using CalamityMod.Items.SummonItems.Invasion;
using CalamityMod.Items.Tools;
using CalamityMod.Items.Tools.ClimateChange;
using CalamityMod.Items.TreasureBags;
@@ -55,6 +57,7 @@ using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
+using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -101,6 +104,12 @@ namespace CalamityMod
// { "Xeroc", 121f },
};
+ private static readonly Dictionary InvasionDifficulty = new Dictionary
+ {
+ { "Acid Rain Initial", 2.5f },
+ { "Acid Rain Aquatic Scourge", 8.8f }
+ };
+
public static void Setup()
{
BossChecklistSupport();
@@ -123,6 +132,13 @@ namespace CalamityMod
bossChecklist.Call("AddBoss", difficulty, npcTypes, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, bossLogTex, bossHeadTex);
}
+ // Wrapper function to add bosses with multiple segments or phases to Boss Checklist.
+ private static void AddInvasion(Mod bossChecklist, Mod hostMod, string name, float difficulty, List npcTypes, Func downed, Func available, object summon,
+ List loot, List collection, string instructions, string despawn, string invasionTexture = null, string iconTexture = null)
+ {
+ bossChecklist.Call("AddEventWithInfo", difficulty, npcTypes, hostMod, name, downed, summon ?? null, collection, loot, instructions, despawn, invasionTexture, iconTexture, available);
+ }
+
// Wrapper function to add minibosses to Boss Checklist.
private static void AddMiniBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, int npcType, Func downed, object summon,
List loot, List collection, string instructions, string despawn, string bossLogTex = null, string bossHeadTex = null)
@@ -176,6 +192,9 @@ namespace CalamityMod
// Adds every single Calamity boss and miniboss to Boss Checklist's Boss Log.
AddCalamityBosses(bossChecklist, calamity);
+ // Adds every single Calamity invasion to the Boss Checklist's Invasion Log.
+ AddCalamityInvasions(bossChecklist, calamity);
+
// Loot which Calamity adds to vanilla bosses and events is also added to Boss Checklist's Boss Log.
AddCalamityBossLoot(bossChecklist);
AddCalamityEventLoot(bossChecklist);
@@ -519,6 +538,34 @@ namespace CalamityMod
}
}
+ private static void AddCalamityInvasions(Mod bossChecklist, Mod calamity)
+ {
+ // Initial Acid Rain
+ {
+ InvasionDifficulty.TryGetValue("Acid Rain Initial", out float order);
+ List enemies = AcidRainEvent.PossibleEnemiesPreHM.Select(enemy => enemy.Item1).ToList();
+ int summon = ItemType();
+ List loot = new List() { ItemType() };
+ string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Eye of Cthulhu is defeated.";
+ string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the ocean.", new Color(146, 183, 116));
+ string bossLogTex = "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist";
+ string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon";
+ AddInvasion(bossChecklist, calamity, "Acid Rain", order, enemies, DownedAcidRainInitial, () => NPC.downedBoss1, summon, loot, null, instructions, despawn, bossLogTex, iconTexture);
+ }
+ // Post-Aquatic Scourge Acid Rain
+ {
+ InvasionDifficulty.TryGetValue("Acid Rain Aquatic Scourge", out float order);
+ List enemies = AcidRainEvent.PossibleEnemiesAS.Select(enemy => enemy.Item1).ToList();
+ int summon = ItemType();
+ List loot = new List() { ItemType() };
+ string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Aquatic Scourge is defeated";
+ string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116));
+ string bossLogTex = "CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist";
+ string iconTexture = "CalamityMod/ExtraTextures/UI/AcidRainIcon";
+ AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Aquatic Scourge)", order, enemies, DownedAcidRainInitial, DownedAquaticScourge, summon, loot, null, instructions, despawn, bossLogTex, iconTexture);
+ }
+ }
+
private static void AddCalamityBossLoot(Mod bossChecklist)
{
// King Slime
diff --git a/NPCs/Abyss/Catfish.cs b/NPCs/Abyss/Catfish.cs
index 74a8fd3345..ac152c9683 100644
--- a/NPCs/Abyss/Catfish.cs
+++ b/NPCs/Abyss/Catfish.cs
@@ -253,7 +253,6 @@ namespace CalamityMod.NPCs.Abyss
public override void NPCLoot()
{
DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20);
- DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
}
public override void HitEffect(int hitDirection, double damage)
diff --git a/NPCs/Abyss/Flounder.cs b/NPCs/Abyss/Flounder.cs
index 186a47c74b..55b040e3fb 100644
--- a/NPCs/Abyss/Flounder.cs
+++ b/NPCs/Abyss/Flounder.cs
@@ -283,7 +283,6 @@ namespace CalamityMod.NPCs.Abyss
public override void NPCLoot()
{
DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 1);
- DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
}
public override void HitEffect(int hitDirection, double damage)
diff --git a/NPCs/Abyss/Gnasher.cs b/NPCs/Abyss/Gnasher.cs
index 4717e964a7..1d751641b7 100644
--- a/NPCs/Abyss/Gnasher.cs
+++ b/NPCs/Abyss/Gnasher.cs
@@ -111,7 +111,6 @@ namespace CalamityMod.NPCs.Abyss
public override void NPCLoot()
{
DropHelper.DropItemCondition(npc, ItemID.TurtleShell, Main.hardMode, 10, 1, 1);
- DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
}
public override void HitEffect(int hitDirection, double damage)
diff --git a/NPCs/Abyss/Mauler.cs b/NPCs/Abyss/Mauler.cs
index f3b7cf2040..9f009d0e88 100644
--- a/NPCs/Abyss/Mauler.cs
+++ b/NPCs/Abyss/Mauler.cs
@@ -352,7 +352,6 @@ namespace CalamityMod.NPCs.Abyss
public override void NPCLoot()
{
DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1);
- DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
int item = Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false);
Main.item[item].color = new Color(151, 115, 57, 255);
NetMessage.SendData(88, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0);
diff --git a/NPCs/Abyss/Trasher.cs b/NPCs/Abyss/Trasher.cs
index e44866e80e..973b699ad6 100644
--- a/NPCs/Abyss/Trasher.cs
+++ b/NPCs/Abyss/Trasher.cs
@@ -355,7 +355,6 @@ namespace CalamityMod.NPCs.Abyss
NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255);
NPC.savedAngler = true;
}
- DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20);
DropHelper.DropItemChance(npc, ModContent.ItemType(), 20);
DropHelper.DropItemCondition(npc, ItemID.Gatligator, Main.hardMode, 10, 1, 1);
diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs
index d643069dba..fbc97ab089 100644
--- a/NPCs/AcidRain/AcidEel.cs
+++ b/NPCs/AcidRain/AcidEel.cs
@@ -1,5 +1,6 @@
using CalamityMod.Dusts;
using CalamityMod.Items.Placeables.Banners;
+using CalamityMod.Items.Materials;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
@@ -96,6 +97,10 @@ namespace CalamityMod.NPCs.AcidRain
npc.velocity.Y += 0.15f;
}
}
+ public override void NPCLoot()
+ {
+ DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
+ }
public override void FindFrame(int frameHeight)
{
npc.frameCounter++;
diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs
index 033be46fb1..de0e642f69 100644
--- a/NPCs/AcidRain/Orthocera.cs
+++ b/NPCs/AcidRain/Orthocera.cs
@@ -1,5 +1,6 @@
using CalamityMod.Dusts;
using CalamityMod.Items.Placeables.Banners;
+using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.World;
using System;
@@ -158,6 +159,10 @@ namespace CalamityMod.NPCs.AcidRain
npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-maxSpeed), new Vector2(maxSpeed));
}
}
+ public override void NPCLoot()
+ {
+ DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
+ }
public override void FindFrame(int frameHeight)
{
npc.frameCounter++;
diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs
index fdef345c77..c1683788dd 100644
--- a/NPCs/AcidRain/Skyfin.cs
+++ b/NPCs/AcidRain/Skyfin.cs
@@ -1,5 +1,6 @@
using CalamityMod.Dusts;
using CalamityMod.Items.Placeables.Banners;
+using CalamityMod.Items.Materials;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
@@ -156,6 +157,10 @@ namespace CalamityMod.NPCs.AcidRain
}
}
}
+ public override void NPCLoot()
+ {
+ DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 3);
+ }
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs
index 068d273e6a..fb63192ff3 100644
--- a/NPCs/CalamityAI.cs
+++ b/NPCs/CalamityAI.cs
@@ -4292,8 +4292,7 @@ namespace CalamityMod.NPCs
if (npc.timeLeft == 1)
{
CalamityWorld.acidRainPoints = 0;
- CalamityWorld.rainingAcid = false;
- AcidRainEvent.UpdateInvasion();
+ AcidRainEvent.UpdateInvasion(false);
npc.timeLeft = 0;
}
@@ -4406,7 +4405,8 @@ namespace CalamityMod.NPCs
if (npc.ai[0] == -1f)
{
// Velocity
- npc.velocity *= 0.98f;
+ if(npc.Calamity().newAI[3] == 0f)
+ npc.velocity *= 0.98f;
// Direction
int num19 = Math.Sign(player.Center.X - vector.X);
@@ -4419,7 +4419,8 @@ namespace CalamityMod.NPCs
// Alpha
if (npc.ai[2] > 20f)
{
- npc.velocity.Y = -2f;
+ if (npc.Calamity().newAI[3] == 0f)
+ npc.velocity.Y = -2f;
npc.alpha -= 5;
if (Collision.SolidCollision(npc.position, npc.width, npc.height))
diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs
new file mode 100644
index 0000000000..7df94b7a8f
--- /dev/null
+++ b/Projectiles/Boss/OldDukeSummonDrop.cs
@@ -0,0 +1,78 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Terraria;
+using Terraria.ID;
+using Terraria.ModLoader;
+using CalamityMod.Buffs.DamageOverTime;
+using CalamityMod.Buffs.StatDebuffs;
+
+namespace CalamityMod.Projectiles.Boss
+{
+ public class OldDukeSummonDrop : ModProjectile
+ {
+ public override void SetStaticDefaults()
+ {
+ DisplayName.SetDefault("Acid");
+ ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
+ ProjectileID.Sets.TrailingMode[projectile.type] = 0;
+ }
+
+ public override void SetDefaults()
+ {
+ projectile.width = 14;
+ projectile.height = 20;
+ projectile.hostile = true;
+ projectile.tileCollide = true;
+ projectile.ignoreWater = false;
+ projectile.timeLeft = 400;
+ }
+ public override void AI()
+ {
+ projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2;
+ if (projectile.velocity.Y <= 8f)
+ {
+ projectile.velocity.Y += 0.15f;
+ }
+ }
+ public override bool OnTileCollide(Vector2 oldVelocity)
+ {
+ // Water drip
+ for (int i = 0; i < 4; i++)
+ {
+ int idx = Dust.NewDust(projectile.position - projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f);
+ Dust dust = Main.dust[idx];
+ dust.position.X -= 2f;
+ Main.dust[idx].alpha = 38;
+ Main.dust[idx].velocity *= 0.1f;
+ Main.dust[idx].velocity -= projectile.velocity * 0.025f;
+ Main.dust[idx].scale = 0.75f;
+ }
+ return true;
+ }
+
+ public override void OnHitPlayer(Player target, int damage, bool crit)
+ {
+ if (Main.rand.NextBool(2))
+ {
+ // 1 to 3 seconds of poisoned
+ target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(1, 4));
+ }
+ else if (Main.rand.NextBool(4))
+ {
+ // 1 to 2 second of Sulphuric Poisoning
+ target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1, 3));
+ }
+ else
+ {
+ // 3 to 5 seconds of Irradiated
+ target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(3, 6));
+ }
+ }
+
+ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
+ {
+ CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2);
+ return false;
+ }
+ }
+}
diff --git a/Projectiles/Boss/OldDukeSummonDrop.png b/Projectiles/Boss/OldDukeSummonDrop.png
new file mode 100644
index 0000000000..f5e4db998f
Binary files /dev/null and b/Projectiles/Boss/OldDukeSummonDrop.png differ
diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs
new file mode 100644
index 0000000000..c5ff4a0b6b
--- /dev/null
+++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs
@@ -0,0 +1,220 @@
+using CalamityMod.Buffs.StatDebuffs;
+using CalamityMod.Dusts;
+using CalamityMod.Events;
+using CalamityMod.NPCs.OldDuke;
+using CalamityMod.World;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Terraria;
+using Terraria.ID;
+using Terraria.Localization;
+using Terraria.ModLoader;
+
+namespace CalamityMod.Projectiles.Boss
+{
+ public class OverlyDramaticDukeSummoner : ModProjectile
+ {
+ public override void SetStaticDefaults()
+ {
+ DisplayName.SetDefault("Old Duke Summoner");
+ ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
+ ProjectileID.Sets.TrailingMode[projectile.type] = 0;
+ }
+
+ public override void SetDefaults()
+ {
+ projectile.width = projectile.height = 1;
+ projectile.scale = 0.004f;
+ projectile.hostile = true;
+ projectile.alpha = 255;
+ projectile.penetrate = -1;
+ projectile.tileCollide = false;
+ projectile.ignoreWater = true;
+ projectile.timeLeft = 1800;
+ }
+ private static void ExpandVertically(int startX, int startY, out int topY, out int bottomY, int maxExpandUp = 100, int maxExpandDown = 100)
+ {
+ topY = startY;
+ bottomY = startY;
+ if (!WorldGen.InWorld(startX, startY, 10))
+ {
+ return;
+ }
+ int yUp = 0;
+ while (yUp < maxExpandUp && topY > 0 && topY >= 10 && Main.tile[startX, topY] != null)
+ {
+ topY--;
+ yUp++;
+ }
+ int yDown = 0;
+ while (yDown < maxExpandDown && bottomY < Main.maxTilesY - 10 && bottomY <= Main.maxTilesY - 10)
+ {
+ if (Main.tile[startX, bottomY] == null)
+ {
+ return;
+ }
+ bottomY++;
+ yDown++;
+ }
+ }
+
+ public override void AI()
+ {
+ projectile.rotation -= 0.15f * (float)(1D - (projectile.alpha / 255D));
+ projectile.ai[0]++;
+
+ float totalTilesToExpand = 1600f * projectile.scale / 16;
+
+ Point centerAsTileCoords = projectile.Center.ToTileCoordinates();
+ ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out int topY, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2));
+ topY++;
+ bottomY--;
+ Vector2 topVector = new Vector2(centerAsTileCoords.X, topY) * 16f + new Vector2(8f);
+ Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f);
+ Vector2 centerVector = Vector2.Lerp(topVector, bottomVector, 0.5f);
+ projectile.width = (int)(208 * projectile.scale);
+ projectile.height = (int)(bottomVector.Y - topVector.Y);
+ projectile.Center = centerVector;
+
+ if (projectile.ai[0] < 90f)
+ {
+ projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.ai[0] / 90f);
+ projectile.scale = MathHelper.Lerp(0.004f, 1f, projectile.ai[0] / 90f);
+ }
+ // Spray gore and acid everywhere
+ else if (projectile.ai[0] < 480f)
+ {
+ if (projectile.ai[0] % 10f == 9f)
+ {
+ Vector2 velocity = new Vector2(0f, -18f).RotatedByRandom(0.7f);
+ Projectile.NewProjectile(projectile.Top + new Vector2(Main.rand.NextFloat(-80f, 80f), 100f), velocity,
+ ModContent.ProjectileType(), 65, 2f);
+ }
+ if (projectile.ai[0] % 35f == 34f)
+ {
+ Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), -7f - Main.rand.NextFloat(4f, 12f)).RotatedByRandom(0.5f);
+ Projectile.NewProjectile(projectile.Top + new Vector2(Main.rand.NextFloat(-30f, 30f), 100f), velocity,
+ ModContent.ProjectileType(), 65, 2f);
+ }
+ }
+
+ // Fade out and die
+ if (projectile.ai[0] >= 600f)
+ {
+ projectile.alpha = (int)MathHelper.Lerp(0f, 255f, (projectile.ai[0] - 600f) / 120f);
+
+ bool canSpawnBoomer = false;
+ for (int i = 0; i < Main.player.Length; i++)
+ {
+ if (!Main.player[i].dead && projectile.Distance(Main.player[i].Center) < 12000f)
+ {
+ canSpawnBoomer = true;
+ break;
+ }
+ }
+
+ // Summon the boomer duke
+ if (projectile.ai[0] == 660f)
+ {
+ if (canSpawnBoomer)
+ {
+ for (int i = 0; i < 160; i++)
+ {
+ Dust dust = Dust.NewDustPerfect(projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulfurousSeaAcid);
+ dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5f, 23f);
+ dust.noGravity = true;
+ dust.scale = 3f;
+ }
+ if (Main.netMode != NetmodeID.MultiplayerClient)
+ {
+ Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar").SoundId, (int)projectile.Top.X, (int)projectile.Top.Y, volumeScale: 1.45f);
+ int boomer = NPC.NewNPC((int)projectile.Top.X, (int)projectile.Top.Y + 100, ModContent.NPCType());
+ string boomerName = Main.npc[boomer].TypeName;
+
+ if (Main.netMode == NetmodeID.SinglePlayer)
+ {
+ Main.NewText(Language.GetTextValue("Announcement.HasAwoken", boomerName), new Color(175, 75, 255));
+ return;
+ }
+
+ if (Main.netMode == NetmodeID.Server)
+ {
+ NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[]
+ {
+ Main.npc[boomer].GetTypeNetName()
+ }), new Color(175, 75, 255));
+ return;
+ }
+ Main.npc[boomer].velocity = Vector2.UnitY * -12f;
+ Main.npc[boomer].alpha = 255;
+ Main.npc[boomer].Calamity().newAI[3] = 1f; // To signal that Old Duke should not deccelerate as it normally would
+ Main.npc[boomer].netUpdate = true;
+ }
+ }
+ else
+ {
+ CalamityWorld.acidRainPoints = 0;
+ AcidRainEvent.UpdateInvasion(false);
+ }
+ }
+ }
+ if (projectile.ai[0] >= 720f)
+ {
+ projectile.Kill();
+ }
+ }
+
+ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
+ {
+ float totalTilesToExpand = 1600f * projectile.scale / 16;
+ Point centerAsTileCoords = projectile.Center.ToTileCoordinates();
+ ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out _, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2));
+ bottomY--;
+ Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f);
+
+ Texture2D texture = ModContent.GetTexture(Texture);
+ float yMax = 1600f * projectile.scale;
+ for (int y = 0; y < yMax; y += 30)
+ {
+ float thetaDelta = MathHelper.Pi * y / yMax;
+ float scale = projectile.scale * MathHelper.Lerp(0.3f, 1.4f, y / yMax);
+ float alphaMultiplier = MathHelper.Lerp(1f, 0.6f, y / yMax);
+ spriteBatch.Draw(texture,
+ bottomVector - Main.screenPosition - Vector2.UnitY * y,
+ null,
+ Color.White * projectile.Opacity * 0.3f * alphaMultiplier,
+ projectile.rotation + thetaDelta,
+ texture.Size() * 0.5f,
+ scale,
+ SpriteEffects.None,
+ 0f);
+ }
+ return false;
+ }
+
+ public override bool CanHitPlayer(Player target) => projectile.ai[0] >= 90f;
+
+ public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
+ {
+ float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft());
+ float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight());
+ float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft());
+ float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight());
+
+ float minDist = dist1;
+ if (dist2 < minDist)
+ minDist = dist2;
+ if (dist3 < minDist)
+ minDist = dist3;
+ if (dist4 < minDist)
+ minDist = dist4;
+
+ return minDist <= 210f * projectile.scale;
+ }
+
+ public override void OnHitPlayer(Player target, int damage, bool crit)
+ {
+ target.AddBuff(ModContent.BuffType(), 420);
+ }
+ }
+}
diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.png b/Projectiles/Boss/OverlyDramaticDukeSummoner.png
new file mode 100644
index 0000000000..b61dd72cd0
Binary files /dev/null and b/Projectiles/Boss/OverlyDramaticDukeSummoner.png differ
diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs
index 037d95fe88..4dc574f24c 100644
--- a/UI/BossHealthBarManager.cs
+++ b/UI/BossHealthBarManager.cs
@@ -16,6 +16,7 @@ using CalamityMod.NPCs.SlimeGod;
using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SunkenSea;
using CalamityMod.NPCs.SupremeCalamitas;
+using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
@@ -409,7 +410,7 @@ namespace CalamityMod.UI
int heightPerOne = 70; //70
int y = Main.screenHeight - startHeight;
- int x = Main.screenWidth - 420 + ((Main.playerInventory || Main.invasionType > 0 || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing) ? -250 : 0);
+ int x = Main.screenWidth - 420 + ((Main.playerInventory || Main.invasionType > 0 || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing || CalamityWorld.rainingAcid) ? -250 : 0);
foreach (BossHPUI ui in Bars)
{
diff --git a/Utilities/Downed.cs b/Utilities/Downed.cs
index 1262b68511..bc3043b175 100644
--- a/Utilities/Downed.cs
+++ b/Utilities/Downed.cs
@@ -32,5 +32,8 @@ namespace CalamityMod
public static readonly Func DownedDoG = () => CalamityWorld.downedDoG;
public static readonly Func DownedYharon = () => CalamityWorld.downedYharon;
public static readonly Func DownedSCal = () => CalamityWorld.downedSCal;
+
+ public static readonly Func DownedAcidRainInitial = () => CalamityWorld.downedEoCAcidRain;
+ public static readonly Func DownedAcidRainHardmode = () => CalamityWorld.downedAquaticScourgeAcidRain;
}
}
diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs
index fd8007f254..60398b68a9 100644
--- a/World/CalamityWorld.cs
+++ b/World/CalamityWorld.cs
@@ -30,6 +30,7 @@ using CalamityMod.NPCs.SlimeGod;
using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Yharon;
+using CalamityMod.Projectiles.Boss;
using CalamityMod.Tiles.Abyss;
using CalamityMod.Tiles.Astral;
using CalamityMod.Tiles.AstralDesert;
@@ -174,6 +175,9 @@ namespace CalamityMod.World
public static bool downedGSS = false;
public static bool downedCLAM = false;
public static bool downedBetsy = false; //Betsy
+
+ public static bool downedEoCAcidRain = false;
+ public static bool downedAquaticScourgeAcidRain = false;
#endregion
#endregion
@@ -257,6 +261,8 @@ namespace CalamityMod.World
ironHeart = false;
dragonScalesBought = false;
rainingAcid = false;
+ downedEoCAcidRain = false;
+ downedAquaticScourgeAcidRain = false;
}
#endregion
@@ -354,6 +360,10 @@ namespace CalamityMod.World
downed.Add("bandit");
if (spawnedCirrus)
downed.Add("drunkPrincess");
+ if (downedEoCAcidRain)
+ downed.Add("eocRain");
+ if (downedAquaticScourgeAcidRain)
+ downed.Add("hmRain");
return new TagCompound
{
@@ -419,6 +429,8 @@ namespace CalamityMod.World
rainingAcid = downed.Contains("acidRain");
spawnedBandit = downed.Contains("bandit");
spawnedCirrus = downed.Contains("drunkPrincess");
+ downedEoCAcidRain = downed.Contains("eocRain");
+ downedAquaticScourgeAcidRain = downed.Contains("hmRain");
abyssChasmBottom = tag.GetInt("abyssChasmBottom");
acidRainPoints = tag.GetInt("acidRainPoints");
@@ -502,6 +514,8 @@ namespace CalamityMod.World
downedCLAM = flags7[2];
dragonScalesBought = flags7[3];
rainingAcid = flags7[4];
+ downedEoCAcidRain = flags[5];
+ downedAquaticScourgeAcidRain = flags[6];
}
else
{
@@ -581,6 +595,8 @@ namespace CalamityMod.World
flags7[2] = downedCLAM;
flags7[3] = dragonScalesBought;
flags7[4] = rainingAcid;
+ flags7[5] = downedEoCAcidRain;
+ flags7[6] = downedAquaticScourgeAcidRain;
writer.Write(flags);
writer.Write(flags2);
@@ -665,6 +681,8 @@ namespace CalamityMod.World
downedCLAM = flags7[2];
dragonScalesBought = flags7[3];
rainingAcid = flags7[4];
+ downedEoCAcidRain = flags[5];
+ downedAquaticScourgeAcidRain = flags[6];
abyssChasmBottom = reader.ReadInt32();
acidRainPoints = reader.ReadInt32();
@@ -896,12 +914,18 @@ namespace CalamityMod.World
Main.maxRaining = 0.89f;
Main.invasionProgressNearInvasion = true;
- // Summon Old Duke post-Polter as needed
+ // Summon Old Duke tornado post-Polter as needed
if (downedPolterghast && acidRainPoints <= 2f &&
- !NPC.AnyNPCs(ModContent.NPCType()))
+ !NPC.AnyNPCs(ModContent.NPCType()) &&
+ CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0)
{
int playerClosestToAbyss = Player.FindClosest(new Vector2(abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0);
- NPC.SpawnOnPlayer(playerClosestToAbyss, ModContent.NPCType());
+ Player closestToAbyss = Main.player[playerClosestToAbyss];
+ if (Main.netMode != NetmodeID.MultiplayerClient)
+ {
+ Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero,
+ ModContent.ProjectileType(), 120, 8f);
+ }
}
}