diff --git a/Buffs/Pets/LittleLightBuff.cs b/Buffs/Pets/LittleLightBuff.cs new file mode 100644 index 0000000000..e1d860ee05 --- /dev/null +++ b/Buffs/Pets/LittleLightBuff.cs @@ -0,0 +1,28 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class LittleLightBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Little Light"); + Description.SetDefault("Endearing"); + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + + player.Calamity().littleLightPet = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + Projectile.NewProjectile(player.Center, -Vector2.UnitY * 10f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } +} diff --git a/Buffs/Pets/LittleLightBuff.png b/Buffs/Pets/LittleLightBuff.png new file mode 100644 index 0000000000..9d35e2b3f6 Binary files /dev/null and b/Buffs/Pets/LittleLightBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5f76a6e85f..0df511ded7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -117,6 +117,7 @@ namespace CalamityMod.CalPlayer public float rangedAmmoCost = 1f; public bool heldGaelsLastFrame = false; public bool GivenBrimstoneLocus = false; + public float GeneralScreenShakePower = 0f; #endregion #region Tile Entity Trackers @@ -331,6 +332,7 @@ namespace CalamityMod.CalPlayer public bool radiator = false; public bool scalPet = false; public bool bendyPet = false; + public bool littleLightPet = false; #endregion #region Rage @@ -1390,9 +1392,7 @@ namespace CalamityMod.CalPlayer if (BossRushEvent.BossRushActive) { if (CalamityConfig.Instance.BossRushAccessoryCurse) - { player.extraAccessorySlots = 0; - } } ResetRogueStealth(); @@ -1435,6 +1435,8 @@ namespace CalamityMod.CalPlayer radiator = false; scalPet = false; bendyPet = false; + littleLightPet = false; + onyxExcavator = false; angryDog = false; fab = false; @@ -2008,6 +2010,15 @@ namespace CalamityMod.CalPlayer #region Screen Position Movements public override void ModifyScreenPosition() { + if (CalamityConfig.Instance.DisableScreenShakes) + return; + + if (GeneralScreenShakePower > 0f) + { + Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower, GeneralScreenShakePower); + GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f); + } + if (CalamityWorld.ScreenShakeSpots.Count > 0) { // Fail-safe to ensure that spots don't last forever. @@ -2479,10 +2490,13 @@ namespace CalamityMod.CalPlayer bool useHoly = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); - bool useSBrimstone = NPC.AnyNPCs(ModContent.NPCType()); + bool useSBrimstone = NPC.AnyNPCs(ModContent.NPCType()) || SCalSky.OverridingIntensity > 0f; player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); - bool inAstral = ZoneAstral; + bool useWyrmWater = NPC.AnyNPCs(ModContent.NPCType()); + player.ManageSpecialBiomeVisuals("CalamityMod:AdultEidolonWyrm", useWyrmWater); + + bool inAstral = ZoneAstral; player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); bool cryogenActive = NPC.AnyNPCs(ModContent.NPCType()); diff --git a/CalamityConfig.cs b/CalamityConfig.cs index d0e6edd9e7..b640141930 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -30,6 +30,12 @@ namespace CalamityMod [Tooltip("Enables rendering afterimages for Calamity NPCs, projectiles, etc.\nDisable to improve performance.")] public bool Afterimages { get; set; } + [Label("Disable Screenshakes")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + [Tooltip("Disables all screen-shaking effects.")] + public bool DisableScreenShakes { get; set; } + [Label("Stealth Invisibility")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] diff --git a/CalamityMod.cs b/CalamityMod.cs index c9b2b04da4..fa743fa9b0 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Armor; using CalamityMod.Items.Dyes.HairDye; using CalamityMod.Localization; using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -175,9 +176,7 @@ namespace CalamityMod PlaguePackHotKey = RegisterHotKey("Booster Dash", "Q"); if (!Main.dedServ) - { LoadClient(); - } ILChanges.Load(); BossRushEvent.Load(); @@ -253,7 +252,10 @@ namespace CalamityMod Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); - Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); + Filters.Scene["CalamityMod:AdultEidolonWyrm"] = new Filter(new AEWScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.25f).UseOpacity(0.35f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:AdultEidolonWyrm"] = new AEWSky(); + + Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); @@ -265,6 +267,8 @@ namespace CalamityMod RipperUI.Load(); AstralArcanumUI.Load(this); + SupremeCalamitas.LoadHeadIcons(); + GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax)))); @@ -568,8 +572,9 @@ namespace CalamityMod { ModContent.NPCType(), 9000 }, { ModContent.NPCType(), 9000 }, { ModContent.NPCType(), 15300 }, - { ModContent.NPCType(), 18000 } - }; + { ModContent.NPCType(), 18000 }, + { ModContent.NPCType(), 18000 } + }; } #endregion @@ -691,8 +696,9 @@ namespace CalamityMod { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin } - }; + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale } + }; } #endregion diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 04c361c29b..eaeb5795a9 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Effects public static Effect LightDistortionShader; public static Effect FadedUVMapStreakShader; public static Effect FadingSolidTrailShader; + public static Effect SCalShieldShader; public static void LoadShaders() { @@ -25,6 +26,7 @@ namespace CalamityMod.Effects LightDistortionShader = CalamityMod.Instance.GetEffect("Effects/DistortionShader"); FadedUVMapStreakShader = CalamityMod.Instance.GetEffect("Effects/FadedUVMapStreak"); FadingSolidTrailShader = CalamityMod.Instance.GetEffect("Effects/FadingSolidTrail"); + SCalShieldShader = CalamityMod.Instance.GetEffect("Effects/SupremeShieldShader"); Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); @@ -35,6 +37,7 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref(LightDistortionShader), "DistortionPass"); GameShaders.Misc["CalamityMod:TrailStreak"] = new MiscShaderData(new Ref(FadedUVMapStreakShader), "TrailPass"); GameShaders.Misc["CalamityMod:FadingSolidTrail"] = new MiscShaderData(new Ref(FadingSolidTrailShader), "TrailPass"); + GameShaders.Misc["CalamityMod:SupremeShield"] = new MiscShaderData(new Ref(SCalShieldShader), "ShieldPass"); } } } diff --git a/Effects/SupremeShieldShader.fx b/Effects/SupremeShieldShader.fx new file mode 100644 index 0000000000..b91aff9481 --- /dev/null +++ b/Effects/SupremeShieldShader.fx @@ -0,0 +1,46 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity : register(C0); +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float inverseLerp(float x, float min, float max) +{ + return saturate((x - min) / (max - min)); +} +float4 PixelFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 baseColor = tex2D(uImage0, coords); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(coords.y + uTime * 0.7))); + float start = 0.45 + sin(uTime * 3) * 0.04; + float ringRadus = 0.1; + float distanceRatio = distance(coords, float2(0.5, 0.5)) * 1.414; + float3 colorToUse = lerp(uColor, uSecondaryColor, pow(distanceRatio, 0.6)); + float originalAlpha = pow(inverseLerp(distanceRatio, 0, start), 2.6); + float ringAlpha = sin(3.141 * inverseLerp(distanceRatio, start, start + ringRadus)) * 1.96; + if (distanceRatio < start) + originalAlpha *= lerp(1, 2.6, noiseColor.r); + else + originalAlpha = lerp(originalAlpha, ringAlpha, inverseLerp(distanceRatio, start, start + ringRadus * 0.5)); + + originalAlpha *= lerp(1, 0.56, distanceRatio) * lerp(1, 2.45, min(1, pow(sin(uTime * 3.1), 10) * 0.7 + uSaturation)); + baseColor = float4(lerp(baseColor.rgb, colorToUse, 0.5), 1.0); + return baseColor * originalAlpha * uOpacity; +} + +technique Technique1 +{ + pass ShieldPass + { + PixelShader = compile ps_2_0 PixelFunction(); + } +} \ No newline at end of file diff --git a/Effects/SupremeShieldShader.xnb b/Effects/SupremeShieldShader.xnb new file mode 100644 index 0000000000..63dcfed3e6 Binary files /dev/null and b/Effects/SupremeShieldShader.xnb differ diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 2d22c5d70f..4c3b1bab37 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -222,6 +222,7 @@ namespace CalamityMod.Events player.ClearBuff(ModContent.BuffType()); } } + Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), Main.player[ClosestPlayerToWorldCenter].Center); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }), new Boss(ModContent.NPCType(), TimeChangeContext.Day), diff --git a/ExtraTextures/CalamitasShield.png b/ExtraTextures/CalamitasShield.png new file mode 100644 index 0000000000..6adeaa39a5 Binary files /dev/null and b/ExtraTextures/CalamitasShield.png differ diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index bef5083841..1b3ee1b9fd 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -120,6 +120,7 @@ namespace CalamityMod.ILEditing DisableTeleportersDuringBossFights(); FixSplittingWormBannerDrops(); IncorporateMinionExplodingCountdown(); + MakeMouseHoverItemsSupportAnimations(); } /// @@ -467,7 +468,34 @@ namespace CalamityMod.ILEditing }; } - #endregion + private static void MakeMouseHoverItemsSupportAnimations() + { + IL.Terraria.Main.DrawInterface_40_InteractItemIcon += (il) => + { + var cursor = new ILCursor(il); + + // Locate the location where the frame rectangle is created. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchNewobj())) + return; + + int endIndex = cursor.Index; + + // And then go back to where it began, right after the draw position vector. + if (!cursor.TryGotoPrev(MoveType.After, i => i.MatchNewobj())) + return; + + // And delete the range that creates the rectangle with intent to replace it. + cursor.RemoveRange(Math.Abs(endIndex - cursor.Index)); + + cursor.Emit(OpCodes.Ldloc_0); + cursor.EmitDelegate>(itemType => + { + return Main.itemAnimations[itemType]?.GetFrame(Main.itemTexture[itemType]) ?? null; + }); + }; + } + + #endregion #region IL Editing Injected/Hooked Functions private static void BossRushLifeBytes(On.Terraria.Main.orig_InitLifeBytes orig) diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index a72cf2a678..898cea7fce 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -156,7 +156,7 @@ namespace CalamityMod.Items.Accessories { Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 350 : 700) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 175 : 350) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); spread -= Main.rand.Next(2, 4); Main.PlaySound(SoundID.Item20, player.Center); } @@ -164,7 +164,7 @@ namespace CalamityMod.Items.Accessories } else { - Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 250 : 500) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 125 : 250) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); Main.PlaySound(SoundID.Item20, player.Center); } @@ -181,7 +181,7 @@ namespace CalamityMod.Items.Accessories bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; - int dam = (int)((shouldNerf ? 200 : 400) * player.MinionDamage()); + int dam = (int)((shouldNerf ? 100 : 200) * player.MinionDamage()); switch (projType) { case 1: //big boomer @@ -222,7 +222,7 @@ namespace CalamityMod.Items.Accessories player.statMana -= manaCost; correctedVelocity *= 25f; Main.PlaySound(SoundID.Item20, player.Center); - int dam = (int)((shouldNerf ? 900 : 1800) * player.MinionDamage()); + int dam = (int)((shouldNerf ? 450 : 900) * player.MinionDamage()); if (player.HasBuff(BuffID.ManaSickness)) { int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); @@ -248,7 +248,7 @@ namespace CalamityMod.Items.Accessories for (float i = 0; i < crystalCount; i++) { float angle = MathHelper.TwoPi / crystalCount * i; - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 175 : 350) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 88 : 176) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; Main.PlaySound(SoundID.Item20, player.Center); @@ -258,7 +258,7 @@ namespace CalamityMod.Items.Accessories else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) { float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 440) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 110 : 220) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; Main.PlaySound(SoundID.Item20, player.Center); diff --git a/Items/Pets/LittleLight.cs b/Items/Pets/LittleLight.cs new file mode 100644 index 0000000000..e2e06f7d6b --- /dev/null +++ b/Items/Pets/LittleLight.cs @@ -0,0 +1,37 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class LittleLight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Little Light"); + Tooltip.SetDefault("It's been looking for you for a long time.\n" + + "Summons a small construct that follows you and provides a great amount of light"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.WispinaBottle); + item.UseSound = SoundID.Item83; + item.shoot = ModContent.ProjectileType(); + item.buffType = ModContent.BuffType(); + + item.value = Item.sellPrice(gold: 15); + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().donorItem = true; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + player.AddBuff(item.buffType, 3600, true); + } + } +} diff --git a/Items/Pets/LittleLight.png b/Items/Pets/LittleLight.png new file mode 100644 index 0000000000..1aa82dc885 Binary files /dev/null and b/Items/Pets/LittleLight.png differ diff --git a/Items/Placeables/SCalAltarItem.cs b/Items/Placeables/SCalAltarItem.cs new file mode 100644 index 0000000000..1d015749e5 --- /dev/null +++ b/Items/Placeables/SCalAltarItem.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SCalAltarItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitous Altar"); + Tooltip.SetDefault("Death\n" + + "Allows you to summon Supreme Calamitas with Ashes of Calamity\n" + + "She creates a large square arena of blocks upon being summoned\n" + + "When she is summoned the arena will spawn around her with her at the center\n" + + "During the battle, heart pickups will heal half as much HP"); + } + + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 60; + item.height = 48; + item.maxStack = 999; + item.useStyle = ItemUseStyleID.SwingThrow; + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/SCalAltarItem.png b/Items/Placeables/SCalAltarItem.png new file mode 100644 index 0000000000..c4bb03cb8b Binary files /dev/null and b/Items/Placeables/SCalAltarItem.png differ diff --git a/Items/SummonItems/EyeofExtinction.cs b/Items/SummonItems/EyeofExtinction.cs index f4d7bd38c3..a0c7b5f962 100644 --- a/Items/SummonItems/EyeofExtinction.cs +++ b/Items/SummonItems/EyeofExtinction.cs @@ -1,11 +1,5 @@ -using CalamityMod.Events; using CalamityMod.Items.Materials; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; -using CalamityMod.World; -using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems @@ -15,69 +9,21 @@ namespace CalamityMod.Items.SummonItems public override void SetStaticDefaults() { DisplayName.SetDefault("Eye of Extinction"); - Tooltip.SetDefault("Death\n" + - "Summons Supreme Calamitas\n" + - "Creates a large square arena of blocks around your player\n" + - "Your player is the CENTER of the arena so be sure to use this item in a good location\n" + - "During the battle, heart pickups will heal half as much HP\n" + - "Not consumable"); + Tooltip.SetDefault("Summons Supreme Calamitas at the altar but is not consumed"); } public override void SetDefaults() { - item.width = 40; - item.height = 40; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + item.width = 54; + item.height = 42; item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; - } - - public override bool UseItem(Player player) - { - int surface = (int)Main.worldSurface; - for (int i = 0; i < Main.maxTilesX; i++) - { - for (int j = 0; j < surface; j++) - { - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j].type == ModContent.TileType()) - { - WorldGen.KillTile(i, j, false, false, false); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(i, j, true); - } - } - } - } - } - - Main.PlaySound(SoundID.Roar, player.position, 0); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); - - return true; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 600a0e2a37..de2c1bb9bb 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 2000; + item.damage = 400; item.melee = true; item.noMelee = true; item.channel = true; diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs index 5f17f841ae..df2d8d51a5 100644 --- a/Items/TreasureBags/StormWeaverBag.cs +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.StormWeaver; @@ -53,6 +54,9 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItem(player, ModContent.ItemType()); } + + // Light pet. + DropHelper.DropItemChance(player, ModContent.ItemType(), 8); } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 780a838702..0d597fed37 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal target.Calamity().GaussFluxTimer = 0; if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, target.whoAmI); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 0f, player.whoAmI, 0f, target.whoAmI); } } } diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 71824bfd6d..4f9524d479 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 420; + item.damage = 85; item.magic = true; - item.mana = (int)42.0; // TODO -- is there a reason for this? + item.mana = 42; item.width = 30; item.height = 34; item.useTime = 15; diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 2e9549aa84..51b616b91c 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic { public class Eternity : ModItem { - public const int BaseDamage = 4200; - public const int ExplosionDamage = 42000; + public const int BaseDamage = 840; + public const int ExplosionDamage = 8400; public const int MaxHomers = 40; public const int DustID = 16; public static readonly Color BlueColor = new Color(34, 34, 160); diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index f63c97e4f1..82994bd8f9 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 616; + item.damage = 125; item.magic = true; item.mana = 50; item.width = 84; diff --git a/Items/Weapons/Magic/Judgement.cs b/Items/Weapons/Magic/Judgement.cs index 64d7e15ad4..a2285e9054 100644 --- a/Items/Weapons/Magic/Judgement.cs +++ b/Items/Weapons/Magic/Judgement.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public class Judgement : ModItem { public const int HitsPerFlash = 300; - public const int FlashBaseDamage = 80000; + public const int FlashBaseDamage = 16000; private const float SpawnAngleSpread = 0.4f * MathHelper.Pi; private const float SpeedRandomness = 0.08f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic { item.width = 40; item.height = 42; - item.damage = 2077; + item.damage = 415; item.knockBack = 4f; item.magic = true; item.mana = 6; diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index ae86596497..6b4bf24fba 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Vehemence"); Tooltip.SetDefault("Casts an intense energy blast\n" + "Does far more damage the more HP an enemy has left\n" + - "Max damage is capped at 1,000,000\n" + + "Max damage is capped at 200,000\n" + "If an enemy has full HP it will inflict several long-lasting debuffs\n" + "Revengeance drop"); Item.staff[item.type] = true; @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 7; + item.damage = 3; item.magic = true; item.mana = 590; item.width = 44; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); player.AddBuff(BuffID.ManaSickness, 600, true); return false; } diff --git a/Items/Weapons/Melee/Animus.cs b/Items/Weapons/Melee/Animus.cs index aad4357be9..6a087479bf 100644 --- a/Items/Weapons/Melee/Animus.cs +++ b/Items/Weapons/Melee/Animus.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 82; item.height = 84; item.scale = 1.5f; - item.damage = 4000; + item.damage = 800; item.melee = true; item.useAnimation = 11; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index c42734ac15..7257e550ae 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 40; item.height = 54; item.melee = true; - item.damage = 200; + item.damage = 50; item.knockBack = 6f; item.useTime = 20; item.useAnimation = 20; diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index cadaa44d0e..a33aa1bbff 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 94; - item.damage = 350; + item.damage = 80; item.melee = true; item.useAnimation = 24; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 5760484f0c..4f36e38f17 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 92; item.height = 104; item.scale = 1.5f; - item.damage = 840; + item.damage = 170; item.melee = true; item.useAnimation = 16; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index 5a1e3f75e5..d964bc6292 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 62; item.height = 62; - item.damage = 2500; + item.damage = 500; item.melee = true; item.useTime = 5; item.reuseDelay = 20; @@ -107,9 +107,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index 5ec1b8cf86..a1121b06a9 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 2000; + item.damage = 400; item.melee = true; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index 48580df177..78144a45c2 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 160; item.height = 160; - item.damage = 10000; + item.damage = 2000; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 6555f98a72..0a795ae9c0 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 120; + item.damage = 150; item.ranged = true; item.width = 60; item.height = 90; diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 658168e7df..7c691feecb 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 150; + item.damage = 130; item.ranged = true; item.width = 64; item.height = 32; diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 7ad7f1d945..20f30b579a 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 4000; + item.damage = 800; item.ranged = true; item.width = 22; item.height = 50; @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index 9813ee6a42..8ab31a915b 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1000; + item.damage = 200; item.ranged = true; item.width = 96; item.height = 38; diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index cc892f3077..49eb1c93ca 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 84; item.height = 34; - item.useTime = item.useAnimation = 7; + item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 7be777a21e..d7e01f2558 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 125; + item.damage = 100; item.width = 20; item.height = 12; item.useTime = 12; diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 5ab2eb98e5..b04090c06e 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1000; + item.damage = 200; item.ranged = true; item.width = 94; item.height = 34; diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index 861a381a26..de9976da87 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int soul = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int soul = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 2f, 0f); if (soul.WithinBounds(Main.maxProjectiles)) { Main.projectile[soul].timeLeft = 600; diff --git a/Items/Weapons/Ranged/SpectreRifle.cs b/Items/Weapons/Ranged/SpectreRifle.cs index 9433cdd22a..fb6d7094d7 100644 --- a/Items/Weapons/Ranged/SpectreRifle.cs +++ b/Items/Weapons/Ranged/SpectreRifle.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.UseSound = SoundID.Item40; item.autoReuse = false; item.shoot = ProjectileID.LostSoulFriendly; - item.shootSpeed = 24f; + item.shootSpeed = 12f; item.useAmmo = AmmoID.Bullet; } @@ -44,8 +44,9 @@ namespace CalamityMod.Items.Weapons.Ranged { if (type == ProjectileID.Bullet) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 2f, 0f); Main.projectile[proj].Calamity().forceRanged = true; + Main.projectile[proj].extraUpdates += 2; } else Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index cd793b98fd..0e71a2c4b9 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 145; + item.damage = 135; item.knockBack = 15f; item.shootSpeed = 16f; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index be0b0dc2bf..8945b125ce 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 720; + item.damage = 150; item.ranged = true; item.width = 60; item.height = 26; diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 4f555aaf8d..e42439a840 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 85; + item.damage = 105; item.ranged = true; item.width = 44; item.height = 58; diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index d145fbe641..652f1c21c7 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -86,6 +86,9 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 1.3); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 98b5179621..31d88e5346 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Hypothermia"); Tooltip.SetDefault("Fires a constant barrage of black ice shards\n" + - "Stealth strikes additionally fire a short ranged ice chunk that shatters into ice shards"); + "Stealth strikes additionally fire short ranged ice chunks that shatter into ice shards"); } public override void SafeSetDefaults() @@ -50,10 +50,15 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable() && player.itemAnimation == item.useAnimation - 1) //setting up the stealth strikes { - damage *= 2; - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; + damage = (int)(damage * 1.7); + + for (int i = 0; i < 4; i++) + { + Vector2 chunkVelocity = new Vector2(speedX, speedY).RotatedByRandom(0.13f) * Main.rand.NextFloat(1f, 1.1f); + int stealth = Projectile.NewProjectile(position, chunkVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + } } int projAmt = Main.rand.Next(1, 3); for (int index = 0; index < projAmt; ++index) diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index 7a44b402e4..4630e9d635 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class NanoblackReaperRogue : RogueWeapon { - public static int BaseDamage = 500; + public static int BaseDamage = 100; public static float Knockback = 9f; public static float Speed = 16f; diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 49275ba1d2..19e369a625 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 94; item.height = 94; - item.damage = 40000; + item.damage = 8000; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 60; diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 66bc4f76e8..a3e20d95f5 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -40,6 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 0.8); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index dcc5758db5..5f970ff13e 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 963; + item.damage = 193; item.knockBack = 1f; item.mana = 99; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 3755c66cce..d71f77e32c 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.mana = 80; - item.damage = 6500; + item.damage = 1300; item.knockBack = 4f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 91f015d49e..e5f2a09002 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.mana = 200; - item.damage = 9999; + item.damage = 1999; item.useStyle = ItemUseStyleID.HoldingUp; item.width = item.height = 28; item.useTime = item.useAnimation = 10; diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 698cd3151c..07aca5bfa0 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -46,34 +46,44 @@ namespace CalamityMod.Localization new [] { "GhostBossText3", "Long-dead prisoners seek their zealous revenge..." }, new [] { "GhostBossText4", "The souls released stir the acidic storms..." }, - new [] { "SupremeBossText3", "Alright, let's get started. Not sure why you're bothering." }, // start - new [] { "SupremeBossText4", "You seem so confident, even though you are painfully ignorant of what has yet to transpire." }, //75% - new [] { "SupremeBossText5", "Everything was going well until you came along." }, //75% - new [] { "SupremeBossText6", "Brothers, could you assist me for a moment? This ordeal is growing tiresome." }, //45% - new [] { "SupremeBossText", "Don't worry, I still have plenty of tricks left." }, //40% - new [] { "SupremeBossText7", "Hmm...perhaps I should let the little ones out to play for a while." },//30% - new [] { "SupremeBossText8", "Impressive...but still not good enough!" }, //20% - new [] { "SupremeBossText9", "I'm just getting started!" }, //10% - new [] { "SupremeBossText20", "How are you still alive!?" }, //8% - new [] { "SupremeBossText21", "Just stop!" }, //6% - new [] { "SupremeBossText22", "Even if you defeat me you would still have the lord to contend with!" }, //4% - new [] { "SupremeBossText23", "He has never lost a battle!" }, //2% - new [] { "SupremeBossText24", "Not even I could defeat him! What hope do you have!?" }, //1% - new [] { "SupremeBossText25", "He has grown far stronger since we last fought...you stand no chance." }, //1% after 10 seconds - new [] { "SupremeBossText26", "Well...I suppose this is the end..." }, //1% after 15 seconds - new [] { "SupremeBossText27", "Perhaps one of these times I'll change my mind..." }, //1% after first win - new [] { "SupremeBossText28", "You aren't hurting as much as I'd like...are you cheating?" }, //not taking enough damage - new [] { "SupremeBossText2", "Go to hell." }, //cheater - new [] { "SupremeBossText10", "At long last I am free...for a time. I'll keep coming back, just like you. Until we meet again, farewell." }, //end after 20 seconds - new [] { "SupremeBossText11", "Do you enjoy going through hell?" }, //rebattle after killing once - new [] { "SupremeBossText12", "Don't get me wrong, I like pain too, but you're just ridiculous." }, //rebattle after killing four times - new [] { "SupremeBossText13", "You must enjoy dying more than most people, huh?" }, //rebattle five deaths - new [] { "SupremeBossText14", "Do you have a fetish for getting killed or something?" }, //rebattle twenty deaths - new [] { "SupremeBossText15", "Alright, I'm done counting. You probably died this much just to see what I'd say." }, //rebattle fifty deaths - new [] { "SupremeBossText16", "You didn't die at all huh? Welp, you probably cheated. Do it again, for real this time...but here's your reward I guess." }, //die 0 times - new [] { "SupremeBossText17", "One death? That's it? ...I guess you earned this then." }, //die 1 time and win - new [] { "SupremeBossText18", "Two deaths, nice job. Here's your reward." }, //die 2 times and win - new [] { "SupremeBossText19", "Third time's the charm. Here's a special reward." }, //die 3 times and win + new [] { "SCalSummonText", "Do you enjoy going through hell?" }, + new [] { "SCalStartText", "You should have just died..." }, + new [] { "SCalBH2Text", "It wasn't too long ago you barely managed to defeat my doppelganger. Quite the failure, wasn't it?" }, + new [] { "SCalBH3Text", "You've harnessed great power, but you wield it for no one but yourself." }, + new [] { "SCalBrothersText", "Would you like to meet my family? Horrible, isn't it?" }, + new [] { "SCalPhase2Text", "You will suffer greatly." }, + new [] { "SCalBH4Text", "It's absurd to even think of trying to get away. As long as you live, you will suffer." }, + new [] { "SCalSeekerRingText", "An upstart who recklessly stole and killed their way to power. I wonder, who does that remind me of...?" }, + new [] { "SCalBH5Text", "You have no stake in this battle. No one gave you any say in this matter!" }, + new [] { "SCalSepulcher2Text", "Once the dust has settled and only one remains, if it is you, what value will this have had?!" }, + new [] { "SCalDesparationText1", "Just stop!" }, + new [] { "SCalDesparationText2", "I have no future if I lose here." }, + new [] { "SCalDesparationText3", "Once you have bested me, you too will only have one path forward." }, + new [] { "SCalDesparationText4", "And that path... also has no future." }, + new [] { "SCalAcceptanceText1", "Even if he has thrown all else away, his power remains." }, + new [] { "SCalAcceptanceText2", "I have no more energy left to resent him, or you..." }, + new [] { "SCalAcceptanceText3", "It will all be in your hands now." }, + + // Some of these keys are incorrect in terms of their contents, but they remain as their bases + an addon at the end to make it + // easier to define them. + new [] { "SCalSummonTextRematch", "You called? If you're looking to get scorched, you've got the right person." }, + new [] { "SCalStartTextRematch", "Ha! You saw it coming this time." }, + new [] { "SCalBH2TextRematch", "Don't get cocky just because you've won once." }, + new [] { "SCalBH3TextRematch", "You know, I was expecting a house call from the Tyrant at this point. Think he died?" }, + new [] { "SCalBH3TextRematch2", "Haha, no way." }, + new [] { "SCalBrothersTextRematch", "Would you like to meet my family? Horrible, isn't it?" }, + new [] { "SCalBrothersTextRematch2", "I'm joking. They are but empty shells now. Did I frighten you?" }, + new [] { "SCalPhase2TextRematch", "Here we go again." }, + new [] { "SCalBH4TextRematch", "Remember these? I bet you've seen them a few times since the last battle... in your nightmares." }, + new [] { "SCalSeekerRingTextRematch", "It seems your skill hasn't faltered in the least." }, + new [] { "SCalBH5TextRematch", "One last go." }, + new [] { "SCalSepulcher2TextRematch", "And... you never cease to amaze." }, + new [] { "SCalDesparationText1Rematch", "You may even have a proper chance now." }, + new [] { "SCalDesparationText2Rematch", "I wonder if you've met his mechanic yet." }, + new [] { "SCalDesparationText3Rematch", "I trust you will not make the same mistakes he did." }, + new [] { "SCalDesparationText4Rematch", "Now... even I cannot see what your future holds." }, + + new [] { "SCalFunnyCheatText", "Go to hell." }, new [] { "EdgyBossText", "Don't get cocky, kid!" }, new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 05de84ee37..16aee95c21 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -249,6 +249,14 @@ namespace CalamityMod case "supremecalamitas": case "supreme calamitas": return CalamityWorld.downedSCal; + + case "adulteidolonwyrm": + case "adult eidolon wyrm": + case "adultwyrm": + case "adult wyrm": + case "adulteidolon": + case "adult eidolon": + return CalamityWorld.downedAdultEidolonWyrm; } } #endregion diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index cf9ca0f0a2..0a0e7b276b 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -29,6 +29,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; @@ -103,6 +104,7 @@ 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 DownedAdultEidolonWyrm = () => CalamityWorld.downedAdultEidolonWyrm; public static readonly Func DownedAcidRainInitial = () => CalamityWorld.downedEoCAcidRain; public static readonly Func DownedAcidRainHardmode = () => CalamityWorld.downedAquaticScourgeAcidRain; @@ -140,6 +142,7 @@ namespace CalamityMod { "Yharon", 18f }, // { "Draedon", 18.5f }, { "SupremeCalamitas", 19f }, + { "AdultEidolonWyrm", 19.5f }, // { "Yharim", 20f }, // { "Noxus", 120f }, // { "Xeroc", 121f }, @@ -581,6 +584,18 @@ namespace CalamityMod string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summon, loot, collection, instructions, despawn); } + + // Adult Eidolon Wyrm + { + BossDifficulty.TryGetValue("AdultEidolonWyrm", out float order); + int type = NPCType(); + int summon = ItemID.RodofDiscord; + List loot = new List() { ItemType(), ItemType(), ItemID.Ectoplasm, ItemType(), ItemType() }; + List collection = new List() { ItemType() }; + string instructions = $"While in the Abyss, use an item that inflicts Chaos State"; + string despawn = CalamityUtils.ColorMessage("...", new Color(0x7F, 0xFF, 0xD4)); + AddBoss(bossChecklist, calamity, "Adult Eidolon Wyrm", order, type, DownedAdultEidolonWyrm, summon, loot, collection, instructions, despawn); + } } private static void AddCalamityInvasions(Mod bossChecklist, Mod calamity) diff --git a/NPCs/Abyss/AEWScreenShaderData.cs b/NPCs/Abyss/AEWScreenShaderData.cs new file mode 100644 index 0000000000..4d0c5fc4ab --- /dev/null +++ b/NPCs/Abyss/AEWScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Abyss +{ + public class AEWScreenShaderData : ScreenShaderData + { + private int AEWIndex; + + public AEWScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateAEWIndex() + { + int AEWType = ModContent.NPCType(); + if (AEWIndex >= 0 && Main.npc[AEWIndex].active && Main.npc[AEWIndex].type == AEWType) + { + return; + } + AEWIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == AEWType) + { + AEWIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateAEWIndex(); + if (AEWIndex != -1) + { + UseTargetPosition(Main.npc[AEWIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/Abyss/AEWSky.cs b/NPCs/Abyss/AEWSky.cs new file mode 100644 index 0000000000..074be772c1 --- /dev/null +++ b/NPCs/Abyss/AEWSky.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Abyss +{ + public class AEWSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int AEWIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + intensity += 0.01f; + else if (!isActive && intensity > 0f) + intensity -= 0.01f; + } + + private float GetIntensity() + { + if (UpdateAEWIndex()) + { + float x = 0f; + if (AEWIndex != -1) + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[AEWIndex].Center); + + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateAEWIndex() + { + int AEWType = ModContent.NPCType(); + if (AEWIndex >= 0 && Main.npc[AEWIndex].active && Main.npc[AEWIndex].type == AEWType) + { + return true; + } + AEWIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == AEWType) + { + AEWIndex = i; + break; + } + } + return AEWIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index b79adab08c..b52e8ce6c9 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -145,10 +145,6 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) @@ -158,10 +154,5 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm2"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 6bb26dbd13..9af8ed6677 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -145,10 +145,6 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) @@ -158,10 +154,5 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm3"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs index a27547108e..15e199468e 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs @@ -1,7 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,15 +16,17 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 60; //36 + npc.damage = 100; + npc.width = 60; npc.height = 88; npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new + npc.LifeMaxNERB(1000000, 1150000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; npc.knockBackResist = 0f; - npc.alpha = 255; + npc.Opacity = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -37,18 +38,15 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { npc.damage = 0; + if (npc.ai[2] > 0f) - { npc.realLife = (int)npc.ai[2]; - } + bool flag = false; if (npc.ai[1] <= 0f) { @@ -64,104 +62,92 @@ namespace CalamityMod.NPCs.Abyss npc.HitEffect(0, 10.0); npc.checkDead(); } + if (!NPC.AnyNPCs(ModContent.NPCType())) - { npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + bool invisiblePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 1f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 5f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 7f; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.15f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Height) * 0.5f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) - { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } + Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult3"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyHuge.cs b/NPCs/Abyss/EidolonWyrmBodyHuge.cs index 7a19413ba3..3071c7da5b 100644 --- a/NPCs/Abyss/EidolonWyrmBodyHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyHuge.cs @@ -1,7 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,15 +16,17 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 60; //36 + npc.damage = 100; + npc.width = 60; npc.height = 88; npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new + npc.LifeMaxNERB(1000000, 1150000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; npc.knockBackResist = 0f; - npc.alpha = 255; + npc.Opacity = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -37,18 +38,15 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { npc.damage = 0; + if (npc.ai[2] > 0f) - { npc.realLife = (int)npc.ai[2]; - } + bool flag = false; if (npc.ai[1] <= 0f) { @@ -64,104 +62,110 @@ namespace CalamityMod.NPCs.Abyss npc.HitEffect(0, 10.0); npc.checkDead(); } + if (!NPC.AnyNPCs(ModContent.NPCType())) - { npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + bool invisiblePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 1f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 5f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 7f; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.15f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + bool shootShadowFireballs = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 6f && Main.npc[(int)npc.ai[2]].Calamity().newAI[2] > 0f; + if (shootShadowFireballs && Main.netMode != NetmodeID.MultiplayerClient) + { + if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 320f) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 90f) + { + float fireballVelocity = 4f; + Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center; + Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; + int type = ProjectileID.CultistBossIceMist; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Height) * 0.5f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) - { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } + Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult2"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - } } } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index b6ffac415c..c587300883 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState) + if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState || NPC.AnyNPCs(ModContent.NPCType())) { detectsPlayer = true; npc.damage = Main.expertMode ? 340 : 170; diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 413da509b7..3747611e89 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,13 +18,31 @@ namespace CalamityMod.NPCs.Abyss { public class EidolonWyrmHeadHuge : ModNPC { - private Vector2 patrolSpot = Vector2.Zero; - public bool detectsPlayer = false; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - bool TailSpawned = false; + private enum Phase + { + ChargeOne = 0, + LightningRain = 1, + FastCharge = 2, + EidolonWyrmSpawn = 3, + ChargeTwo = 4, + IceMist = 5, + ShadowFireballSpin = 6, + AncientDoomSummon = 7, + LightningCharge = 8, + EidolistSpawn = 9 + } + + private float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + Vector2 chargeDestination = default; + private const int minLength = 40; + private const int maxLength = 41; + private bool TailSpawned = false; + private int rotationDirection = 0; public override void SetStaticDefaults() { @@ -34,17 +52,20 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 24f; - npc.damage = 1500; - npc.width = 254; //36 - npc.height = 138; //20 - npc.defense = 700; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.95f; - global.unbreakableDR = true; - npc.lifeMax = 1000000; - npc.aiStyle = -1; + npc.npcSlots = 50f; + npc.GetNPCDamage(); + npc.width = 254; + npc.height = 138; + npc.defense = 100; + npc.DR_NERD(0.4f); + CalamityGlobalNPC global = npc.Calamity(); + global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); + npc.LifeMaxNERB(1000000, 1150000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; + npc.Opacity = 0f; npc.knockBackResist = 0f; npc.value = Item.buyPrice(10, 0, 0, 0); npc.behindTiles = true; @@ -53,37 +74,58 @@ namespace CalamityMod.NPCs.Abyss npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.netAlways = true; - } + npc.boss = true; + music = CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ?? MusicID.Boss3; + } public override void SendExtraAI(BinaryWriter writer) { - writer.WriteVector2(patrolSpot); - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } + writer.Write(npc.dontTakeDamage); + writer.WriteVector2(chargeDestination); + writer.Write(rotationDirection); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { - patrolSpot = reader.ReadVector2(); - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + npc.dontTakeDamage = reader.ReadBoolean(); + chargeDestination = reader.ReadVector2(); + rotationDirection = reader.ReadInt32(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Difficulty modes bool malice = CalamityWorld.malice; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive || malice; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || malice; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; // Increase aggression if player is taking a long time to kill the boss if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases + bool phase2 = lifeRatio < 0.8f; + bool phase3 = lifeRatio < 0.6f; + bool phase4 = lifeRatio < 0.4f; + bool phase5 = lifeRatio < 0.2f; + bool phase6 = lifeRatio < 0.05f; + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -92,156 +134,62 @@ namespace CalamityMod.NPCs.Abyss if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) npc.TargetClosest(); + // Target variable Player player = Main.player[npc.target]; - if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState) - { - if (!detectsPlayer) - { - if (Main.netMode != NetmodeID.Server) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y); - - detectsPlayer = true; - } - npc.damage = 1500; - } - else - npc.damage = 0; - - npc.chaseable = detectsPlayer; - - if (detectsPlayer) - { - if (npc.soundDelay <= 0 && Main.netMode != NetmodeID.Server) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.NextBool(900) && Main.netMode != NetmodeID.Server) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - - if (npc.ai[2] > 0f) + if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - int damage = Main.expertMode ? 300 : 400; - float xPos = Main.rand.NextBool(2) ? npc.position.X + 200f : npc.position.X - 200f; - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); - int random = Main.rand.Next(3); - if (random == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, 0f, 0f, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, -vector4.X, -vector4.Y, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else - { - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 0.6f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) - { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 2f; - } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 2f; - } - } - } - } - } - } + // Play spawn sound + if (!TailSpawned && npc.ai[0] == 0f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + } - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; + // Spawn segments + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + else + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + } + else + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - if (Main.player[npc.target].dead) + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + + // Despawn if target is dead + if (player.dead) { npc.TargetClosest(false); - npc.velocity.Y += 3f; + npc.velocity.Y += 2f; if (npc.position.Y > Main.worldSurface * 16.0) - npc.velocity.Y += 3f; + npc.velocity.Y += 2f; - if (npc.position.Y > (Main.maxTilesY - 200) * 16.0) + if (npc.position.Y > Main.rockLayer * 16.0) { for (int a = 0; a < Main.maxNPCs; a++) { @@ -251,214 +199,824 @@ namespace CalamityMod.NPCs.Abyss } } - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; + // Delete self if far from target or tail doesn't exist + if (Vector2.Distance(player.Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) + npc.active = false; - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) - npc.active = false; - - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - - if (patrolSpot == Vector2.Zero) - patrolSpot = Main.player[npc.target].Center; - - float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; - float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; - - if (!detectsPlayer) + // Adjust opacity + bool invisiblePhase = calamityGlobalNPC.newAI[0] == (float)Phase.LightningRain || calamityGlobalNPC.newAI[0] == (float)Phase.IceMist || calamityGlobalNPC.newAI[0] == (float)Phase.AncientDoomSummon; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) { - num192 += 800; - if (Math.Abs(npc.Center.X - num191) < 400f) - { - if (npc.velocity.X > 0f) + npc.Opacity += 0.15f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Rotation and direction + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + int direction = npc.direction; + npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1); + if (direction != npc.direction) + npc.netUpdate = true; + + // General AI pattern + // Charge : Phase 5 - Charges become predictive + // Charge : Phase 2 - Spin around target and summon shadow fireballs + // Charge : Phase 4 - Swim to the right and dash towards the target, summon lightning bolts from above during it + // Turn invisible, swim above the target and summon predictive lightning bolts + // Turn visible and charge towards the target quickly 1 time, soon after the previous attack ends + // Spawn an Eidolon Wyrm and swim below the target for 10 seconds, or less, if the Wyrm dies + // Charge : Phase 5 - Charges become predictive + // Charge : Phase 3 - Turn invisible and summon ancient dooms around the target + // Charge : Phase 4 - Turn visible, swim to the left and dash towards the target, summon lightning bolts from above during it + // Turn invisible, swim beneath the target and summon ice mist + // Turn visible and charge towards the target quickly 1 time, soon after the previous attack ends + // Spawn Eidolists and swim below the target for 10 seconds, or less, if the Eidolists die + + // Attack patterns + // Phase 1 - 0, 0, 0, 1, 2, 3, 4, 4, 4, 5, 2, 9 + // Phase 2 - 0, 6, 0, 1, 2, 3, 4, 4, 4, 5, 2, 9 + // Phase 3 - 0, 6, 0, 1, 2, 3, 4, 7, 4, 5, 2, 9 + // Phase 4 - 0, 6, 8, 1, 2, 3, 4, 7, 8, 5, 2, 9 + + // Default vector to swim to + Vector2 destination = player.Center; + + // Charge variables + Vector2 chargeVector = default; + float chargeDistance = 1000f; + float turnDistance = 640f; + float chargeLocationDistance = turnDistance * 0.2f; + switch ((int)calamityGlobalNPC.newAI[1]) + { + case 0: + chargeVector.X -= chargeDistance; + break; + case 1: + chargeVector.X += chargeDistance; + break; + case 2: + chargeVector.Y -= chargeDistance; + break; + case 3: + chargeVector.Y += chargeDistance; + break; + case 4: + chargeVector.X -= chargeDistance; + chargeVector.Y -= chargeDistance; + break; + case 5: + chargeVector.X += chargeDistance; + chargeVector.Y += chargeDistance; + break; + case 6: + chargeVector.X -= chargeDistance; + chargeVector.Y += chargeDistance; + break; + case 7: + chargeVector.X += chargeDistance; + chargeVector.Y -= chargeDistance; + break; + } + Vector2 chargeLocation = destination + chargeVector; + Vector2 chargeVectorFlipped = chargeVector * -1f; + + // Lightning Rain variables + Vector2 lightningRainLocation = new Vector2(0f, -1200f); + float lightningRainLocationDistance = turnDistance * 0.2f; + + // Wyrm and Eidolist variables + Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, 1200f); + float eidolonWyrmPhaseLocationDistance = turnDistance * 0.5f; + int maxEidolists = 10; + + // Ice Mist variables + Vector2 iceMistLocation = new Vector2(0f, 1200f); + float iceMistLocationDistance = turnDistance * 0.2f; + + // Spin variables + float spinRadius = 800f; + Vector2 spinLocation = new Vector2(0f, -spinRadius); + float spinLocationDistance = turnDistance * 0.1f; + float degreesOfRotation = 2f; + int totalRotations = 3; + + // Ancient Doom variables + Vector2 ancientDoomLocation = new Vector2(0f, -1200f); + float ancientDoomLocationDistance = turnDistance * 0.2f; + int ancientDoomLimit = 6; + int ancientDoomDegrees = 360 / ancientDoomLimit; + int ancientDoomDistance = 640; + float maxAncientDoomRings = 3f; + + // Lightning charge variables + Vector2 lightningChargeVector = npc.localAI[2] == 0f ? new Vector2(1000f, 0f) : new Vector2(-1000f, 0f); + float lightningChargeLocationDistance = turnDistance * 0.2f; + Vector2 lightningChargeLocation = destination + lightningChargeVector; + Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; + + // Velocity and turn speed values + float minVelocity = !player.wet ? 20f : 10f; + float velocity = Math.Min(minVelocity, Math.Max(minVelocity * 0.4f, player.velocity.Length())); + float turnSpeed = !player.wet ? MathHelper.ToRadians(4f) : MathHelper.ToRadians(2f); + float quickTurnVelocityMult = 0.5f; + float quickTurnTurnSpeedMult = 2f; + float normalChargeVelocityMult = 2f; + float normalChargeTurnSpeedMult = 0.5f; + float invisiblePhaseVelocityMult = 1.5f; + float fastChargeVelocityMult = 3f; + float fastChargeTurnSpeedMult = 0.5f; + + // Phase gate values + float chargePhaseGateValue = 180f; + float chargeGateValue = chargePhaseGateValue + 10f; + float lightningRainDuration = 180f; + float lightningRainPhaseDuration = lightningRainDuration + 30f; + float eidolonWyrmPhaseDuration = 600f; + float iceMistDuration = 180f; + float iceMistPhaseDuration = iceMistDuration + 30f; + float spinPhaseDuration = 360 * totalRotations / degreesOfRotation; + float ancientDoomPhaseGateValue = 30f; + float ancientDoomGateValue = 120f; + float lightningChargePhaseGateValue = 90f; + float lightningChargeGateValue = lightningChargePhaseGateValue + 10f; + + // Phase switch + switch ((int)AIState) + { + // First charge combo + case (int)Phase.ChargeOne: + + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { - num191 += 500f; + turnDistance = chargeLocationDistance; + if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) + { + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + + if (calamityGlobalNPC.newAI[2] < chargeGateValue) + { + // Slow down and quickly turn for 10 frames before the charge + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == chargeGateValue) + chargeDestination = destination + chargeVectorFlipped; + + velocity *= quickTurnVelocityMult; + turnSpeed *= quickTurnTurnSpeedMult; + } + else + { + // Charge + velocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < chargeLocationDistance) + { + npc.ai[3] += 1f; + float maxCharges = phase4 ? 1 : phase2 ? 2 : 3; + if (npc.ai[3] >= maxCharges) + { + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.ShadowFireballSpin : (float)Phase.LightningRain; + } + else if (phase2) + calamityGlobalNPC.newAI[0] = (float)Phase.ShadowFireballSpin; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[2] = 0f; + + npc.TargetClosest(); + } + } + } + else + destination += chargeLocation; } else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Turn invisible, swim above and summon predictive lightning bolts + case (int)Phase.LightningRain: + + // Swim up + destination += lightningRainLocation; + turnDistance = lightningRainLocationDistance; + + velocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseVelocityMult; + + if ((destination - npc.Center).Length() < lightningRainLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { - num191 -= 500f; + if (calamityGlobalNPC.newAI[2] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), npc.Center); + + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < lightningRainDuration && Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 2; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance && Collision.CanHit(npc.Center, 1, 1, playerCenter, 1, 1)) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int num34 = numProjectiles + 1; + numProjectiles = num34; + if (num34 >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = 40f; + float lightningVelocity = 8f; + for (int i = 0; i < numProjectiles; i++) + { + // Predictive bolt + Vector2 vector52 = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + float ai = Main.rand.Next(100); + Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; + int type = ProjectileID.CultistBossLightningOrbArc; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, vector53, type, damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); + + // Opposite bolt + vector52 = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + float ai2 = Main.rand.Next(100); + vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; + Projectile.NewProjectile(npc.Center, vector53, type, damage, 0f, Main.myPlayer, vector52.ToRotation(), ai2); + + // Normal bolt + vector52 = targetCenterArray[i] - npc.Center; + float ai3 = Main.rand.Next(100); + vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; + Projectile.NewProjectile(npc.Center, vector53, type, damage, 0f, Main.myPlayer, vector52.ToRotation(), ai3); + } + } + + Lighting.AddLight(npc.Center, 0.4f, 0.85f, 0.9f); + + float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num737 < -0.5f) + num737 = -0.5f; + if (num737 > 0.5f) + num737 = 0.5f; + + Vector2 value40 = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(num737 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + int num738 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[num738].position = npc.Center + value40; + Main.dust[num738].velocity = Vector2.Normalize(Main.dust[num738].position - npc.Center) * 2f; + Main.dust[num738].noGravity = true; + + float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num740 < -0.5f) + num740 = -0.5f; + if (num740 > 0.5f) + num740 = 0.5f; + + Vector2 value41 = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(num740 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + int num741 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[num741].velocity = Vector2.Zero; + Main.dust[num741].position = npc.Center + value41; + Main.dust[num741].noGravity = true; + + if (calamityGlobalNPC.newAI[2] >= lightningRainPhaseDuration) + { + npc.localAI[0] = 0f; + calamityGlobalNPC.newAI[0] = (float)Phase.FastCharge; + calamityGlobalNPC.newAI[2] = 90f; + npc.TargetClosest(); + } } - } + + break; + + // Turn visible and charge quickly + case (int)Phase.FastCharge: + + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) + { + turnDistance = chargeLocationDistance; + if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) + { + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + + if (calamityGlobalNPC.newAI[2] < chargeGateValue) + { + // Slow down and quickly turn for 10 frames before the charge + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == chargeGateValue) + chargeDestination = destination + chargeVectorFlipped; + + velocity *= quickTurnVelocityMult; + turnSpeed *= quickTurnTurnSpeedMult; + } + else + { + // Charge very quickly + velocity *= fastChargeVelocityMult; + turnSpeed *= fastChargeTurnSpeedMult; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < chargeLocationDistance) + { + calamityGlobalNPC.newAI[0] = npc.localAI[0] == 0f ? (float)Phase.EidolonWyrmSpawn : (float)Phase.EidolistSpawn; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[2] = 0f; + + npc.TargetClosest(); + } + } + } + else + destination += chargeLocation; + } + else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Summon an Eidolon Wyrm and swim below the target for 10 seconds, or less, if the Wyrm dies + case (int)Phase.EidolonWyrmSpawn: + + destination += eidolonWyrmPhaseLocation; + turnDistance = eidolonWyrmPhaseLocationDistance; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[2] == 0f) + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + } + + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration || !NPC.AnyNPCs(ModContent.NPCType())) + { + calamityGlobalNPC.newAI[0] = (float)Phase.ChargeTwo; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; + + // Second charge combo + case (int)Phase.ChargeTwo: + + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) + { + turnDistance = chargeLocationDistance; + if ((chargeLocation - npc.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) + { + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + + if (calamityGlobalNPC.newAI[2] < chargeGateValue) + { + // Slow down and quickly turn for 10 frames before the charge + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == chargeGateValue) + chargeDestination = destination + chargeVectorFlipped; + + velocity *= quickTurnVelocityMult; + turnSpeed *= quickTurnTurnSpeedMult; + } + else + { + // Charge + velocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < chargeLocationDistance) + { + npc.ai[3] += 1f; + float maxCharges = phase4 ? 1 : phase3 ? 2 : 3; + if (npc.ai[3] >= maxCharges) + { + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.AncientDoomSummon : (float)Phase.IceMist; + } + else if (phase3) + calamityGlobalNPC.newAI[0] = (float)Phase.AncientDoomSummon; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[2] = 0f; + + npc.TargetClosest(); + } + } + } + else + destination += chargeLocation; + } + else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Turn invisible, swim beneath the target and summon ice mist + case (int)Phase.IceMist: + + // Swim down + destination += iceMistLocation; + turnDistance = iceMistLocationDistance; + + velocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseVelocityMult; + + if ((destination - npc.Center).Length() < iceMistLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 2; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance && Collision.CanHit(npc.Center, 1, 1, playerCenter, 1, 1)) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int num34 = numProjectiles + 1; + numProjectiles = num34; + if (num34 >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = 60f; + float iceMistVelocity = 16f; + for (int i = 0; i < numProjectiles; i++) + { + // Predictive mist + Vector2 vector52 = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + Vector2 vector53 = Vector2.Normalize(vector52) * iceMistVelocity; + int type = ProjectileID.CultistBossIceMist; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, vector53, type, damage, 0f, Main.myPlayer, 0f, 1f); + + // Opposite mist + vector52 = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center; + vector53 = Vector2.Normalize(vector52) * iceMistVelocity; + Projectile.NewProjectile(npc.Center, vector53, type, damage, 0f, Main.myPlayer, 0f, 1f); + + // Normal mist + vector52 = targetCenterArray[i] - npc.Center; + vector53 = Vector2.Normalize(vector52) * iceMistVelocity; + Projectile.NewProjectile(npc.Center, vector53, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + + Lighting.AddLight(npc.Center, 0.3f, 0.75f, 0.9f); + + float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num737 < -0.5f) + num737 = -0.5f; + if (num737 > 0.5f) + num737 = 0.5f; + + Vector2 value40 = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(num737 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + int num738 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[num738].position = npc.Center + value40; + Main.dust[num738].velocity = Vector2.Normalize(Main.dust[num738].position - npc.Center) * 2f; + Main.dust[num738].noGravity = true; + + float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num740 < -0.5f) + num740 = -0.5f; + if (num740 > 0.5f) + num740 = 0.5f; + + Vector2 value41 = new Vector2(-npc.width * 0.6f * npc.scale, 0f).RotatedBy(num740 * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation()); + int num741 = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[num741].velocity = Vector2.Zero; + Main.dust[num741].position = npc.Center + value41; + Main.dust[num741].noGravity = true; + + if (calamityGlobalNPC.newAI[2] >= iceMistPhaseDuration) + { + npc.localAI[0] = 1f; + calamityGlobalNPC.newAI[0] = (float)Phase.FastCharge; + calamityGlobalNPC.newAI[2] = 90f; + npc.TargetClosest(); + } + } + + break; + + // Phase 2 attack - Get in position for spin, spin around target and summon shadow fireballs + case (int)Phase.ShadowFireballSpin: + + // Swim up + destination += spinLocation; + turnDistance = spinLocationDistance; + + velocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseVelocityMult; + + // Spin around target + if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + if (rotationDirection == 0) + rotationDirection = player.direction; + + calamityGlobalNPC.newAI[2] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.Center = player.Center + new Vector2(spinRadius, 0).RotatedBy(npc.localAI[1]); + + npc.localAI[1] += MathHelper.ToRadians(degreesOfRotation) * rotationDirection; + + if (calamityGlobalNPC.newAI[2] >= spinPhaseDuration) + { + rotationDirection = 0; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + // Return to prevent other velocity code from being called + return; + } + + break; + + // Phase 3 attack - Swim above, turn invisible and summon ancient dooms around the target + case (int)Phase.AncientDoomSummon: + + // Swim up + destination += ancientDoomLocation; + turnDistance = ancientDoomLocationDistance; + + if (npc.localAI[1] < maxAncientDoomRings) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= ancientDoomPhaseGateValue) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; + if (aiGateValue % ancientDoomGateValue == 0f) + { + // Spawn 3 (or more) circles of Ancient Dooms around the target + int ancientDoomScale = (int)(aiGateValue / ancientDoomGateValue); + ancientDoomLimit = 4 + ancientDoomScale; + ancientDoomDegrees = 360 / ancientDoomLimit; + ancientDoomDistance = 550 + ancientDoomScale * 45; + for (int i = 0; i < ancientDoomLimit; i++) + { + float ai2 = i * ancientDoomDegrees; + NPC.NewNPC((int)(player.Center.X + (float)(Math.Sin(i * ancientDoomDegrees) * ancientDoomDistance)), (int)(player.Center.Y + (float)(Math.Cos(i * ancientDoomDegrees) * ancientDoomDistance)), + NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); + } + npc.localAI[1] += 1f; + npc.TargetClosest(); + } + } + } + } + + if (npc.localAI[1] >= maxAncientDoomRings) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= ancientDoomGateValue + maxAncientDoomRings) + { + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeTwo; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + } + + break; + + // Phase 4 attack - Swim to the right or left and charge towards the target, summon a wall of lightning bolts in the direction of the charge + case (int)Phase.LightningCharge: + + if (calamityGlobalNPC.newAI[2] >= lightningChargePhaseGateValue) + { + turnDistance = lightningChargeLocationDistance; + if ((lightningChargeLocation - npc.Center).Length() < lightningChargeLocationDistance || calamityGlobalNPC.newAI[2] > lightningChargePhaseGateValue) + { + if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + + if (calamityGlobalNPC.newAI[2] < lightningChargeGateValue) + { + // Slow down and quickly turn for 10 frames before the charge + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] == lightningChargeGateValue) + chargeDestination = destination + lightningChargeVectorFlipped; + + velocity *= quickTurnVelocityMult; + turnSpeed *= quickTurnTurnSpeedMult; + } + else + { + // Charge + velocity *= fastChargeVelocityMult; + turnSpeed *= fastChargeTurnSpeedMult; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < lightningChargeLocationDistance) + { + calamityGlobalNPC.newAI[0] = npc.localAI[2] == 0f ? (float)Phase.LightningRain : (float)Phase.IceMist; + calamityGlobalNPC.newAI[2] = 0f; + + npc.localAI[2] += 1f; + if (npc.localAI[2] > 1f) + npc.localAI[2] = 0f; + + npc.TargetClosest(); + } + } + } + else + destination += lightningChargeLocation; + } + else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Summon Eidolists and swim below the target for 10 seconds, or less, if the Eidolists die + case (int)Phase.EidolistSpawn: + + destination += eidolonWyrmPhaseLocation; + turnDistance = eidolonWyrmPhaseLocationDistance; + + if (calamityGlobalNPC.newAI[2] == 0f) + { + // Spawn Eidolists randomly around the target + for (int i = 0; i < maxEidolists; i++) + { + Point npcCenter = npc.Center.ToTileCoordinates(); + Point playerCenter = player.Center.ToTileCoordinates(); + Vector2 distance = player.Center - npc.Center; + + int baseDistance = 20; + int minDistance = 3; + int maxDistance = 7; + int collisionRange = 2; + int iterations = 0; + bool tooFar = distance.Length() > 2800f; + while (!tooFar && iterations < 100) + { + iterations++; + int randomX = Main.rand.Next(playerCenter.X - baseDistance, playerCenter.X + baseDistance + 1); + int randomY = Main.rand.Next(playerCenter.Y - baseDistance, playerCenter.Y + baseDistance + 1); + if ((randomY < playerCenter.Y - maxDistance || randomY > playerCenter.Y + maxDistance || randomX < playerCenter.X - maxDistance || randomX > playerCenter.X + maxDistance) && (randomY < npcCenter.Y - minDistance || randomY > npcCenter.Y + minDistance || randomX < npcCenter.X - minDistance || randomX > npcCenter.X + minDistance) && !Main.tile[randomX, randomY].nactive()) + { + bool canSpawn = true; + if (canSpawn && Collision.SolidTiles(randomX - collisionRange, randomX + collisionRange, randomY - collisionRange, randomY + collisionRange)) + canSpawn = false; + + if (canSpawn) + { + NPC.NewNPC(randomX * 16 + 8, randomY * 16 + 8, ModContent.NPCType(), 0, npc.whoAmI); + break; + } + } + } + } + } + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration || !NPC.AnyNPCs(ModContent.NPCType())) + { + calamityGlobalNPC.newAI[0] = (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; } - else - { - num188 = 10f; - num189 = 0.175f; - if (!Main.player[npc.target].wet) - { - num188 = 20f; - num189 = 0.25f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } + // Increase velocity if velocity is ever zero + if (npc.velocity == Vector2.Zero) + npc.velocity.X = 2f * player.direction; - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - { - return detectsPlayer; - } - return null; - } + // Acceleration + if (!((destination - npc.Center).Length() < turnDistance)) + { + float targetAngle = npc.AngleTo(destination); + float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + npc.velocity = f.ToRotationVector2() * velocity; + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + // Velocity upper limit + if (npc.velocity.Length() > velocity) + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * velocity; + + // Reduce Y velocity if it's less than 1 + if (Math.Abs(npc.velocity.Y) < 1f) + npc.velocity.Y -= 0.1f; + + // Storm code + if (calamityGlobalNPC.newAI[3] == 0f) + { + // Start a storm + if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu)) + return; + + CalamityUtils.StartRain(true, true); + calamityGlobalNPC.newAI[3] = 1f; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 70f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CalamityUtils.AntiButcher(npc, ref damage, 0.1f); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 center = npc.Center; + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Height) * 0.5f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.downedPolterghast) - { - return SpawnCondition.CaveJellyfish.Chance * 0.012f; - } - return 0f; - } - public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); @@ -471,53 +1029,31 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); } - public override void HitEffect(int hitDirection, double damage) - { - if (detectsPlayer) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - public override void OnHitPlayer(Player player, int damage, bool crit) + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 1200, true); + player.AddBuff(ModContent.BuffType(), 600, true); } } } diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 5410543ebc..d39e8fde54 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -144,10 +144,6 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) @@ -157,11 +153,5 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm4"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(ModContent.BuffType(), 60, true); - } } } diff --git a/NPCs/Abyss/EidolonWyrmTailHuge.cs b/NPCs/Abyss/EidolonWyrmTailHuge.cs index 7ea423cc0b..8fdd938774 100644 --- a/NPCs/Abyss/EidolonWyrmTailHuge.cs +++ b/NPCs/Abyss/EidolonWyrmTailHuge.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,15 +16,17 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 86; //28 - npc.height = 120; //28 + npc.damage = 100; + npc.width = 86; + npc.height = 120; npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new + npc.LifeMaxNERB(1000000, 1150000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; npc.knockBackResist = 0f; - npc.alpha = 255; + npc.Opacity = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -36,18 +38,15 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { npc.damage = 0; + if (npc.ai[2] > 0f) - { npc.realLife = (int)npc.ai[2]; - } + bool flag = false; if (npc.ai[1] <= 0f) { @@ -63,105 +62,92 @@ namespace CalamityMod.NPCs.Abyss npc.HitEffect(0, 10.0); npc.checkDead(); } + if (!NPC.AnyNPCs(ModContent.NPCType())) - { npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + bool invisiblePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 1f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 5f || Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 7f; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.15f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Height) * 0.5f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) - { Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } + Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult4"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(ModContent.BuffType(), 60, true); - } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index f83bfd048e..e334514fd5 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AquaticScourge aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.LifeMaxNERB(80000, 92000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.behindTiles = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index e903f3841f..8d556fec1a 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.AquaticScourge aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.LifeMaxNERB(80000, 92000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.behindTiles = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 58a3510805..18ebbb9351 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.DR_NERD(0.05f); npc.aiStyle = -1; aiType = -1; - npc.LifeMaxNERB(80000, 92000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -82,6 +82,7 @@ namespace CalamityMod.NPCs.AquaticScourge { if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive) music = CalamityMod.Instance.GetMusicFromMusicMod("AquaticScourge") ?? MusicID.Boss2; + CalamityAI.AquaticScourgeAI(npc, mod, true); } @@ -130,23 +131,22 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - { return npc.Calamity().newAI[0] == 1f; - } + return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe) - { return 0f; - } + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) { if (!NPC.AnyNPCs(ModContent.NPCType())) return 0.01f; } + return 0f; } @@ -239,15 +239,13 @@ namespace CalamityMod.NPCs.AquaticScourge public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - } + if (npc.life <= 0) { for (int k = 0; k < 15; k++) - { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); } } @@ -255,9 +253,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool CheckActive() { if (npc.Calamity().newAI[0] == 1f && !Main.player[npc.target].dead && npc.Calamity().newAI[1] != 1f) - { return false; - } + return true; } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 5750ec01d7..66b9a95990 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.AquaticScourge aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.LifeMaxNERB(80000, 92000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.behindTiles = true; diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 7ecd9f4524..1782798cc0 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.height = 280; npc.defense = 40; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(84000, NPC.downedMoonlord ? 292500 : 107000, 7400000); // 30 seconds in boss rush + npc.LifeMaxNERB(84000, NPC.downedMoonlord ? 292500 : 107000, 740000); // 30 seconds in boss rush npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index a11865b1b1..4f6f559c0d 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -31,10 +31,6 @@ namespace CalamityMod.NPCs.AstrumAureus npc.alpha = 255; npc.defense = 10; npc.lifeMax = 3000; - if (BossRushEvent.BossRushActive) - { - npc.lifeMax = 30000; - } npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index c7c1ec345b..807d4f4d5b 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 38; npc.height = 44; npc.defense = 50; - npc.LifeMaxNERB(187500, 225000, 6500000); + npc.LifeMaxNERB(187500, 225000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 74c30d9772..cbc4ff0eb1 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 56; npc.height = 56; npc.defense = 25; - npc.LifeMaxNERB(187500, 225000, 6500000); + npc.LifeMaxNERB(187500, 225000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 2e433ce3cc..210133b3d9 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 52; npc.height = 68; npc.defense = 75; - npc.LifeMaxNERB(187500, 225000, 6500000); + npc.LifeMaxNERB(187500, 225000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 341064d544..c6d924c090 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 4f2cca0c78..c4aadc9463 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.height = 150; npc.defense = 15; npc.value = Item.buyPrice(0, 12, 0, 0); - npc.LifeMaxNERB(30000, 41000, 6500000); + npc.LifeMaxNERB(30000, 41000, 650000); npc.DR_NERD(0.15f); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index f4a0080002..265559c299 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.DR_NERD(0.1f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(170625, 189375, 3000000); // Old HP - 227500, 252500 + npc.LifeMaxNERB(170625, 189375, 300000); // Old HP - 227500, 252500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 2cee269829..466f0f09e0 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.width = 120; npc.height = 80; npc.defense = 20; - npc.LifeMaxNERB(9000, 11250, 50000); // Old HP - 12000, 15000 + npc.LifeMaxNERB(9000, 11250, 5000); // Old HP - 12000, 15000 npc.knockBackResist = 0f; npc.lavaImmune = true; npc.noGravity = true; diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 66a7ad67ed..522c9e1df1 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Calamitas npc.defense = 15; npc.DR_NERD(0.15f); npc.value = 0f; - npc.LifeMaxNERB(37500, 51750, 5200000); + npc.LifeMaxNERB(37500, 51750, 520000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 687ce7ce36..203f7699c2 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Calamitas npc.height = 120; npc.defense = 10; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(9000, 13200, 800000); + npc.LifeMaxNERB(9000, 13200, 80000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index d8e4025eef..efa62c49fd 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Calamitas npc.height = 120; npc.defense = 10; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(7500, 11025, 800000); + npc.LifeMaxNERB(7500, 11025, 80000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index bdebb54d74..e2fc49af79 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Calamitas npc.defense = 25; npc.value = Item.buyPrice(0, 15, 0, 0); npc.DR_NERD(0.15f); - npc.LifeMaxNERB(28125, 38812, 3900000); + npc.LifeMaxNERB(28125, 38812, 390000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index 9f9ee6f774..1a63b3f046 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Calamitas npc.lifeMax = 200; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + npc.lifeMax = 3000; } npc.aiStyle = 5; aiType = NPCID.Probe; diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index 3347c7233c..4c1819d072 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Calamitas npc.lifeMax = CalamityWorld.death ? 1500 : 2500; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 150000; + npc.lifeMax = 15000; } npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 6a4580b0f1..49e4a736cc 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; @@ -10515,7 +10516,18 @@ namespace CalamityMod.NPCs if (malice) enrage = true; - npc.defense = turboEnrage ? (npc.defDefense * 50) : npc.defDefense; + if (turboEnrage) + { + npc.defense = npc.defDefense * 50; + npc.Calamity().DR = 0.99f; + npc.Calamity().unbreakableDR = true; + } + else + { + npc.defense = npc.defDefense; + npc.Calamity().DR = 0.25f; + npc.Calamity().unbreakableDR = false; + } // Float through tiles or not bool flag44 = false; @@ -12842,7 +12854,7 @@ namespace CalamityMod.NPCs int rateOfChange = 1; float splitProjVelocity = 5f; - // Percent life remaining for Cultist + // Percent life remaining for Cultist or Eidolon Wyrm float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; bool phase2 = lifeRatio < 0.7f; @@ -12851,7 +12863,7 @@ namespace CalamityMod.NPCs bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; int target = Main.maxPlayers; - if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) + if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss || Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) { if (target == Main.maxPlayers) target = Main.npc[(int)npc.ai[0]].target; @@ -12861,6 +12873,9 @@ namespace CalamityMod.NPCs if (phase4 || death) rateOfChange = 3; + + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + npc.dontTakeDamage = true; } else kill = true; @@ -12881,6 +12896,12 @@ namespace CalamityMod.NPCs double deg = npc.ai[3]; double rad = deg * (Math.PI / 180); double dist = 550; + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + { + float aiGateValue = Main.npc[(int)npc.ai[0]].Calamity().newAI[2] - 30f; + int ancientDoomScale = (int)(aiGateValue / 120f); + dist += ancientDoomScale * 45; + } npc.position.X = Main.player[target].Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; npc.position.Y = Main.player[target].Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; float spinVelocity = 8f * (1f - (npc.ai[1] / duration)); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b1d72a4266..2267c42300 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -212,77 +212,77 @@ namespace CalamityMod.NPCs public static SortedDictionary BossRushHPChanges = new SortedDictionary { // Tier 1 - { NPCID.QueenBee, 3150000 }, // 30 seconds + { NPCID.QueenBee, 315000 }, // 30 seconds - { NPCID.BrainofCthulhu, 1000000 }, // 30 seconds with creepers - { NPCID.Creeper, 100000 }, + { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers + { NPCID.Creeper, 10000 }, - { NPCID.KingSlime, 3000000 }, // 30 seconds - { NPCID.BlueSlime, 36000 }, - { NPCID.SlimeSpiked, 72000 }, - { NPCID.GreenSlime, 27000 }, - { NPCID.RedSlime, 54000 }, - { NPCID.PurpleSlime, 72000 }, - { NPCID.YellowSlime, 63000 }, - { NPCID.IceSlime, 45000 }, - { NPCID.UmbrellaSlime, 54000 }, - { NPCID.RainbowSlime, 300000 }, - { NPCID.Pinky, 150000 }, + { NPCID.KingSlime, 300000 }, // 30 seconds + { NPCID.BlueSlime, 3600 }, + { NPCID.SlimeSpiked, 7200 }, + { NPCID.GreenSlime, 2700 }, + { NPCID.RedSlime, 5400 }, + { NPCID.PurpleSlime, 7200 }, + { NPCID.YellowSlime, 6300 }, + { NPCID.IceSlime, 4500 }, + { NPCID.UmbrellaSlime, 5400 }, + { NPCID.RainbowSlime, 30000 }, + { NPCID.Pinky, 15000 }, - { NPCID.EyeofCthulhu, 4500000 }, // 30 seconds - { NPCID.ServantofCthulhu, 60000 }, + { NPCID.EyeofCthulhu, 450000 }, // 30 seconds + { NPCID.ServantofCthulhu, 6000 }, - { NPCID.SkeletronPrime, 1100000 }, // 30 seconds - { NPCID.PrimeVice, 540000 }, - { NPCID.PrimeCannon, 450000 }, - { NPCID.PrimeSaw, 450000 }, - { NPCID.PrimeLaser, 380000 }, + { NPCID.SkeletronPrime, 110000 }, // 30 seconds + { NPCID.PrimeVice, 54000 }, + { NPCID.PrimeCannon, 45000 }, + { NPCID.PrimeSaw, 45000 }, + { NPCID.PrimeLaser, 38000 }, - { NPCID.Golem, 500000 }, // 30 seconds - { NPCID.GolemHead, 300000 }, - { NPCID.GolemHeadFree, 300000 }, - { NPCID.GolemFistLeft, 250000 }, - { NPCID.GolemFistRight, 250000 }, + { NPCID.Golem, 50000 }, // 30 seconds + { NPCID.GolemHead, 30000 }, + { NPCID.GolemHeadFree, 30000 }, + { NPCID.GolemFistLeft, 25000 }, + { NPCID.GolemFistRight, 25000 }, - { NPCID.EaterofWorldsHead, 100000 }, // 30 seconds + immunity timer at start - { NPCID.EaterofWorldsBody, 100000 }, - { NPCID.EaterofWorldsTail, 100000 }, + { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start + { NPCID.EaterofWorldsBody, 10000 }, + { NPCID.EaterofWorldsTail, 10000 }, // Tier 2 - { NPCID.TheDestroyer, 2500000 }, // 30 seconds + immunity timer at start - { NPCID.TheDestroyerBody, 2500000 }, - { NPCID.TheDestroyerTail, 2500000 }, - { NPCID.Probe, 100000 }, + { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start + { NPCID.TheDestroyerBody, 250000 }, + { NPCID.TheDestroyerTail, 250000 }, + { NPCID.Probe, 10000 }, - { NPCID.Spazmatism, 1500000 }, // 30 seconds - { NPCID.Retinazer, 1250000 }, + { NPCID.Spazmatism, 150000 }, // 30 seconds + { NPCID.Retinazer, 125000 }, - { NPCID.WallofFlesh, 4500000 }, // 30 seconds - { NPCID.WallofFleshEye, 4500000 }, + { NPCID.WallofFlesh, 450000 }, // 30 seconds + { NPCID.WallofFleshEye, 450000 }, - { NPCID.SkeletronHead, 1600000 }, // 30 seconds - { NPCID.SkeletronHand, 600000 }, + { NPCID.SkeletronHead, 160000 }, // 30 seconds + { NPCID.SkeletronHand, 60000 }, // Tier 3 - { NPCID.CultistBoss, 2200000 }, // 30 seconds - { NPCID.CultistDragonHead, 600000 }, - { NPCID.CultistDragonBody1, 600000 }, - { NPCID.CultistDragonBody2, 600000 }, - { NPCID.CultistDragonBody3, 600000 }, - { NPCID.CultistDragonBody4, 600000 }, - { NPCID.CultistDragonTail, 600000 }, - { NPCID.AncientCultistSquidhead, 500000 }, + { NPCID.CultistBoss, 220000 }, // 30 seconds + { NPCID.CultistDragonHead, 60000 }, + { NPCID.CultistDragonBody1, 60000 }, + { NPCID.CultistDragonBody2, 60000 }, + { NPCID.CultistDragonBody3, 60000 }, + { NPCID.CultistDragonBody4, 60000 }, + { NPCID.CultistDragonTail, 60000 }, + { NPCID.AncientCultistSquidhead, 50000 }, - { NPCID.Plantera, 1600000 }, // 30 seconds - { NPCID.PlanterasTentacle, 400000 }, + { NPCID.Plantera, 160000 }, // 30 seconds + { NPCID.PlanterasTentacle, 40000 }, // Tier 4 - { NPCID.DukeFishron, 2900000 }, // 30 seconds + { NPCID.DukeFishron, 290000 }, // 30 seconds - { NPCID.MoonLordCore, 1600000 }, // 1 minute - { NPCID.MoonLordHand, 450000 }, - { NPCID.MoonLordHead, 600000 }, - { NPCID.MoonLordLeechBlob, 8000 } + { NPCID.MoonLordCore, 160000 }, // 1 minute + { NPCID.MoonLordHand, 45000 }, + { NPCID.MoonLordHead, 60000 }, + { NPCID.MoonLordLeechBlob, 800 } // 8 minutes in total for vanilla Boss Rush bosses }; @@ -2011,6 +2011,13 @@ namespace CalamityMod.NPCs if (NPC.LunarApocalypseIsUp) PillarEventProgressionEdit(npc); + // Adult Wyrm Ancient Doom + if (npc.type == NPCID.AncientDoom) + { + if (Main.npc[(int)npc.ai[0]].type == NPCType()) + return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod); + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { switch (npc.type) @@ -5226,6 +5233,10 @@ namespace CalamityMod.NPCs { return CalamityWorld.downedSCal; } + else if (type == NPCType()) + { + return CalamityWorld.downedAdultEidolonWyrm; + } return true; } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 41cf2720e9..a47c0c1739 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.CeaselessVoid global.DR = 0.5f; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1; - npc.LifeMaxNERB(notDoGFight ? 67200 : 16800, notDoGFight ? 77280 : 19320, 720000); + npc.LifeMaxNERB(notDoGFight ? 67200 : 16800, notDoGFight ? 77280 : 19320, 72000); // If fought alone, Ceaseless Void plays its own theme if (notDoGFight) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 94ccb55925..70eab62a37 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.CeaselessVoid } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 44000; + npc.lifeMax = 4400; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 37cada574c..a44cead856 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Crabulon npc.lifeMax = 25; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 150000; + npc.lifeMax = 15000; } aiType = -1; npc.knockBackResist = 0.75f; diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index b12f975919..c8f5fa3d36 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Crabulon npc.width = 280; npc.height = 160; npc.defense = 8; - npc.LifeMaxNERB(3000, 4000, 11000000); + npc.LifeMaxNERB(3000, 4000, 1100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/Cryogen/Cryocore.cs b/NPCs/Cryogen/Cryocore.cs index 8a27e5ebbf..4d218b288c 100644 --- a/NPCs/Cryogen/Cryocore.cs +++ b/NPCs/Cryogen/Cryocore.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = 220; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + npc.lifeMax = 3000; } npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Cryogen/Cryocore2.cs b/NPCs/Cryogen/Cryocore2.cs index 2bcf04a2b2..4449d6c0f7 100644 --- a/NPCs/Cryogen/Cryocore2.cs +++ b/NPCs/Cryogen/Cryocore2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = 300; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 40000; + npc.lifeMax = 4000; } npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index abf643b65c..adf3fbf2d4 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Cryogen npc.height = 88; npc.defense = 12; npc.DR_NERD(0.1f); - npc.LifeMaxNERB(18795, 27615, 3000000); + npc.LifeMaxNERB(18795, 27615, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 53764ccc5b..1a96481f63 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = 1400; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.alpha = 255; npc.HitSound = SoundID.NPCHit5; diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs index eddd6bcf1b..76556df949 100644 --- a/NPCs/Cryogen/IceMass.cs +++ b/NPCs/Cryogen/IceMass.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = 220; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + npc.lifeMax = 3000; } npc.knockBackResist = 0f; npc.canGhostHeal = false; diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index dd84f1ea55..f6d46c6f47 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.height = 36; npc.defense = 6; npc.DR_NERD(0.05f); - npc.LifeMaxNERB(2600, 3000, 16500000); + npc.LifeMaxNERB(2600, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs index 6c8e713b1b..eb756d8f7b 100644 --- a/NPCs/DesertScourge/DesertScourgeBodySmall.cs +++ b/NPCs/DesertScourge/DesertScourgeBodySmall.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.lifeMax = 800; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 350000; + npc.lifeMax = 35000; } npc.aiStyle = 6; aiType = -1; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 986a0a8d86..0ec5d5a082 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.npcSlots = 12f; npc.width = 32; npc.height = 80; - npc.LifeMaxNERB(2600, 3000, 16500000); + npc.LifeMaxNERB(2600, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index a95ab611df..ac285418d3 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.lifeMax = 800; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 350000; + npc.lifeMax = 35000; } npc.aiStyle = 6; aiType = -1; diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 81f820c434..0ec1efdfaf 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.height = 48; npc.defense = 9; npc.DR_NERD(0.1f); - npc.LifeMaxNERB(2600, 3000, 16500000); + npc.LifeMaxNERB(2600, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs index 4698c4bd36..fad410cd8d 100644 --- a/NPCs/DesertScourge/DesertScourgeTailSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeTailSmall.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.lifeMax = 800; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 350000; + npc.lifeMax = 35000; } npc.aiStyle = 6; aiType = -1; diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs index f6c7601ce1..c527852e61 100644 --- a/NPCs/DesertScourge/DriedSeekerBody.cs +++ b/NPCs/DesertScourge/DriedSeekerBody.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.lifeMax = 100; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.knockBackResist = 0f; npc.aiStyle = 6; diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 8cd3b49879..6f0d10fa2d 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.lifeMax = 100; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.aiStyle = 6; aiType = -1; diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs index bc8dfd8d55..2a1e6d7155 100644 --- a/NPCs/DesertScourge/DriedSeekerTail.cs +++ b/NPCs/DesertScourge/DriedSeekerTail.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.lifeMax = 100; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.knockBackResist = 0f; npc.aiStyle = 6; diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index 4d6b9c910a..15a07e3ff6 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.925f; global.unbreakableDR = true; - npc.LifeMaxNERB(517500, 621000, 9200000); + npc.LifeMaxNERB(517500, 621000, 920000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 1b122ba9de..c531d9d37f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.width = 186; npc.height = 186; npc.defense = 50; - npc.LifeMaxNERB(517500, 621000, 9200000); + npc.LifeMaxNERB(517500, 621000, 920000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.1f; diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 297b3e3456..5d2bcd4595 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.width = 80; npc.height = 140; npc.defense = 50; - npc.LifeMaxNERB(517500, 621000, 9200000); + npc.LifeMaxNERB(517500, 621000, 920000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 20ff3dce30..55a0ac975d 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.HiveMind npc.lifeMax = 90; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 20000; + npc.lifeMax = 2000; } npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 0c1eea2ef9..cae1276597 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.HiveMind npc.lifeMax = 150; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 18000; + npc.lifeMax = 1800; } npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index d81b83f356..e42c56c57d 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.HiveMind npc.lifeMax = 100; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 13000; + npc.lifeMax = 1300; } npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 01a0f444f7..00f8794dc3 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.HiveMind npc.lifeMax = 150; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 13000; + npc.lifeMax = 1300; } npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index a98ad39595..9b317a00d1 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.HiveMind npc.width = 150; npc.height = 120; npc.defense = 10; - npc.LifeMaxNERB(1200, 1800, 350000); + npc.LifeMaxNERB(1200, 1800, 35000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 8d45da909f..9ce3f2f962 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.HiveMind npc.width = 177; npc.height = 142; npc.defense = 5; - npc.LifeMaxNERB(5800, 7560, 3000000); + npc.LifeMaxNERB(5800, 7560, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index e5e2ba6e5d..b706b04af9 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Leviathan npc.lifeMax = 1600; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.knockBackResist = 0f; npc.noGravity = true; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index efd333eb20..a0a108be06 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Leviathan npc.height = 450; npc.defense = 40; npc.DR_NERD(0.35f); - npc.LifeMaxNERB(55200, 72560, 6000000); + npc.LifeMaxNERB(55200, 72560, 600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index fa9d7bb70a..ed5662c6a6 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Leviathan npc.lifeMax = 650; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.knockBackResist = 0f; npc.HitSound = SoundID.NPCHit1; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index b4d0b63279..49d0514046 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Leviathan npc.height = 100; npc.defense = 20; npc.DR_NERD(0.2f); - npc.LifeMaxNERB(27400, 41600, 2600000); + npc.LifeMaxNERB(27400, 41600, 260000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index caf70c5158..884ec78418 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Leviathan npc.lifeMax = 650; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + npc.lifeMax = 1000; } npc.alpha = 255; npc.HitSound = SoundID.NPCHit5; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 907b26f985..b417aae330 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.Abyss; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -8,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.NormalNPCs { public class Eidolist : ModNPC @@ -55,7 +57,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.4f, 0.5f); - if (npc.justHit) + if (npc.justHit || NPC.AnyNPCs(ModContent.NPCType())) { hasBeenHit = true; } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 920d219989..f64d4e9fb2 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.OldDuke npc.GetNPCDamage(); npc.defense = 90; npc.DR_NERD(0.5f, null, null, null, true); - npc.LifeMaxNERB(412500, 495000, 4000000); + npc.LifeMaxNERB(412500, 495000, 400000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 2e5a0ec6cc..48dd29b190 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.OldDuke npc.lifeMax = 6000; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index e9e3c84701..82f0f46799 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.OldDuke npc.lifeMax = 3750; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 75000; + npc.lifeMax = 7500; } npc.alpha = 255; npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 4f58dd4496..c4c1ba793d 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 60; npc.height = 60; npc.defense = 8; - npc.LifeMaxNERB(2500, 2700, 800000); + npc.LifeMaxNERB(2500, 2700, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 5bc4bb82ce..e30a2177d4 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 40; npc.height = 40; npc.defense = 6; - npc.LifeMaxNERB(160, 180, 70000); + npc.LifeMaxNERB(160, 180, 7000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index f8ee8a69da..b38d262a4d 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 42; npc.height = 42; npc.defense = 4; - npc.LifeMaxNERB(1250, 1500, 500000); + npc.LifeMaxNERB(1250, 1500, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index b733129d6c..e2543f48c9 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 70; npc.height = 84; npc.defense = 4; - npc.LifeMaxNERB(2500, 2700, 800000); + npc.LifeMaxNERB(2500, 2700, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index dd41884c5b..f2f7de7253 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 58; npc.height = 68; npc.defense = 2; - npc.LifeMaxNERB(160, 180, 70000); + npc.LifeMaxNERB(160, 180, 7000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index b967ee24a1..ba3afcccc3 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Perforator npc.npcSlots = 5f; npc.width = 42; npc.height = 62; - npc.LifeMaxNERB(1250, 1500, 500000); + npc.LifeMaxNERB(1250, 1500, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 000a1f2b15..d8801d404b 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 110; npc.height = 100; npc.defense = 4; - npc.LifeMaxNERB(3750, 5400, 2700000); + npc.LifeMaxNERB(3750, 5400, 270000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -84,11 +84,11 @@ namespace CalamityMod.NPCs.Perforator // Variables for ichor spore phase float sporePhaseGateValue = 600f; - bool floatAboveToFireSpores = npc.ai[2] >= sporePhaseGateValue - 120f; + bool floatAboveToFireBlobs = npc.ai[2] >= sporePhaseGateValue - 120f; - // Don't deal damage for 3 seconds after spawning or while firing spores + // Don't deal damage for 3 seconds after spawning or while firing blobs npc.damage = npc.defDamage; - if (npc.ai[1] < 180f || floatAboveToFireSpores) + if (npc.ai[1] < 180f || floatAboveToFireBlobs) { if (npc.ai[1] < 180f) npc.ai[1] += 1f; @@ -196,10 +196,10 @@ namespace CalamityMod.NPCs.Perforator npc.rotation = npc.velocity.X * 0.04f; - // Emit ichor spores + // Emit ichor blobs if (phase2) { - if (wormsAlive == 0 || malice || floatAboveToFireSpores) + if (wormsAlive == 0 || malice || floatAboveToFireBlobs) { npc.ai[2] += 1f; if (npc.ai[2] >= sporePhaseGateValue) @@ -207,7 +207,7 @@ namespace CalamityMod.NPCs.Perforator if (npc.ai[2] < sporePhaseGateValue + 300f) { if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.95f; + npc.velocity *= 0.96f; else npc.ai[2] = sporePhaseGateValue + 300f; } @@ -230,24 +230,24 @@ namespace CalamityMod.NPCs.Perforator } } - int numSpores = expertMode ? 14 : 7; - int type = ModContent.ProjectileType(); + int numBlobs = expertMode ? 6 : 3; + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < numSpores; i++) + for (int i = 0; i < numBlobs; i++) { - Vector2 sporeVelocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - sporeVelocity.Normalize(); - sporeVelocity *= Main.rand.Next(200, 401) * 0.01f; + Vector2 blobVelocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + blobVelocity.Normalize(); + blobVelocity *= Main.rand.Next(200, 401) * (malice ? 0.02f : 0.01f); - float sporeVelocityYAdd = Math.Abs(sporeVelocity.Y) * 0.5f; - if (sporeVelocity.Y < 2f) - sporeVelocity.Y = 2f + sporeVelocityYAdd; + float sporeVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.5f; + if (blobVelocity.Y < 2f) + blobVelocity.Y = 2f + sporeVelocityYAdd; if (BossRushEvent.BossRushActive) - sporeVelocity *= 2f; + blobVelocity *= 2f; - Projectile.NewProjectile(npc.Center, sporeVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.Center, blobVelocity, type, damage, 0f, Main.myPlayer); } } @@ -260,8 +260,8 @@ namespace CalamityMod.NPCs.Perforator float velocityXEnrageIncrease = 1.5f * enrageScale; float velocityYEnrageIncrease = 0.5f * enrageScale; - // When firing spores, float above the target and don't call any other projectile firing or movement code - if (floatAboveToFireSpores) + // When firing blobs, float above the target and don't call any other projectile firing or movement code + if (floatAboveToFireBlobs) { if (revenge) { diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index e12c2e747f..57d0f734ea 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 60; npc.height = 78; npc.defense = 12; - npc.LifeMaxNERB(2500, 2700, 800000); + npc.LifeMaxNERB(2500, 2700, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 7b2ab1f0eb..244853f4b2 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 40; npc.height = 50; npc.defense = 10; - npc.LifeMaxNERB(160, 180, 70000); + npc.LifeMaxNERB(160, 180, 7000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index bad7643bbf..87edea613e 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Perforator npc.width = 40; npc.height = 34; npc.defense = 8; - npc.LifeMaxNERB(1250, 1500, 500000); + npc.LifeMaxNERB(1250, 1500, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index 52a8deeb4f..9edc45c817 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.lifeMax = 300; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index f1ad7bc792..3ce4eacc7e 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.lifeMax = 400; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index f83e9fe159..3cdd2cff0f 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = 22; npc.height = 22; npc.defense = 10; - npc.lifeMax = BossRushEvent.BossRushActive ? 30000 : 300; + npc.lifeMax = BossRushEvent.BossRushActive ? 3000 : 300; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index a75c62059a..4188edf12d 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = 42; npc.height = 42; npc.defense = 10; - npc.lifeMax = BossRushEvent.BossRushActive ? 30000 : 300; + npc.lifeMax = BossRushEvent.BossRushActive ? 3000 : 300; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 1358b5818e..087ca5850e 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.height = 198; npc.defense = 40; npc.DR_NERD(0.3f); - npc.LifeMaxNERB(81000, 106500, 3700000); + npc.LifeMaxNERB(81000, 106500, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index c5a280a9b2..796e00a9e8 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.value = Item.buyPrice(0, 1, 50, 0); if (BossRushEvent.BossRushActive) { - npc.lifeMax = 200000; + npc.lifeMax = 20000; } npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 0efa789d2c..0d7ea35c9c 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Polterghast npc.DR_NERD(0.2f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(350000, 420000, 3250000); + npc.LifeMaxNERB(350000, 420000, 325000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index a180c24218..a973b11061 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.height = 80; npc.defense = 40; npc.DR_NERD(0.3f); - npc.LifeMaxNERB(76875, 84375, 1650000); // Old HP - 102500, 112500 + npc.LifeMaxNERB(76875, 84375, 165000); // Old HP - 102500, 112500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index 01670e6bb8..30fdbae60e 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.height = 80; npc.defense = 50; npc.DR_NERD(0.4f); - npc.LifeMaxNERB(30000, 37500, 300000); // Old HP - 40000, 50000 + npc.LifeMaxNERB(30000, 37500, 30000); // Old HP - 40000, 50000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 17d79f2198..14c05b1eb5 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.height = 80; npc.defense = 30; npc.DR_NERD(0.2f); - npc.LifeMaxNERB(18750, 26250, 200000); // Old HP - 25000, 35000 + npc.LifeMaxNERB(18750, 26250, 20000); // Old HP - 25000, 35000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 69f6eef03a..1bb61cae78 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Providence npc.lifeMax = 18750; // Old HP - 25000 if (BossRushEvent.BossRushActive) { - npc.lifeMax = 300000; + npc.lifeMax = 30000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 9f43a3e1a1..411f7d0e2f 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Providence npc.lifeMax = 30000; // Old HP - 40000 if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 7968872e6a..73c8e224e0 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Providence npc.lifeMax = 31875; // Old HP - 42500 if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 5871d7faa6..f500a7d92a 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.Providence npc.DR_NERD(normalDR, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); - npc.LifeMaxNERB(330000, 375000, 12500000); // Old HP - 440000, 500000 + npc.LifeMaxNERB(330000, 375000, 1250000); // Old HP - 440000, 500000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index ff2fb5e549..ccd9cbb191 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Ravager npc.defense = 55; npc.value = Item.buyPrice(0, 25, 0, 0); npc.DR_NERD(0.35f); - npc.LifeMaxNERB(42700, 53500, 4600000); + npc.LifeMaxNERB(42700, 53500, 460000); if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage = (int)(npc.damage * 1.5); diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 9e8d5770c0..d4c3d24779 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.Ravager } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 260000; + npc.lifeMax = 26000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 82f1800919..3bf550f5ee 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.Ravager } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 260000; + npc.lifeMax = 26000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 02a1fe8dcb..4854526a29 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Ravager } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 450000; + npc.lifeMax = 45000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 501459b908..5c5d72006b 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Ravager } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index cd84a025c3..0df7ac0e1b 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Ravager } if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 008cfe156a..fe4d791bc1 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Signus npc.defense = 60; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; - npc.LifeMaxNERB(notDoGFight ? 224000 : 56000, notDoGFight ? 356400 : 87600, 2400000); + npc.LifeMaxNERB(notDoGFight ? 224000 : 56000, notDoGFight ? 356400 : 87600, 240000); // If fought alone, Signus plays his own theme if (notDoGFight) diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 0d1b8b3096..c1aa36059a 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.height = 92; npc.scale = 1.1f; npc.defense = 10; - npc.LifeMaxNERB(4650, 6400, 2200000); + npc.LifeMaxNERB(4650, 6400, 220000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 32e4e716fb..3f06c947c4 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.width = 44; npc.height = 44; npc.defense = 6; - npc.LifeMaxNERB(2000, 2500, 2500000); + npc.LifeMaxNERB(2000, 2500, 250000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); NPCID.Sets.TrailCacheLength[npc.type] = 8; @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.SlimeGod aiType = -1; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 8, 0, 0); - npc.alpha = 55; + npc.Opacity = 0.8f; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; @@ -265,8 +265,9 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity = Vector2.Zero; - if (npc.alpha < 255) - npc.alpha += 5; + npc.Opacity -= 0.2f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; } bool slimeDead = false; @@ -306,8 +307,9 @@ namespace CalamityMod.NPCs.SlimeGod return; } - if (npc.alpha > 55) - npc.alpha -= 5; + npc.Opacity += 0.2f; + if (npc.Opacity > 0.8f) + npc.Opacity = 0.8f; buffedSlime = 0; } @@ -326,10 +328,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.rotation = npc.velocity.X * 0.1f; // Set teleport location, turn invisible, spin direction - npc.alpha += 20; - if (npc.alpha >= 255) + npc.Opacity -= 0.2f; + if (npc.Opacity <= 0f) { - npc.alpha = 255; + npc.Opacity = 0f; npc.velocity.Normalize(); int teleportX = player.velocity.X < 0f ? -20 : 20; @@ -349,17 +351,17 @@ namespace CalamityMod.NPCs.SlimeGod npc.rotation = npc.velocity.X * 0.1f; // Teleport to location - if (npc.alpha == 255) + if (npc.Opacity == 0f) { Vector2 position = new Vector2(npc.ai[2] * 16f - (npc.width / 2), npc.ai[3] * 16f - (npc.height / 2)); npc.position = position; } // Turn visible - npc.alpha -= 20; - if (npc.alpha < 55) + npc.Opacity += 0.2f; + if (npc.Opacity >= 0.8f) { - npc.alpha = 55; + npc.Opacity = 0.8f; npc.localAI[0] = vectorCenter.X - player.Center.X < 0 ? 1f : -1f; npc.localAI[1] = 2f; } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index a1ca39f66d..4941e55751 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.height = 92; npc.scale = 1.1f; npc.defense = 12; - npc.LifeMaxNERB(4150, 5700, 1600000); + npc.LifeMaxNERB(4150, 5700, 160000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 0a0334067b..1bef8fec7e 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { npc.Calamity().canBreakPlayerDefense = true; - npc.LifeMaxNERB(875, 1205, 800000); + npc.LifeMaxNERB(875, 1205, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.GetNPCDamage(); diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index a1f673ecd6..518e515d68 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { npc.Calamity().canBreakPlayerDefense = true; - npc.LifeMaxNERB(1350, 1800, 1100000); + npc.LifeMaxNERB(1350, 1800, 110000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.GetNPCDamage(); diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index f16310e06a..05d17e19c8 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 180; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.knockBackResist = 0f; animationType = 121; diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index 89b4f74a41..a8a73973e2 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 90; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index 6a7aeefb17..b65ef0b378 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 110; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index ada5e1b3a5..e872db3e4e 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 130; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 120000; + npc.lifeMax = 12000; } npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0bfdd14d05..d5524a821d 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.StormWeaver global.DR = 0.999999f; global.unbreakableDR = true; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 170000); + npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 17000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index f2328851e1..8e8733d12b 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.height = 40; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.lifeMax = notDoGFight ? 760500 : 126750; - npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 4550000); + npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 455000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 5f5689cbf6..390a1833b9 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.StormWeaver global.DR = 0.999999f; global.unbreakableDR = true; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 170000); + npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 17000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 6f3016351c..0803a04291 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; @@ -48,7 +49,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.height = 74; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.lifeMax = notDoGFight ? 760500 : 126750; - npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 4550000); + npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 455000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) @@ -370,7 +371,7 @@ namespace CalamityMod.NPCs.StormWeaver Vector2 soundCenter = Main.player[npc.target].Center; // Play lightning sound on all nearby players if in phase 3 - if (phase3 && Main.netMode != NetmodeID.Server) + if (phase3) { if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) { @@ -378,11 +379,14 @@ namespace CalamityMod.NPCs.StormWeaver Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)soundCenter.X, (int)soundCenter.Y); - // Set how quickly the lightning flash dissipates - lightningDecay = Main.rand.NextFloat() * 0.05f + 0.008f; + if (Main.netMode != NetmodeID.Server) + { + // Set how quickly the lightning flash dissipates + lightningDecay = Main.rand.NextFloat() * 0.05f + 0.008f; - // Set how quickly the lightning flash intensifies - lightningSpeed = Main.rand.NextFloat() * 0.05f + 0.05f; + // Set how quickly the lightning flash intensifies + lightningSpeed = Main.rand.NextFloat() * 0.05f + 0.05f; + } } } else @@ -543,10 +547,11 @@ namespace CalamityMod.NPCs.StormWeaver } // Start a storm when in third phase - if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu)) + if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu) || calamityGlobalNPC.newAI[1] > 0f) return; CalamityUtils.StartRain(true, true); + calamityGlobalNPC.newAI[1] = 1f; } } @@ -702,7 +707,10 @@ namespace CalamityMod.NPCs.StormWeaver // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) + + // Light pet. + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + if (Main.rand.NextBool(20)) { DropHelper.DropItem(npc, ModContent.ItemType()); DropHelper.DropItem(npc, ModContent.ItemType()); diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 0bb0798c71..d12af0f5b2 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.defense = 0; npc.takenDamageMultiplier = 3f; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 170000); + npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 17000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 6f674df02b..d1de56d76c 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.height = 80; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.lifeMax = notDoGFight ? 760500 : 126750; - npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 4550000); + npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 455000); // If fought alone, Storm Weaver plays its own theme if (notDoGFight) diff --git a/NPCs/SupremeCalamitas/HoodedHeadIcon.png b/NPCs/SupremeCalamitas/HoodedHeadIcon.png new file mode 100644 index 0000000000..9fa8485791 Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodedHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodedHeadIconP2.png b/NPCs/SupremeCalamitas/HoodedHeadIconP2.png new file mode 100644 index 0000000000..b58cdcfaad Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodedHeadIconP2.png differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png new file mode 100644 index 0000000000..6c12e09c8e Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png b/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png new file mode 100644 index 0000000000..dc1377a577 Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png differ diff --git a/NPCs/SupremeCalamitas/SCalSky.cs b/NPCs/SupremeCalamitas/SCalSky.cs index 4b8ec5cb18..bf4233d713 100644 --- a/NPCs/SupremeCalamitas/SCalSky.cs +++ b/NPCs/SupremeCalamitas/SCalSky.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool isActive = false; private float intensity = 0f; private int SCalIndex = -1; + public static float OverridingIntensity = 0f; public override void Update(GameTime gameTime) { @@ -26,6 +28,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas private float GetIntensity() { + if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) + return OverridingIntensity; + + OverridingIntensity = 0f; if (this.UpdateSCalIndex()) { float x = 0f; diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs index b3c5cd68d5..28b113b94a 100644 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -1,4 +1,8 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,6 +11,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormHeart : ModNPC { + public PrimitiveTrail ChainDrawer = null; + public int ChainHeartIndex => (int)npc.ai[0]; + public List ChainEndpoints = new List(); public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Heart"); @@ -18,7 +25,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 24; npc.height = 24; npc.defense = 0; - npc.LifeMaxNERB(25600, 29440); + npc.LifeMaxNERB(25600, 29440, 10000); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -26,6 +33,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; + npc.hide = true; npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath1; } @@ -44,6 +52,71 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.alpha = 0; } + public float PrimitiveWidthFunction(float completionRatio) + { + float widthInterpolant = Utils.InverseLerp(0f, 0.16f, completionRatio, true) * Utils.InverseLerp(1f, 0.84f, completionRatio, true); + widthInterpolant = (float)Math.Pow(widthInterpolant, 8D); + float baseWidth = MathHelper.Lerp(4f, 1f, widthInterpolant); + float pulseWidth = MathHelper.Lerp(0f, 3.2f, (float)Math.Pow(Math.Sin(Main.GlobalTime * 4.4f + npc.whoAmI * 1.3f + completionRatio), 16D)); + return baseWidth + pulseWidth; + } + + public Color PrimitiveColorFunction(float completionRatio) + { + float colorInterpolant = MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0f, 0.34f, completionRatio, true) * Utils.InverseLerp(1.07f, 0.66f, completionRatio, true)); + return Color.Lerp(Color.DarkRed * 0.7f, Color.Red, colorInterpolant) * 0.425f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (ChainDrawer is null) + ChainDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction); + for (int i = 0; i < ChainEndpoints.Count; i++) + { + List points = new List() + { + npc.Center, + ChainEndpoints[i] + npc.DirectionTo(ChainEndpoints[i]) * 25f + }; + ChainDrawer.Draw(points, -Main.screenPosition, 40); + } + + return true; + } + + public void TendrilDestructionEffects(int tendrilIndex) + { + for (int i = 0; i < 70; i++) + { + Vector2 dustSpawnPosition = Vector2.Lerp(npc.Center, ChainEndpoints[tendrilIndex], i / 70f); + Dust blood = Dust.NewDustDirect(dustSpawnPosition, 4, 4, DustID.Blood); + blood.velocity = Main.rand.NextVector2Circular(3f, 3f); + blood.scale = Main.rand.NextFloat(1f, 1.4f); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int i = 0; i < ChainEndpoints.Count; i++) + TendrilDestructionEffects(i); + } + } + + public override void DrawBehind(int index) + { + Main.instance.DrawCacheNPCsBehindNonSolidTiles.Add(index); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.66); + } + } + public override bool CheckActive() { return false; diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 540c255fbf..c8b45321bd 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.damage = 0; npc.defense = 60; npc.DR_NERD(0.25f); - npc.LifeMaxNERB(Main.expertMode ? 24000 : 15000, 28000); + npc.LifeMaxNERB(Main.expertMode ? 24000 : 15000, 2800); npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index af2aa073b9..a34f9404cc 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; -using CalamityMod.Items.Accessories; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; @@ -14,21 +13,36 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { - [AutoloadBossHead] public class SupremeCalamitas : ModNPC { + internal enum FrameAnimationType + { + // The numbering of these values correspond to a frame on the sprite. If this enumeration or the sprite itself + // is updated, these numbers will need to be too. + UpwardDraft = 0, + FasterUpwardDraft = 1, + Casting = 2, + BlastCast = 3, + BlastPunchCast = 4, + OutwardHandCast = 5, + PunchHandCast = 6, + Count = 7 + } + private float bossLife; private float uDieLul = 1f; private float passedVar = 0f; @@ -38,6 +52,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool despawnProj = false; private bool startText = false; private bool startBattle = false; //100% + private bool hasSummonedSepulcher1 = false; //100% private bool startSecondAttack = false; //80% private bool startThirdAttack = false; //60% private bool halfLife = false; //40% @@ -45,6 +60,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool secondStage = false; //20% private bool startFifthAttack = false; //10% private bool gettingTired = false; //8% + private bool hasSummonedSepulcher2 = false; //8% private bool gettingTired2 = false; //6% private bool gettingTired3 = false; //4% private bool gettingTired4 = false; //2% @@ -52,6 +68,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool willCharge = false; private bool canFireSplitingFireball = true; private bool spawnArena = false; + private bool enteredBrothersPhase = false; + private bool hasSummonedBrothers = false; private int giveUpCounter = 1200; private int lootTimer = 0; //900 * 5 = 4500 @@ -66,16 +84,92 @@ namespace CalamityMod.NPCs.SupremeCalamitas private int spawnYAdd = 0; private int bulletHellCounter = 0; private int bulletHellCounter2 = 0; + private int attackCastDelay = 0; + private int hitTimer = 0; + private float shieldOpacity = 1f; + private float shieldRotation = 0f; + private float forcefieldOpacity = 1f; + private float forcefieldScale = 1; + private FrameAnimationType FrameType + { + get => (FrameAnimationType)(int)npc.localAI[2]; + set => npc.localAI[2] = (int)value; + } + private bool AttackCloseToBeingOver + { + get + { + int attackLength = 0; + + // First phase. + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + attackLength = 300; + if (npc.ai[1] == 2f) + attackLength = 70; + if (npc.ai[1] == 3f) + attackLength = 480; + if (npc.ai[1] == 4f) + attackLength = 300; + } + else + { + if (npc.ai[1] == 0f) + attackLength = 240; + if (npc.ai[1] == 2f) + attackLength = 70; + if (npc.ai[1] == 3f) + attackLength = 300; + if (npc.ai[1] == 4f) + attackLength = 240; + } + return npc.ai[2] >= attackLength - 30f; + } + } + private ref float FrameChangeSpeed => ref npc.localAI[3]; + + private Vector2 cataclysmSpawnPosition; + private Vector2 catastropheSpawnPosition; + private Vector2 initialRitualPosition; private Rectangle safeBox = default; + public static int hoodedHeadIconIndex; + public static int hoodedHeadIconP2Index; + public static int hoodlessHeadIconIndex; + public static int hoodlessHeadIconP2Index; public static float normalDR = 0.25f; public static float enragedDR = 0.99f; + private static readonly Color textColor = Color.Orange; + private const int sepulcherSpawnCastTime = 75; + private const int brothersSpawnCastTime = 150; + + // TODO: This is cumbersome. Change it to be better in 1.4. + internal static void LoadHeadIcons() + { + string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; + string hoodedIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIconP2"; + string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; + string hoodlessIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIconP2"; + CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); + hoodedHeadIconIndex = ModContent.GetModBossHeadSlot(hoodedIconPath); + + CalamityMod.Instance.AddBossHeadTexture(hoodedIconP2Path, -1); + hoodedHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodedIconP2Path); + + CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); + hoodlessHeadIconIndex = ModContent.GetModBossHeadSlot(hoodlessIconPath); + + CalamityMod.Instance.AddBossHeadTexture(hoodlessIconP2Path, -1); + hoodlessHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodlessIconP2Path); + } + public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[npc.type] = 21; NPCID.Sets.TrailingMode[npc.type] = 1; } @@ -84,14 +178,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.Calamity().canBreakPlayerDefense = true; npc.GetNPCDamage(); npc.npcSlots = 50f; - npc.width = 120; - npc.height = 120; + npc.width = npc.height = 44; npc.defense = 100; npc.DR_NERD(normalDR, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); npc.value = Item.buyPrice(10, 0, 0, 0); - npc.LifeMaxNERB(1000000, 1150000); + npc.LifeMaxNERB(1000000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -103,8 +196,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.canGhostHeal = false; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - music = CalamityMod.Instance.GetMusicFromMusicMod("SCG") ?? MusicID.Boss2; + npc.HitSound = SoundID.NPCHit1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SCG") ?? MusicID.Boss2; + } + + public override void BossHeadSlot(ref int index) + { + bool inPhase2 = npc.ai[0] == 3f; + if (!CalamityWorld.downedSCal) + index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; + else + index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; } public override void SendExtraAI(BinaryWriter writer) @@ -114,12 +216,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(despawnProj); writer.Write(startText); writer.Write(startBattle); + writer.Write(hasSummonedSepulcher1); writer.Write(startSecondAttack); writer.Write(startThirdAttack); writer.Write(startFourthAttack); writer.Write(startFifthAttack); writer.Write(halfLife); writer.Write(secondStage); + writer.Write(hasSummonedSepulcher2); writer.Write(gettingTired); writer.Write(gettingTired2); writer.Write(gettingTired3); @@ -128,6 +232,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(willCharge); writer.Write(canFireSplitingFireball); writer.Write(spawnArena); + writer.Write(hasSummonedBrothers); + writer.Write(enteredBrothersPhase); writer.Write(npc.dontTakeDamage); writer.Write(npc.chaseable); @@ -144,6 +250,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(spawnYAdd); writer.Write(bulletHellCounter); writer.Write(bulletHellCounter2); + writer.Write(hitTimer); + writer.Write(attackCastDelay); + + writer.Write(shieldRotation); } public override void ReceiveExtraAI(BinaryReader reader) @@ -153,12 +263,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas despawnProj = reader.ReadBoolean(); startText = reader.ReadBoolean(); startBattle = reader.ReadBoolean(); + hasSummonedSepulcher1 = reader.ReadBoolean(); startSecondAttack = reader.ReadBoolean(); startThirdAttack = reader.ReadBoolean(); startFourthAttack = reader.ReadBoolean(); startFifthAttack = reader.ReadBoolean(); halfLife = reader.ReadBoolean(); secondStage = reader.ReadBoolean(); + hasSummonedSepulcher2 = reader.ReadBoolean(); gettingTired = reader.ReadBoolean(); gettingTired2 = reader.ReadBoolean(); gettingTired3 = reader.ReadBoolean(); @@ -167,6 +279,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas willCharge = reader.ReadBoolean(); canFireSplitingFireball = reader.ReadBoolean(); spawnArena = reader.ReadBoolean(); + hasSummonedBrothers = reader.ReadBoolean(); + enteredBrothersPhase = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); @@ -183,11 +297,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnYAdd = reader.ReadInt32(); bulletHellCounter = reader.ReadInt32(); bulletHellCounter2 = reader.ReadInt32(); + hitTimer = reader.ReadInt32(); + attackCastDelay = reader.ReadInt32(); + + shieldRotation = reader.ReadSingle(); } public override void AI() { + #region Resets + + // Use an ordinary upward draft by default. + FrameType = FrameAnimationType.UpwardDraft; + FrameChangeSpeed = 0.15f; + #endregion #region StartUp + CalamityGlobalNPC.SCal = npc.whoAmI; lootTimer++; @@ -233,8 +358,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas int monsterDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); int waveDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); int hellblastDamage = npc.GetProjectileDamage(ModContent.ProjectileType()); + int bodyWidth = 44; + int bodyHeight = 42; - Vector2 vectorCenter = npc.Center; + Vector2 vectorCenter = npc.Center; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -248,62 +375,96 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startText) { - if (Main.LocalPlayer.Calamity().sCalKillCount == 4) - { - string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else if (Main.LocalPlayer.Calamity().sCalKillCount == 1) - { - string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - - if (Main.LocalPlayer.Calamity().sCalDeathCount < 51) - { - if (Main.LocalPlayer.Calamity().sCalDeathCount == 50) - { - string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else if (Main.LocalPlayer.Calamity().sCalDeathCount > 19) - { - string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - else if (Main.LocalPlayer.Calamity().sCalDeathCount > 4) - { - string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - } + string key = "Mods.CalamityMod.SCalSummonText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); startText = true; } + #endregion + #region Directioning + + bool currentlyCharging = npc.ai[1] == 2f; + if (!currentlyCharging && Math.Abs(player.Center.X - npc.Center.X) > 16f) + npc.spriteDirection = (player.Center.X < npc.Center.X).ToDirectionInt(); + #endregion + #region Forcefield and Shield Logic + + if (hitTimer > 0) + hitTimer--; + + Vector2 hitboxSize = new Vector2(forcefieldScale * 216f / 1.4142f); + hitboxSize = Vector2.Max(hitboxSize, new Vector2(42, 44)); + if (npc.Size != hitboxSize) + npc.Size = hitboxSize; + + // Make the shield and forcefield fade away in her acceptance phase. + if (npc.life <= npc.lifeMax * 0.01) + { + shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); + forcefieldScale = MathHelper.Lerp(forcefieldScale, 0f, 0.08f); + } + + // Summon a shield if the next attack will be a charge. + else if (!npc.dontTakeDamage && ((willCharge && AttackCloseToBeingOver) || npc.ai[1] == 2f)) + { + if (npc.ai[1] != 2f) + { + float idealRotation = npc.AngleTo(player.Center); + float angularOffset = Math.Abs(MathHelper.WrapAngle(shieldRotation - idealRotation)); + + if (angularOffset > 0.04f) + { + shieldRotation = shieldRotation.AngleLerp(idealRotation, 0.125f); + shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); + } + } + else + { + // Emit dust off the skull at the position of its eye socket. + for (float num6 = 1f; num6 < 16f; num6 += 1f) + { + Dust dust = Dust.NewDustPerfect(npc.Center, 182); + dust.position = Vector2.Lerp(npc.position, npc.oldPosition, num6 / 16f) + npc.Size * 0.5f; + dust.position += shieldRotation.ToRotationVector2() * 42f; + dust.position += (shieldRotation - MathHelper.PiOver2).ToRotationVector2() * (float)Math.Cos(npc.velocity.ToRotation()) * -4f; + dust.noGravity = true; + dust.velocity = npc.velocity; + dust.color = Color.Red; + dust.scale = MathHelper.Lerp(0.6f, 0.85f, 1f - num6 / 16f); + } + } + + // Shrink the force-field since it looks strange when charging. + forcefieldScale = MathHelper.Lerp(forcefieldScale, 0.45f, 0.08f); + shieldOpacity = MathHelper.Lerp(shieldOpacity, 1f, 0.08f); + } + // Make the shield disappear if it is no longer relevant and regenerate the forcefield. + else + { + shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); + forcefieldScale = MathHelper.Lerp(forcefieldScale, 1f, 0.08f); + } + #endregion #region ArenaCreation if (!spawnArena) { spawnArena = true; - Vector2 vectorPlayer = new Vector2(player.position.X, player.position.Y); if (death) { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1000f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1000f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1000f); + safeBox.X = spawnX = spawnXReset = (int)(npc.Center.X - 1000f); + spawnX2 = spawnXReset2 = (int)(npc.Center.X + 1000f); + safeBox.Y = spawnY = spawnYReset = (int)(npc.Center.Y - 1000f); safeBox.Width = 2000; safeBox.Height = 2000; spawnYAdd = 100; } else { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1250f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1250f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1250f); + safeBox.X = spawnX = spawnXReset = (int)(npc.Center.X - 1250f); + spawnX2 = spawnXReset2 = (int)(npc.Center.X + 1250f); + safeBox.Y = spawnY = spawnYReset = (int)(npc.Center.Y - 1250f); safeBox.Width = 2500; safeBox.Height = 2500; spawnYAdd = 125; @@ -317,6 +478,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) { + if (!WorldGen.InWorld(num55, num56, 2)) + continue; + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) { Main.tile[num55, num56].type = (ushort)ModContent.TileType(); @@ -332,6 +496,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + + if (initialRitualPosition == Vector2.Zero) + { + initialRitualPosition = npc.Center + Vector2.UnitY * 24f; + npc.netUpdate = true; + } } } #endregion @@ -381,29 +551,76 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.TargetClosest(false); player = Main.player[npc.target]; + + // Slow down and disappear in a burst of fire if should despawn. if (!player.active || player.dead) { canDespawn = true; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; + npc.Opacity = MathHelper.Lerp(npc.Opacity, 0f, 0.065f); + npc.velocity = Vector2.Lerp(Vector2.UnitY * -4f, Vector2.Zero, (float)Math.Sin(MathHelper.Pi * npc.Opacity)); + forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, npc.Opacity, true); + if (npc.alpha >= 230) + { + // TODO: Spawn the town NPC variant of SCal here when it's on the public branch. + npc.active = false; + npc.netUpdate = true; + } - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; + for (int i = 0; i < MathHelper.Lerp(2f, 6f, 1f - npc.Opacity); i++) + { + Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); + brimstoneFire.color = Color.Red; + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); + brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); + brimstoneFire.noGravity = true; + } } } else canDespawn = false; - #endregion - #region FirstAttack - if (bulletHellCounter2 < 900) + #endregion + #region Cast Charge Countdown + if (attackCastDelay > 0) + { + attackCastDelay--; + npc.velocity *= 0.94f; + npc.dontTakeDamage = true; + + // Make a magic effect over time. + for (int i = 0; i < (attackCastDelay == 0 ? 16 : 1); i++) + { + Vector2 dustSpawnPosition = npc.Bottom; + float horizontalSpawnOffset = bodyWidth * Main.rand.NextFloat(0.42f, 0.5f); + if (Main.rand.NextBool(2)) + horizontalSpawnOffset *= -1f; + dustSpawnPosition.X += horizontalSpawnOffset; + + Dust magic = Dust.NewDustPerfect(dustSpawnPosition, 267); + magic.color = Color.Lerp(Color.Red, Color.Orange, Main.rand.NextFloat(0.8f)); + magic.noGravity = true; + magic.velocity = Vector2.UnitY * -Main.rand.NextFloat(5f, 9f); + magic.scale = 1f + npc.velocity.Y * 0.35f; + } + + if ((startBattle && !hasSummonedSepulcher1) || (gettingTired && !hasSummonedSepulcher2)) + DoHeartsSpawningCastAnimation(player, death); + + if (enteredBrothersPhase && !hasSummonedBrothers) + DoBrothersSpawningCastAnimation(bodyWidth, bodyHeight); + + if (attackCastDelay == 0) + { + npc.dontTakeDamage = false; + npc.netUpdate = true; + } + + FrameType = FrameAnimationType.Casting; + return; + } + #endregion + #region FirstAttack + if (bulletHellCounter2 < 900) { despawnProj = true; bulletHellCounter2 += 1; @@ -414,10 +631,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { bulletHellCounter += 1; @@ -447,34 +660,33 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + FrameType = FrameAnimationType.Casting; return; } else if (!startBattle) { - string key = "Mods.CalamityMod.SupremeBossText3"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - if (Main.netMode != NetmodeID.MultiplayerClient) + attackCastDelay = sepulcherSpawnCastTime; + for (int i = 0; i < 40; i++) { - spawnY += 250; - if (death) - { - spawnY -= 50; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); + castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); + castFire.fadeIn = 1.25f; + castFire.noGravity = true; } + + npc.Center = safeBox.TopRight() + new Vector2(-120f, 620f); + + for (int i = 0; i < 40; i++) + { + Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); + castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); + castFire.fadeIn = 1.25f; + castFire.noGravity = true; + } + + Main.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); startBattle = true; } #endregion @@ -490,10 +702,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { if (bulletHellCounter2 < 1200) @@ -536,13 +744,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + FrameType = FrameAnimationType.Casting; return; } if (!startSecondAttack && (npc.life <= npc.lifeMax * 0.75)) { - string key = "Mods.CalamityMod.SupremeBossText4"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalBH2Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); startSecondAttack = true; return; } @@ -559,10 +769,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { if (bulletHellCounter2 % 180 == 0) // Blasts from top @@ -596,15 +802,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + FrameType = FrameAnimationType.Casting; return; } if (!startThirdAttack && (npc.life <= npc.lifeMax * 0.5)) { - // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. - music = CalamityMod.Instance.GetMusicFromMusicMod("SCL") ?? MusicID.Boss3; - string key = "Mods.CalamityMod.SupremeBossText5"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. + music = CalamityMod.Instance.GetMusicFromMusicMod("SCL") ?? MusicID.Boss3; + string key = "Mods.CalamityMod.SCalBH3Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + if (CalamityWorld.downedSCal) + CalamityUtils.DisplayLocalizedText(key + "2", textColor); startThirdAttack = true; return; } @@ -621,10 +831,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) // More clustered attack { if (bulletHellCounter2 % 180 == 0) // Blasts from top @@ -634,6 +840,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); int divisor = revenge ? 225 : expertMode ? 450 : 675; + + // TODO: Resprite Brimstone Monsters to be something else. if (bulletHellCounter2 % divisor == 0 && expertMode) // Giant homing fireballs { Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f, passedVar); @@ -665,15 +873,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + FrameType = FrameAnimationType.Casting; return; } if (!startFourthAttack && (npc.life <= npc.lifeMax * 0.3)) { // Switch from the Lament section of Stained, Brutal Calamity to the Epiphany section. music = CalamityMod.Instance.GetMusicFromMusicMod("SCE") ?? MusicID.LunarBoss; - string key = "Mods.CalamityMod.SupremeBossText7"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalBH4Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); startFourthAttack = true; return; } @@ -690,10 +900,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { if (bulletHellCounter2 % 240 == 0) // Blasts from top @@ -736,13 +942,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + FrameType = FrameAnimationType.Casting; return; } if (!startFifthAttack && (npc.life <= npc.lifeMax * 0.1)) { - string key = "Mods.CalamityMod.SupremeBossText9"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalBH5Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); startFifthAttack = true; return; } @@ -752,49 +960,59 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (gettingTired5) { - // Switch from the Epiphany section of Stained, Brutal Calamity to the Acceptance section. - music = CalamityMod.Instance.GetMusicFromMusicMod("SCA") ?? MusicID.Eerie; - npc.noGravity = false; + // Switch from the Epiphany section of Stained, Brutal Calamity to the Acceptance section. + music = CalamityMod.Instance.GetMusicFromMusicMod("SCA") ?? MusicID.Eerie; + + if (npc.velocity.Y < 9f) + npc.velocity.Y += 0.185f; npc.noTileCollide = false; + npc.noGravity = false; npc.damage = 0; if (!canDespawn) - npc.velocity.X *= 0.98f; + npc.velocity.X *= 0.96f; - float num = player.Center.X - vectorCenter.X; - float num1 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num1, num) - MathHelper.PiOver2; - - if (CalamityWorld.downedSCal) //after first time you kill her + if (CalamityWorld.downedSCal) { - if (giveUpCounter == 900) + // TODO: Spawn the town NPC variant of SCal again here. + if (giveUpCounter == 720) { - string key = "Mods.CalamityMod.SupremeBossText27"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + for (int i = 0; i < 24; i++) + { + Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); + brimstoneFire.color = Color.Red; + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); + brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); + brimstoneFire.fadeIn = 1.25f; + brimstoneFire.noGravity = true; + } + + npc.active = false; + npc.netUpdate = true; + NPCLoot(); } - giveUpCounter--; - bool canBeHit = giveUpCounter < 900; - npc.chaseable = canBeHit; - npc.dontTakeDamage = !canBeHit; - return; - } - if (giveUpCounter == 600) - { - string key = "Mods.CalamityMod.SupremeBossText25"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - if (giveUpCounter == 300) - { - string key = "Mods.CalamityMod.SupremeBossText26"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); } + else if (giveUpCounter == 900) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText1", textColor); + else if(giveUpCounter == 600) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText2", textColor); + else if(giveUpCounter == 300) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText3", textColor); if (giveUpCounter <= 0) { - npc.chaseable = true; - npc.dontTakeDamage = false; + for (int i = 0; i < 24; i++) + { + Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); + brimstoneFire.color = Color.Red; + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); + brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); + brimstoneFire.fadeIn = 1.25f; + brimstoneFire.noGravity = true; + } + + npc.active = false; + npc.netUpdate = true; + NPCLoot(); return; } giveUpCounter--; @@ -814,61 +1032,64 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - string key = "Mods.CalamityMod.SupremeBossText24"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalDesparationText4"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); gettingTired5 = true; return; } else if (!gettingTired4 && (npc.life <= npc.lifeMax * 0.02)) { - string key = "Mods.CalamityMod.SupremeBossText23"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalDesparationText3"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); gettingTired4 = true; return; } else if (!gettingTired3 && (npc.life <= npc.lifeMax * 0.04)) { - string key = "Mods.CalamityMod.SupremeBossText22"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalDesparationText2"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); gettingTired3 = true; return; } else if (!gettingTired2 && (npc.life <= npc.lifeMax * 0.06)) { - string key = "Mods.CalamityMod.SupremeBossText21"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalDesparationText1"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); gettingTired2 = true; return; } else if (!gettingTired && (npc.life <= npc.lifeMax * 0.08)) { - string key = "Mods.CalamityMod.SupremeBossText20"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - if (Main.netMode != NetmodeID.MultiplayerClient) + attackCastDelay = sepulcherSpawnCastTime; + for (int i = 0; i < 40; i++) { - spawnY += 250; - if (death) - { - spawnY -= 50; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); + castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); + castFire.fadeIn = 1.25f; + castFire.noGravity = true; } + + npc.Center = safeBox.TopRight() + new Vector2(-120f, 620f); + + for (int i = 0; i < 40; i++) + { + Dust castFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-70f, 70f), (int)CalamityDusts.Brimstone); + castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); + castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); + castFire.fadeIn = 1.25f; + castFire.noGravity = true; + } + + Main.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); gettingTired = true; return; } @@ -904,19 +1125,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region TransformSeekerandBrotherTriggers if (!halfLife && (npc.life <= npc.lifeMax * 0.4)) { - string key = "Mods.CalamityMod.SupremeBossText"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalPhase2Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); halfLife = true; } + // TODO: Resprite the seekers to be something other than eyeballs. if (npc.life <= npc.lifeMax * 0.2) { - if (secondStage == false) + if (!secondStage) { - string key = "Mods.CalamityMod.SupremeBossText8"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + string key = "Mods.CalamityMod.SCalSeekerRingText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(SoundID.Item74, npc.position); @@ -928,6 +1152,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Eye.ai[3] = I * 18; } } + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center); secondStage = true; } } @@ -938,58 +1163,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.life > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.life < npc.lifeMax * 0.45f && !enteredBrothersPhase) { - int num660 = (int)(npc.lifeMax * 0.55); - if ((npc.life + num660) < bossLife) - { - bossLife = npc.life; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); - string key = "Mods.CalamityMod.SupremeBossText6"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } + enteredBrothersPhase = true; + attackCastDelay = brothersSpawnCastTime; + npc.netUpdate = true; } } - #endregion - #region TargetandRotation - float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float num802 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; - - if (num803 < 0f) - num803 += MathHelper.TwoPi; - else if (num803 > MathHelper.TwoPi) - num803 -= MathHelper.TwoPi; - - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((num803 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num804; - else - npc.rotation += num804; - } - else if (npc.rotation > num803) - { - if ((npc.rotation - num803) > MathHelper.Pi) - npc.rotation += num804; - else - npc.rotation -= num804; - } - - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - npc.rotation = num803; #endregion #region FirstStage if (npc.ai[0] == 0f) @@ -1010,10 +1191,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; return; } else @@ -1180,78 +1357,126 @@ namespace CalamityMod.NPCs.SupremeCalamitas vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num825 = player.position.X + (player.width / 2) - vector82.X; num826 = player.position.Y + (player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2(num826, num825) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 90f) - { - npc.localAI[1] = 0f; + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 90f) + { + npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num180 = player.position.X + player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float num828 = 10f * uDieLul; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; - int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = ModContent.ProjectileType(); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - for (int num186 = 0; num186 < 8; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - float speedBoost = num186 > 3 ? -(num186 - 3) : num186; - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + int randomShot = Main.rand.Next(6); + if (randomShot == 0 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 15; i++) + { + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f); + magic.color = Color.OrangeRed; + magic.scale = 1.2f; + magic.fadeIn = 0.6f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else if (randomShot == 1 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 20; i++) + { + Dust magic = Dust.NewDustPerfect(value9, (int)CalamityDusts.Brimstone); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.3f; + magic.color = Color.Red; + magic.scale = 1.425f; + magic.fadeIn = 0.75f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else + { + canFireSplitingFireball = true; + randomShot = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + for (int num186 = 0; num186 < 8; num186++) + { + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float speedBoost = num186 > 3 ? -(num186 - 3) : num186; + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + + for (int i = 0; i < 7; i++) + { + Vector2 magicDustVelocity = new Vector2(num180 + speedBoost, num182 + speedBoost); + magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); + + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = magicDustVelocity; + magic.color = Color.Red; + magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); + magic.fadeIn = 0.67f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } + + FrameType = FrameAnimationType.FasterUpwardDraft; } else if (npc.ai[1] == 1f) { - npc.rotation = num803; float num383 = wormAlive ? 26f : 30f; if (npc.life < npc.lifeMax * 0.95) num383 += 1f; @@ -1274,7 +1499,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.velocity.X = num384 * num386; npc.velocity.Y = num385 * num386; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), npc.Center); + shieldRotation = npc.velocity.ToRotation(); + npc.netUpdate = true; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), npc.Center); } npc.ai[1] = 2f; @@ -1282,6 +1510,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (npc.ai[1] == 2f) { npc.ai[2] += 1f; + + if (Math.Abs(npc.velocity.X) > 0.15f) + npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); if (npc.ai[2] >= 25f) { if (!canDespawn) @@ -1294,22 +1525,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.velocity.Y = 0f; } } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= 70f) + bool willChargeAgain = npc.ai[3] + 1 < 2; + + if (npc.ai[2] >= 70f) { npc.ai[3] += 1f; npc.ai[2] = 0f; npc.TargetClosest(); - npc.rotation = num803; - if (npc.ai[3] >= 2f) + if (!willChargeAgain) npc.ai[1] = -1f; else npc.ai[1] = 1f; - } - } + } + + if (willChargeAgain && npc.ai[2] > 50f) + { + float idealRotation = npc.AngleTo(player.Center); + shieldRotation = shieldRotation.AngleLerp(idealRotation, 0.125f); + shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); + } + + FrameType = FrameAnimationType.FasterUpwardDraft; + } else if (npc.ai[1] == 3f) { float num412 = 32f; @@ -1326,7 +1565,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; - Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -18f, 2f); + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; float num416 = player.position.Y + (player.height / 2) - vector40.Y; float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); @@ -1383,6 +1623,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas num416 = player.position.Y + (player.height / 2) - vector40.Y; Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), npc.Center); + // Release a burst of magic dust along with a brimstone hellblast skull. + for (int i = 0; i < 25; i++) + { + Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); + brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + npc.velocity; + brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.color = Color.OrangeRed; + brimstoneMagic.fadeIn = 1.5f; + brimstoneMagic.noLight = true; + } + if (Main.netMode != NetmodeID.MultiplayerClient) { float num418 = 10f * uDieLul; @@ -1391,13 +1643,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas num417 = num418 / num417; num415 *= num417; num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; + vector40.X += num415 * 2f; + vector40.Y += num416 * 2f; Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, hellblastDamage, 0f, Main.myPlayer, 0f, 0f); } } - } - } + } + + if (Main.rand.NextBool(2)) + { + Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); + brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + npc.velocity; + brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.noLight = true; + } + + FrameType = FrameAnimationType.OutwardHandCast; + } else if (npc.ai[1] == 4f) { int num831 = 1; @@ -1454,15 +1717,32 @@ namespace CalamityMod.NPCs.SupremeCalamitas vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num834 = player.position.X + (player.width / 2) - vector83.X; num835 = player.position.Y + (player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2(num835, num834) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 140f) + int shootRate = wormAlive ? 280 : 140; + npc.localAI[1]++; + FrameChangeSpeed = 0.175f; + FrameType = FrameAnimationType.BlastCast; + + if (npc.localAI[1] > shootRate) + { + Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -22f, 2f); + + // Release a burst of magic dust when punching. + for (int i = 0; i < 25; i++) + { + Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); + brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + npc.velocity; + brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.color = Color.OrangeRed; + brimstoneMagic.fadeIn = 1.5f; + brimstoneMagic.noLight = true; + } + npc.localAI[1] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - npc.localAI[1] = 0f; float num837 = 5f * uDieLul; int num839 = ModContent.ProjectileType(); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -1481,9 +1761,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.ai[1] = -1f; npc.TargetClosest(); npc.netUpdate = true; - } - } - } + } + } + } if (npc.life < npc.lifeMax * 0.4) { @@ -1497,6 +1777,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region Transition + + // TODO: Add a special flame that encases SCal during the transition phase instead of just dust. else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { npc.dontTakeDamage = true; @@ -1515,8 +1797,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.ai[2] = 0f; } - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; if (npc.ai[1] == 100f) { @@ -1534,7 +1814,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + for (int i = 0; i < 4; i++) + { + Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), (int)CalamityDusts.Brimstone); + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2.75f, 4.25f); + brimstoneFire.noGravity = true; + } if (!canDespawn) { @@ -1728,78 +2013,124 @@ namespace CalamityMod.NPCs.SupremeCalamitas vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num825 = player.position.X + (player.width / 2) - vector82.X; num826 = player.position.Y + (player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2(num826, num825) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 60f) - { - npc.localAI[1] = 0f; + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 60f) + { + npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num180 = player.position.X + player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float num828 = 10f * uDieLul; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; - int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); - } - else - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - canFireSplitingFireball = true; - randomShot = ModContent.ProjectileType(); - for (int num186 = 0; num186 < 8; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - float speedBoost = num186 > 3 ? -(num186 - 3) : num186; - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + int randomShot = Main.rand.Next(6); + if (randomShot == 0 && canFireSplitingFireball) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 16; i++) + { + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.2f; + magic.color = Color.OrangeRed; + magic.scale = 1.3f; + magic.fadeIn = 0.6f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else if (randomShot == 1 && canFireSplitingFireball) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 24; i++) + { + Dust magic = Dust.NewDustPerfect(value9, (int)CalamityDusts.Brimstone); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.6f; + magic.color = Color.Red; + magic.scale = 1.5f; + magic.fadeIn = 0.8f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + canFireSplitingFireball = true; + randomShot = ModContent.ProjectileType(); + for (int num186 = 0; num186 < 8; num186++) + { + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float speedBoost = num186 > 3 ? -(num186 - 3) : num186; + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + + for (int i = 0; i < 10; i++) + { + Vector2 magicDustVelocity = new Vector2(num180 + speedBoost, num182 + speedBoost); + magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 10f); + + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = magicDustVelocity; + magic.color = Color.Red; + magic.scale = MathHelper.Lerp(0.975f, 1.7f, i / 10f); + magic.fadeIn = 0.9f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } + } else if (npc.ai[1] == 1f) { - npc.rotation = num803; float num383 = wormAlive ? 31f : 35f; if (npc.life < npc.lifeMax * 0.3) num383 += 1f; @@ -1818,7 +2149,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.velocity.X = num384 * num386; npc.velocity.Y = num385 * num386; - } + shieldRotation = npc.velocity.ToRotation(); + npc.netUpdate = true; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/SCalDash"), npc.Center); + } npc.ai[1] = 2f; } @@ -1837,22 +2172,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.velocity.Y = 0f; } } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.rotation = num803; - if (npc.ai[3] >= 1f) - npc.ai[1] = -1f; - else - npc.ai[1] = 1f; - } - } + bool willChargeAgain = npc.ai[3] + 1 < 1; + + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + + if (!willChargeAgain) + npc.ai[1] = -1f; + else + npc.ai[1] = 1f; + } + + if (willChargeAgain && npc.ai[2] > 50f) + { + float idealRotation = npc.AngleTo(player.Center); + shieldRotation = shieldRotation.AngleLerp(idealRotation, 0.125f); + shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); + } + + FrameType = FrameAnimationType.FasterUpwardDraft; + } else if (npc.ai[1] == 3f) { float num412 = 32f; @@ -1869,7 +2213,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; - Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -18f, 2f); + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; float num416 = player.position.Y + (player.height / 2) - vector40.Y; float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); @@ -1926,7 +2271,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas num416 = player.position.Y + (player.height / 2) - vector40.Y; Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) + // Release a burst of magic dust along with a brimstone hellblast skull. + for (int i = 0; i < 25; i++) + { + Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); + brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.31f) * Main.rand.NextFloat(3f, 5f) + npc.velocity; + brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.color = Color.OrangeRed; + brimstoneMagic.fadeIn = 1.5f; + brimstoneMagic.noLight = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) { float num418 = 10f * uDieLul; int num420 = ModContent.ProjectileType(); @@ -1939,8 +2296,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, hellblastDamage, 0f, Main.myPlayer, 0f, 0f); } } - } - } + } + + if (Main.rand.NextBool(2)) + { + Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); + brimstoneMagic.velocity = Vector2.UnitY.RotatedByRandom(0.14f) * Main.rand.NextFloat(-3.5f, -3f) + npc.velocity; + brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.noLight = true; + } + + FrameChangeSpeed = 0.245f; + FrameType = FrameAnimationType.PunchHandCast; + } else if (npc.ai[1] == 4f) { int num831 = 1; @@ -1997,40 +2366,284 @@ namespace CalamityMod.NPCs.SupremeCalamitas vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num834 = player.position.X + (player.width / 2) - vector83.X; num835 = player.position.Y + (player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2(num835, num834) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 100f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); - npc.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 8f; - vector83.Y += num835 * 8f; - int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); - } - } + int shootRate = wormAlive ? 200 : 100; + npc.localAI[1]++; + if (npc.ai[2] > 40f && (npc.localAI[1] > shootRate - 18 || npc.localAI[1] <= 15f)) + { + FrameChangeSpeed = 0f; + FrameType = FrameAnimationType.BlastPunchCast; + } - npc.ai[2] += 1f; + if (npc.localAI[1] > shootRate) + { + Vector2 handPosition = npc.Center + new Vector2(npc.spriteDirection * -22f, 2f); + + // Release a burst of magic dust when punching. + for (int i = 0; i < 25; i++) + { + Dust brimstoneMagic = Dust.NewDustPerfect(handPosition, 264); + brimstoneMagic.velocity = npc.DirectionTo(player.Center).RotatedByRandom(0.24f) * Main.rand.NextFloat(5f, 7f) + npc.velocity; + brimstoneMagic.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.color = Color.OrangeRed; + brimstoneMagic.fadeIn = 1.5f; + brimstoneMagic.noLight = true; + } + npc.localAI[1] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + npc.localAI[1] = 0f; + float num837 = 5f * uDieLul; + int num839 = ModContent.ProjectileType(); + num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 8f; + vector83.Y += num835 * 8f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + + npc.ai[2] += 1f; if (npc.ai[2] >= 240f) { npc.ai[1] = -1f; npc.TargetClosest(); npc.netUpdate = true; - } - } + } + } } } #endregion } + public void DoHeartsSpawningCastAnimation(Player target, bool death) + { + int tempSpawnY = spawnY; + tempSpawnY += 250; + if (death) + tempSpawnY -= 50; + + List heartSpawnPositions = new List(); + for (int i = 0; i < 5; i++) + { + heartSpawnPositions.Add(new Vector2(spawnX + spawnXAdd * i + 50, tempSpawnY + spawnYAdd * i)); + heartSpawnPositions.Add(new Vector2(spawnX2 - spawnXAdd * i - 50, tempSpawnY + spawnYAdd * i)); + } + + float castCompletion = Utils.InverseLerp(sepulcherSpawnCastTime - 25f, 0f, attackCastDelay, true); + Vector2 armPosition = npc.Center + Vector2.UnitX * npc.spriteDirection * -8f; + + // Emit dust at the arm position as a sort of magic effect. + Dust magic = Dust.NewDustPerfect(armPosition, 264); + magic.velocity = Vector2.UnitY.RotatedByRandom(0.17f) * -Main.rand.NextFloat(2.7f, 4.1f); + magic.color = Color.OrangeRed; + magic.noLight = true; + magic.fadeIn = 0.6f; + magic.noGravity = true; + + foreach (Vector2 heartSpawnPosition in heartSpawnPositions) + { + Vector2 leftDustPosition = Vector2.CatmullRom(armPosition + Vector2.UnitY * 1000f, armPosition, heartSpawnPosition, heartSpawnPosition + Vector2.UnitY * 1000f, castCompletion); + + Dust castMagicDust = Dust.NewDustPerfect(leftDustPosition, 267); + castMagicDust.scale = 1.67f; + castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); + castMagicDust.fadeIn = 0.67f; + castMagicDust.color = Color.Red; + castMagicDust.noGravity = true; + } + + if (attackCastDelay == 0) + { + string key = "Mods.CalamityMod.SCalStartText"; + if (npc.life <= npc.lifeMax * 0.08) + key = "Mods.CalamityMod.SCalSepulcher2Text"; + + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + foreach (Vector2 heartSpawnPosition in heartSpawnPositions) + { + // Make the hearts appear in a burst of flame. + for (int i = 0; i < 20; i++) + { + Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), (int)CalamityDusts.Brimstone); + castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); + castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); + castFire.fadeIn = 1.25f; + castFire.noGravity = true; + } + } + + // And play a fire-like sound effect. + Main.PlaySound(SoundID.DD2_BetsyWindAttack, target.Center); + hasSummonedSepulcher1 = true; + hasSummonedSepulcher2 = npc.life <= npc.lifeMax * 0.08; + + // TODO: Resprite brimstone hearts a bit. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List hearts = new List(); + for (int x = 0; x < 5; x++) + { + hearts.Add(NPC.NewNPC(spawnX + 50, tempSpawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255)); + spawnX += spawnXAdd; + + hearts.Add(NPC.NewNPC(spawnX2 - 50, tempSpawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255)); + spawnX2 -= spawnXAdd; + tempSpawnY += spawnYAdd; + } + + ConnectAllBrimstoneHearts(hearts); + + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + npc.netUpdate = true; + } + } + } + + public void DoBrothersSpawningCastAnimation(int bodyWidth, int bodyHeight) + { + Vector2 leftOfCircle = npc.Center + Vector2.UnitY * bodyHeight * 0.5f - Vector2.UnitX * bodyWidth * 0.45f; + Vector2 rightOfCircle = npc.Center + Vector2.UnitY * bodyHeight * 0.5f + Vector2.UnitX * bodyWidth * 0.45f; + + if (Main.netMode != NetmodeID.MultiplayerClient && catastropheSpawnPosition == Vector2.Zero) + { + catastropheSpawnPosition = npc.Center - Vector2.UnitX * 500f; + cataclysmSpawnPosition = npc.Center + Vector2.UnitX * 500f; + npc.netUpdate = true; + } + + // Draw some magic dust much like the sandstorm elemental cast that approaches where the brothers will spawn. + if (attackCastDelay < brothersSpawnCastTime - 45f && attackCastDelay >= 60f) + { + float castCompletion = Utils.InverseLerp(brothersSpawnCastTime - 45f, 60f, attackCastDelay); + + Vector2 leftDustPosition = Vector2.CatmullRom(leftOfCircle + Vector2.UnitY * 1000f, leftOfCircle, catastropheSpawnPosition, catastropheSpawnPosition + Vector2.UnitY * 1000f, castCompletion); + Vector2 rightDustPosition = Vector2.CatmullRom(rightOfCircle + Vector2.UnitY * 1000f, rightOfCircle, cataclysmSpawnPosition, cataclysmSpawnPosition + Vector2.UnitY * 1000f, castCompletion); + + Dust castMagicDust = Dust.NewDustPerfect(leftDustPosition, 267); + castMagicDust.scale = 1.67f; + castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); + castMagicDust.color = Color.Red; + castMagicDust.noGravity = true; + + castMagicDust = Dust.CloneDust(castMagicDust); + castMagicDust.position = rightDustPosition; + } + + // Make some magic effects at where the bros will spawn. + if (attackCastDelay < 60f) + { + float burnPower = Utils.InverseLerp(60f, 20f, attackCastDelay); + if (attackCastDelay == 0f) + burnPower = 4f; + + for (int i = 0; i < MathHelper.Lerp(5, 25, burnPower); i++) + { + Dust fire = Dust.NewDustPerfect(catastropheSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); + fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); + if (attackCastDelay == 0) + { + fire.velocity += Main.rand.NextVector2Circular(4f, 4f); + fire.fadeIn = 1.6f; + } + fire.noGravity = true; + fire.noLight = true; + fire.color = Color.OrangeRed; + fire.scale = 1.4f + fire.velocity.Y * 0.16f; + + fire = Dust.NewDustPerfect(cataclysmSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); + fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); + if (attackCastDelay == 0) + { + fire.velocity += Main.rand.NextVector2Circular(4f, 4f); + fire.fadeIn = 1.6f; + } + fire.noGravity = true; + fire.noLight = true; + fire.color = Color.OrangeRed; + fire.scale = 1.4f + fire.velocity.Y * 0.16f; + } + } + + // And spawn them. + if (attackCastDelay == 0) + { + string key = "Mods.CalamityMod.SCalBrothersText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + + CalamityUtils.DisplayLocalizedText(key, textColor); + if (CalamityWorld.downedSCal) + CalamityUtils.DisplayLocalizedText(key + "2", textColor); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, ModContent.NPCType()); + CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, ModContent.NPCType()); + } + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, npc.Center); + hasSummonedBrothers = true; + } + } + + public void ConnectAllBrimstoneHearts(List heartIndices) + { + int heartType = ModContent.NPCType(); + + // Ensure that the hearts go in order based on the arena. + IEnumerable hearts = heartIndices.Select(i => Main.npc[i]); + hearts = hearts.OrderByDescending(heart => Math.Abs(heart.Center.X - safeBox.Left)).ToList(); + + int firstHeartIndex = heartIndices.First(); + int lastHeartIndex = heartIndices.Last(); + + heartIndices = heartIndices.OrderByDescending(heart => Math.Abs(Main.npc[heart].Center.X - safeBox.Left)).ToList(); + + for (int i = 0; i < hearts.Count(); i++) + { + NPC heart = hearts.ElementAt(i); + + Vector2 endpoint = safeBox.TopLeft(); + Vector2 oppositePosition = Vector2.Zero; + + for (int j = 0; j < 2; j++) + { + int tries = 0; + do + { + endpoint.X = heart.Center.X + (j == 0).ToDirectionInt() * Main.rand.NextFloat(75f, 250f); + tries++; + if (tries >= 100) + break; + } + while (Math.Abs(endpoint.X - safeBox.Center.X) > safeBox.Width * 0.48f); + + if (tries >= 100) + endpoint.X = MathHelper.Clamp(endpoint.X, safeBox.Left, safeBox.Right); + + heart.ModNPC().ChainEndpoints.Add(endpoint); + } + + if (Main.rand.NextBool(2)) + { + endpoint.X = heart.Center.X + Main.rand.NextBool(2).ToDirectionInt() * Main.rand.NextFloat(45f, 360f); + endpoint.X = MathHelper.Clamp(endpoint.X, safeBox.Left, safeBox.Right); + heart.ModNPC().ChainEndpoints.Add(endpoint); + } + + heart.netUpdate = true; + } + } + #region Loot public override void BossLoot(ref string name, ref int potionType) { @@ -2044,9 +2657,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas //Does not occur in Boss Rush due to weakened SCal + stronger weapons (rarely occurs with just Cal gear) if ((lootTimer < 6000) && !BossRushEvent.BossRushActive) { - string key = "Mods.CalamityMod.SupremeBossText2"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalFunnyCheatText", textColor); return true; } @@ -2055,9 +2666,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void NPCLoot() { - DeathMessage(); + // Create a teleport line effect + Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); + npc.Center = initialRitualPosition; - // Incrase the player's SCal kill count + // Increase the player's SCal kill count if (Main.player[npc.target].Calamity().sCalKillCount < 5) Main.player[npc.target].Calamity().sCalKillCount++; @@ -2103,54 +2716,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSCal); - // Mark Supreme Calamitas as dead + // Mark Supreme Calamitas as defeated CalamityWorld.downedSCal = true; CalamityNetcode.SyncWorld(); } #endregion - private void DeathMessage() - { - Color messageColor = Color.Orange; - string key; - - // If the player has never killed SCal before, comment on how many attempts it took - if (Main.player[npc.target].Calamity().sCalKillCount == 0) - { - switch (Main.LocalPlayer.Calamity().sCalDeathCount) - { - case 0: - key = "Mods.CalamityMod.SupremeBossText16"; - break; - case 1: - key = "Mods.CalamityMod.SupremeBossText17"; - break; - case 2: - key = "Mods.CalamityMod.SupremeBossText18"; - break; - case 3: // Three deaths exactly rewards Lul - key = "Mods.CalamityMod.SupremeBossText19"; - DropHelper.DropItem(npc, ModContent.ItemType()); - break; - default: // Four or more deaths: Lul is permanently missed - key = "Mods.CalamityMod.SupremeBossText10"; - break; - } - } - else - { - // If SCal has been killed before, instead comment on her respawning - key = "Mods.CalamityMod.SupremeBossText10"; - } - - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } + // Prevent the player from accidentally killing SCal instead of having her turn into a town NPC. + public override bool CheckDead() + { + npc.life = 1; + npc.active = true; + npc.dontTakeDamage = true; + npc.netUpdate = true; + return false; + } + public override bool CheckActive() { return canDespawn; @@ -2165,21 +2751,44 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return true; + + Vector2 shieldCenter = npc.Center + shieldRotation.ToRotationVector2() * 24f; + Vector2 shieldTop = shieldCenter - (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 61f; + Vector2 shieldBottom = shieldCenter - (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 61f; + + float _ = 0f; + bool collidingWithShield = Collision.CheckAABBvLineCollision(target.TopLeft, target.Size, shieldTop, shieldBottom, 64f, ref _) && shieldOpacity > 0.55f; + return collidingWithShield || npc.Hitbox.Intersects(target.Hitbox); } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; + bool wormAlive = false; + if (CalamityGlobalNPC.SCalWorm != -1) + wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; + int shootRate = wormAlive ? 200 : 100; + + // Special punch logic for the blast attack. + if (FrameType == FrameAnimationType.BlastPunchCast && (npc.localAI[1] > shootRate - 18 || npc.localAI[1] <= 15f)) + { + if (npc.localAI[1] > shootRate - 18) + npc.frame.Y = (int)MathHelper.Lerp(0, 3, Utils.InverseLerp(shootRate - 18, shootRate, npc.localAI[1], true)); + else + npc.frame.Y = (int)MathHelper.Lerp(3, 5, Utils.InverseLerp(0f, 15f, npc.localAI[1], true)); + npc.frame.Y += (int)FrameType * 6; + } + else + { + npc.frameCounter += FrameChangeSpeed; + npc.frameCounter %= 6; + npc.frame.Y = (int)npc.frameCounter + (int)FrameType * 6; + } } public override Color? GetAlpha(Color drawColor) { if (willCharge) - return new Color(0, 0, 0, npc.alpha); + return drawColor * npc.Opacity * 0.45f; return null; } @@ -2189,13 +2798,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = npc.ai[0] > 1f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitas2") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Texture2D texture2D15 = CalamityWorld.downedSCal ? Main.npcTexture[npc.type] : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); + + Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type] / 2f); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 7; - if (CalamityConfig.Instance.Afterimages) + Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[npc.type], npc.frame.Y / Main.npcFrameCount[npc.type], npc.frame.Y % Main.npcFrameCount[npc.type]); + + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -2204,41 +2816,135 @@ namespace CalamityMod.NPCs.SupremeCalamitas color38 = npc.GetAlpha(color38); color38 *= (num153 - num155) / 15f; Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector41 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector41, frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } + bool inPhase2 = npc.ai[0] >= 3f && npc.life > npc.lifeMax * 0.01; Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - texture2D15 = npc.ai[0] > 1f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitas2Glow") : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + if (inPhase2) + { + // Make the sprite jitter with rage in phase 2. This does not happen in rematches since it would make little sense logically. + if (!CalamityWorld.downedSCal) + vector43 += Main.rand.NextVector2Circular(0.25f, 0.7f); - if (CalamityConfig.Instance.Afterimages) - { - for (int num163 = 1; num163 < num153; num163++) - { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + // And gain a flaming aura. + Color auraColor = npc.GetAlpha(Color.Red) * 0.4f; + for (int i = 0; i < 7; i++) + { + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTime * 4f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 4.25f, (float)Math.Cos(Main.GlobalTime * 4f) * 0.5f + 0.5f); + spriteBatch.Draw(texture2D15, vector43 + rotationalDrawOffset, frame, auraColor, npc.rotation, vector11, npc.scale * 1.1f, spriteEffects, 0f); + } + } + spriteBatch.Draw(texture2D15, vector43, frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + DrawForcefield(spriteBatch); + DrawShield(spriteBatch); return false; } + public void DrawForcefield(SpriteBatch spriteBatch) + { + spriteBatch.EnterShaderRegion(); + + float intensity = hitTimer / 35f; + + // Shield intensity is always high during invincibility, except during cast animations, so that she can be more easily seen. + if (npc.dontTakeDamage && attackCastDelay <= 0) + intensity = 0.75f + Math.Abs((float)Math.Cos(Main.GlobalTime * 1.7f)) * 0.1f; + + // Make the forcefield weaker in the second phase as a means of showing desparation. + if (npc.ai[0] >= 3f) + intensity *= 0.6f; + + float lifeRatio = npc.life / (float)npc.lifeMax; + float flickerPower = 0f; + if (lifeRatio < 0.6f) + flickerPower += 0.1f; + if (lifeRatio < 0.3f) + flickerPower += 0.15f; + if (lifeRatio < 0.1f) + flickerPower += 0.2f; + if (lifeRatio < 0.05f) + flickerPower += 0.1f; + float opacity = forcefieldOpacity; + opacity *= MathHelper.Lerp(1f, 1f - flickerPower, (float)Math.Pow(Math.Cos(Main.GlobalTime * MathHelper.Lerp(3f, 9f, flickerPower)), 24D)); + + // During/prior to a charge the forcefield is always darker than usual and thus its intensity is also higher. + if (!npc.dontTakeDamage && (willCharge || npc.ai[1] == 2f)) + intensity = 1.1f; + + Texture2D forcefieldTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/CalamitasShield"); + GameShaders.Misc["CalamityMod:SupremeShield"].UseImage("Images/Misc/Perlin"); + + Color forcefieldColor = Color.DarkViolet; + Color secondaryForcefieldColor = Color.Red * 1.4f; + + if (!npc.dontTakeDamage && (willCharge || npc.ai[1] == 2f)) + { + forcefieldColor *= 0.25f; + secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Black, 0.7f); + } + + forcefieldColor *= opacity; + secondaryForcefieldColor *= opacity; + + GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor); + GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor); + GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(intensity); + GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:SupremeShield"].Apply(); + + spriteBatch.Draw(forcefieldTexture, npc.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, forcefieldScale * 3f, SpriteEffects.None, 0f); + + spriteBatch.ExitShaderRegion(); + } + + public void DrawShield(SpriteBatch spriteBatch) + { + float jawRotation = shieldRotation; + float jawRotationOffset = 0f; + + // Have an agape mouth when charging. + if (npc.ai[1] == 2f) + jawRotationOffset -= 0.71f; + + // And a laugh right before the charge. + else if (willCharge && npc.ai[1] != 2f && AttackCloseToBeingOver) + jawRotationOffset += MathHelper.Lerp(0.04f, -0.82f, (float)Math.Sin(Main.GlobalTime * 17.2f) * 0.5f + 0.5f); + + Color shieldColor = Color.White * shieldOpacity; + Texture2D shieldSkullTexture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop"); + Texture2D shieldJawTexture = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom"); + Vector2 drawPosition = npc.Center + shieldRotation.ToRotationVector2() * 24f - Main.screenPosition; + Vector2 jawDrawPosition = drawPosition; + SpriteEffects direction = Math.Cos(shieldRotation) > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; + if (direction == SpriteEffects.FlipVertically) + jawDrawPosition += (shieldRotation - MathHelper.PiOver2).ToRotationVector2() * 42f; + else + { + jawDrawPosition += (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 42f; + jawRotationOffset *= -1f; + } + + spriteBatch.Draw(shieldJawTexture, jawDrawPosition, null, shieldColor, jawRotation + jawRotationOffset, shieldJawTexture.Size() * 0.5f, 1f, direction, 0f); + spriteBatch.Draw(shieldSkullTexture, drawPosition, null, shieldColor, shieldRotation, shieldSkullTexture.Size() * 0.5f, 1f, direction, 0f); + } + public override void HitEffect(int hitDirection, double damage) { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + hitTimer = 35; + npc.netUpdate = true; + } + for (int k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index 0eea683573..1040ac0397 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas2.png b/NPCs/SupremeCalamitas/SupremeCalamitas2.png deleted file mode 100644 index 87017c3b28..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas2Glow.png b/NPCs/SupremeCalamitas/SupremeCalamitas2Glow.png deleted file mode 100644 index b7730d4549..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas2Glow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png b/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png deleted file mode 100644 index f09dcde7e3..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png new file mode 100644 index 0000000000..23b956ca93 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png b/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png deleted file mode 100644 index 2b3078e2ef..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index ca5c87efad..c86787cf94 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.DR_NERD(0.25f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(240000, 276000); + npc.LifeMaxNERB(240000, 276000, 100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index a887f341e7..76b6beafda 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.DR_NERD(0.25f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(240000, 276000); + npc.LifeMaxNERB(240000, 276000, 100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/SupremeCalamitas/SupremeShieldBottom.png b/NPCs/SupremeCalamitas/SupremeShieldBottom.png new file mode 100644 index 0000000000..dbcdfc736d Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeShieldBottom.png differ diff --git a/NPCs/SupremeCalamitas/SupremeShieldTop.png b/NPCs/SupremeCalamitas/SupremeShieldTop.png new file mode 100644 index 0000000000..5154a5a348 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeShieldTop.png differ diff --git a/NPCs/SupremeCalamitas/unknown.png b/NPCs/SupremeCalamitas/unknown.png new file mode 100644 index 0000000000..8aec7550d7 Binary files /dev/null and b/NPCs/SupremeCalamitas/unknown.png differ diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 1aa0cd5d6b..1f811a6af8 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.Yharon npc.width = 200; npc.height = 200; npc.defense = 90; - npc.LifeMaxNERB(1080625, 1296750, 3700000); + npc.LifeMaxNERB(1080625, 1296750, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 741e80fcd7..782ccaa384 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -43,20 +43,14 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } if (projectile.alpha > 0) - { projectile.alpha -= 25; - } if (projectile.alpha < 0) - { projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index f72085b059..fe9e600933 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss //Rotation projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90f) * projectile.direction; projectile.velocity *= 1.01f; diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 932027bf11..d46b5b78e1 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; using System.IO; using Terraria; using Terraria.ModLoader; @@ -28,6 +29,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; + projectile.hide = true; projectile.penetrate = -1; projectile.timeLeft = 36000; projectile.Opacity = 0f; @@ -193,6 +195,12 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 300, true); } + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindProjectiles.Add(index); + drawCacheProjsBehindNPCs.Add(index); + } + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs new file mode 100644 index 0000000000..f834dd6957 --- /dev/null +++ b/Projectiles/Boss/IchorBlob.cs @@ -0,0 +1,213 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class IchorBlob : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ichor Blob"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 52; + projectile.height = 56; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + // Deal no damage and increment the variable used to kill the projectile after 15 seconds + projectile.ai[1] += 1f; + if (projectile.ai[1] > 900f) + { + projectile.localAI[0] += 10f; + projectile.damage = 0; + } + + // Kill the projectile 26 frames after it stops dealing damage + if (projectile.localAI[0] > 255f) + { + projectile.Kill(); + projectile.localAI[0] = 255f; + } + + // Add yellow light based on alpha + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.16f / 255f, (255 - projectile.alpha) * 0.04f / 255f); + + // Adjust projectile visibility based on the kill timer + projectile.alpha = (int)(100.0 + projectile.localAI[0] * 0.7); + + if (projectile.velocity.Y != 0f && projectile.ai[0] == 0f) + { + // Rotate based on velocity, only do this here, because it's falling + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + projectile.frame = 0; + } + else + { + // Prevent sliding + projectile.velocity.X = 0f; + + // Do not animate falling frames + projectile.ai[0] = 1f; + + if (projectile.frame < 2) + { + // Set frame to blob and frame counter to 0 + projectile.frame = 2; + projectile.frameCounter = 0; + + // Play squish sound + Main.PlaySound(SoundID.NPCDeath21, projectile.Center); + + // Emit dust + float num50 = 1.6f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length(); + for (int num53 = 0; num53 < 10; num53++) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 200, default, num50); + Dust dust = Main.dust[num54]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + dust.noGravity = true; + dust.velocity.Y -= 2f; + dust.velocity *= 3f; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default, num51); + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + dust.velocity.Y -= 2f; + dust.velocity *= 2f; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.velocity += value4 * Main.rand.NextFloat(); + } + for (int num55 = 0; num55 < 5; num55++) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 0, default, num52); + Dust dust = Main.dust[num56]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + dust.noGravity = true; + dust.velocity.Y -= 2f; + dust.velocity *= 0.5f; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + } + } + + projectile.rotation = 0f; + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + projectile.frame = 5; + } + + // Do velocity code after the frame code, to avoid messing anything up + // Reduce x velocity every frame + projectile.velocity.X *= 0.99f; + + // Stop falling if water or lava is hit + if (projectile.wet || projectile.lavaWet) + { + projectile.velocity.Y = 0f; + } + else + { + // Fall + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y > 6f) + projectile.velocity.Y = 6f; + } + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool CanHitPlayer(Player target) + { + Rectangle targetHitbox = target.Hitbox; + + Vector2 blobCenter = new Vector2(projectile.Center.X, projectile.Center.Y + 14f); + 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 <= 16f && projectile.ai[1] <= 900f && projectile.ai[1] > 120f; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.ai[1] > 900f) + { + byte b2 = (byte)((26f - (projectile.ai[1] - 900f)) * 10f); + byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); + } + return new Color(255, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.ai[1] <= 900f && projectile.ai[1] > 120f) + target.AddBuff(BuffID.Ichor, 240); + } + } +} diff --git a/Projectiles/Boss/IchorSporeCloud.cs b/Projectiles/Boss/IchorSporeCloud.cs deleted file mode 100644 index 719cef1c4c..0000000000 --- a/Projectiles/Boss/IchorSporeCloud.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class IchorSporeCloud : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/Boss/SporeGasPlantera"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ichor Spore Gas"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] > 900f) - { - projectile.localAI[0] += 10f; - projectile.damage = 0; - } - - if (projectile.localAI[0] > 255f) - { - projectile.Kill(); - projectile.localAI[0] = 255f; - } - - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.16f / 255f, (255 - projectile.alpha) * 0.04f / 255f); - - projectile.alpha = (int)(100.0 + projectile.localAI[0] * 0.7); - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.rotation += projectile.direction * 0.002f; - - if (projectile.velocity.Length() > 0.5f) - projectile.velocity *= 0.99f; - } - - public override bool CanHitPlayer(Player target) => projectile.ai[1] <= 900f && projectile.ai[1] > 120f; - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.ai[1] > 900f) - { - byte b2 = (byte)((26f - (projectile.ai[1] - 900f)) * 10f); - byte a2 = (byte)(projectile.alpha * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(255, 255, 255, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - // Changes the texture of the projectile - Texture2D texture = Main.projectileTexture[projectile.type]; - switch ((int)projectile.ai[0]) - { - case 0: - break; - case 1: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SporeGasPlantera2"); - break; - case 2: - texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SporeGasPlantera3"); - break; - default: - break; - } - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (projectile.ai[1] <= 900f && projectile.ai[1] > 120f) - target.AddBuff(BuffID.Ichor, 240); - } - } -} diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 4b073a77d9..bd115c6f79 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { projectile.velocity.X *= 0.95f; + if (projectile.wet || projectile.lavaWet) { projectile.velocity.Y = 0f; @@ -39,10 +40,9 @@ namespace CalamityMod.Projectiles.Boss { projectile.velocity.Y += 0.1f; if (projectile.velocity.Y > 5f) - { projectile.velocity.Y = 5f; - } } + projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -50,9 +50,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 1) - { projectile.frame = 0; - } } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -61,14 +59,7 @@ namespace CalamityMod.Projectiles.Boss return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; public override Color? GetAlpha(Color lightColor) { diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs new file mode 100644 index 0000000000..215ae94a4f --- /dev/null +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -0,0 +1,78 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs.SupremeCalamitas; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class SCalRitualDrama : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float Time => ref projectile.ai[0]; + public const int PulseTime = 45; + public const int TotalRitualTime = 270; + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Ritual Drama"); + + public override void SetDefaults() + { + projectile.width = projectile.height = 2; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = TotalRitualTime; + } + + public override void AI() + { + SCalSky.OverridingIntensity = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); + Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true); + Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 4f; + + int fireReleaseRate = Time > 150f ? 2 : 1; + for (int i = 0; i < fireReleaseRate; i++) + { + if (Main.rand.NextBool(4)) + { + Dust brimstone = Dust.NewDustPerfect(projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267); + brimstone.scale = Main.rand.NextFloat(0.7f, 1f); + brimstone.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat()); + brimstone.fadeIn = 0.7f; + brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.5f, 2.8f); + brimstone.noGravity = true; + } + } + + Time++; + } + + public override void Kill(int timeLeft) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + CalamityUtils.SpawnBossBetter(projectile.Center - new Vector2(60f), ModContent.NPCType()); + + // Make a laugh sound and create a burst of brimstone dust. + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), projectile.Center); + Main.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, projectile.Center); + + Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 16f; + + // Generate a dust explosion + float burstDirectionVariance = 3; + float burstSpeed = 14f; + for (int j = 0; j < 16; j++) + { + burstDirectionVariance += j * 2; + for (int k = 0; k < 40; k++) + { + Dust burstDust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + burstDust.scale = Main.rand.NextFloat(3.1f, 3.5f); + burstDust.position += Main.rand.NextVector2Circular(10f, 10f); + burstDust.velocity = Main.rand.NextVector2Square(-burstDirectionVariance, burstDirectionVariance).SafeNormalize(Vector2.UnitY) * burstSpeed; + burstDust.noGravity = true; + } + burstSpeed += 1.8f; + } + } + } +} diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 8fc1717647..a37ab63224 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -799,93 +799,96 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.CultistBossIceMist) { - if (projectile.localAI[1] == 0f) + if (NPC.AnyNPCs(NPCID.CultistBoss)) { - projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item120, projectile.position); - } + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item120, projectile.position); + } - projectile.ai[0] += 1f; + projectile.ai[0] += 1f; - // Main projectile - float duration = 300f; - if (projectile.ai[1] == 1f) - { - if (projectile.ai[0] >= duration - 20f) - projectile.alpha += 10; + // Main projectile + float duration = 300f; + if (projectile.ai[1] == 1f) + { + if (projectile.ai[0] >= duration - 20f) + projectile.alpha += 10; + else + projectile.alpha -= 10; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + + if (projectile.ai[0] >= duration) + { + projectile.Kill(); + return false; + } + + int num103 = Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + + if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector50 = projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); + } + + projectile.rotation += (float)Math.PI / 30f; + + Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + + return false; + } + + // Split projectiles + projectile.position -= projectile.velocity; + + if (projectile.ai[0] >= duration - 260f) + projectile.alpha += 3; else - projectile.alpha -= 10; + projectile.alpha -= 40; if (projectile.alpha < 0) projectile.alpha = 0; if (projectile.alpha > 255) projectile.alpha = 255; - if (projectile.ai[0] >= duration) + if (projectile.ai[0] >= duration - 255f) { projectile.Kill(); return false; } - int num103 = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); + float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); + Vector2 spinningpoint13 = value39 * scaleFactor3; - if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + for (int num724 = 0; num724 < 6; num724++) { - Vector2 vector50 = projectile.rotation.ToRotationVector2(); - Projectile.NewProjectile(projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); + Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * ((float)Math.PI * 2f) / 6f); + + Lighting.AddLight(vector51, 0.3f, 0.75f, 0.9f); + + for (int num725 = 0; num725 < 2; num725++) + { + int num726 = Dust.NewDust(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[num726].noGravity = true; + } } - projectile.rotation += (float)Math.PI / 30f; - - Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); - return false; } - - // Split projectiles - projectile.position -= projectile.velocity; - - if (projectile.ai[0] >= duration - 260f) - projectile.alpha += 3; - else - projectile.alpha -= 40; - - if (projectile.alpha < 0) - projectile.alpha = 0; - if (projectile.alpha > 255) - projectile.alpha = 255; - - if (projectile.ai[0] >= duration - 255f) - { - projectile.Kill(); - return false; - } - - Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); - float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); - Vector2 spinningpoint13 = value39 * scaleFactor3; - - for (int num724 = 0; num724 < 6; num724++) - { - Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * ((float)Math.PI * 2f) / 6f); - - Lighting.AddLight(vector51, 0.3f, 0.75f, 0.9f); - - for (int num725 = 0; num725 < 2; num725++) - { - int num726 = Dust.NewDust(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); - Main.dust[num726].noGravity = true; - } - } - - return false; } // Change the stupid homing eyes diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs index a4b81b6491..26aa22600a 100644 --- a/Projectiles/Environment/LightningMark.cs +++ b/Projectiles/Environment/LightningMark.cs @@ -98,9 +98,6 @@ namespace CalamityMod.Projectiles.Environment return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 792e04d8ed..e4b2f0fadb 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic player.itemAnimation = 2; projectile.ai[0] += 1f; - projectile.damage = (int)((projectile.ai[0] - 120f) * 4.5f); + projectile.damage = (int)(projectile.ai[0] - 120f); // Max damage = 3480 if (projectile.damage >= 100 && Main.myPlayer == projectile.owner) { if (player.statMana <= 0 && player.manaFlower) diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index 438bc07c38..faa8f40130 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 77bbc6fea5..2c64a9c432 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index a20626f7e0..1c0bc2704e 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index 26ab9a638d..52258a4191 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 2b8439f6b7..f2e8ce99e3 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -54,14 +54,12 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - double lifeAmount = (double)target.life; - double lifeMax = (double)target.lifeMax; + double lifeAmount = target.life; + double lifeMax = target.lifeMax; double damageMult = lifeAmount / lifeMax * 7; damage = (int)Math.Pow(damage, damageMult); - if (damage > 1000000) - { - damage = 1000000; - } + if (damage > 200000) + damage = 200000; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index 1d682dd116..5dd19647a7 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index db1b0e9a5c..8a78bd504c 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -83,7 +83,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 7f1e881df1..43af8f7713 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -91,13 +91,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 86c4db0a0e..572b5c03eb 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -82,16 +82,9 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index 300ed6c013..7d1bad3b9c 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -92,16 +92,9 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs index ecfe0b858e..1bc3c24666 100644 --- a/Projectiles/Melee/EutrophicSpark.cs +++ b/Projectiles/Melee/EutrophicSpark.cs @@ -85,13 +85,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Melee/GreenBall.cs b/Projectiles/Melee/GreenBall.cs index 872e3037fa..c3938295f1 100644 --- a/Projectiles/Melee/GreenBall.cs +++ b/Projectiles/Melee/GreenBall.cs @@ -64,7 +64,6 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 3251df881d..e4ec7e0036 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -56,16 +56,9 @@ namespace CalamityMod.Projectiles.Melee CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { diff --git a/Projectiles/Melee/RedBall.cs b/Projectiles/Melee/RedBall.cs index 104a21e124..a40cf49d18 100644 --- a/Projectiles/Melee/RedBall.cs +++ b/Projectiles/Melee/RedBall.cs @@ -64,7 +64,6 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index 31923f89f1..1995da51a1 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -85,13 +85,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index ae85e36f66..fab6461f71 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Melee/Waterfall.cs b/Projectiles/Melee/Waterfall.cs index 350ba5e362..cb2887f311 100644 --- a/Projectiles/Melee/Waterfall.cs +++ b/Projectiles/Melee/Waterfall.cs @@ -74,7 +74,6 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Pets/LittleLightProj.cs b/Projectiles/Pets/LittleLightProj.cs new file mode 100644 index 0000000000..93ce8385ea --- /dev/null +++ b/Projectiles/Pets/LittleLightProj.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class LittleLightProj : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + + public Color LightColor => new Color(160, 251, 255); + public ref float Time => ref projectile.ai[0]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Little Light"); + Main.projFrames[projectile.type] = 9; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.LightPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.netImportant = true; + projectile.penetrate = -1; + } + + public override void AI() + { + if (VerifyOwnerIsPresent()) + return; + + HandleFrames(); + DoSpinEffect(); + HoverTowardsOwnersShoulder(); + + // Look in the same direction as the projectile's owner. + projectile.spriteDirection = Owner.direction; + + // Emit light. + // Suspicious Looking Tentacle uses 1.5f as a brightness factor, for reference. + Lighting.AddLight(projectile.Center, LightColor.ToVector3() * 2.5f); + + Time++; + } + + public bool VerifyOwnerIsPresent() + { + // No logic should be run if the player is no longer active in the game. + if (!Owner.active) + { + projectile.Kill(); + return true; + } + + if (Owner.dead) + Owner.Calamity().littleLightPet = false; + if (Owner.Calamity().littleLightPet) + projectile.timeLeft = 2; + + return false; + } + + public void HandleFrames() + { + projectile.frameCounter++; + projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; + } + + public void DoSpinEffect() + { + // Spin around from time to time. + if (projectile.frameCounter % 180f > 150f) + projectile.rotation += MathHelper.TwoPi / 30f; + else + projectile.rotation = 0f; + } + + public void HoverTowardsOwnersShoulder() + { + Vector2 destination = Owner.Top; + destination.X -= Owner.direction * Owner.width * 1.25f; + destination.Y += Owner.height * 0.25f; + + // Hover in the air a little bit over time so that the pet doesn't seem static. + destination.Y += (float)Math.Sin(MathHelper.TwoPi * Time / 45f) * 5f; + + projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.125f); + if (projectile.WithinRange(destination, 10f)) + projectile.Center = destination; + else + projectile.Center += projectile.SafeDirectionTo(destination) * 4f; + + projectile.Center = destination; + } + } +} diff --git a/Projectiles/Pets/LittleLightProj.png b/Projectiles/Pets/LittleLightProj.png new file mode 100644 index 0000000000..d079096803 Binary files /dev/null and b/Projectiles/Pets/LittleLightProj.png differ diff --git a/Projectiles/Ranged/BrimstoneBallFriendly.cs b/Projectiles/Ranged/BrimstoneBallFriendly.cs index 0f2aa04a00..34b2218740 100644 --- a/Projectiles/Ranged/BrimstoneBallFriendly.cs +++ b/Projectiles/Ranged/BrimstoneBallFriendly.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index d78d385798..6a57cc9aba 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/ChargedBlast3.cs b/Projectiles/Ranged/ChargedBlast3.cs index e933a04bfa..80b4c01193 100644 --- a/Projectiles/Ranged/ChargedBlast3.cs +++ b/Projectiles/Ranged/ChargedBlast3.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index a34ed3f622..886768a044 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -60,10 +60,6 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } projectile.velocity *= 0.98f; return false; } diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index c2ace743bd..7eab0f6951 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/ProBolt.cs b/Projectiles/Ranged/ProBolt.cs index 4ab36211b3..fe28af83db 100644 --- a/Projectiles/Ranged/ProBolt.cs +++ b/Projectiles/Ranged/ProBolt.cs @@ -63,7 +63,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index e28d39bc95..df82641be0 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index 5fd2c99f57..906baefa81 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/CraniumSmasherProj.cs b/Projectiles/Rogue/CraniumSmasherProj.cs index 2b8df0fe72..71fe67556d 100644 --- a/Projectiles/Rogue/CraniumSmasherProj.cs +++ b/Projectiles/Rogue/CraniumSmasherProj.cs @@ -47,13 +47,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index ac401e185e..26c1194e50 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 01c6d0244e..bdddc72975 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 618f947cd2..6ee65ee71f 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -66,7 +66,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 832e395016..f63beb3aeb 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.alpha = 150; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210 && target.CanBeChasedBy(projectile); + public override bool? CanHitNPC(NPC target) => (projectile.timeLeft < 210 || projectile.ai[0] == 2f) && target.CanBeChasedBy(projectile); public override void AI() { @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (projectile.ai[0] != 1f && projectile.timeLeft < 210) + if (projectile.ai[0] != 1f && (projectile.timeLeft < 210 || projectile.ai[0] == 2f)) CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index 643f209599..f783897502 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -92,7 +92,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index 70ae338723..91ed97f076 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -57,12 +57,9 @@ namespace CalamityMod.Projectiles.Rogue return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(250, 150, 0, projectile.alpha); } diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index be56115935..e5b7103e3e 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index da950face9..b78b5d5a14 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -55,13 +55,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Rogue/TheSyringeCinder.cs b/Projectiles/Rogue/TheSyringeCinder.cs index b7218845ce..40df8407c9 100644 --- a/Projectiles/Rogue/TheSyringeCinder.cs +++ b/Projectiles/Rogue/TheSyringeCinder.cs @@ -114,10 +114,6 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { projectile.ai[1] = 1f; - if (projectile.penetrate == 0) - { - projectile.Kill(); - } return false; } diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index e62b061cec..0fcbacdff2 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -117,7 +117,6 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike) { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index ed3133c78e..07996c0071 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -221,14 +221,7 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 3be260cc68..d2a4885906 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -262,12 +262,9 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index 7a46e4f780..fa9e73016c 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -100,16 +100,9 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { //1 spider = 15 frames, 5 spiders, 10 frames int immuneTime = 16 - spiderCount; diff --git a/Projectiles/Summon/Cinder.cs b/Projectiles/Summon/Cinder.cs index 60325cd923..11c74f713b 100644 --- a/Projectiles/Summon/Cinder.cs +++ b/Projectiles/Summon/Cinder.cs @@ -89,13 +89,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index 1a634da6ab..3b1c0b2dce 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -97,13 +97,6 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 8048b833d3..ada310e94e 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -91,13 +91,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index 97de782c29..c08d48f1bc 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -97,13 +97,6 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index fac39b6bf0..f3b9591cd3 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -91,13 +91,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 3ae46abad2..0d3bbca0cf 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -50,9 +50,9 @@ namespace CalamityMod.Projectiles.Summon /// This cooldown is set in /// public int LaserCooldown = 0; - public const int LaserBaseDamage = 21000; - public const int RegicideBaseDamageSmall = 9487; - public const int RegicideBaseDamageLarge = 26000; + public const int LaserBaseDamage = 4200; + public const int RegicideBaseDamageSmall = 1897; + public const int RegicideBaseDamageLarge = 5200; public override void SetStaticDefaults() { diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index be6cdc1ad3..b1608eb3f9 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -590,12 +590,9 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { int index = Gore.NewGore(new Vector2(projectile.position.X - (float) (projectile.width / 2), projectile.position.Y - (float) (projectile.height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), projectile.scale); Main.gore[index].velocity *= 0.1f; diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index 58aa77bc25..b9501c9d4a 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -369,13 +369,6 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Typeless/ChaosGeyser.cs b/Projectiles/Typeless/ChaosGeyser.cs index a1d57edc28..1fe2138a9a 100644 --- a/Projectiles/Typeless/ChaosGeyser.cs +++ b/Projectiles/Typeless/ChaosGeyser.cs @@ -102,16 +102,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 180); } diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index 050445914c..2323a36ea4 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -85,13 +85,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Typeless/HolyEruption.cs index 15ff0edadf..f4af993411 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Typeless/HolyEruption.cs @@ -82,16 +82,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); } diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 7070969989..506625c457 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -89,16 +89,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index f3d8d7e5f1..4cb5481bcc 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -82,13 +82,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Sounds/Custom/SupremeCalamitasSpawn.cs b/Sounds/Custom/SupremeCalamitasSpawn.cs new file mode 100644 index 0000000000..48a6293bae --- /dev/null +++ b/Sounds/Custom/SupremeCalamitasSpawn.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SupremeCalamitasSpawn : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1.2f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SupremeCalamitasSpawn.ogg b/Sounds/Custom/SupremeCalamitasSpawn.ogg new file mode 100644 index 0000000000..eaf7921f2e Binary files /dev/null and b/Sounds/Custom/SupremeCalamitasSpawn.ogg differ diff --git a/Tiles/SCalAltar.cs b/Tiles/SCalAltar.cs new file mode 100644 index 0000000000..74239da3d5 --- /dev/null +++ b/Tiles/SCalAltar.cs @@ -0,0 +1,112 @@ +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class SCalAltar : ModTile + { + public const int Width = 4; + public const int Height = 3; + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSpelunker[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Altar"); + AddMapEntry(new Color(43, 19, 42), name); + disableSmartCursor = true; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + // Fire dust. + type = 6; + return true; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType()); + } + + public override bool NewRightClick(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int left = i - tile.frameX / 18; + int top = j - tile.frameY / 18; + + if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && + !Main.LocalPlayer.HasItem(ModContent.ItemType())) + { + return true; + } + + if (NPC.AnyNPCs(ModContent.NPCType()) || BossRushEvent.BossRushActive) + return true; + + if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) + return true; + + bool usingSpecialItem = Main.LocalPlayer.HasItem(ModContent.ItemType()); + + Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); + ritualSpawnPosition += new Vector2(-10f, -24f); + + Main.PlaySound(SoundID.DD2_EtherianPortalOpen, ritualSpawnPosition); + Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + + if (!usingSpecialItem) + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + + return true; + } + + public override void MouseOver(int i, int j) + { + if (Main.LocalPlayer.HasItem(ModContent.ItemType())) + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + else + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.showItemIcon = true; + } + + public override void MouseOverFar(int i, int j) + { + if (Main.LocalPlayer.HasItem(ModContent.ItemType())) + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + else + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.showItemIcon = true; + } + } +} diff --git a/Tiles/SCalAltar.png b/Tiles/SCalAltar.png new file mode 100644 index 0000000000..430144741e Binary files /dev/null and b/Tiles/SCalAltar.png differ diff --git a/TrailGeneration/PrimitiveTrail.cs b/TrailGeneration/PrimitiveTrail.cs index 53668105f3..321a218468 100644 --- a/TrailGeneration/PrimitiveTrail.cs +++ b/TrailGeneration/PrimitiveTrail.cs @@ -42,9 +42,6 @@ namespace CalamityMod public MiscShaderData SpecialShader; public TrailPointRetrievalFunction TrailPointFunction; - public DynamicIndexBuffer IndexBuffer = null; - public DynamicVertexBuffer VertexBuffer = null; - public Vector2 OverridingStickPointStart = Vector2.Zero; public Vector2 OverridingStickPointEnd = Vector2.Zero; @@ -99,7 +96,7 @@ namespace CalamityMod BaseEffect.Projection = effectProjection; } - public static List RigidPointRetreivalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable originalRotations = null) + public static List RigidPointRetreivalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable _ = null) { List basePoints = originalPositions.Where(originalPosition => originalPosition != Vector2.Zero).ToList(); List endPoints = new List(); @@ -212,10 +209,6 @@ namespace CalamityMod vertices[i * 2 + 1] = new VertexPosition2DColor(right, vertexColor, rightCurrentTextureCoord); } - if (VertexBuffer is null || vertices.Length != VertexBuffer.VertexCount) - VertexBuffer = new DynamicVertexBuffer(Main.instance.GraphicsDevice, typeof(VertexPosition2DColor), vertices.Length, BufferUsage.WriteOnly); - VertexBuffer.SetData(vertices); - return vertices.ToArray(); } @@ -241,10 +234,6 @@ namespace CalamityMod indices[startingTriangleIndex + 5] = (short)(connectToIndex + 3); } - if (IndexBuffer is null || indices.Length != IndexBuffer.IndexCount) - IndexBuffer = new DynamicIndexBuffer(Main.instance.GraphicsDevice, typeof(short), indices.Length, BufferUsage.WriteOnly); - IndexBuffer.SetData(indices); - return indices; } @@ -254,7 +243,7 @@ namespace CalamityMod List trailPoints = TrailPointFunction(originalPositions, generalOffset, totalTrailPoints, originalRotations); // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. - if (originalPositions.Count() <= 2 || trailPoints.Count <= 2) + if (trailPoints.Count <= 2) return; // If the trail point has any NaN positions, don't draw anything. @@ -279,10 +268,7 @@ namespace CalamityMod else BaseEffect.CurrentTechnique.Passes[0].Apply(); - Main.instance.GraphicsDevice.Indices = IndexBuffer; - Main.instance.GraphicsDevice.SetVertexBuffer(VertexBuffer); - Main.instance.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, triangleIndices.Length / 3); - + Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length, triangleIndices, 0, triangleIndices.Length / 3); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } } diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index e07527c38a..5b71b20055 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -194,6 +194,11 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(true, new int[] { }) }, { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, @@ -261,10 +266,6 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(true, new int[] { }) }, { ModContent.NPCType(), new Tuple(true, new int[] { }) }, { ModContent.NPCType(), new Tuple(true, new int[] { }) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, - { ModContent.NPCType(), new Tuple(true, new int[] { }) }, - { ModContent.NPCType(), new Tuple(true, new int[] { }) }, - { ModContent.NPCType(), new Tuple(true, new int[] { }) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 9b6ead6cbd..5a0fc2ee07 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -280,7 +281,9 @@ namespace CalamityMod { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 } + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 } }; EnemyStats.ContactDamageValues = new SortedDictionary @@ -533,7 +536,9 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, { ModContent.NPCType(), new int[] { 220, 440, 462, 476, 540 } }, - { ModContent.NPCType(), new int[] { 350, 560, 592, 608, 768 } } + { ModContent.NPCType(), new int[] { 350, 560, 592, 608, 768 } }, + + { ModContent.NPCType(), new int[] { 400, 800, 850, 880, 1000 } } }; EnemyStats.ProjectileDamageValues = new SortedDictionary, int[]> @@ -556,7 +561,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, { new Tuple(NPCID.QueenBee, ProjectileID.Stinger), new int[] { 22, 44, 64, 72, 96 } }, // 66 damage in non-rev master mode @@ -786,7 +791,12 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } } + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 948 } } }; } diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 2c1f909820..ce03012763 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -477,6 +477,8 @@ namespace CalamityMod target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); } + public static T ModNPC(this NPC npc) where T : ModNPC => npc.modNPC as T; + /// /// Summons a boss near a particular area depending on a specific spawn context. /// diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 445f06248d..eda8257d20 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -181,6 +181,7 @@ namespace CalamityMod.World public static bool downedBumble = false; public static bool downedYharon = false; public static bool downedSCal = false; + public static bool downedAdultEidolonWyrm = false; public static bool downedGSS = false; public static bool downedCLAM = false; public static bool downedCLAMHardMode = false; @@ -196,9 +197,8 @@ namespace CalamityMod.World public override void Initialize() { if (CalamityConfig.Instance.NerfExpertPillars) - { NPC.LunarShieldPowerExpert = 100; - } + CalamityGlobalNPC.holyBoss = -1; CalamityGlobalNPC.doughnutBoss = -1; CalamityGlobalNPC.voidBoss = -1; @@ -276,6 +276,7 @@ namespace CalamityMod.World downedSentinel3 = false; downedYharon = false; downedSCal = false; + downedAdultEidolonWyrm = false; downedCLAM = false; downedCLAMHardMode = false; downedBumble = false; @@ -343,6 +344,8 @@ namespace CalamityMod.World downed.Add("yharon"); if (downedSCal) downed.Add("supremeCalamitas"); + if (downedAdultEidolonWyrm) + downed.Add("adultEidolonWyrm"); if (downedBumble) downed.Add("bumblebirb"); if (downedCrabulon) @@ -500,6 +503,7 @@ namespace CalamityMod.World downedSecondSentinels = downed.Contains("secondSentinels"); downedYharon = downed.Contains("yharon"); downedSCal = downed.Contains("supremeCalamitas"); + downedAdultEidolonWyrm = downed.Contains("adultEidolonWyrm"); downedBumble = downed.Contains("bumblebirb"); downedCrabulon = downed.Contains("crabulon"); downedBetsy = downed.Contains("betsy"); @@ -681,6 +685,8 @@ namespace CalamityMod.World BitsByte flags11 = reader.ReadByte(); malice = flags11[0]; + HasGeneratedLuminitePlanetoids = flags11[1]; + downedAdultEidolonWyrm = flags11[2]; } else { @@ -787,13 +793,18 @@ namespace CalamityMod.World flags10[0] = anglerName; flags10[1] = clothierName; flags10[2] = encounteredOldDuke; - flags10[3] = malice; - flags10[4] = HasGeneratedLuminitePlanetoids; + flags10[3] = false; + flags10[4] = false; flags10[5] = false; flags10[6] = false; flags10[7] = false; - writer.Write(flags); + BitsByte flags11 = new BitsByte(); + flags11[0] = malice; + flags11[1] = HasGeneratedLuminitePlanetoids; + flags11[2] = downedAdultEidolonWyrm; + + writer.Write(flags); writer.Write(flags2); writer.Write(flags3); writer.Write(flags4); @@ -803,6 +814,7 @@ namespace CalamityMod.World writer.Write(flags8); writer.Write(flags9); writer.Write(flags10); + writer.Write(flags11); writer.Write(abyssChasmBottom); writer.Write(acidRainPoints); writer.Write(Reforges); @@ -908,13 +920,18 @@ namespace CalamityMod.World anglerName = flags10[0]; clothierName = flags10[1]; encounteredOldDuke = flags10[2]; - malice = flags10[3]; - HasGeneratedLuminitePlanetoids = flags10[4]; + _ = flags10[3]; + _ = flags10[4]; _ = flags10[5]; _ = flags10[6]; _ = flags10[7]; - abyssChasmBottom = reader.ReadInt32(); + BitsByte flags11 = reader.ReadByte(); + malice = flags11[0]; + HasGeneratedLuminitePlanetoids = flags11[1]; + downedAdultEidolonWyrm = flags11[2]; + + abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); Reforges = reader.ReadInt32(); MoneyStolenByBandit = reader.ReadInt32();