diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index b3053e247c..a5a3331c8a 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -338,9 +338,6 @@ namespace CalamityMod.Balancing // 50% resist to Eidolic Wail. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 35% resist to Venusian Trident's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); - // 25% resist to Corinth Prime's Grenades. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); diff --git a/Buffs/DamageOverTime/RancorBurn.cs b/Buffs/DamageOverTime/RancorBurn.cs deleted file mode 100644 index cab69f7bf8..0000000000 --- a/Buffs/DamageOverTime/RancorBurn.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class RancorBurn : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().RancorBurnTime < npc.buffTime[buffIndex]) - npc.Calamity().RancorBurnTime = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; - } - } -} diff --git a/Buffs/DamageOverTime/RancorBurn.png b/Buffs/DamageOverTime/RancorBurn.png deleted file mode 100644 index f7e99e7e26..0000000000 Binary files a/Buffs/DamageOverTime/RancorBurn.png and /dev/null differ diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 7a80aadb2a..384231f977 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Accessories // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 549733c0b9..61c6dbf9cc 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.ShadowFlame] = true; player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; } } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 4f7c014cc6..52d7328429 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddRecipeGroup("AnySilverBar", 10). + AddIngredient(3). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index ec7d8b167f..594b9b5626 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Armor.Fearmonger BuffID.Frostburn, BuffID.CursedInferno, BuffID.ShadowFlame, //doesn't do anything - BuffID.Daybreak, //doesn't do anything + ModContent.BuffType(), BuffID.Burning, ModContent.BuffType(), ModContent.BuffType(), diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index c4fe0204bc..d9bd11290a 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -95,8 +95,8 @@ namespace CalamityMod.Items public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddRecipeGroup("IronBar", 10). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 662a70a79b..98e581a6a0 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddIngredient(10). + AddIngredient(2). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index f50734ad0f..fe93d842ff 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -3,6 +3,8 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,23 +22,40 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 60; - Item.damage = 260; + Item.damage = 115; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 60; + Item.useTime = 3; + Item.useAnimation = 45; + Item.reuseDelay = 75; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; + Item.knockBack = 20f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.UseSound = SoundID.Item43; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/PhantasmalFuryShoot") with { Volume = 0.6f, PitchVariance = 0.15f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 6f; Item.rare = ModContent.RarityType(); } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectileDirect(source, position + velocity * 13, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.8f, 1.1f), ModContent.ProjectileType(), damage, 0, player.whoAmI, 0f, 0f); + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectileDirect(source, position + velocity * 13, velocity.RotatedByRandom(0.4f), ModContent.ProjectileType(), damage / 2, 0, player.whoAmI, 0f, 0f); + } + for (int i = 0; i < 2; i++) + { + Dust chargefull = Dust.NewDustPerfect(position + velocity * 13, 267); + chargefull.velocity = velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(1f, 4); + chargefull.scale = Main.rand.NextFloat(0.5f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Color.Aqua, 0.3f); + } + return false; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 593ac52488..0cd4425a84 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -20,19 +20,19 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 56; - Item.damage = 280; + Item.damage = 190; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 14; - Item.useAnimation = 14; + Item.mana = 10; + Item.useTime = 12; + Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 8f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = 5f; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 275e0f2306..f4c89dbcc5 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 68; - Item.damage = 256; + Item.damage = 2156; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 40; + Item.useTime = 65; + Item.useAnimation = 65; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 19f; + Item.shootSpeed = 13f; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index 50d0e9b31b..38d580285a 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 36; - Item.height = 34; + Item.height = 36; Item.damage = 37; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/AshenStalactite.png b/Items/Weapons/Rogue/AshenStalactite.png index aafd03c7af..7eda8b46b2 100644 Binary files a/Items/Weapons/Rogue/AshenStalactite.png and b/Items/Weapons/Rogue/AshenStalactite.png differ diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index e17e158a74..c275a75dde 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddRecipeGroup("AnySilverBar", 10). + AddIngredient(3). AddTile(TileID.Anvils). Register(); } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index f37881d4da..546fec1f08 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -622,11 +622,6 @@ Zerg: { Description: Spawn rates are greatly boosted } -RancorBurn: { - DisplayName: Rancor Burn - Description: Burning -} - AbyssalDivingSuitBuff: { DisplayName: Abyssal Diving Suit Description: You are made of metal diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index ac617a0f5e..4e2b2e3f22 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -391,9 +391,8 @@ GruesomeEminence: { DisplayName: Gruesome Eminence Tooltip: ''' - Summons a gaseous conglomeration of spirits near the cursor - At first, the spirits will fly wildly. This can hurt enemies and players - However, over time they will begin to accumulate to create a single, controllable monstrosity + Summons a gaseous conglomeration of spirits near the cursor that fly around wildly + Over time, the spirits accumulate to create a single, controllable monstrosity [c/C61B40:'The spirits of the amalgam could never pass on to their desired afterlife,] [c/C61B40:Tainted and melded by rage as they were.'] ''' @@ -596,7 +595,7 @@ ParasiticSceptor: { PhantasmalFury: { DisplayName: Phantasmal Fury - Tooltip: Casts a phantasmal bolt that explodes into more bolts + Tooltip: Casts a vortex of homing souls around you that repels enemies and will fly towards your cursor after a few seconds } PhoenixFlameBarrage: { @@ -682,7 +681,7 @@ Rancor: { Tooltip: ''' Casts a magic circle that charges energy and eventually releases a powerful laser burst of controlled maleficent magic - The laser causes arms and searing lava to appear on surfaces it touches which harm both you and enemies + The laser causes arms and searing lava to appear on surfaces it touches [c/C61B40:'Forgiveness can only heal so much,] [c/C61B40:If the recipient has not yet forgiven themselves.'] ''' @@ -751,7 +750,7 @@ ShaderainStaff: { ShadowboltStaff: { DisplayName: Shadowbolt Staff - Tooltip: The more tiles and enemies the beam bounces off of or travels through the more damage the beam does + Tooltip: Fires a shadow beam that creates a platform to redirect itself back at enemies for increased damage } ShiftingSands: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index d0a381c6fa..50131e4b99 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -519,9 +519,10 @@ Metastasis: { Tooltip: ''' Summons a Sepulcher to fight for you - While the Sepulcher is active brimstone hearts will begin to appear and orbit you - It will attempt to attack you more and more frequently depending on how many hearts are present - It takes up 4 minion slots and it can only be summoned once + While the Sepulcher is active, brimstone hearts will begin to appear and orbit you + When too many hearts are present, it will interrupt attacking to attack the hearts instead + This happens more frequently depending on how many hearts are present + Requires 4 minion slots to use and can only be summoned once [c/C61B40:A contemplated possible future of the cosmic serpent,] [c/C61B40:A gruesome warning for those blinded by the hunger for power.] ''' diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index b52c15e978..4511d4cfa3 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -616,6 +616,7 @@ DraedonFacility: Other minor research projects Abyss: Disposing of Silva's remains SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock +AuricLandMines: Setting god killing traps // Hold Shift tooltip default HoldShiftTooltipExtensionIndicator: Hold "Left Shift" for more HoldShiftTooltipReplacementIndicator: Hold "Left Shift" for details diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index cde04bd8a6..70d09800df 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5,12 +5,12 @@ using System.Reflection; using CalamityMod.Balancing; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Tools; @@ -299,7 +299,7 @@ namespace CalamityMod.NPCs public int vulnerabilityHex = 0; public int banishingFire = 0; public int wither = 0; - public int RancorBurnTime = 0; + public int ashesOnDeath = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -523,7 +523,7 @@ namespace CalamityMod.NPCs myClone.vulnerabilityHex = vulnerabilityHex; myClone.banishingFire = banishingFire; myClone.wither = wither; - myClone.RancorBurnTime = RancorBurnTime; + myClone.ashesOnDeath = ashesOnDeath; // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; @@ -5291,8 +5291,8 @@ namespace CalamityMod.NPCs banishingFire--; if (wither > 0) wither--; - if (RancorBurnTime > 0) - RancorBurnTime--; + if (ashesOnDeath > 0) + ashesOnDeath--; if (cobaltNerfTimer > 0) cobaltNerfTimer--; @@ -5376,7 +5376,7 @@ namespace CalamityMod.NPCs { SoundEngine.PlaySound(SoundID.Item49, Main.LocalPlayer.Center); Vector2 shardVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 7.5f; - int damage = 20; + int damage = Main.LocalPlayer.ApplyArmorAccDamageBonusesTo(20); Projectile.NewProjectile(npc.GetSource_FromThis(), Main.LocalPlayer.Center, shardVel, ProjectileType(), damage, 5f, Main.myPlayer); } } @@ -5392,6 +5392,7 @@ namespace CalamityMod.NPCs if (player.miscCounter % frequency == 0) { int sDamage = strongerShock ? 50 : 10; + sDamage = player.ApplyArmorAccDamageBonusesTo(sDamage); Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 5f; Projectile spark = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, velocity, ProjectileType(), sDamage, 0f, player.whoAmI, 0f, 1f); spark.timeLeft = 120; @@ -5954,7 +5955,7 @@ namespace CalamityMod.NPCs modifiers.ScalingBonusDamage += (empowered ? 0.4f : 0.2f) * TagDamageMult; if (Main.netMode != NetmodeID.Server) { - var color = ProvUtils.GetProjectileColor((int)(Main.dayTime ? Providence.Providence.BossMode.Day : Providence.Providence.BossMode.Night), 0); + var color = ProvUtils.GetDayNightColor(!Main.dayTime, 0); float power = Math.Min(npc.height / 100f, 3f); var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); @@ -6019,7 +6020,7 @@ namespace CalamityMod.NPCs #region Hit Effect public override void HitEffect(NPC npc, NPC.HitInfo hit) { - if (npc.life <= 0 && npc.Organic() && RancorBurnTime > 0) + if (npc.life <= 0 && npc.Organic() && ashesOnDeath > 0) DeathAshParticle.CreateAshesFromNPC(npc); // Cultist shield flicker @@ -6593,6 +6594,20 @@ namespace CalamityMod.NPCs if (absorberAffliction > 0) AbsorberAffliction.DrawEffects(npc, ref drawColor); + // Rancor's burn effect + if (ashesOnDeath > 0) + { + if (Main.rand.NextBool(4)) + { + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0.475f); + } + if (Main.rand.NextBool(6)) + { + Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f)); + RancorLavaMetaball.SpawnParticle(randomPosition, Main.rand.NextFloat(30f, 37f)); + } + } + if (astralInfection > 0) AstralInfectionDebuff.DrawEffects(npc, ref drawColor); @@ -6857,7 +6872,6 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight > 0), ("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither > 0), ("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().pFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/RancorBurn", NPC => NPC.Calamity().RancorBurnTime > 0), ("CalamityMod/Buffs/DamageOverTime/RiptideDebuff", NPC => NPC.Calamity().rTide > 0), ("CalamityMod/Buffs/DamageOverTime/SagePoison", NPC => NPC.Calamity().sagePoisonTime > 0), ("CalamityMod/Buffs/DamageOverTime/ShellfishClaps", NPC => NPC.Calamity().shellfishVore > 0), diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index 3816d66fed..d92df384c7 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -45,8 +45,6 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) => NPC.lifeMax = 50000; - public override void AI() { NPC.Opacity = Utils.GetLerpValue(0f, 25f, Time, true); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index a0ec072864..e190c43eef 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -1073,12 +1073,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; - if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - NPC.DrawBackglow(ProvUtils.GetProjectileColor((int)mode, 0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetProjectileColor((int)mode, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index c5829443b7..b7df246a38 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -796,9 +796,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; - NPC.DrawBackglow(ProvUtils.GetProjectileColor((int)mode, 0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetProjectileColor((int)mode, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 2f5ac58127..9414e06ee0 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -514,9 +514,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; - NPC.DrawBackglow(ProvUtils.GetProjectileColor((int)mode, 0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetProjectileColor((int)mode, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, overrideColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 06fe1f97b8..87c76906fb 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -156,12 +156,9 @@ namespace CalamityMod.NPCs.Providence } } - Providence.BossMode mode = Providence.BossMode.Day; - if (!Main.dayTime) mode = Providence.BossMode.Night; + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - NPC.DrawBackglow(ProvUtils.GetProjectileColor((int)mode, 0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - - spriteBatch.Draw(texture2D15, vector43, NPC.frame, ProvUtils.GetProjectileColor((int)mode, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 898929f843..624647f339 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -163,12 +163,9 @@ namespace CalamityMod.NPCs.Providence } } - Providence.BossMode mode = Providence.BossMode.Day; - if (!Main.dayTime) mode = Providence.BossMode.Night; + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - NPC.DrawBackglow(ProvUtils.GetProjectileColor((int)mode, 0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetProjectileColor((int)mode, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, violetLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index f12f5713c4..2441f94f06 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -158,12 +158,9 @@ namespace CalamityMod.NPCs.Providence } } - Providence.BossMode mode = Providence.BossMode.Day; - if (!Main.dayTime) mode = Providence.BossMode.Night; + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - NPC.DrawBackglow(ProvUtils.GetProjectileColor((int)mode, 0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetProjectileColor((int)mode, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index bfb37e96d4..567ad13fc1 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -78,16 +78,9 @@ namespace CalamityMod.NPCs.Providence { Night = -1, Day = 0, - Red = 1, - Orange = 2, - Yellow = 3, - Green = 4, - Blue = 5, - Violet = 6 + Rainbow = 1, } - public int colorShiftTimer = -1; - Color HighFireColor = new Color(255, 191, 73); Color LowFireColor = new Color(116, 45, 23); @@ -298,7 +291,6 @@ namespace CalamityMod.NPCs.Providence writer.Write(text); writer.Write(useDefenseFrames); writer.Write(biomeType); - writer.Write(colorShiftTimer); writer.Write(phaseChange); writer.Write(frameUsed); writer.Write(healTimer); @@ -324,7 +316,6 @@ namespace CalamityMod.NPCs.Providence text = reader.ReadBoolean(); useDefenseFrames = reader.ReadBoolean(); biomeType = reader.ReadInt32(); - colorShiftTimer = reader.ReadInt32(); phaseChange = reader.ReadInt32(); frameUsed = reader.ReadInt32(); healTimer = reader.ReadInt32(); @@ -354,9 +345,6 @@ namespace CalamityMod.NPCs.Providence public override void AI() { - // Local helper variable to get the current boss mode without having to use the magic number version - int currentMode = (int)NPC.localAI[1]; - // Set the border drawing to true if it isn't set to true // Can happen when another mod sets to false for a difficulty and that difficulty is then toggled off. shouldDrawInfernoBorder = true; @@ -384,25 +372,9 @@ namespace CalamityMod.NPCs.Providence bool bossRush = BossRushEvent.BossRushActive; bool getFuckedAI = Main.zenithWorld; - int timeToShift = 30; //Switches color every half-second if (getFuckedAI) - { - colorShiftTimer++; - - if (colorShiftTimer == -1) //Initiate - { - NPC.localAI[1] = (float)BossMode.Red; - colorShiftTimer = 0; - } - else if (colorShiftTimer >= timeToShift) - { - NPC.localAI[1]++; - if (NPC.localAI[1] > (float)BossMode.Violet) - NPC.localAI[1] = (float)BossMode.Red; - colorShiftTimer = 0; - } - } - else if ((!Main.dayTime && !Main.remixWorld) || bossRush) // Normal Night time activity + NPC.localAI[1] = (float)BossMode.Rainbow; + else if (!ProvUtils.DayAI()) // Normal Night time activity NPC.localAI[1] = (float)BossMode.Night; else NPC.localAI[1] = (float)BossMode.Day; @@ -453,7 +425,9 @@ namespace CalamityMod.NPCs.Providence // Increase all projectile damage at night, but reduce to 0 for Zenith int projectileDamageMult = 1; - if (nightAI) + if (getFuckedAI) + projectileDamageMult = 0; + else if (nightAI) projectileDamageMult = 2; NPC.Calamity().CurrentlyEnraged = !bossRush && nightAI; @@ -469,7 +443,7 @@ namespace CalamityMod.NPCs.Providence int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; // Change dust type at night - int dustType = ProvUtils.GetDustID(NPC.localAI[1]); + int dustType = ProvUtils.GetDustID(); // Phase times float phaseTime = nightAI ? (240f - 60f * (1f - lifeRatio)) : 300f; @@ -511,9 +485,9 @@ namespace CalamityMod.NPCs.Providence float burnIntensity = CalculateBurnIntensity(attackDelayAfterCocoon); // Color determination - Color hiColor = ProvUtils.GetProjectileColor(currentMode, 0); - Color medColor = ProvUtils.GetProjectileColor(currentMode, 255); - Color loColor = ProvUtils.GetProjectileColor(currentMode, 255, true); + Color hiColor = ProvUtils.GetProjectileColor(0); + Color medColor = ProvUtils.GetProjectileColor(255); + Color loColor = ProvUtils.GetProjectileColor(255, true); if (!player.dead && player.active && !player.creativeGodMode && !Dying) { @@ -857,10 +831,7 @@ namespace CalamityMod.NPCs.Providence { // Slowly drift down when spawning if (spawnAnimation) - { - colorShiftTimer++; // Also double the shift speed in the mean time :) NPC.velocity = Vector2.Zero; - } else { // Slows down while firing Holy Rays. It would've not slowed down for the Zenith seed but apparently it was too fast (shockers). @@ -1133,8 +1104,8 @@ namespace CalamityMod.NPCs.Providence } CalamityUtils.AddScreenshakeAt(NPC.Center, 10, 2000); - Color hColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 255, false); - Color lColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 0, true); + Color hColor = ProvUtils.GetProjectileColor(255, false); + Color lColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 30; i++) { @@ -1852,8 +1823,8 @@ namespace CalamityMod.NPCs.Providence { CalamityUtils.AddScreenshakeAt(NPC.Center, 5, 2000); - Color hiColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 255, false); - Color loColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 0, true); + Color hiColor = ProvUtils.GetProjectileColor( 255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 30; i++) { @@ -1958,7 +1929,7 @@ namespace CalamityMod.NPCs.Providence float shorterDistanceFade = Utils.GetLerpValue(0f, 120f, aiTimer, true); // Distance does not get shorter if in GFB / Guardians are alive - if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Red) + if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Rainbow) { maxDistance = baseDistance; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) @@ -2025,8 +1996,8 @@ namespace CalamityMod.NPCs.Providence { CalamityUtils.AddScreenshakeAt(NPC.Center, 10, 2000); - Color hiColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 255, false); - Color loColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 30; i++) { @@ -2187,7 +2158,7 @@ namespace CalamityMod.NPCs.Providence { int frameY = (int)(NPC.Calamity().newAI[3] / 4) % 4; float sc1 = MathHelper.Lerp(1, 0, sc); - Main.EntitySpriteDraw(orbTex.Value, NPC.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(MathHelper.Lerp(0f, 10f, sc)), 0).RotatedByRandom(MathHelper.TwoPi), orbTex.Frame(), ProvUtils.GetProjectileColor((int)NPC.localAI[1], 0, false).MultiplyRGBA(new Color(sc * 45f, sc * 11f, sc * 22f, 0f)), 0f, orbTex.Frame().Center(), (sc * 4.4f) + (float)(Math.Cos((float)NPC.Calamity().newAI[3] / 10) * sc), SpriteEffects.None); + Main.EntitySpriteDraw(orbTex.Value, NPC.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(MathHelper.Lerp(0f, 10f, sc)), 0).RotatedByRandom(MathHelper.TwoPi), orbTex.Frame(), ProvUtils.GetProjectileColor(0, false).MultiplyRGBA(new Color(sc * 45f, sc * 11f, sc * 22f, 0f)), 0f, orbTex.Frame().Center(), (sc * 4.4f) + (float)(Math.Cos((float)NPC.Calamity().newAI[3] / 10) * sc), SpriteEffects.None); } } @@ -2269,41 +2240,43 @@ namespace CalamityMod.NPCs.Providence // Draw the glowmask textures + their afterimages // These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. - Color WingColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 0); // Default to day + Color WingColor = ProvUtils.GetProjectileColor(0); // Default to day Color CrystalColor = Color.Violet; - switch (NPC.localAI[1]) + + if (NPC.localAI[1] == (float)BossMode.Rainbow) { - case (float)BossMode.Red: - WingColor = Color.Red; - CrystalColor = Color.BlueViolet; - break; - - case (float)BossMode.Orange: - WingColor = Color.Orange; - CrystalColor = Color.HotPink; - break; - - case (float)BossMode.Yellow: // Same as day - break; - - case (float)BossMode.Green: - WingColor = Color.Green; - CrystalColor = Color.Gold; - break; - - case (float)BossMode.Blue: // Same as night - case (float)BossMode.Night: - WingColor = Color.Cyan; - CrystalColor = Color.BlueViolet; - break; - - case (float)BossMode.Violet: + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + { WingColor = Color.Magenta; CrystalColor = Color.GreenYellow; - break; - - default: - break; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + { + WingColor = Color.Cyan; + CrystalColor = Color.BlueViolet; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + { + WingColor = Color.Green; + CrystalColor = Color.Gold; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + CrystalColor = Color.Violet; + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + { + WingColor = Color.Orange; + CrystalColor = Color.HotPink; + } + else // Red + { + WingColor = Color.Red; + CrystalColor = Color.BlueViolet; + } + } + else if (NPC.localAI[1] == (float)BossMode.Night) + { + WingColor = Color.Cyan; + CrystalColor = Color.BlueViolet; } Color BaseWingColor = Color.Lerp(WingColor, BaseColor, Brightness) * NPC.Opacity; @@ -2314,13 +2287,13 @@ namespace CalamityMod.NPCs.Providence BaseCrystalColor = colorOverride.Value; } - Color GlowWingColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], NPC.GetAlpha(drawColor), true); + Color GlowWingColor = ProvUtils.GetProjectileColor(NPC.GetAlpha(drawColor), true); if (CalamityConfig.Instance.Afterimages) { for (int j = 1; j < maxAfterimages; j++) { - Color AfterimageWingColor = ProvUtils.GetProjectileColor((int)NPC.localAI[1], 0, true); + Color AfterimageWingColor = ProvUtils.GetProjectileColor(0, true); AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); AfterimageWingColor *= (maxAfterimages - j) / 15f; @@ -2487,7 +2460,7 @@ namespace CalamityMod.NPCs.Providence public override Color? GetAlpha(Color drawColor) { - return ProvUtils.GetProjectileColor((int)NPC.localAI[1], drawColor) * NPC.Opacity; + return ProvUtils.GetProjectileColor(drawColor) * NPC.Opacity; } public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -2514,7 +2487,7 @@ namespace CalamityMod.NPCs.Providence int pr = (int)(progress * 30f); - Color col = ProvUtils.GetProjectileColor((int)NPC.localAI[1], Color.DarkGray, true); + Color col = ProvUtils.GetProjectileColor(Color.DarkGray, true); col.A = 255; Main.EntitySpriteDraw(tex, NPC.Center + vec + new Vector2(0, 310) - Main.screenPosition + new Vector2(Main.rand.Next(-pr, pr) * 2, outset), new Rectangle(0, i * 2, tex.Width, 2), Color.Lerp(col, Color.White, progress * 2f).MultiplyRGBA(new Color(255, 255, 255, MathHelper.Lerp(progress, 1f, 0.2f) * 2f)), 0f, tex.Size() / 2f, 1f, SpriteEffects.None); @@ -2700,7 +2673,7 @@ namespace CalamityMod.NPCs.Providence SoundEngine.PlaySound(HurtSound, NPC.Center); } - int dustType = ProvUtils.GetDustID(NPC.localAI[1]); + int dustType = ProvUtils.GetDustID(); for (int k = 0; k < 15; k++) { int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); @@ -2853,11 +2826,26 @@ namespace CalamityMod.NPCs.Providence // These will be used for almost every single one of her projectiles, so it's useful to have. public static class ProvUtils { - public static Color GetProjectileColor(int Mode, Color givenLightColor, bool Outline = false) + public static bool DayAI() => (Main.IsItDay() || Main.remixWorld) && !Main.zenithWorld && !BossRushEvent.BossRushActive; + + // Simplified to day/night only. For PSC and Profaned Guardians + public static Color GetDayNightColor(int Alpha, bool Outline = false) => GetDayNightColor(!Main.IsItDay() && !Main.remixWorld, Alpha, Outline); + public static Color GetDayNightColor(bool Night, int Alpha, bool Outline = false) + { + Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day + + if (Night) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + + return FinalColor; + } + + public static Color GetProjectileColor(Color givenLightColor, bool Outline = false) { int alpha = 0; - if (!Outline && Mode == (int)Providence.BossMode.Yellow) + // Custom set alpha for GFB Yellow Mode + if (!Outline && Main.zenithWorld && Main.GlobalTimeWrappedHourly % 6f >= 2f && Main.GlobalTimeWrappedHourly % 6f < 3f) { float colorBrightness = (givenLightColor.R + givenLightColor.G + givenLightColor.B / 3) / 255f; alpha = (int)MathHelper.Lerp(0f, 155f, colorBrightness); @@ -2868,35 +2856,24 @@ namespace CalamityMod.NPCs.Providence } Color FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); // Default to day - switch (Mode) + + if (Main.zenithWorld) { - case (int)Providence.BossMode.Red: - FinalColor = new Color(250, 100, Outline ? 200 : 100, alpha); - break; - - case (int)Providence.BossMode.Orange: - FinalColor = new Color(250, 150, Outline ? 150 : 100, alpha); - break; - - case (int)Providence.BossMode.Yellow: // Same as day - break; - - case (int)Providence.BossMode.Green: - FinalColor = new Color(Outline ? 200 : 100, 250, 100, alpha); - break; - - case (int)Providence.BossMode.Blue: // Same as night - case (int)Providence.BossMode.Night: - FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); - break; - - case (int)Providence.BossMode.Violet: + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, alpha); - break; - - default: - break; + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + FinalColor = new Color(Outline ? 200 : 100, 250, 100, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + FinalColor = new Color(250, 150, Outline ? 150 : 100, alpha); + else // Red + FinalColor = new Color(250, 100, Outline ? 200 : 100, alpha); } + else if (!DayAI()) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); if (Outline) FinalColor *= 0.1f; @@ -2904,38 +2881,27 @@ namespace CalamityMod.NPCs.Providence return FinalColor; } - public static Color GetProjectileColor(int Mode, int Alpha, bool Outline = false) + public static Color GetProjectileColor(int Alpha, bool Outline = false) { Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day - switch (Mode) + + if (Main.zenithWorld) { - case (int)Providence.BossMode.Red: - FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); - break; - - case (int)Providence.BossMode.Orange: - FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); - break; - - case (int)Providence.BossMode.Yellow: // Same as day - break; - - case (int)Providence.BossMode.Green: - FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); - break; - - case (int)Providence.BossMode.Blue: // Same as night - case (int)Providence.BossMode.Night: - FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); - break; - - case (int)Providence.BossMode.Violet: + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, Alpha); - break; - - default: - break; + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); + else // Red + FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); } + else if (!DayAI()) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); if (Outline) FinalColor *= 0.1f; @@ -2943,88 +2909,92 @@ namespace CalamityMod.NPCs.Providence return FinalColor; } - public static int GetDustID(float Mode) + // Assign the night bool to turn it into a binary day/night state without accounting for GFB + public static int GetDustID(bool? Night = null) { int DustType = (int)CalamityDusts.ProfanedFire; // Default to day - switch (Mode) + + if (Night.HasValue) { - case (float)Providence.BossMode.Red: - DustType = DustID.RedTorch; - break; - - case (float)Providence.BossMode.Orange: - DustType = DustID.OrangeTorch; - break; - - case (float)Providence.BossMode.Yellow: // Same as day - break; - - case (float)Providence.BossMode.Green: - DustType = DustID.GreenTorch; - break; - - case (float)Providence.BossMode.Blue: // Same as night - case (float)Providence.BossMode.Night: + if (Night.Value) DustType = (int)CalamityDusts.Nightwither; - break; - - case (float)Providence.BossMode.Violet: - DustType = DustID.PurpleTorch; - break; - - default: - break; } + else if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + DustType = DustID.PurpleTorch; + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + DustType = (int)CalamityDusts.Nightwither; + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + DustType = DustID.GreenTorch; + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + DustType = (int)CalamityDusts.ProfanedFire; + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + DustType = DustID.OrangeTorch; + else // Red + DustType = DustID.RedTorch; + } + else if (!DayAI()) + DustType = (int)CalamityDusts.Nightwither; + return DustType; } + // Shortcut function for applying Burden Breaker-like negative healing to GFB Providence + public static void ApplyGFBDamage(Projectile proj, int BaseDuration, int NegativeHealValue) + { + int index = Player.FindClosest(proj.position, proj.width, proj.height); + Player player = Main.player[index]; + if (player is null) + return; + if (proj.Colliding(proj.Hitbox, player.Hitbox)) + ApplyDebuffs(player, BaseDuration, NegativeHealValue); + } + // Include debuffs inflicted by Providence's projectiles for all her forms // In the GFB seed, also includes negative healing - public static void ApplyHitEffects(Player Target, int Mode, int BaseDuration, int NegativeHealValue) + public static void ApplyDebuffs(Player Target, int BaseDuration, int NegativeHealValue = 0) { - int BuffType = ModContent.BuffType(); // Default to day - float Multiplier = 1f; // Used to counterbalance Cursed Inferno and Shadowflame + int BuffType = ModContent.BuffType(); // Default to non-GFB - // Day and Night Providence inflicts 16-80 damage of debuffs depending on attacks - // GFB Providence inflicts 24-120 damage (+50%) for half the colors, 26-130 (+62.5%) for another half - switch (Mode) + // All debuffs are adjusted to be 50% more powerful in GFB + float Multiplier = 1f; + if (Main.zenithWorld) { - case (int)Providence.BossMode.Red: - BuffType = ModContent.BuffType(); - break; - - case (int)Providence.BossMode.Orange: - BuffType = ModContent.BuffType(); - Multiplier = 0.5f; - break; - - case (int)Providence.BossMode.Yellow: // Same as day - break; - - case (int)Providence.BossMode.Green: - BuffType = BuffID.CursedInferno; - Multiplier = 0.75f; - break; - - case (int)Providence.BossMode.Blue: // Night Providence no longer inflicts a different debuff, but Blue GFB Providence does - BuffType = ModContent.BuffType(); - break; - case (int)Providence.BossMode.Night: //Same as Day, will inflict Holy Flames - break; - case (int)Providence.BossMode.Violet: + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + { BuffType = ModContent.BuffType(); - Multiplier = 0.60f; - break; - - default: - break; + Multiplier = 2f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + { + BuffType = ModContent.BuffType(); + Multiplier = 1.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + { + BuffType = BuffID.CursedInferno; + Multiplier = 2.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + { + BuffType = ModContent.BuffType(); + Multiplier = 1.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + BuffType = ModContent.BuffType(); + else // Red + { + BuffType = ModContent.BuffType(); + Multiplier = 2f; + } } Target.AddBuff(BuffType, (int)(BaseDuration * Multiplier)); // A. Specifically inflicts Vaporfied in quirky RGB Mode because it's a colorful debuff // B. Apply the negative healing - if (Mode >= (int)Providence.BossMode.Red) + if (Main.zenithWorld) { // Obligatory offensive guardian boosting negative heals if (CalamityGlobalNPC.holyBossAttacker != -1) diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs index b28c7f8f58..3f2cfc9766 100644 --- a/NPCs/SunkenSea/LostShoal.cs +++ b/NPCs/SunkenSea/LostShoal.cs @@ -87,6 +87,7 @@ namespace CalamityMod.NPCs.SunkenSea if (Main.rand.NextBool(50)) { Variant = (int)ShoalColor.Gold; + NPC.catchItem = ItemID.GoldCoin; } RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); @@ -342,6 +343,22 @@ namespace CalamityMod.NPCs.SunkenSea } } + public override void OnCaughtBy(Player player, Item item, bool failed) + { + // Gold shoals drop Gold Coins instead of ash when caught + // The shoal drops 1 coin by default while the extra coins are spawned here in a spread + if (!failed) + { + if (Variant == (int)ShoalColor.Gold) + { + for (int i = 0; i < Main.rand.Next(0, 5); i++) + { + Item.NewItem(NPC.GetSource_CatchEntity(NPC), NPC.getRect(), ItemID.GoldCoin); + } + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs index de2b390b52..38c002c8d3 100644 --- a/NPCs/SunkenSea/SandProwler.cs +++ b/NPCs/SunkenSea/SandProwler.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.SunkenSea { public class SandProwler : ModNPC { - public const int maxLength = 9; + public const int maxLength = 14; public float speed = 3f; public float turnSpeed = 0.0625f; bool TailSpawned = false; @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", PortraitPositionXOverride = 40, @@ -549,12 +549,18 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } + public override bool CheckActive() { return IsHead; } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); + + public static void DefineSandProwlerLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 4); + } public override void HitEffect(NPC.HitInfo hit) { diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs index e33c3c3b3e..12ae5ed946 100644 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -16,6 +16,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.GameContent.Bestiary; +using CalamityMod.NPCs.Crags; namespace CalamityMod.NPCs.SunkenSea { @@ -54,16 +55,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - + this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 0; NPCID.Sets.TrailCacheLength[NPC.type] = 60; NPCID.Sets.UsesNewTargetting[NPC.type] = true; @@ -274,7 +266,7 @@ namespace CalamityMod.NPCs.SunkenSea if (SnapTimer > 0f) { int snapTime = PeekingOut ? 45 : 32; - float idealSpeed = PeekingOut ? 1.75f : 8f; + float idealSpeed = PeekingOut ? 1.75f : 10f; float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; @@ -461,10 +453,7 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 4); - } + public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); public override void HitEffect(NPC.HitInfo hit) { @@ -481,5 +470,15 @@ namespace CalamityMod.NPCs.SunkenSea Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); } } + public override void OnKill() + { + // Increase the kill count of Sand Prowlers for the Bestiary + if (NPC.GetWereThereAnyInteractions()) + { + NPC nPC = new NPC(); + nPC.SetDefaults(ModContent.NPCType()); + Main.BestiaryTracker.Kills.RegisterKill(nPC); + } + } } } diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 398c4be829..0837b1a5ea 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -71,14 +71,12 @@ namespace CalamityMod.Projectiles.Boss float a = (float)Math.Sin(amount2 / 20) + 1; - int mode = (int)Providence.BossMode.Yellow; - - Color color = Color.Lerp(ProvUtils.GetProjectileColor(mode, 0, true), ProvUtils.GetProjectileColor(mode, 0, false), a); + Color color = Color.Lerp(ProvUtils.GetProjectileColor(0, true), ProvUtils.GetProjectileColor(0, false), a); bool underworld = Projectile.ai[0] == 2f; if (!Main.zenithWorld) { - if (Main.IsItDay()) + if (Main.IsItDay() || Main.remixWorld) { color.R = 255; if (underworld) diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 7ce92c1236..3dde54ea10 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -64,6 +64,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 320, 20); + Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); if (Projectile.timeLeft > TimeLeft - AccelerationTime) @@ -72,26 +74,6 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -105,15 +87,15 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 13; i++) { - GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(3f, 6f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); - GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-50f, 50f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(2f, 5f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(3f, 6f), ProvUtils.GetProjectileColor(255, false))); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-50f, 50f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(2f, 5f), ProvUtils.GetProjectileColor(255, false))); } started = true; } if (Projectile.localAI[0] == 0f) { - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int i = 0; i < 10; i++) { int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -131,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss if (Math.Abs(Projectile.velocity.X) > 0.2) Projectile.spriteDirection = -Projectile.direction; - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(50), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, false, 20, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(50), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, false, 20, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(255))); GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center + new Vector2(40, 0).RotatedBy(Vector2.Zero.AngleTo(-Projectile.velocity)) + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(1f, 3f), 150f)); if (Projectile.velocity.X < 0f) @@ -142,16 +124,16 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; Vector2 sc = Vector2.One; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor, true), 4f, sc, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, sc, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), sc, SpriteEffects.None, 0); return false; @@ -159,8 +141,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 30; i++) { @@ -177,7 +159,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 8 : 6; + int totalProjectiles = !ProvUtils.DayAI() ? 8 : 6; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) totalProjectiles *= 2; @@ -196,7 +178,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int j = 0; j < 4; j++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); @@ -213,20 +195,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 320, 20); + ProvUtils.ApplyDebuffs(target, 320); } } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 9a0afc1f4d..228eb43f73 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -37,37 +37,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - /* - * Day mode by default but syncs with the boss - * Uses maxPenetrate because it's kinda pointless for a boss projectile - * and it's convenient to copypaste without having to do adjustments - * If someone really feels like making a proper int for this purpose they can do it themselves - Iris - */ - - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - SquishAnimation += 0.06f; - SquishAnimation = MathHelper.Clamp(SquishAnimation, 0f, 1f); Projectile.ai[0] += 1f; @@ -80,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss { Vector2 center = Projectile.Center + new Vector2(0, -15); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(center, new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-4f, 2f)), false, 30, Main.rand.NextFloat(1f, 2.5f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(center, new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-4f, 2f)), false, 30, Main.rand.NextFloat(1f, 2.5f), ProvUtils.GetProjectileColor(255))); } float velocityY = -2f; @@ -111,25 +85,25 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { float squish = CalamityUtils.SineBumpEasing(SquishAnimation, 1) * 0.25f; - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor, true), 4f, new Vector2(Projectile.scale + squish, Projectile.scale - squish), texture, offset: new Vector2(0, (-22 * (1 - squish)))); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale + squish, Projectile.scale - squish), texture, offset: new Vector2(0, (-22 * (1 - squish)))); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, (framing / 2f) + 22), new Vector2(Projectile.scale + squish, Projectile.scale - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 25; i++) { @@ -149,20 +123,13 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 160, 20); + ProvUtils.ApplyDebuffs(target, 160); } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 4a926f2b67..c8a9dcbb94 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -35,40 +35,18 @@ namespace CalamityMod.Projectiles.Boss Projectile.Calamity().DealsDefenseDamage = true; } - public override void OnSpawn(IEntitySource source) - { - - } - public override void AI() { - Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 50); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); if (Projectile.ai[0] == 0f && BossRushEvent.BossRushActive) Projectile.velocity *= 1.25f; if (!started) { - Color cl = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); + Color cl = ProvUtils.GetProjectileColor(255); GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, cl, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); started = true; } @@ -98,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[1] += (Projectile.velocity.Length() / 20); - Color col = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); + Color col = ProvUtils.GetProjectileColor(255); float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); @@ -113,8 +91,8 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, true) * 4; - Color baseColor2 = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); + Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; + Color baseColor2 = ProvUtils.GetProjectileColor(255); baseColor.A = 0; baseColor *= lerpMult; baseColor2 *= lerpMult; @@ -147,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(50); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int d = 0; d < 5; d++) { int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -170,22 +148,15 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - - Projectile.Kill(); - } + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => Projectile.Kill(); public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 50); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 662997d9e1..c04e53c84b 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -35,36 +35,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 80, 20); + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.alpha -= (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 10 : 5; + Projectile.alpha -= !ProvUtils.DayAI() ? 10 : 5; if (Projectile.alpha <= 0) Projectile.Kill(); @@ -80,24 +61,24 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { Projectile.scale = 1.5f; - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor, true), 4f, new Vector2(Projectile.scale)); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale)); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 25; i++) { @@ -148,20 +129,13 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 20); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index dfed3decab..f85df4fe56 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -35,29 +35,10 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 80, 10); + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -82,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; playerDirection.Normalize(); playerDirection *= projVelocityMult; - float inertia = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 20f : 25f; + float inertia = !ProvUtils.DayAI() ? 20f : 25f; Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= projVelocityMult; @@ -90,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); if (Main.rand.NextBool()) { @@ -102,15 +83,15 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -124,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int i = 0; i < 5; i++) { int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -144,20 +125,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 10); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index c05e489fbb..72817641c2 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -36,29 +36,10 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); + Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Player player = Main.player[Projectile.owner]; Projectile.frameCounter++; @@ -75,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Y > velocityYCap) Projectile.velocity.Y = velocityYCap; - float velocityX = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 0.025f : 0.02f; + float velocityX = !ProvUtils.DayAI() ? 0.025f : 0.02f; if (Projectile.position.X + Projectile.width < player.position.X) { if (Projectile.velocity.X < 0f) @@ -89,13 +70,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X -= velocityX; } - float velocityXCap = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 10f : 8f; + float velocityXCap = !ProvUtils.DayAI() ? 10f : 8f; if (Projectile.velocity.X > velocityXCap || Projectile.velocity.X < -velocityXCap) Projectile.velocity.X *= 0.97f; float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); if (Main.rand.NextBool()) { @@ -107,23 +88,23 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 25; i++) { @@ -142,20 +123,13 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index df12252236..2cd2e6925c 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -55,26 +55,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); if (Projectile.localAI[0] == 0f) { @@ -86,14 +69,14 @@ namespace CalamityMod.Projectiles.Boss bool commanderSpear = Projectile.ai[0] == -1f; bool enragedCommanderSpear = Projectile.ai[0] == -2f; - float timeGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); + float timeGateValue = !ProvUtils.DayAI() ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); if (Projectile.ai[0] <= 0f) { Projectile.ai[1] += 1f; - float slowGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); + float slowGateValue = !ProvUtils.DayAI() ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); float fastGateValue = 30f; - float minVelocity = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); + float minVelocity = !ProvUtils.DayAI() ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); float maxVelocity = minVelocity * 4f; float extremeVelocity = maxVelocity * 2f; float deceleration = 0.95f; @@ -122,8 +105,8 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 0.2f : 0.1f; - float amplitude = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : 2f; + float frequency = !ProvUtils.DayAI() ? 0.2f : 0.1f; + float amplitude = !ProvUtils.DayAI() ? 4f : 2f; Projectile.ai[1] += frequency; @@ -145,49 +128,27 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; bool aimedSpear = Projectile.ai[0] > 0f; - int red = 255; - int green = 255; - int blue = 0; - switch (Projectile.maxPenetrate) - { - case (int)Providence.BossMode.Red: - red = 255; - green = aimedSpear ? 0 : 125; - blue = aimedSpear ? 0 : 255; - break; - case (int)Providence.BossMode.Orange: - red = 255; - green = 125; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Yellow: //Same as day - case (int)Providence.BossMode.Day: - red = 255; - green = aimedSpear ? 255 : 125; - blue = aimedSpear ? 25 : 125; - break; - case (int)Providence.BossMode.Green: - red = 0; - green = 255; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - red = aimedSpear ? 100 : 175; - green = aimedSpear ? 255 : 175; - blue = 255; - break; - case (int)Providence.BossMode.Violet: - red = aimedSpear ? 125 : 255; - green = aimedSpear ? 0 : 255; - blue = 125; - break; - default: - break; - } - Color baseColor = new Color(red, green, blue, 0); + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to day - GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity, false, 15, Main.rand.NextFloat(0.5f, 1.5f) * MathHelper.Clamp(Projectile.velocity.Length() / 15, 0f, 2f), aimedSpear ? baseColor : ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false))); + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + baseColor = new Color(aimedSpear ? 125 : 255, aimedSpear ? 0 : 255, 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + baseColor = new Color(0, 255, aimedSpear ? 0 : 175); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + baseColor = new Color(255, 125, aimedSpear ? 0 : 175); + else // Red + baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); + } + else if (!ProvUtils.DayAI()) + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity, false, 15, Main.rand.NextFloat(0.5f, 1.5f) * MathHelper.Clamp(Projectile.velocity.Length() / 15, 0f, 2f), aimedSpear ? baseColor : ProvUtils.GetProjectileColor(255, false))); } public override bool PreDraw(ref Color lightColor) @@ -195,53 +156,31 @@ namespace CalamityMod.Projectiles.Boss Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; bool aimedSpear = Projectile.ai[0] > 0f; - int red = 255; - int green = 255; - int blue = 0; - switch (Projectile.maxPenetrate) - { - case (int)Providence.BossMode.Red: - red = 255; - green = aimedSpear ? 0 : 125; - blue = aimedSpear ? 0 : 255; - break; - case (int)Providence.BossMode.Orange: - red = 255; - green = 125; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Yellow: //Same as day - case (int)Providence.BossMode.Day: - red = 255; - green = aimedSpear ? 255 : 125; - blue = aimedSpear ? 0 : 125; - break; - case (int)Providence.BossMode.Green: - red = 0; - green = 255; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - red = aimedSpear ? 100 : 175; - green = aimedSpear ? 255 : 175; - blue = 255; - break; - case (int)Providence.BossMode.Violet: - red = aimedSpear ? 125 : 255; - green = aimedSpear ? 0 : 255; - blue = 125; - break; - default: - break; - } - Color baseColor = new Color(red, green, blue, 0); + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to day Color baseColor2 = new Color(15, 35, 50, 0); + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + baseColor = new Color(aimedSpear ? 125 : 255, aimedSpear ? 0 : 255, 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + baseColor = new Color(0, 255, aimedSpear ? 0 : 175); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + baseColor = new Color(255, 125, aimedSpear ? 0 : 175); + else // Red + baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); + } + else if (!ProvUtils.DayAI()) + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + if (!aimedSpear) { - baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); - baseColor2 = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + baseColor = ProvUtils.GetProjectileColor(0); + baseColor2 = ProvUtils.GetProjectileColor(0, true); } Vector2 projDirection = Main.screenPosition - new Vector2(0f, Projectile.gfxOffY); @@ -274,25 +213,18 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); + ProvUtils.ApplyDebuffs(target, 120); } public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, false); + return ProvUtils.GetProjectileColor(0, false); } } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index bf3ea364de..ef0569297f 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -53,6 +53,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); if (Projectile.timeLeft > TimeLeft - AccelerationTime) @@ -61,26 +63,6 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -90,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); if (Projectile.localAI[1] == 0f) { for (int d = 0; d < 10; d++) @@ -130,7 +112,7 @@ namespace CalamityMod.Projectiles.Boss float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255))); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); if (Main.rand.NextBool()) { @@ -140,23 +122,23 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + return ProvUtils.GetProjectileColor(0); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 25; i++) { @@ -171,7 +153,7 @@ namespace CalamityMod.Projectiles.Boss } GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); - int blobAmt = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 9 : 6; + int blobAmt = !ProvUtils.DayAI() ? 9 : 6; if (Projectile.owner == Main.myPlayer) { Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y); @@ -189,20 +171,13 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18f, targetHitbox); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 160, 20); + ProvUtils.ApplyDebuffs(target, 160); } } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index e6c1d5ced5..6e1562fccd 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -37,30 +37,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 80, 10); + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Landing += 0.1f; - Landing = MathHelper.Clamp(Landing, 0f, 1f); colliding = Projectile.velocity.Y == 0f; @@ -115,12 +96,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + return ProvUtils.GetProjectileColor(0); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * (1 + Projectile.frame); float squish = CalamityUtils.SineBumpEasing(Landing, 1) * 0.5f; @@ -132,15 +113,15 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.PiOver2; } Vector2 vec = new Vector2(0, framing * squish); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, new Vector2(1 + squish, 1 - squish), texture, offset: vec); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.alpha, true), 4f, new Vector2(1 + squish, 1 - squish), texture, offset: vec); Main.spriteBatch.Draw(texture, Projectile.Center + vec - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), new Vector2(1 + squish, 1 - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 25; i++) { @@ -156,20 +137,13 @@ namespace CalamityMod.Projectiles.Boss GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f, 0.015f, 5)); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 10); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index c38db134b0..ecaaa25008 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -37,18 +37,6 @@ namespace CalamityMod.Projectiles.Boss { Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - if (Projectile.timeLeft < 510) Projectile.tileCollide = true; @@ -73,13 +61,13 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetDayNightColor(Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; @@ -87,8 +75,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255, false); - Color loColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0, true); + Color hiColor = ProvUtils.GetDayNightColor(255, false); + Color loColor = ProvUtils.GetDayNightColor(0, true); for (int i = 0; i < 25; i++) { diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 8718275f05..a90cc4a6a7 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -91,8 +91,6 @@ namespace CalamityMod.Projectiles.Boss Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - Projectile.position.X = proviTarget.Center.X - (Projectile.width / 2); Projectile.position.Y = proviTarget.Center.Y - (Projectile.height / 2) + proviTarget.gfxOffY - 360f; if (proviTarget.gravDir == -1f) @@ -113,7 +111,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Color BaseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + Color BaseColor = ProvUtils.GetProjectileColor(0); float Brightness = 0.8f; Color DustColor = Color.Lerp(BaseColor, Color.White, Brightness); Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, DustColor, 1f)]; @@ -132,7 +130,7 @@ namespace CalamityMod.Projectiles.Boss // At day, fires every 300 frames but lasts 1500-3600 frames. // At night, fires every 30 framges but lasts 210 frames. // In GFB, fires at night rate for the first 210 frames, then at day rate for the next 1500. - bool dayAI = Projectile.maxPenetrate == (int)Providence.BossMode.Day || (Projectile.maxPenetrate >= (int)Providence.BossMode.Red && Projectile.timeLeft < 1500); + bool dayAI = ProvUtils.DayAI() || (Main.zenithWorld && Projectile.timeLeft < 1500); if (Projectile.localAI[0] >= (dayAI ? 300f : 30f)) { diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 65f14061af..bfc1e781c0 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -51,23 +51,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 0, 10); + bool healerGuardianAlive = true; if (CalamityGlobalNPC.doughnutBossHealer < 0 || !Main.npc[CalamityGlobalNPC.doughnutBossHealer].active) healerGuardianAlive = false; Lighting.AddLight(Projectile.Center, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - // Night AI or Guardian Healer - if (Projectile.maxPenetrate != (int)Providence.BossMode.Day || healerGuardianAlive) + if (!ProvUtils.DayAI() || healerGuardianAlive) Projectile.extraUpdates = 1; if (Projectile.timeLeft < 300) @@ -232,21 +225,5 @@ namespace CalamityMod.Projectiles.Boss } public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity); - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - // In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) - return; - - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 0, 10); - } } } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 49a1594ac9..72a56060bf 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -58,26 +58,7 @@ namespace CalamityMod.Projectiles.Boss { ExtraWidth = Projectile.ai[2]; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - bool scissorLasers = CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day); + bool scissorLasers = CalamityWorld.revenge || !ProvUtils.DayAI(); Vector2? vector78 = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) @@ -103,6 +84,9 @@ namespace CalamityMod.Projectiles.Boss return; } + if (projScale == 1f) + ProvUtils.ApplyGFBDamage(Projectile, 400, 20); + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * projScale; if (Projectile.scale > projScale) Projectile.scale = projScale; @@ -131,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) rayLength = 2400f; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], rayLength, 0.5f); // Length of laser, linear interpolation Vector2 dustRotation = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int j = 0; j < 2; j++) @@ -158,13 +142,13 @@ namespace CalamityMod.Projectiles.Boss for (float i = 0; i < Projectile.localAI[1]; i += Main.rand.NextFloat(15, 30)) { - GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(30 * ExtraWidth), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)) + (Projectile.velocity * i), Projectile.velocity * 5, false, 5, Main.rand.NextFloat(0.5f, 1.5f), ProvUtils.GetProjectileColor((int)Projectile.maxPenetrate, 255), false)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(30 * ExtraWidth), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)) + (Projectile.velocity * i), Projectile.velocity * 5, false, 5, Main.rand.NextFloat(0.5f, 1.5f), ProvUtils.GetProjectileColor(255), false)); } } public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) @@ -174,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 scale = new Vector2(Projectile.scale * ExtraWidth, Projectile.scale); - bool dayTime = Projectile.maxPenetrate == (int)Providence.BossMode.Day; + bool dayTime = ProvUtils.DayAI(); Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : @@ -183,7 +167,7 @@ namespace CalamityMod.Projectiles.Boss ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float rayDrawLength = Projectile.localAI[1]; //length of laser - Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, lightColor); + Color baseColor = ProvUtils.GetProjectileColor(lightColor); Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, scale, SpriteEffects.None, 0); @@ -196,7 +180,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[2]++; - Color glowColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + Color glowColor = ProvUtils.GetProjectileColor(0); Main.EntitySpriteDraw(GlowBallTexture, Projectile.Center - Main.screenPosition, GlowBallTexture.Frame(), glowColor, 0f, GlowBallTexture.Frame().Center(), Projectile.scale / 1.5f * ExtraWidth, SpriteEffects.None); Main.EntitySpriteDraw(GlowRingTexture, Projectile.Center - Main.screenPosition, GlowRingTexture.Frame(), glowColor, 0f, GlowRingTexture.Frame().Center(), Projectile.scale / MathHelper.Lerp(1.5f, 1f, (float)Math.Sin(Projectile.localAI[2] / 20f) * 0.5f) * ExtraWidth, SpriteEffects.None); @@ -250,20 +234,13 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - // In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 400, 20); + ProvUtils.ApplyDebuffs(target, 400); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index 42758283fe..f5554e4fb8 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -30,26 +30,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - - if (CalamityGlobalNPC.holyBoss != -1) - { - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - - if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - - Color c = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); + Color c = ProvUtils.GetProjectileColor(255); GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity / 2f, false, 10, 0.5f * Projectile.ai[2], c)); GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, 0.5f * Projectile.ai[2], 150, Main.rand.NextFloat(-0.01f, 0.01f))); diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 99543487e8..32a30db723 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -58,82 +58,46 @@ namespace CalamityMod.Projectiles.Magic float laserNormalize; Vector2 projDirection = Vector2.Zero; float laserTimer; - float y; + float yOffset; float laserRotationSpeed; float scaleFactor6; - Color color = new Color(1, 1, 1, 127); + Color color = GetBeamColor((int)projectile2.ai[0], (int)Projectile.ai[0]); Projectile.Opacity = 1f; - if (projectile2.ai[0] < 720f) + if (projectile2.ai[0] < 360f) { - laserTimer = projectile2.ai[0] / 1440f; - y = 6f + projectile2.ai[0] / 720f * 7f; - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - - if (projectile2.ai[0] < 480f) + laserTimer = projectile2.ai[0] / 720f; + yOffset = 6f + projectile2.ai[0] / 360f * 7f; + if (projectile2.ai[0] < 240f) laserRotationSpeed = 1.75f; else - laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); - - scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; + laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 240f) / 120f); + scaleFactor6 = -2f - projectile2.ai[0] / 360f * 5f; } else { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - colorLimit = 255f; - - switch ((int)Projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); - break; - } - laserTimer = 0.5f; laserRotationSpeed = 10.875f; - y = 13f; + yOffset = 13f; scaleFactor6 = -7f; } float laserDirection = (projectile2.ai[0] + laserPosition * laserRotationSpeed) / (laserRotationSpeed * 6f) * MathHelper.TwoPi; laserNormalize = Vector2.UnitY.RotatedBy(laserDirection).Y * (MathHelper.Pi / 6) * laserTimer * 0.33f; - projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation()); + projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, yOffset)).RotatedBy(projectile2.velocity.ToRotation()); Projectile.position = projectile2.Center + aimDirection * 16f - Projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)Projectile.ai[1]].gfxOffY); Projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; Projectile.position += projDirection; Projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(laserNormalize); Projectile.scale = 1.5f * (1.5f - laserTimer); - // Takes 360 frames to reach normal damage - float amount = projectile2.ai[0] / 1200f; + // Takes 180 frames to reach normal damage + float amount = projectile2.ai[0] / 600f; if (amount > 1f) amount = 1f; Projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); - if (projectile2.ai[0] >= 720f) + if (projectile2.ai[0] >= 360f) chargeUpCenter = new Vector2?(projectile2.Center); if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) @@ -212,55 +176,15 @@ namespace CalamityMod.Projectiles.Magic Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float drawArea = Projectile.localAI[1]; Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; - Color color = new Color(1, 1, 1, 127); - if (projectile2.ai[0] < 720f) - { - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)Projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); - break; - } - } + Color color = GetBeamColor((int)projectile2.ai[0], (int)Projectile.ai[0]); - Color value25 = color; + Vector2 drawStart = Projectile.Center.Floor(); drawStart += Projectile.velocity * Projectile.scale * 10.5f; drawArea -= Projectile.scale * 14.5f * Projectile.scale; Vector2 drawScale = new Vector2(Projectile.scale); DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * Projectile.Opacity; + DelegateMethods.c_1 = color * 0.75f * Projectile.Opacity; Vector2 projPos = Projectile.oldPos[0]; projPos = new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, drawStart - Main.screenPosition, drawStart + Projectile.velocity * drawArea - Main.screenPosition, drawScale, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); @@ -269,6 +193,46 @@ namespace CalamityMod.Projectiles.Magic return false; } + public Color GetBeamColor(int timer, int type) + { + Color color = Color.Black; + if (timer < 360f) + { + float brightness = MathHelper.Clamp(timer / 180f, 0f, 1f); + color = Color.Lerp(Color.Black, Color.White, brightness); + } + else + { + float hue = 0f; + switch (type) + { + case 1: // 30 (Orange) + hue = 1f / 12f; + break; + case 2: // 60 (Yellow) + hue = 1f / 6f; + break; + case 3: // 120 (Green) + hue = 1f / 3f; + break; + case 4: // 210 (Blue) + hue = 7f / 12f; + break; + case 5: // 270 (Purple) + hue = 3f / 4f; + break; + case 0: // 0 (Red) + default: + hue = 0f; + break; + } + float lightness = 1f - (MathHelper.Clamp((timer - 360f) / 240f, 0f, 1f) * 0.4f); + color = Main.hslToRgb(hue, 1f, lightness); + } + color.A = 127; + return color; + } + public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 806fdadff5..54d192a1ef 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -1,5 +1,7 @@ using System; +using System.Threading.Channels; using Microsoft.Xna.Framework; +using Steamworks; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,11 +11,14 @@ namespace CalamityMod.Projectiles.Magic public class PhantasmalFuryProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public int time = 0; + public float dustRotation = 0; + public bool launched = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -22,13 +27,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 900; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 15; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -38,51 +49,94 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - if (Projectile.timeLeft % 10 == 0) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - if (Projectile.timeLeft < 100) - { - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 10f, 20f); - } + dustRotation += 0.12f; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.5f); - Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); - - for (int i = 0; i < 3; i++) - { - int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 2f); - Main.dust[spectre].noGravity = true; - Main.dust[spectre].velocity *= 0.5f; - Main.dust[spectre].velocity += Projectile.velocity * 0.1f; - } + // 175, 100 ALPHA Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + if (time >= 500) + { + if (time == 500) + { + Projectile.penetrate = 1; + launched = true; + } + + NPC target = Projectile.Center.ClosestNPCAt(700); + if (target != null && target.CanBeChasedBy(Projectile)) + { + Vector2 moveTotarget = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 6) + Projectile.velocity += moveTotarget * 0.45f; + else + Projectile.velocity *= 0.9f; + } + + if (time < 550 && target == null) + { + if (Projectile.velocity.Length() < 6) + Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + else + Projectile.velocity *= 0.9f; + } + } + else if (time > 15) + { + Vector2 circle = Owner.Center + new Vector2(0, -30).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToEnemy * Main.rand.NextFloat(0.2f, 0.4f); + else + Projectile.velocity *= 0.85f; + } + + if (time > 5) + { + Vector2 dustPos = Projectile.Center + (MathHelper.Pi + dustRotation + MathHelper.PiOver2).ToRotationVector2() * 10f * Projectile.scale; + Dust dust = Dust.NewDustPerfect(dustPos, 175, (MathHelper.Pi + dustRotation * Math.Sign(Projectile.velocity.Length())).ToRotationVector2() * 2); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust.alpha = Main.rand.Next(100, 170 + 1); + dust.velocity = dust.velocity.RotatedByRandom(0f); + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (launched ? 1f : 0.05f); + + Player Owner = Main.player[Projectile.owner]; + if (target.CanBeMoved(true)) + { + // Custom knockback + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 2); + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); - for (int j = 0; j <= 10; j++) + //SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + for (int i = 0; i <= 3; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); - } - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 8; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } + Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 6).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(1.2f, 1.8f)); + dust.noGravity = true; + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 278 : 267); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(1f, 4); + chargefull.scale = Main.rand.NextFloat(0.5f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Color.Aqua, 0.3f); } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 1); + return false; } } diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 16f456274e..36b8d0bab3 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,31 +9,121 @@ namespace CalamityMod.Projectiles.Magic public class Phantom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public float sizeVariance = 2; + public int time = 0; + public int spinDir = 100; + public int waveOften = 40; + public float scaleVariance = 1; + + public bool launched = false; public override void SetDefaults() { Projectile.width = 8; Projectile.height = 8; Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 2; + Projectile.extraUpdates = 5; + Projectile.penetrate = -1; Projectile.ignoreWater = true; - Projectile.timeLeft = 120; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 30; } public override void AI() { - Projectile.rotation += 0.01f; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); + Projectile.rotation += Main.rand.NextFloat(0.02f, 0.09f); - for (int i = 0; i < 2; i++) + if (spinDir == 100) { - int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); - Main.dust[spectre].noGravity = true; + spinDir = Main.rand.NextBool() ? 1 : -1; + waveOften = Main.rand.Next(10, 40 + 1); + Projectile.scale = Main.rand.NextFloat(0.95f, 1.1f); } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); + + if (time % 2 == 0 && time > 3 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-1, 1), -Projectile.velocity * 0.3f, false, 4, 0.025f, Color.Lerp(Color.White, Color.Aqua, 0.3f) * 0.6f, new Vector2(1, 0.3f), true, false, 2); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (time >= 500) + { + if (time == 500) + { + Projectile.penetrate = 1; + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 6; + launched = true; + } + + float badDist = Vector2.Distance(Owner.Calamity().mouseWorld, Projectile.Center); + if (badDist < 30) + { + time = 600; + } + + NPC target = Projectile.Center.ClosestNPCAt(550); + + if (target != null) + { + Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 6) + Projectile.velocity += moveToEnemy * 0.3f; + else + Projectile.velocity *= 0.85f; + } + + if (time < 550 && target == null) + { + if (Projectile.velocity.Length() < 6) + Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + else + Projectile.velocity *= 0.9f; + } + + if (time % waveOften == 0) + spinDir *= -1; + + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.01f, 0.02f) * spinDir); + } + else if (time > 15) + { + Vector2 circle = Owner.Center + new Vector2(0, -30).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToEnemy * Main.rand.NextFloat(0.2f, 0.4f); + else + Projectile.velocity *= 0.85f; + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (launched ? 1f : 0.05f); + + Player Owner = Main.player[Projectile.owner]; + if (target.CanBeMoved(true)) + { + // Custom knockback + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 2); + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 3).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Magic/RancorArm.cs b/Projectiles/Magic/RancorArm.cs index e9247e6092..2f3c7a281c 100644 --- a/Projectiles/Magic/RancorArm.cs +++ b/Projectiles/Magic/RancorArm.cs @@ -1,9 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -28,7 +29,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = Projectile.height = 4; Projectile.friendly = true; - Projectile.hostile = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic // Decide a frame to use and adjust the hitbox based on it. if (Projectile.localAI[0] == 0f) { - // Play a wraith death sound by default, play a generic flame sound when spawned by gfb Orthoceras + // Play a wraith death sound by default, play a generic flame sound when spawned by GFB Orthoceras SoundStyle sound = Time == 0 ? SoundID.NPCDeath52 : SoundID.Item20; SoundEngine.PlaySound(sound, Projectile.Center); @@ -135,17 +135,6 @@ namespace CalamityMod.Projectiles.Magic behindNPCsAndTiles.Add(index); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - if (Projectile.friendly) - { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 450f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 375f; - else modifiers.SourceDamage.Flat += 300f; - } - } - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index cc971a645e..caa7e8cfb2 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic // Decide scale and initial rotation on the first frame this projectile exists. if (Projectile.localAI[0] == 0f) { - Projectile.scale = Main.rand.NextFloat(1f, 1.7f); + Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1]; Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index 45e9a59036..a27ef75db1 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.friendly = true; - Projectile.hostile = true; Projectile.timeLeft = 300; Projectile.ignoreWater = true; } @@ -49,12 +48,6 @@ namespace CalamityMod.Projectiles.Magic Time++; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += Main.rand.Next(80, 90); - } - public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; } } diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index b2d907be0d..195f7e0446 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic public void CreateTileHitEffects() { Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner, 0f, 1f); if (Main.rand.NextBool()) { @@ -182,10 +182,7 @@ namespace CalamityMod.Projectiles.Magic overWiresUI.Add(index); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 150); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.Calamity().ashesOnDeath = 10; public override bool ShouldUpdatePosition() => false; } diff --git a/Projectiles/Magic/ShadowPlatform.png b/Projectiles/Magic/ShadowPlatform.png new file mode 100644 index 0000000000..1cf9fd563a Binary files /dev/null and b/Projectiles/Magic/ShadowPlatform.png differ diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 333ed9a895..39192a3d4e 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -1,7 +1,13 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using rail; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using ReLogic.Content; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -9,65 +15,231 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - + public int time = 0; + public float platFade = 0; + public float platRot = 0; + public bool spawnPlat = false; + public bool hasSetPlatSpawn = false; + public bool hasReboundOffPlat = false; + public bool reflecting = false; + public int reflectionTimer = 50; + public Vector2 platPosCenter; + public Vector2 platPosWall; + public NPC chosenTarget; + public Vector2 targetCenter; + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 6; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 2400; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void AI() { - Projectile.damage = (int)(Projectile.damage * 1.15); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + + if (!spawnPlat && !hasReboundOffPlat && targetCenter != Vector2.Zero) + platFade = MathHelper.Lerp(platFade, 1, 0.008f); + if (hasReboundOffPlat) { - Projectile.Kill(); + platFade -= 0.0007f; + } + + BeamMainVisuals(Owner, targetDist); + + if (reflecting) + { + if (reflectionTimer > 15) + platPosCenter += (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * -2.7f * Utils.GetLerpValue(15, 40, reflectionTimer, true); + else + platPosCenter += (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 9f * Utils.GetLerpValue(10, 0, reflectionTimer, true); + + Projectile.extraUpdates = 0; + Projectile.velocity = Vector2.Zero; + Projectile.Center = platPosWall; + reflectionTimer--; + if (reflectionTimer <= 0) + { + SoundStyle bounce = new("CalamityMod/Sounds/Item/ShadowboltReflect"); + SoundEngine.PlaySound(bounce with { Volume = 0.6f, Pitch = 0f }, platPosWall); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.velocity = (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 5; + reflecting = false; + hasReboundOffPlat = true; + time = 10; + Projectile.extraUpdates = 100; + } + } + + if (spawnPlat && hasSetPlatSpawn) + { + chosenTarget = Projectile.Center.ClosestNPCAt(2000); + + if (chosenTarget == null) + targetCenter = Owner.Calamity().mouseWorld; + else + targetCenter = chosenTarget.Center; + + platPosCenter = Projectile.Center + Projectile.velocity * Main.rand.Next(70, 120 + 1); + platRot = (Projectile.Center - platPosCenter).SafeNormalize(Vector2.UnitX).ToRotation(); + platPosWall = platPosCenter + new Vector2(0, 8).RotatedBy(platRot); + spawnPlat = false; + } + if (!spawnPlat && reflecting && targetCenter != Vector2.Zero) + { + if (chosenTarget == null) + targetCenter = Owner.Calamity().mouseWorld; + else + targetCenter = chosenTarget.Center; + + platRot = platRot.AngleLerp((targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX).ToRotation(), 0.1f); + platPosWall = platPosCenter + new Vector2(0, -30).RotatedBy(platRot + MathHelper.ToRadians(90f)); + } + if (!spawnPlat && !hasReboundOffPlat && targetCenter != Vector2.Zero) + { + float beamDist = Vector2.Distance(platPosWall, Projectile.Center); + if (beamDist <= 25 && !reflecting) + { + Particle blastRing = new CustomPulse(platPosWall, Vector2.Zero, Color.Purple, "CalamityMod/Particles/SmallBloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), 0.1f, 1.55f, 20, true); + GeneralParticleHandler.SpawnParticle(blastRing); + + SoundStyle wall = new("CalamityMod/Sounds/Item/ShadowboltWallHit"); + SoundEngine.PlaySound(wall with { Volume = 0.5f, Pitch = 0f }, platPosWall); + reflecting = true; + Projectile.extraUpdates = 0; + } + } + + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && (Collision.SolidCollision(Projectile.Center, 20, 20) || time > 90)) + { + hasSetPlatSpawn = true; + spawnPlat = true; + } + time++; + } + private void BeamMainVisuals(Player Owner, float targetDist) + { + if (reflecting) + { + for (int i = 0; i < 2; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 267); + chargefull.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.8f); + chargefull.scale = Main.rand.NextFloat(0.35f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } else { - if (Projectile.velocity.X != oldVelocity.X) + if (time == 14) { - Projectile.velocity.X = -oldVelocity.X; + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f, 0.75f, 12, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.55f, 12, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 6; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.6f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } - if (Projectile.velocity.Y != oldVelocity.Y) + if (targetDist < 1400) { - Projectile.velocity.Y = -oldVelocity.Y; + if (time > 30 && Main.rand.NextBool(15)) + { + Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-1, 1), false, 50, 1.9f, Color.Lerp(Color.Indigo, Color.Purple, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 22 && time % 3 == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * 0.1f, false, 18, 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), Color.Lerp(Color.Indigo, Color.Orchid, 0.25f), new Vector2(0.7f, 1f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 30 && Main.rand.NextBool(12)) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 267); + chargefull.velocity = Projectile.velocity * Main.rand.NextFloat(-2, 2); + chargefull.scale = Main.rand.NextFloat(0.95f, 1.4f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (hasReboundOffPlat ? 2.5f : 1) * damageMult; + + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn) + { + spawnPlat = true; + hasSetPlatSpawn = true; + } + //if (!hasReboundOffPlat) + //Projectile.extraUpdates = 10; + } + public override bool? CanDamage() => reflecting ? false : null; + public override bool PreDraw(ref Color lightColor) + { + if (targetCenter != Vector2.Zero && platFade > 0) + { + Texture2D pTexture = ModContent.Request("CalamityMod/Projectiles/Magic/ShadowPlatform").Value; + + for (int i = 0; i < 5; i++) + { + Color auraColor = Color.Lerp(Color.Indigo, Color.Purple, Utils.GetLerpValue(0, 5, i)) with { A = 0 } * 0.55f * platFade; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 30f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition + rotationalDrawOffset, null, auraColor, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f), SpriteEffects.None); + } + + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition, null, Color.Purple with { A = 0 } * platFade, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f), SpriteEffects.None); + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition, null, Color.White with { A = 0 } * platFade * 0.6f, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f) * 0.93f, SpriteEffects.None); + } + + if (!reflecting && time >= 22 && !hasReboundOffPlat) + { + Asset tex = ModContent.Request("CalamityMod/Particles/GlowSpark"); + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15, null, Color.White with { A = 0 } * 0.7f, Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f), tex.Size() * 0.5f, new Vector2(0.4f, 1f) * (i * 0.3f) * 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), SpriteEffects.None); + } + } + + if (reflecting) + { + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, platPosWall - Main.screenPosition, null, Color.Purple with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.65f * Utils.GetLerpValue(-25, 20, reflectionTimer, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, platPosWall - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.45f * Utils.GetLerpValue(-25, 20, reflectionTimer, true) * randSize, SpriteEffects.None, 0); + } return false; } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 1.15); - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - for (int i = 0; i < 4; i++) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * ((float)i * 0.25f); - Projectile.alpha = 255; - int shadowDust = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); - Main.dust[shadowDust].position = projPos; - Main.dust[shadowDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[shadowDust].velocity *= 0.2f; - } - } - } } } diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index ef1d961c19..495e8611b2 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -61,12 +61,8 @@ namespace CalamityMod.Projectiles.Magic float flySpeed = 8f; float flyInertia = 54f; - Projectile.hostile = true; - Projectile.friendly = false; if (ProjectileOwner != null && (ProjectileOwner.ModProjectile().CurrentPower > 0.97f || Projectile.timeLeft < 95)) { - Projectile.hostile = false; - radius += 36f; target = ProjectileOwner; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 71f1e234be..2af7ed9e9d 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -140,11 +140,6 @@ namespace CalamityMod.Projectiles.Magic HoverOffset = Vector2.Zero; } - // Previously, Gruesome Eminence stopped being able to hurt you when fully charged. - // This has been changed so that its threat is everpresent. - Projectile.hostile = Time > 75f; - // Projectile.hostile = !tame && Time > 75f; - // Explode into a burst of spirit dust and gas clouds when a bigger face appears. if (!WasStrongBefore && CurrentPower > LargeMouthPowerLowerBound) { @@ -304,22 +299,6 @@ namespace CalamityMod.Projectiles.Magic DrawHead(backTexture, 1.04f); } - // Damage scales up over time as it grows. - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - float damageFactor = 0.25f + 0.75f * CurrentPower; - int fullPowerDamage; - if (Main.masterMode) - fullPowerDamage = 540; - else if (Main.expertMode) - fullPowerDamage = 450; - else - fullPowerDamage = 360; - - modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += (int)(damageFactor * fullPowerDamage); - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { for (int i = 0; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 55c7c4f354..0b377eb749 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,38 +16,62 @@ namespace CalamityMod.Projectiles.Magic ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } - + public int time = 0; + public bool explode = true; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 7; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45); Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0f); - if (Projectile.wet && !Projectile.lavaWet) - { - Projectile.Kill(); - } + + if (Projectile.timeLeft == 1) + explode = false; if (Projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.localAI[0] += 1f; } - for (int i = 0; i < 3; i++) + if (time == 5) { - int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.2f); - Main.dust[venusDust].noGravity = true; - Main.dust[venusDust].velocity *= 0.5f; - Main.dust[venusDust].velocity += Projectile.velocity * 0.1f; + for (int i = 0; i < 12; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.1f, 1); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); + } } + if (targetDist < 1400) + { + if (time > 8 && time % 3 == 0) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 35, 0.8f, Color.Lerp(Color.OrangeRed, Color.Coral, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 6 && time % 2 == 0) + { + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.08f * (i == 0 ? 0.5f : 1), Color.Lerp(Color.Orange, Color.Coral, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -56,16 +81,33 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) + Player Owner = Main.player[Projectile.owner]; + if (Projectile.owner == Main.myPlayer && explode) { - int explosionDamage = Projectile.damage; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item74 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Coral, Utils.GetLerpValue(-2, 6, i, true)), i == 5 ? "CalamityMod/Particles/FlameExplosion" : "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.1f + 0.03f * i, (int)(30 - i * 1.3f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + int explosionDamage = Projectile.damage / 4; float explosionKB = 6f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, explosionKB, Projectile.owner); - int cinderDamage = (int)(Projectile.damage * 0.20); + int cinderDamage = (int)(Projectile.damage * 0.02); float cinderKB = 0f; - Vector2 cinderPos = Projectile.oldPosition + 0.5f * Projectile.Size; - int numCinders = Main.rand.Next(7, 10); + Vector2 cinderPos = Projectile.Center; + int numCinders = 10; for (int i = 0; i < numCinders; i++) { Vector2 cinderVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); @@ -75,15 +117,24 @@ namespace CalamityMod.Projectiles.Magic } cinderVel.Normalize(); cinderVel *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), cinderPos, cinderVel + new Vector2(0, -3), ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); + } + + for (int i = 0; i < 20; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 1.25f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 1); + return true; } } } diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 199f6ca856..6fdb7c87b8 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -14,65 +14,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 250; - Projectile.height = 250; + Projectile.width = 400; + Projectile.height = 400; Projectile.friendly = true; Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 120; + Projectile.timeLeft = 2; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 17; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - Projectile.localAI[0] += 1f; - } - float projTimer = 25f; - if (Projectile.ai[0] > 180f) - { - projTimer -= (Projectile.ai[0] - 180f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rando1 = (float)Main.rand.Next(-30, 31); - float rando2 = (float)Main.rand.Next(-30, 31); - float rando3 = (float)Main.rand.Next(9, 27); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 2.5f); - Dust dust = Main.dust[venusDust]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rando1; - dust.velocity.Y = rando2; - timerCounter++; - } - return; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 300); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index a30274e76a..9d06d4ffea 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -23,10 +23,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 14; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 120; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -105,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic } //Dust - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(6)) { int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[venusDust]; @@ -114,16 +115,18 @@ namespace CalamityMod.Projectiles.Magic dust.scale += (float)Main.rand.Next(50) * 0.01f; dust.noGravity = true; dust.velocity.Y -= 2f; + dust.velocity += Projectile.velocity * 0.5f; } - if (Main.rand.NextBool(10)) + if (Main.rand.NextBool(14)) { - int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); + int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 278, 0f, 0f, 0, default, Main.rand.NextFloat(0.3f, 0.5f)); Dust dust2 = Main.dust[venusDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; dust2.noGravity = true; dust2.velocity *= 0.1f; + dust2.velocity += Projectile.velocity * 0.5f; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); } } diff --git a/Projectiles/Rogue/AshenStalactiteDebris.png b/Projectiles/Rogue/AshenStalactiteDebris.png index c19bebc35f..8afd326680 100644 Binary files a/Projectiles/Rogue/AshenStalactiteDebris.png and b/Projectiles/Rogue/AshenStalactiteDebris.png differ diff --git a/Projectiles/Rogue/AshenStalagmiteProj.png b/Projectiles/Rogue/AshenStalagmiteProj.png index 2f1751aaa4..4f22b80bf9 100644 Binary files a/Projectiles/Rogue/AshenStalagmiteProj.png and b/Projectiles/Rogue/AshenStalagmiteProj.png differ diff --git a/Projectiles/Summon/BrimstoneDartMinion.cs b/Projectiles/Summon/BrimstoneDartMinion.cs index ea5ddd301c..60f7c8aee1 100644 --- a/Projectiles/Summon/BrimstoneDartMinion.cs +++ b/Projectiles/Summon/BrimstoneDartMinion.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Other; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,6 +43,13 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } + public override bool? CanHitNPC(NPC target) + { + if (target.type == ModContent.NPCType()) + return false; + return null; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 26db5b6ad2..7618a2ec74 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -323,9 +323,8 @@ namespace CalamityMod.Projectiles.Summon if (shouldDrawDust) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); var shouldAdjust = !Main.dayTime && buffedAi; - int dustId = ProvUtils.GetDustID(pscState); + int dustId = ProvUtils.GetDustID(!Main.dayTime); for (int i = 0; i < 6; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.Size / 2f).RotatedBy(Projectile.rotation), dustId); diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 7f05149aa0..ff490d34a0 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = new Vector2(Owner.Center.X + Main.rand.NextFloat(-10, 10), Owner.Center.Y + Main.rand.NextFloat(-10, 10)); Vector2 velocity = (Owner.Center - dustPos).SafeNormalize(Vector2.Zero); velocity *= (Main.dayTime || !SpawnedFromPSC) ? 3f : 6.9f; - var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID((float)((Main.dayTime || !SpawnedFromPSC) ? Providence.BossMode.Day : Providence.BossMode.Night)), velocity, 0, default(Color), 2f); + var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID(!Main.dayTime && SpawnedFromPSC), velocity, 0, default(Color), 2f); if (!Main.dayTime && SpawnedFromPSC) dust.noGravity = true; } @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon if (!Main.rand.NextBool(3)) continue; - Dust dust = Dust.NewDustDirect(Owner.position, Owner.width, Owner.height, ProvUtils.GetDustID((float)((Main.dayTime || !SpawnedFromPSC) ? Providence.BossMode.Day : Providence.BossMode.Night))); + Dust dust = Dust.NewDustDirect(Owner.position, Owner.width, Owner.height, ProvUtils.GetDustID(!Main.dayTime && SpawnedFromPSC)); dust.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); dust.velocity.Y -= Main.rand.NextFloat(1f, 3f); dust.scale = Main.rand.NextFloat(1.15f, 1.45f); diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index bd791dc12e..4db64bdb9b 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -314,9 +314,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); Vector2 dustVelocity = (player.Center - spawnPosition) * 0.085f + owner.velocity; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - - Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(pscState)); + Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(!Main.dayTime)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); dust.color = Color.Lerp(Color.LightCoral, Color.White, Projectile.ai[2] / 120 * Main.rand.NextFloat(0.65f, 1f)); diff --git a/Projectiles/Summon/MiniGuardianHolyRay.cs b/Projectiles/Summon/MiniGuardianHolyRay.cs index c2fa1521ab..a5c7f9dd29 100644 --- a/Projectiles/Summon/MiniGuardianHolyRay.cs +++ b/Projectiles/Summon/MiniGuardianHolyRay.cs @@ -107,8 +107,7 @@ namespace CalamityMod.Projectiles.Summon // Fire laser through walls at max length num807 = 2400f; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustType = ProvUtils.GetDustID(pscState); + int dustType = ProvUtils.GetDustID(!Main.dayTime); float amount = 0.5f; Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); // Length of laser, linear interpolation Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); @@ -149,8 +148,7 @@ namespace CalamityMod.Projectiles.Summon ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float num223 = Projectile.localAI[1]; //length of laser - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Color color44 = ProvUtils.GetProjectileColor(pscState, 0) * 0.9f; + Color color44 = ProvUtils.GetDayNightColor(!Main.dayTime, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/MiniGuardianStars.cs b/Projectiles/Summon/MiniGuardianStars.cs index 2d2092bd96..94fec64eb7 100644 --- a/Projectiles/Summon/MiniGuardianStars.cs +++ b/Projectiles/Summon/MiniGuardianStars.cs @@ -87,8 +87,7 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(50); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustType = ProvUtils.GetDustID(pscState); + int dustType = ProvUtils.GetDustID(!Main.dayTime); for (int d = 0; d < 5; d++) { int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -118,9 +117,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) - return; - Projectile.Kill(); } } diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 5b17d39ef2..3d7c55e6ed 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -137,8 +137,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -146,8 +145,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -180,8 +178,7 @@ namespace CalamityMod.Projectiles.Summon Split(false, false); } SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); @@ -251,7 +248,7 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.timeLeft > 550) Projectile.velocity *= 0.95f; - int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID((float)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night)), 0f, 0f, 100, default, Main.dayTime ? 1f : 0.75f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime), 0f, 0f, 100, default, Main.dayTime ? 1f : 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -329,17 +326,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -380,8 +375,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -507,9 +501,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha), 1); return false; } @@ -524,8 +517,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -736,8 +728,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity *= boomerSwarm ? 1.03f : 1.02f; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -747,8 +738,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -756,8 +746,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/ProfanedCrystalRangedHugesNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -792,8 +781,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -922,8 +910,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 50; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -956,16 +943,14 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -1507,9 +1492,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); Vector2 dustVelocity = (Projectile.Center - spawnPosition) * 0.085f + owner.velocity; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - - Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(pscState)); + Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(!Main.dayTime)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); dust.noGravity = true; @@ -1567,7 +1550,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = new Vector2(Owner.Center.X + Main.rand.NextFloat(-10, 10), Owner.Center.Y + Main.rand.NextFloat(-10, 10)); Vector2 velocity = (Owner.Center - dustPos).SafeNormalize(Vector2.Zero); velocity *= Main.dayTime ? 3f : 6.9f; - var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID((float)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night)), velocity, 0, default(Color), 2f); + var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID(!Main.dayTime), velocity, 0, default(Color), 2f); if (!Main.dayTime) dust.noGravity = true; } @@ -1795,8 +1778,7 @@ namespace CalamityMod.Projectiles.Summon //Ensure that psa's spears are not coloured by night var psc = Projectile.ai[0] > 0f; - int pscState = (int)((!Main.dayTime && psc) ? Providence.BossMode.Night : Providence.BossMode.Day); - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 1f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime && psc), 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; handleAI(psc && Projectile.ai[1] > 0f); @@ -1813,9 +1795,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { var psc = Projectile.ai[0] > 0f; - int pscState = (int)((!Main.dayTime && psc) ? Providence.BossMode.Night : Providence.BossMode.Day); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime && psc, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetDayNightColor(!Main.dayTime && psc, Projectile.alpha), 1); return false; } @@ -1830,9 +1811,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); var psc = Projectile.ai[0] > 0f; - var shouldAdjust = !Main.dayTime && psc; - int pscState = (int)(shouldAdjust ? Providence.BossMode.Night : Providence.BossMode.Day); - int dustID = ProvUtils.GetDustID(pscState); + bool shouldAdjust = !Main.dayTime && psc; + int dustID = ProvUtils.GetDustID(shouldAdjust); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 2f); @@ -1927,16 +1907,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime), 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -1944,8 +1922,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -1980,8 +1957,7 @@ namespace CalamityMod.Projectiles.Summon Split(); } SoundEngine.PlaySound(HolyBlast.ImpactSound, Projectile.Center); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); @@ -2077,17 +2053,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -2102,8 +2076,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 93860c3ce5..971d9601d8 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Summon HoverNearOwner, AttackEnemy_Charge, AttackEnemy_ReleaseDartBurst, - AttackOwner + AttackHearts } public int IdleTimer; public int AttackTimer; - public int PlayerAttackCountdown; + public int HeartAttackCountdown; public SepulcherSegment[] Segments = new SepulcherSegment[24]; public List Arms = new List(); public Player Owner => Main.player[Projectile.owner]; @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon Initialize(); writer.Write(IdleTimer); - writer.Write(PlayerAttackCountdown); + writer.Write(HeartAttackCountdown); writer.Write(Arms.Count); for (int i = 0; i < Arms.Count; i++) { @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Summon Initialize(); IdleTimer = reader.ReadInt32(); - PlayerAttackCountdown = reader.ReadInt32(); + HeartAttackCountdown = reader.ReadInt32(); int armCount = reader.ReadInt32(); Arms.Clear(); for (int i = 0; i < armCount; i++) @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = AttemptToFindTarget(1450f); // Enter the attack state if a valid enemy is found and go back to hovering otherwise. - // This will be overriden if attacking the owner. + // This will be overriden if attacking its hearts. if (CurrentAIState != AIState.AttackEnemy_ReleaseDartBurst && CurrentAIState != AIState.AttackEnemy_Charge) { if (potentialTarget != null) @@ -195,23 +195,19 @@ namespace CalamityMod.Projectiles.Summon AttackTimer = 0; } - // Reset the AI to player attack mode if the countdown is going on. - if (PlayerAttackCountdown > 0) + // Reset the AI to heart attack mode if the countdown is going on. + if (HeartAttackCountdown > 0) { - if (CurrentAIState != AIState.AttackOwner) - CurrentAIState = AIState.AttackOwner; + if (CurrentAIState != AIState.AttackHearts) + CurrentAIState = AIState.AttackHearts; - PlayerAttackCountdown--; + HeartAttackCountdown--; // If it's finished, go back to idle owner hover movement. - if (PlayerAttackCountdown <= 0) + if (HeartAttackCountdown <= 0) CurrentAIState = AIState.HoverNearOwner; } - - // Determine whether the projectile can attack its owner based on the attakc countdown. - Projectile.hostile = PlayerAttackCountdown > 0; - switch (CurrentAIState) { case AIState.HoverNearOwner: @@ -225,8 +221,8 @@ namespace CalamityMod.Projectiles.Summon AttackEnemyByCharging(potentialTarget); AttackTimer++; break; - case AIState.AttackOwner: - AttackOwner(); + case AIState.AttackHearts: + AttackHearts(); break; } @@ -248,7 +244,7 @@ namespace CalamityMod.Projectiles.Summon chanceToBecomeAngry = Utils.GetLerpValue(2f, 6f, heartsAttachedToOwner, true); if (Main.rand.NextFloat() < chanceToBecomeAngry) { - PlayerAttackCountdown = 300; + HeartAttackCountdown = 300; Projectile.netUpdate = true; } else if (Main.netMode != NetmodeID.MultiplayerClient) @@ -349,7 +345,7 @@ namespace CalamityMod.Projectiles.Summon float rotationalVelocityFactor = Utils.GetLerpValue(0f, 6f, Projectile.velocity.Length(), true); if (CurrentAIState == AIState.AttackEnemy_Charge) rotationalVelocityFactor *= 0.85f; - if (CurrentAIState == AIState.AttackOwner) + if (CurrentAIState == AIState.AttackHearts) rotationalVelocityFactor *= 1.2f; if (Arms[i].ReelingBack) @@ -455,14 +451,39 @@ namespace CalamityMod.Projectiles.Summon } } - public void AttackOwner() + public void AttackHearts() { // Attempt to angle towards the owner. float newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 21f, 0.025f); - if (!Projectile.WithinRange(Owner.Center, 370f)) + // Find the closest heart to the minion. + float npcDistCompare = 960f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) { - Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.Center) * newSpeed; + if (!n.CanBeChasedBy(Projectile, false) || n.type != ModContent.NPCType()) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If there are no Hearts left, immediately go back to being passive. + if (index == -1) + { + HeartAttackCountdown = 0; + CurrentAIState = AIState.HoverNearOwner; + return; + } + // Otherwise, move towards the targeted heart. + NPC targetHeart = Main.npc[index]; + if (!Projectile.WithinRange(targetHeart.Center, 185f)) + { + Vector2 idealVelocity = Projectile.SafeDirectionTo(targetHeart.Center) * newSpeed; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); float idealAimDirection = idealVelocity.ToRotation(); @@ -470,15 +491,15 @@ namespace CalamityMod.Projectiles.Summon } else if (Projectile.velocity.Length() < 36f) { - Projectile.velocity *= 1.03f; + Projectile.velocity *= 1.066f; if (JawSnapTimer <= 0f) { // Open the mouth of the jaw if close but not super close to the owner. - if (Projectile.WithinRange(Owner.Center, 300f)) + if (Projectile.WithinRange(targetHeart.Center, 150f)) JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); // If really close, snap. - if (Projectile.WithinRange(Owner.Center, 180f)) + if (Projectile.WithinRange(targetHeart.Center, 90f)) { SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, Projectile.Center); JawSnapTimer = 45f; @@ -526,7 +547,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - float angerFactor = Utils.GetLerpValue(300f, 280f, PlayerAttackCountdown, true) * Utils.GetLerpValue(0f, 30f, PlayerAttackCountdown, true); + float angerFactor = Utils.GetLerpValue(300f, 280f, HeartAttackCountdown, true) * Utils.GetLerpValue(0f, 30f, HeartAttackCountdown, true); float afterimageOutwardness = MathHelper.Lerp(6f, 8f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 2.3f) * 0.5f + 0.5f) * angerFactor; Color backAfterimageColor = Color.Red * angerFactor; backAfterimageColor.A = 0; @@ -671,21 +692,11 @@ namespace CalamityMod.Projectiles.Summon #endregion - #region Damage Stuff - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 450f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 375f; - else modifiers.SourceDamage.Flat += 300f; - } - public override bool? CanHitNPC(NPC target) { if (target.type == ModContent.NPCType()) - return false; + return HeartAttackCountdown > 0; return null; } - #endregion } } diff --git a/Sounds/Item/PhantasmalFuryShoot.ogg b/Sounds/Item/PhantasmalFuryShoot.ogg new file mode 100644 index 0000000000..27b47390c1 Binary files /dev/null and b/Sounds/Item/PhantasmalFuryShoot.ogg differ diff --git a/Sounds/Item/ShadowboltReflect.ogg b/Sounds/Item/ShadowboltReflect.ogg new file mode 100644 index 0000000000..a2d84277be Binary files /dev/null and b/Sounds/Item/ShadowboltReflect.ogg differ diff --git a/Sounds/Item/ShadowboltWallHit.ogg b/Sounds/Item/ShadowboltWallHit.ogg new file mode 100644 index 0000000000..9293a99d50 Binary files /dev/null and b/Sounds/Item/ShadowboltWallHit.ogg differ diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index d7c58193c9..72124efd39 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -306,6 +306,16 @@ namespace CalamityMod.Systems progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Roxcalibur").Value; MiscWorldgenRoutines.PlaceRoxShrine(); })); + + // No Traps/GFB Auric Land Mines + if (Main.noTrapsWorld) + { + tasks.Insert(++currentFinalIndex, new PassLegacy("Auric Land Mines", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AuricLandMines").Value; + MiscWorldgenRoutines.GenerateAuricLandMines(); + })); + } } } diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index f413f99e1e..ddf4982220 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.FurnitureAncient; +using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; @@ -489,5 +490,37 @@ namespace CalamityMod.World } } #endregion + + #region Auric Land Mines + public static void GenerateAuricLandMines() + { + int landMineID = ModContent.TileType(); + int landMineChance = Main.zenithWorld ? 150 : 300; + float maxDepth = Main.maxTilesY * (Main.zenithWorld ? 0.75f : 0.5f); // depth increased in gfb due to the evil columns that extend further downward + for (int x = 0; x < Main.maxTilesX; x++) + { + for (int y = 0; y < maxDepth; y++) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (t != null) + { + if (above != null) + { + // Yharim killed the gods with auric land mines obviously + if ((t.TileType == TileID.Ebonstone || t.TileType == TileID.Crimstone) && !above.HasTile) + { + if (WorldGen.genRand.NextBool(landMineChance)) + { + WorldGen.SlopeTile(x, y); + WorldGen.PlaceTile(x, y - 1, landMineID); + } + } + } + } + } + } + } + #endregion } }